diff --git a/.gitattributes b/.gitattributes index 8ed5be5660d..9a23872ce40 100644 --- a/.gitattributes +++ b/.gitattributes @@ -337,6 +337,7 @@ res/cardsfolder/auriok_salvagers.txt -text svneol=native#text/plain res/cardsfolder/auriok_sunchaser.txt -text svneol=native#text/plain res/cardsfolder/auriok_transfixer.txt -text svneol=native#text/plain res/cardsfolder/aurochs.txt -text svneol=native#text/plain +res/cardsfolder/austere_command.txt svneol=native#text/plain res/cardsfolder/avalanche_riders.txt -text svneol=native#text/plain res/cardsfolder/avatar_of_fury.txt -text svneol=native#text/plain res/cardsfolder/avatar_of_might.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/austere_command.txt b/res/cardsfolder/austere_command.txt new file mode 100644 index 00000000000..91f7d325504 --- /dev/null +++ b/res/cardsfolder/austere_command.txt @@ -0,0 +1,8 @@ +Name:Austere Command +ManaCost:4 W W +Types:Sorcery +Text:Choose two - Destroy all artifacts; or destroy all enchantments; or destroy all creatures with converted mana cost 3 or less; or destroy all creatures with converted mana cost 4 or greater. +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/austere_command.jpg +End \ No newline at end of file diff --git a/src/forge/CardFactory_Sorceries.java b/src/forge/CardFactory_Sorceries.java index 1ccf84e91be..6ab7f356224 100644 --- a/src/forge/CardFactory_Sorceries.java +++ b/src/forge/CardFactory_Sorceries.java @@ -1,6 +1,7 @@ package forge; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Vector; @@ -6925,6 +6926,130 @@ public class CardFactory_Sorceries { card.addSpellAbility(spell); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Austere Command")) { + final ArrayList userChoice = new ArrayList(); + + final String[] cardChoices = { + "Destroy all artifacts", + "Destroy all enchantments", + "Destroy all creatures with converted mana cost 3 or less", + "Destroy all creatures with converted mana cost 4 or more" + }; + + final SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = -8501457363981482513L; + + @Override + public void resolve() { + + //"Destroy all artifacts", + if(userChoice.contains(cardChoices[0])) { + CardList cards = AllZoneUtil.getCardsInPlay().filter(AllZoneUtil.artifacts); + for(Card c:cards) AllZone.GameAction.destroy(c); + } + + //"Destroy all enchantments", + if(userChoice.contains(cardChoices[1])) { + CardList cards = AllZoneUtil.getCardsInPlay().filter(AllZoneUtil.enchantments); + for(Card c:cards) AllZone.GameAction.destroy(c); + } + + //"Destroy all creatures with converted mana cost 3 or less", + if(userChoice.contains(cardChoices[2])) { + CardList cards = AllZoneUtil.getCreaturesInPlay(); + cards = cards.filter(new CardListFilter() { + public boolean addCard(Card c) { + return CardUtil.getConvertedManaCost(c) <= 3; + } + }); + for(Card c:cards) AllZone.GameAction.destroy(c); + } + + //"Destroy all creatures with converted mana cost 4 or more"}; + if(userChoice.contains(cardChoices[3])) { + CardList cards = AllZoneUtil.getCreaturesInPlay(); + cards = cards.filter(new CardListFilter() { + public boolean addCard(Card c) { + return CardUtil.getConvertedManaCost(c) >= 4; + } + }); + for(Card c:cards) AllZone.GameAction.destroy(c); + } + }//resolve() + + @Override + public boolean canPlayAI() { + return false; + } + };//SpellAbility + + final Command setStackDescription = new Command() { + private static final long serialVersionUID = -635710110379729475L; + + public void execute() { + ArrayList a = new ArrayList(); + if(userChoice.contains(cardChoices[0])) a.add("destroy all artifacts"); + if(userChoice.contains(cardChoices[1])) a.add("destroy all enchantments"); + if(userChoice.contains(cardChoices[2])) a.add("destroy all creatures with CMC <= 3"); + if(userChoice.contains(cardChoices[3])) a.add("destroy all creatures with CMC >= 4"); + + String s = a.get(0) + ", " + a.get(1); + spell.setStackDescription(card.getName() + " - " + s); + } + };//Command + + Input chooseTwoInput = new Input() { + private static final long serialVersionUID = 2352497236500922820L; + + @Override + public void showMessage() { + if(card.isCopiedSpell()) { + setStackDescription.execute(); + stopSetNext(new Input_PayManaCost(spell)); + } + else { + //reset variables + userChoice.clear(); + + ArrayList display = new ArrayList(Arrays.asList(cardChoices)); + + ArrayList a = chooseTwo(display); + //everything stops here if user cancelled + if(a == null) { + stop(); + return; + } + + userChoice.addAll(a); + + setStackDescription.execute(); + stopSetNext(new Input_PayManaCost(spell)); + } + }//showMessage() + + ArrayList chooseTwo(ArrayList choices) { + ArrayList out = new ArrayList(); + Object o = AllZone.Display.getChoiceOptional("Choose Two", choices.toArray()); + if(o == null) return null; + + out.add((String) o); + choices.remove(out.get(0)); + o = AllZone.Display.getChoiceOptional("Choose Two", choices.toArray()); + if(o == null) return null; + + out.add((String) o); + + return out; + }//chooseTwo() + };//Input chooseTwoInput + + card.clearSpellAbility(); + card.addSpellAbility(spell); + spell.setBeforePayMana(chooseTwoInput); + }//*************** END ************ END ************************** + return card; }//getCard