diff --git a/res/cardsfolder/c/cryptic_command.txt b/res/cardsfolder/c/cryptic_command.txt index 5f7ccf66776..b1e11cdf66f 100644 --- a/res/cardsfolder/c/cryptic_command.txt +++ b/res/cardsfolder/c/cryptic_command.txt @@ -1,7 +1,12 @@ Name:Cryptic Command ManaCost:1 U U U Types:Instant -Text:Choose two - Counter target spell; or return target permanent to its owner's hand; or tap all creatures your opponents control; or draw a card. +Text: +A:SP$ Charm | Cost$ 1 U U U | Choices$ DBCounter,DBReturn,DBTapAll,DBDraw | CharmNum$ 2 | SpellDescription$ Choose two - Counter target spell; or return target permanent to its owner's hand; or tap all creatures your opponents control; or draw a card. +SVar:DBCounter:DB$ Counter | TargetType$ Spell | ValidTgts$ Card | SpellDescription$ Counter target spell. +SVar:DBReturn:DB$ ChangeZone | Origin$ Battlefield | Destination$ Hand | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | SpellDescription$ Return target permanent to its owner's hand. +SVar:DBTapAll:DB$ TapAll | ValidCards$ Creature.YouDontCtrl | SpellDescription$ Tap all creatures your opponents control. +SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ 1 | SpellDescription$ Draw a card. SVar:RemAIDeck:True SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/cryptic_command.jpg diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Instants.java b/src/main/java/forge/card/cardFactory/CardFactory_Instants.java index 0359aad9636..11de106c25d 100644 --- a/src/main/java/forge/card/cardFactory/CardFactory_Instants.java +++ b/src/main/java/forge/card/cardFactory/CardFactory_Instants.java @@ -24,7 +24,6 @@ import forge.gui.input.Input; import forge.gui.input.Input_PayManaCost; import javax.swing.*; -import java.util.ArrayList; /** @@ -991,207 +990,7 @@ public class CardFactory_Instants { card.addSpellAbility(spell); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if (cardName.equals("Cryptic Command")) { - final SpellAbility[] m_spell = new SpellAbility[1]; - final Card[] m_perm = new Card[1]; - - final ArrayList userChoice = new ArrayList(); - - final String[] cardChoice = { - "Counter target spell", - "Return target permanent to its owner's hand", - "Tap all creatures your opponents control", - "Draw a card"}; - - final SpellAbility spell = new Spell(card) { - private static final long serialVersionUID = 9178547049760990376L; - - @Override - public void resolve() { - - //"Counter target spell", - for (int i = 0; i < card.getChoices().size(); i++) { - if (card.getChoice(i).equals(cardChoice[0])) { - if (AllZone.getStack().size() > 0) { - SpellAbility sa = AllZone.getStack().peekAbility(); - if (sa.isSpell()) { - AllZone.getStack().pop(); - AllZone.getGameAction().moveToGraveyard(sa.getSourceCard()); - } - } - } - } - - //"Return target Permanent to its owner's hand", - if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) { - if (AllZoneUtil.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) - { - AllZone.getGameAction().moveToHand(getTargetCard()); - } - } - - //"Tap all creatures your opponents control", - for (int i = 0; i < card.getChoices().size(); i++) { - if (card.getChoice(i).equals(cardChoice[2])) { - CardList creatures = AllZoneUtil.getCreaturesInPlay(card.getController().getOpponent()); - for (Card c : creatures) { - c.tap(); - } - } - } - - //"Draw a card" - if (userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) { - card.getController().drawCard(); - } - } //resolve() - - @Override - public boolean canPlayAI() { - return false; - } - }; //SpellAbility - - final Command setStackDescription = new Command() { - - private static final long serialVersionUID = -4833850318955216009L; - - public void execute() { - ArrayList a = new ArrayList(); - if (userChoice.contains(cardChoice[0]) || card.getChoices().contains(cardChoice[0])) { - a.add("counter target spell"); - } - if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) { - a.add("return target permanent to its owner's hand"); - } - if (userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2])) { - a.add("tap all creatures your opponents control"); - } - if (userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) { - a.add(" Draw a card."); - } - - String s = a.get(0) + ", " + a.get(1); - spell.setStackDescription(card.getName() + " - " + s); - } - };//Command - - - final Input returnTarget = new Input() { - private static final long serialVersionUID = 2736368243448655071L; - - @Override - public void showMessage() { - AllZone.getDisplay().showMessage("Select target permanent"); - ButtonUtil.enableOnlyCancel(); - } - - @Override - public void selectButtonCancel() { - stop(); - } - - @Override - public void selectCard(final Card c, final PlayerZone zone) { - if (c.isPermanent() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(card, c)) { - if (card.isCopiedSpell()) { - card.getChoiceTargets().remove(0); - } - m_perm[0] = c; - spell.setTargetCard(c); - card.setSpellChoiceTarget(String.valueOf(c.getUniqueNumber())); - setStackDescription.execute(); - stopSetNext(new Input_PayManaCost(spell)); - } //if - } //selectCard() - }; //Input targetLand - - Input chooseTwoInput = new Input() { - private static final long serialVersionUID = -4200213000203960667L; - - @Override - public void showMessage() { - if (card.isCopiedSpell()) { - if (card.getChoices().contains(cardChoice[1])) { - stopSetNext(returnTarget); - } - else { - setStackDescription.execute(); - - stopSetNext(new Input_PayManaCost(spell)); - } - } else { - //reset variables - m_spell[0] = null; - m_perm[0] = null; - card.getChoices().clear(); - card.getChoiceTargets().clear(); - userChoice.clear(); - - ArrayList display = new ArrayList(); - - //get all - CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield); - - if (AllZone.getStack().size() > 0) { - display.add("Counter target spell"); - } - if (list.size() > 0) { - display.add("Return target permanent to its owner's hand"); - } - display.add("Tap all creatures your opponents control"); - display.add("Draw a card"); - - ArrayList a = chooseTwo(display); - //everything stops here if user cancelled - if (a == null) { - stop(); - return; - } - - userChoice.addAll(a); - - if (userChoice.contains(cardChoice[1])) { - stopSetNext(returnTarget); - } - else { - setStackDescription.execute(); - stopSetNext(new Input_PayManaCost(spell)); - } - } - } //showMessage() - - ArrayList chooseTwo(final ArrayList choices) { - ArrayList out = new ArrayList(); - Object o = GuiUtils.getChoiceOptional("Choose Two", choices.toArray()); - if (o == null) { - return null; - } - - out.add((String) o); - card.addSpellChoice((String) o); - choices.remove(out.get(0)); - o = GuiUtils.getChoiceOptional("Choose Two", choices.toArray()); - if (o == null) { - return null; - } - - out.add((String) o); - card.addSpellChoice((String) o); - return out; - } //chooseTwo() - }; //Input chooseTwoInput - - card.addSpellAbility(spell); - - card.setSpellWithChoices(true); - spell.setBeforePayMana(chooseTwoInput); - } //*************** END ************ END ************************** + }//*************** END ************ END ************************** //*************** START *********** START **************************