public override void Attack(AFighter target) { if (_healthPoint <= _maxHealthPoint / 4 && _objects.Count > 0) { UseObject(-1, this); } else { int damage = Math.Max((_attack + _random.Next(_attack)) - (target.Defense + _random.Next(target.Defense)), 0); OnAttacked(target); if (target.Mana < 5) { _isShieldMode = false; } else if (_healthPoint <= _maxHealthPoint / 2 || _isShieldMode) { _isShieldMode = true; OnActivatedShieldMode(); damage /= 2; } target.TakeDamage(damage); OnFighterDied(target); } }
public override void Attack(AFighter target) { if (_manaPoint >= _spells[0].ManaModifier) { if (_healingMode) { UseSpell(1, this); } else { UseSpell(0, target); OnFighterDied(target); } } else { OnAttacked(target); int damage = Math.Max((_attack + _random.Next(_attack)) - (target.Defense + _random.Next(target.Defense)), 0); _manaPoint += _random.Next(1, 3); target.TakeDamage(damage); OnFighterDied(target); } }