public virtual void Attack(IDamageableEntity target) { // Fire attacking event bool shouldAbort; GameEventManager.Attacking(this, target, isRetaliation: false, shouldAbort: out shouldAbort); if (!shouldAbort) { // Use up a durability charge this.TakeDamage(1); GameEngine.TriggerDeathrattles(); } }
/// <summary> /// Attacks another target /// </summary> /// <param name="target">The target to attack</param> public void Attack(IDamageableEntity target) { // Make sure the minion isn't exhausted first or can't attack if (!this.CanAttack) { throw new InvalidOperationException("This minion can't attack yet!"); } // Make sure we're not attacking through a taunt var enemyPlayZone = GameEngine.GameState.WaitingPlayerPlayZone; var targetMinion = target as BaseMinion; if (((targetMinion != null && !targetMinion.HasTaunt) || target is BasePlayer) && enemyPlayZone.Any(minion => minion != null && ((BaseMinion)minion).HasTaunt)) { throw new InvalidOperationException("Can't attack through taunt!"); } if (targetMinion != null && targetMinion.IsStealthed) { throw new InvalidOperationException("Can't attack a minion that is stealthed!"); } if (this.IsStealthed) { this.RemoveStatusEffects(MinionStatusEffects.STEALTHED); } this.attacksThisTurn++; // Fire attacking event bool shouldAbort; GameEventManager.Attacking(this, target, isRetaliation: false, shouldAbort: out shouldAbort); if (!this.HasWindfury || (this.HasWindfury && this.attacksThisTurn >= 2)) { this.ApplyStatusEffects(MinionStatusEffects.EXHAUSTED); } }