From 5faa05fb40c1db92ab6c5ddd9db617bdda6b14dc Mon Sep 17 00:00:00 2001 From: Sloth Date: Sat, 12 Nov 2011 17:27:43 +0000 Subject: [PATCH] - Removed canBePlayedAndPayedByAI check from getPlayable because the same check is always done later again (this should speed up AI thinking time). --- src/main/java/forge/ComputerAIGeneral.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/forge/ComputerAIGeneral.java b/src/main/java/forge/ComputerAIGeneral.java index 0bc435dce34..81c94f8394a 100644 --- a/src/main/java/forge/ComputerAIGeneral.java +++ b/src/main/java/forge/ComputerAIGeneral.java @@ -1,7 +1,5 @@ package forge; -import static forge.error.ErrorViewer.showError; - import java.util.ArrayList; import java.util.HashMap; @@ -339,16 +337,7 @@ public class ComputerAIGeneral implements Computer { ArrayList spellAbility = new ArrayList(); for (Card c : l) { for (SpellAbility sa : c.getSpellAbility()) { - // if SA is from AF_Counter don't add to getPlayable - // This try/catch should fix the "computer is thinking" bug - try { - sa.setActivatingPlayer(AllZone.getComputerPlayer()); - if (ComputerUtil.canBePlayedAndPayedByAI(sa)) { - spellAbility.add(sa); - } - } catch (Exception ex) { - showError(ex, "There is an error in the card code for %s:%n", c.getName(), ex.getMessage()); - } + spellAbility.add(sa); } } return spellAbility.toArray(new SpellAbility[spellAbility.size()]); @@ -506,9 +495,8 @@ public class ComputerAIGeneral implements Computer { */ public final void stackResponse() { // if top of stack is empty - SpellAbility[] sas = null; + SpellAbility[] sas = getOtherPhases(); if (AllZone.getStack().size() == 0) { - sas = getOtherPhases(); boolean pass = (sas.length == 0) || AllZone.getPhase().is(Constant.Phase.END_OF_TURN, AllZone.getComputerPlayer()); @@ -548,7 +536,6 @@ public class ComputerAIGeneral implements Computer { return; } - sas = getOtherPhases(); if (sas.length > 0) { // Spell not Countered if (!ComputerUtil.playCards(sas)) {