From 17504912c616bff71e8428b4ef2cab9fcb119fdf Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 05:46:59 +0000 Subject: [PATCH] - Added the keyword spDestroyAll. - Added Serene Heart, Tranquil Domain and Tsunami. --- res/cards.txt | 18 ++++++++++++ src/forge/CardFactory.java | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/res/cards.txt b/res/cards.txt index 9dafe34b218..73cad8e9a62 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,21 @@ +Serene Heart +1 G +Instant +Destroy all Auras. +spDestroyAll:Aura + +Tranquil Domain +1 G +Instant +Destroy all non-Aura enchantments. +spDestroyAll:Enchantment.nonAura + +Tsunami +3 G +Sorcery +Destroy all Islands. +spDestroyAll:Island + Assassinate 2 B Sorcery diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 17e4aa38d02..a60514542ce 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -2578,6 +2578,66 @@ public class CardFactory implements NewConstants { }//spDestroyTgt + // Generic destroy all card + if(hasKeyword(card, "spDestroyAll") != -1) { + int n = hasKeyword(card, "spDestroyAll"); + + 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 boolean NoRegen = (k.length == 3); + + card.clearSpellAbility(); + + final SpellAbility spDstryAll = new Spell(card) { + private static final long serialVersionUID = 132554543614L; + + @Override + public boolean canPlayAI() { + CardList human = new CardList(AllZone.Human_Play.getCards()); + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + + human = human.getValidCards(Tgts); + human = human.getNotKeyword("Indestructible"); + computer = computer.getValidCards(Tgts); + computer = computer.getNotKeyword("Indestructible"); + + // the computer will at least destroy 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); + + CardListUtil.sortByIndestructible(all); + CardListUtil.sortByDestroyEffect(all); + + for(int i = 0; i < all.size(); i++) { + Card c = all.get(i); + if(NoRegen) AllZone.GameAction.destroyNoRegeneration(c); else AllZone.GameAction.destroy(c); + } + }// resolve() + + }; //SpDstryAll + + + card.setSVar("PlayMain1", "TRUE"); + card.addSpellAbility(spDstryAll); + + }//spDestroyAll + + // Generic bounce target card if(hasKeyword(card, "spBounceTgt") != -1) { int n = hasKeyword(card, "spBounceTgt");