public void ApplyArtefact(int index, int power, MagicPersonRP value) { if (value == null) { throw new Exception("Объект не передан."); } if (this.CONDITION_OF_PERSON != Condition.Dead) { var arte = m_inventory[index]; arte.setPower(power); Condition temp = CONDITION_OF_PERSON; value.CURRENT_AMOUNT_OF_MAGIC += arte.changeEXP(); value.CURRENT_AMOUNT_OF_HP += arte.changeHP(); value.CONDITION_OF_PERSON = arte.changeCondition(); if (arte.changeCondition() == Condition.Notchange) { CONDITION_OF_PERSON = temp; } if (!arte.renewable()) { m_inventory.Remove(arte); } } else { throw new Exception("Персонаж мёртв."); } }
//public bool DoSpell(MagicPersonRP sender, PersonRP receiver) //{ // return SpellDo(sender, receiver); //} protected override bool makeMagic(MagicPersonRP sender, PersonRP receiver, int power) { if (receiver.CONDITION_OF_PERSON != Condition.Paralyzed) { return(false); //каст } receiver.CURRENT_AMOUNT_OF_HP = 1; return(true); }
public bool SpellDo(MagicPersonRP sender, PersonRP receiver, int power) { if (power < 0) { throw new Exception("Мощность заклинания не может быть меньше 0"); } if (sender == null || receiver == null) { throw new NullReferenceException("Должен быть указан человек на которого накладывается заклинание"); } if (Status_cd) { return(false); } if (receiver.STATUS_RES) { return(false); } if (sender.CONDITION_OF_PERSON == Condition.Dead || sender.CONDITION_OF_PERSON == Condition.Paralyzed) { return(false); } if (verb && !sender.SPEECH) { return(false); } if (move && !sender.MOVE) { return(false); } float f = min_manacost + power * cost_on_value; if (sender.CURRENT_AMOUNT_OF_MAGIC < f) { //CD_Do(1000); return(false); } if (makeMagic(sender, receiver, power)) { sender.CURRENT_AMOUNT_OF_MAGIC -= f; CD_Do(cd); return(true); } else { return(false); } }
protected override bool makeMagic(MagicPersonRP sender, PersonRP receiver, int power) { if (receiver.CONDITION_OF_PERSON == Condition.Dead) { return(false); } receiver.STATUS_RES = true; Thread a = new Thread(() => { Thread.Sleep(power + 1000); receiver.STATUS_RES = false; }); a.Start(); return(true); }
protected override bool makeMagic(MagicPersonRP sender, PersonRP receiver, int power) { if (receiver.CONDITION_OF_PERSON != Condition.Poisoned) { return(false);//каст } if (receiver.hp_percents() >= 10f) { receiver.CONDITION_OF_PERSON = Condition.Normal; } else { receiver.CONDITION_OF_PERSON = Condition.Weakened; } return(true); }
protected override bool makeMagic(MagicPersonRP sender, PersonRP receiver, int power) { if (receiver.CONDITION_OF_PERSON == Condition.Dead) { return(false); // может быть отравлен стоит убрать(от этого зависит будет ли каст способности) } float Power = power_start + power; // можно домножить на что-нибудь float new_hp = receiver.CURRENT_AMOUNT_OF_HP + Power; if (receiver.MAX_HP < new_hp) { receiver.CURRENT_AMOUNT_OF_HP = receiver.MAX_HP; } else { receiver.CURRENT_AMOUNT_OF_HP = new_hp; } return(true); }
protected abstract bool makeMagic(MagicPersonRP sender, PersonRP receiver, int power);