/// <summary> /// /// </summary> /// <param name="fighter">тот, кто наносит урон</param> /// <param name="damage">чистый, незаблокированный урон</param> /// <param name="opponent">тот, кто получает урон</param> static void Damage(IFighter fighter, int damage, IFighter opponent) { if (fighter.EP.Quanity == 0) { damage /= 2; } opponent.Damage(damage); }
public IFighter Hit(IFighter attackingCharcter, IFighter defendingCharacter) { var fighter = new Fighter { Attack = defendingCharacter.Attack, Endurance = defendingCharacter.Endurance - attackingCharcter.Damage(), Arms = defendingCharacter.Arms, Strength = defendingCharacter.Strength }; if (defendingCharacter.Weapons != null) { foreach (var defendingCharacterWeapon in defendingCharacter.Weapons) { fighter.AddWeapon(defendingCharacterWeapon); } } fighter.Endurance = -attackingCharcter.Damage(); return(fighter); }