Exemple #1
0
 //Attack--------------------------
 public void Attack(ICharacter attacked)
 {
     try
     {
         if (CheckMultiCast.CheckUsabilityAttack(this, attacked) == true)
         {
             Random rnd          = new Random();
             int    randomDamage = rnd.Next(this.damage - 10, this.damage);
             if (attacked.HealthCurr == attacked.HealthCap)
             {
                 attacked.HealthRegenTimer.Start();
             }
             double calDamage = (randomDamage + CalCriticalChance()) - (0.7 * this.armor);
             if (calDamage < 0)
             {
                 calDamage = 0;
             }
             attacked.HealthCurr -= calDamage;
             attacked.Armor      -= 0.1 * (calDamage++);
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
     catch (InvalidOperationException) { }
 }
Exemple #2
0
 public override void CastTo(ICharacter attacker, ICharacter defender)
 {
     try
     {
         if (CheckMultiCast.CheckUsabilityCastTo(attacker, this, defender))
         {
             base.CastTo(attacker, defender);
             attacker.Power.PowerConsume(this);
             defender.HealthCurr -= base.Value;
         }
     }
     catch (InvalidOperationException) { }
 }
Exemple #3
0
 public void Equip(IEquippable <Item> item)
 {
     try
     {
         if (Check.IsEquippableByMage(item) == true &&
             CheckMultiCast.ChechEquippability(this, item) == true)
         {
             base.Equip(item);
             ResetCharacterToDefault(500);
             BuffFromIntellect();
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
     catch (InvalidOperationException) { }
 }
Exemple #4
0
        public override void Cast(ICharacter character)
        {
            try
            {
                if (CheckMultiCast.CheckUsabilityCast(character, this) == true)
                {
                    base.spellCD = new SpellCoolDown(base.coolDownDuration);
                    character.Power.PowerGenerate(this);
                    character.HealthCurr += base.Value;

                    if (character.HealthCurr > character.HealthCap)
                    {
                        character.HealthCurr = character.HealthCap;
                    }
                }
            }
            catch (InvalidOperationException) { }
        }
Exemple #5
0
 public void Equip(IEquippable <Item> item)
 {
     try
     {
         if (CheckMultiCast.ChechEquippability(this, item) == true)
         {
             if (this.equippment[item.SlotCompatibility] != null)
             {
                 this.equippment[item.SlotCompatibility].UnEquip(this);
                 backpack.Change(this.equippment[item.SlotCompatibility], item, this);
             }
             else
             {
                 item.Equip(this);
             }
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
     catch (InvalidOperationException) { }
 }