Пример #1
0
 protected string AttackPerform(Character attacker, Character defence)
 {
     StringBuilder returnMsg = new StringBuilder();
     if (AttackRoll(attacker) >= defence.GetACHit())
     {
         int damage = attacker.GetWeaponDamage();
         returnMsg.Append(attacker.Name + " attacked " + defence.Name + "\n");
         returnMsg.Append("Delivered damage: " + damage + "\n");
         defence.LifePoints -= damage;
     }
     else returnMsg.Append("The attack of " + attacker.Name + " failed\n");
     return returnMsg.ToString();
 }
Пример #2
0
 protected string AttackPerform(Character attacker, Character defence)
 {
     StringBuilder returnMsg = new StringBuilder();
     returnMsg.Append("*************************************\n");
     if (AttackRoll(attacker) >= defence.GetACHit())
     {
         int damage = attacker.GetWeaponDamage();
         returnMsg.Append(attacker.Name + " attacked " + defence.Name + "\n");
         returnMsg.Append(attacker.Name + " delivered " + damage + "pt damage to " + defence.Name + " \n");
         defence.LifePoints -= damage;
         if (defence.LifePoints < 1 && defence is NonPlayerCharacter)
         {
             returnMsg.Append(defence.Name + " is dead\n");
         }
     }
     else returnMsg.Append("The attack of " + attacker.Name + " to " + defence.Name + " was failed\n");
     returnMsg.Append("*************************************\n");
     return returnMsg.ToString();
 }
Пример #3
0
 protected int AttackRoll(Character character)
 {
     return DiceRoller.GetInstance().Roll(1, new Dice(20)) + character.Strength;
 }