Beispiel #1
0
 public bool Attack(Hero hero)
 {
     if (hero.isAlive)
     {
         var offenserValue = this.Agility + new Random().Next(2, 12);
         var defenserValue = hero.Agility + new Random().Next(2, 12);
         if (offenserValue - defensePoint > 0)
         {
             var attack = this.AttackValue();
             hero.ChangeHealth(attack);
             return true;
         }
         else
         {
             var offenserValue2 = hero.Agility + new Random().Next(2, 12);
             var defenserValue2 = this.Agility + new Random().Next(1, 6);
             if (offenserValue - defensePoint > 0)
             {
                 var attack = hero.AttackValue();
                 this.ChangeHealth(attack);
                 return true;
             }
            return false;
         }
     }
     else
         return false;
 }
Beispiel #2
0
 protected virtual void Attack(Hero enemy, int phase)
 {
     var myAttack = this.AttackValue();
     var enemyDefense = enemy.DefenseValue();
     var myHit = myAttack + DiceProvider.Instance.Throw(1, 12 / phase);
     var enemyHit = enemyDefense + DiceProvider.Instance.Throw(1, 12);
     if (myHit > enemyHit)
     {
         var HitPoints = (int)(myHit * DrawAttack());
         enemy.ChangeHealth(HitPoints);
     }
     else
     {
         if (phase < 2)
             enemy.Attack(this, phase + 1);
     }
 }