예제 #1
0
        public AttackResult Attack(IBattleable defender, int roll, int round)
        {
            const int damage   = 1;
            const int baseRoll = 50;
            var       target   = baseRoll + (int)(CalculateAttackScore() - defender.CalculateDefenseScore());
            var       result   = (roll <= target);

            if (result)
            {
                defender.TakeDamage(damage);
            }
            return(new AttackResult(
                       result, target, roll, damage,
                       new AttackResult.Participant(Name, Health),
                       new AttackResult.Participant(defender.Name, defender.Health),
                       round));
        }