From d33838cde68f256b65532fbaafb8a661cdf7fd2e Mon Sep 17 00:00:00 2001 From: Sloth Date: Sat, 21 Jul 2012 17:05:51 +0000 Subject: [PATCH] - More Cleanup in ComputerAIGeneral. --- .../forge/game/player/ComputerAIGeneral.java | 39 ++++--------------- .../forge/game/player/ComputerAIInput.java | 14 +------ 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/src/main/java/forge/game/player/ComputerAIGeneral.java b/src/main/java/forge/game/player/ComputerAIGeneral.java index 4098424fc71..4f4811814e2 100644 --- a/src/main/java/forge/game/player/ComputerAIGeneral.java +++ b/src/main/java/forge/game/player/ComputerAIGeneral.java @@ -34,7 +34,6 @@ import forge.card.spellability.SpellAbility; import forge.card.spellability.SpellPermanent; import forge.card.trigger.Trigger; import forge.card.trigger.TriggerType; -import forge.game.phase.PhaseType; import forge.game.zone.ZoneType; /** @@ -63,12 +62,8 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void main() { - if (AllZone.getStack().size() == 0) { - ComputerUtil.chooseLandsToPlay(); - this.playCards(); - } else { - this.stackResponse(); - } + ComputerUtil.chooseLandsToPlay(); + this.playCards(); } // main() @@ -252,7 +247,7 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void beginCombat() { - this.stackResponse(); + this.playCards(); } /** @@ -291,7 +286,7 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void declareAttackersAfter() { - this.stackResponse(); + this.playCards(); } /** @@ -315,7 +310,7 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void declareBlockersAfter() { - this.stackResponse(); + this.playCards(); } /** @@ -325,7 +320,7 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void endOfCombat() { - this.stackResponse(); + this.playCards(); } // end of Human's turn @@ -336,7 +331,7 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void endOfTurn() { - this.stackResponse(); + this.playCards(); } /** @@ -346,24 +341,6 @@ public class ComputerAIGeneral implements Computer { */ @Override public final void stackNotEmpty() { - this.stackResponse(); - } - - /** - *

- * stackResponse. - *

- */ - public final void stackResponse() { - // if top of stack is empty - if (AllZone.getStack().size() == 0) { - if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN, AllZone.getComputerPlayer())) { - Singletons.getModel().getGameState().getPhaseHandler().passPriority(); - return; - } - this.playCards(); - return; - } // if top of stack is owned by me if (AllZone.getStack().peekInstance().getActivatingPlayer().isComputer()) { @@ -386,7 +363,7 @@ public class ComputerAIGeneral implements Computer { possibleCounters = this.getPossibleETBCounters(); if ((possibleCounters.size() > 0) && !ComputerUtil.playSpellAbilities(possibleCounters)) { // Responding Permanent w/ ETB Counter is on the Stack - // Singletons.getModel().getGameState().getPhaseHandler().passPriority(); + // If playSpellAbilities returns false, a Spell is hitting the Stack return; } final ArrayList sas = this.getSpellAbilities(cards); diff --git a/src/main/java/forge/game/player/ComputerAIInput.java b/src/main/java/forge/game/player/ComputerAIInput.java index ec838c4bb21..73387fc7ec0 100644 --- a/src/main/java/forge/game/player/ComputerAIInput.java +++ b/src/main/java/forge/game/player/ComputerAIInput.java @@ -102,27 +102,15 @@ public class ComputerAIInput extends Input { Log.debug("Computer main1"); this.computer.main(); break; - case COMBAT_BEGIN: - this.computer.beginCombat(); - break; case COMBAT_DECLARE_ATTACKERS: this.computer.declareAttackers(); break; - case COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY: - this.computer.declareAttackersAfter(); - break; - case COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY: - this.computer.declareBlockersAfter(); - break; - case COMBAT_END: - this.computer.endOfCombat(); - break; case MAIN2: Log.debug("Computer main2"); this.computer.main(); break; default: - this.computer.stackNotEmpty(); + this.computer.endOfCombat(); break; } }