- Fixed doTriggerAINoCost in CounterAI when the stack is empty.

This commit is contained in:
Sloth
2012-11-28 11:58:48 +00:00
parent 4284e149dc
commit a58bbfe347

View File

@@ -21,7 +21,7 @@ public class CounterAi extends SpellAiLogic {
boolean toReturn = true; boolean toReturn = true;
final Cost abCost = sa.getPayCosts(); final Cost abCost = sa.getPayCosts();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
if (Singletons.getModel().getGame().getStack().size() < 1) { if (Singletons.getModel().getGame().getStack().isEmpty()) {
return false; return false;
} }
@@ -110,6 +110,9 @@ public class CounterAi extends SpellAiLogic {
final Target tgt = sa.getTarget(); final Target tgt = sa.getTarget();
if (tgt != null) { if (tgt != null) {
if (Singletons.getModel().getGame().getStack().isEmpty()) {
return false;
}
final SpellAbility topSA = Singletons.getModel().getGame().getStack().peekAbility(); final SpellAbility topSA = Singletons.getModel().getGame().getStack().peekAbility();
if (!CardFactoryUtil.isCounterableBy(topSA.getSourceCard(), sa) || topSA.getActivatingPlayer().isComputer()) { if (!CardFactoryUtil.isCounterableBy(topSA.getSourceCard(), sa) || topSA.getActivatingPlayer().isComputer()) {
return false; return false;