From 93f2c923b70795c1f50ec8c00ee87dfd537670db Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 03:55:57 +0000 Subject: [PATCH] Added code for Explore. --- src/forge/CardFactory.java | 49 +++++++++++++++++++++++++++++++ src/forge/ComputerAI_General.java | 5 +++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 3683113756d..4dc86fa38a3 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -17557,6 +17557,55 @@ public class CardFactory implements NewConstants { }//*************** END ************ END ************************** + //*************** START *********** START ************************** + if(cardName.equals("Explore")) + { + final SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = 8377957584738695517L; + + public boolean canPlayAI() { + // The computer should only play this card if it has at least + // one land in its hand. Because of the way the computer turn + // is structured, it will already have played its first land. + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, + Constant.Player.Computer); + + CardList list = new CardList(hand.getCards()); + + list = list.getType("Land"); + if (list.size() > 0) + return true; + else + return false; + } + + public void resolve() { + final String thePlayer = card.getController(); + if (thePlayer.equals(Constant.Player.Human)) + AllZone.GameInfo.addHumanCanPlayNumberOfLands(1); + else + AllZone.GameInfo.addComputerCanPlayNumberOfLands(1); + + Command untilEOT = new Command() + { + + private static final long serialVersionUID = -2618916698575607634L; + + public void execute() + { + if (thePlayer.equals(Constant.Player.Human)) + AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1); + // There's no corresponding 'if' for the computer + // The computer's land total gets reset to the right value + // every turn + } + }; + AllZone.EndOfTurn.addUntil(untilEOT); + } + }; + card.clearSpellAbility(); + card.addSpellAbility(spell); + } //*************** END ************ END ************************** // Cards with Cycling abilities // -1 means keyword "Cycling" not found diff --git a/src/forge/ComputerAI_General.java b/src/forge/ComputerAI_General.java index 54089154bec..efa8564c921 100644 --- a/src/forge/ComputerAI_General.java +++ b/src/forge/ComputerAI_General.java @@ -21,6 +21,7 @@ public class ComputerAI_General implements Computer { public void main1() { if(AllZone.GameInfo.getComputerCanPlayNumberOfLands() > 0) { + AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1); ComputerUtil.playLand(); for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) { @@ -52,7 +53,8 @@ public class ComputerAI_General implements Computer { AllZone.GameInfo.setComputerCanPlayNumberOfLands(CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer)); playCards(Constant.Phase.Main2); - } + + } private void playCards(final String phase) { SpellAbility[] sp = phase.equals(Constant.Phase.Main1)? getMain1():getMain2(); @@ -100,6 +102,7 @@ public class ComputerAI_General implements Computer { play.add("Epic Proportions"); play.add("Erratic Explosion"); + play.add("Explore"); play.add("Expunge"); play.add("Faceless Butcher"); play.add("Feral Lightning");