From 4e37f7b44234e9ffed9f1fa844366ca402de5e09 Mon Sep 17 00:00:00 2001 From: excessum Date: Tue, 17 Feb 2015 11:55:39 +0000 Subject: [PATCH] - Fixed bug due to free pings in DamageDealAi caused by r28843 --- .../java/forge/ai/ability/DamageDealAi.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java index b4f2f97071f..42d2039d99c 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -366,28 +366,32 @@ public class DamageDealAi extends DamageAiBase { // TODO: add check here if card is about to die from something // on the stack // or from taking combat damage - if (!source.isSpell()){ - boolean freePing = isTrigger || sa.getPayCosts() == null || sa.getTargets().getNumTargeted() > 0 - || ComputerUtil.playImmediately(ai, sa); - + + boolean freePing = isTrigger || sa.getPayCosts() == null + || sa.getTargets().getNumTargeted() > 0 + || ComputerUtil.playImmediately(ai, sa); + + if (!source.isSpell()) { if (phase.is(PhaseType.END_OF_TURN) && sa.isAbility()) { if (phase.getNextTurn().equals(ai)) freePing = true; } - + if (phase.is(PhaseType.MAIN2) && sa.isAbility()) { - if (sa.getRestrictions().isPwAbility() || source.hasSVar("EndOfTurnLeavePlay")) + if (sa.getRestrictions().isPwAbility() + || source.hasSVar("EndOfTurnLeavePlay")) freePing = true; } - - if (freePing && sa.canTarget(enemy)) { - tcs.add(enemy); - if (divided) { - tgt.addDividedAllocation(enemy, dmg); - break; - } + } + + if (freePing && sa.canTarget(enemy)) { + tcs.add(enemy); + if (divided) { + tgt.addDividedAllocation(enemy, dmg); + break; } } + } else if (tgt.canTgtCreature()) { final Card c = this.dealDamageChooseTgtC(ai, sa, dmg, noPrevention, enemy, mandatory); if (c != null) {