From a0cbe8e04c7d7769fdb0461f2c1155f32e0eefe0 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 05:47:53 +0000 Subject: [PATCH] - Added the keyword spBounceAll. - Added Hibernation, Inundate, Reduce to Dreams and Sunder. --- res/cards.txt | 25 +++++++++++++++ src/forge/CardFactory.java | 62 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/res/cards.txt b/res/cards.txt index bbece309161..8edbbf4cbc9 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,28 @@ +Hibernation +2 U +Instant +Return all green permanents to their owners' hands. +spBounceAll:Permanent.Green:Hand +SVar:RemAIDeck:True + +Inundate +3 U U U +Sorcery +Return all nonblue creatures to their owners' hands. +spBounceAll:Permanent.nonBlue:Hand + +Reduce to Dreams +3 U U +Sorcery +Return all artifacts and enchantments to their owners' hands. +spBounceAll:Artifact,Enchantment:Hand + +Sunder +3 U U +Sorcery +Return all lands to their owners' hands. +spBounceAll:Land:Hand + Winds of Rath 3 W W Sorcery diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 35304bcd3b1..bd61a136598 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -2774,6 +2774,68 @@ public class CardFactory implements NewConstants { }//spBounceTgt + // Generic bounce all card + if(hasKeyword(card, "spBounceAll") != -1) { + int n = hasKeyword(card, "spBounceAll"); + + String parse = card.getKeyword().get(n).toString(); + card.removeIntrinsicKeyword(parse); + + String k[] = parse.split(":"); + String Targets = k[1]; // Artifact, Creature, Enchantment, Land, Permanent, White, Blue, Black, Red, Green, Colorless, MultiColor + // non-Artifact, non-Creature, non-Enchantment, non-Land, non-Permanent, + //non-White, non-Blue, non-Black, non-Red, non-Green, non-Colorless, non-MultiColor + final String Tgts[] = Targets.split(","); + + final String Destination = k[2]; + + card.clearSpellAbility(); + + final SpellAbility spBnceAll = new Spell(card) { + private static final long serialVersionUID = 897326872601L; + + @Override + public boolean canPlayAI() { + CardList human = new CardList(AllZone.Human_Play.getCards()); + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + + human = human.getValidCards(Tgts); + computer = computer.getValidCards(Tgts); + + // the computer will at least bounce 2 more human permanents + return AllZone.Phase.getPhase().equals(Constant.Phase.Main2) && + (computer.size() < human.size() - 1); + } + + @Override + public void resolve() { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + all = all.getValidCards(Tgts); + + for(int i = 0; i < all.size(); i++) { + Card c = all.get(i); + if(c.isToken()) AllZone.getZone(c).remove(c); + else { if(Destination.equals("TopofLibrary")) AllZone.GameAction.moveToTopOfLibrary(c); + else if(Destination.equals("ShuffleIntoLibrary")) { + AllZone.GameAction.moveToTopOfLibrary(c); + AllZone.GameAction.shuffle(c.getOwner()); + } + else if(Destination.equals("Exile")) AllZone.GameAction.removeFromGame(c); + else if(Destination.equals("Hand")) { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); + AllZone.GameAction.moveTo(hand, c); + } + } + } + }// resolve() + + }; //SpBnceAll + + card.addSpellAbility(spBnceAll); + + }//spBounceAll while(hasKeyword(card, "abDrawCards") != -1) { int n = hasKeyword(card, "abDrawCards");