From 1e9926de67da8cf3e239609535805589303c96ed Mon Sep 17 00:00:00 2001 From: slapshot5 Date: Sat, 5 Nov 2011 04:37:38 +0000 Subject: [PATCH] convert Tezzeret the Seeker to script --- res/cardsfolder/t/tezzeret_the_seeker.txt | 5 + .../cardfactory/CardFactoryPlaneswalkers.java | 934 +----------------- 2 files changed, 8 insertions(+), 931 deletions(-) diff --git a/res/cardsfolder/t/tezzeret_the_seeker.txt b/res/cardsfolder/t/tezzeret_the_seeker.txt index dfbb7179748..42b0f7cf0c0 100644 --- a/res/cardsfolder/t/tezzeret_the_seeker.txt +++ b/res/cardsfolder/t/tezzeret_the_seeker.txt @@ -3,6 +3,11 @@ ManaCost:3 U U Types:Planeswalker Tezzeret Text:no text Loyalty:4 +A:AB$ Untap | Cost$ AddCounter<1/LOYALTY> | ValidTgts$ Artifact | TgtPrompt$ Choose target artifact | TargetMin$ 0 | TargetMax$ 2 | Planeswalker$ True | SpellDescription$ Untap up to two target artifacts. +A:AB$ ChangeZone | Cost$ SubCounter | Origin$ Library | Destination$ Battlefield | ChangeType$ Artifact.cmcLEChosenX | ChangeNum$ 1 | Shuffle$ True | Planeswalker$ True | SpellDescription$ Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library. +A:AB$ AnimateAll | Cost$ SubCounter<5/LOYALTY> | Power$ 5 | Toughness$ 5 | Types$ Creature,Artifact | ValidCards$ Artifact.YouCtrl | Planeswalker$ True | Ultimate$ True | SpellDescription$ Artifacts you control become 5/5 artifact creatures until end of turn. +#ChosenX SVar created by Cost payment +SVar:X:XChoice SVar:Rarity:Mythic SVar:Picture:http://www.wizards.com/global/images/magic/general/tezzeret_the_seeker.jpg SetInfo:ALA|Mythic|http://magiccards.info/scans/en/ala/60.jpg diff --git a/src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java b/src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java index 323363e42f8..5685517bdd4 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryPlaneswalkers.java @@ -1,17 +1,13 @@ package forge.card.cardfactory; -import java.util.HashMap; - import com.esotericsoftware.minlog.Log; import forge.AllZone; import forge.AllZoneUtil; -import forge.ButtonUtil; import forge.Card; import forge.CardList; import forge.CardListFilter; import forge.CardUtil; -import forge.Command; import forge.Constant; import forge.Constant.Zone; import forge.Counters; @@ -25,7 +21,6 @@ import forge.card.spellability.AbilityActivated; import forge.card.spellability.SpellAbility; import forge.card.spellability.Target; import forge.gui.GuiUtils; -import forge.gui.input.Input; /** *

@@ -54,719 +49,8 @@ public class CardFactoryPlaneswalkers { card.addComesIntoPlayCommand(CardFactoryUtil.entersBattleFieldWithCounters(card, Counters.LOYALTY, card.getBaseLoyalty())); } - - /* - * // *************** START *********** START ************************** - * if (cardName.equals("Elspeth, Knight-Errant")) { // computer only - * plays ability 1 and 3, put 1/1 Soldier in play and // make everything - * indestructible final int[] turn = new int[1]; turn[0] = -1; - * - * // ability2: target creature gets +3/+3 and flying until EOT final - * Target target2 = new Target(card, "TgtC"); final Cost cost2 = new - * Cost("AddCounter<1/LOYALTY>", cardName, true); final SpellAbility - * ability2 = new Ability_Activated(card, cost2, target2) { private - * static final long serialVersionUID = 6624768423224398603L; - * - * @Override public void resolve() { turn[0] = - * AllZone.getPhase().getTurn(); final Card c = this.getTargetCard(); - * - * final Command eot = new Command() { private static final long - * serialVersionUID = 94488363210770877L; - * - * @Override public void execute() { if (AllZoneUtil.isCardInPlay(c)) { - * c.addTempAttackBoost(-3); c.addTempDefenseBoost(-3); - * c.removeExtrinsicKeyword("Flying"); } } // execute() }; // Command if - * (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) { - * c.addTempAttackBoost(3); c.addTempDefenseBoost(3); - * c.addExtrinsicKeyword("Flying"); - * - * AllZone.getEndOfTurn().addUntil(eot); } } // resolve() - * - * @Override public boolean canPlayAI() { return false; } - * - * @Override public boolean canPlay() { - * - * return (0 < card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); - * - * } // canPlay() }; // SpellAbility ability2 - * - * // ability3 final Cost cost3 = new Cost("SubCounter<8/LOYALTY>", - * cardName, true); final SpellAbility ability3 = new - * Ability_Activated(card, cost3, null) { private static final long - * serialVersionUID = -830373718591602944L; - * - * @Override public void resolve() { turn[0] = - * AllZone.getPhase().getTurn(); - * - * final Card emblem = new Card(); // should we even name this - * permanent? // emblem.setName("Elspeth Emblem"); - * emblem.addIntrinsicKeyword("Indestructible"); - * emblem.addIntrinsicKeyword("Shroud"); - * emblem.addIntrinsicKeyword("Artifacts, creatures, enchantments, " + - * "and lands you control are indestructible."); - * emblem.setImmutable(true); emblem.addType("Emblem"); - * emblem.addController(card.getController()); - * emblem.setOwner(card.getController()); - * - * AllZone.getGameAction().moveToPlay(emblem); - * - * // AllZone.getGameAction().checkStateEffects(); - * AllZone.getStaticEffects().rePopulateStateBasedList(); for (final - * String effect : - * AllZone.getStaticEffects().getStateBasedMap().keySet()) { final - * Command com = GameActionUtil.commands.get(effect); com.execute(); } } - * - * @Override public boolean canPlay() { return (8 <= - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() - * - * @Override public boolean canPlayAI() { CardList list = - * AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); list = - * list.filter(new CardListFilter() { - * - * @Override public boolean addCard(final Card c) { return c.isEmblem() - * && c.hasKeyword("Artifacts, creatures, enchantments, " + - * "and lands you control are indestructible."); } }); return - * (list.size() == 0) && (card.getCounters(Counters.LOYALTY) > 8); } }; - * - * // ability 1: create white 1/1 token final Cost cost1 = new - * Cost("AddCounter<1/LOYALTY>", cardName, true); final SpellAbility - * ability1 = new Ability_Activated(card, cost1, null) { private static - * final long serialVersionUID = -6766888113766637596L; - * - * @Override public void resolve() { turn[0] = - * AllZone.getPhase().getTurn(); - * - * CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", - * card.getController(), "W", new String[] { "Creature", "Soldier" }, 1, - * 1, new String[] { "" }); } - * - * @Override public boolean canPlayAI() { if (ability3.canPlay() && - * ability3.canPlayAI()) { return false; } else { return true; } } - * - * @Override public boolean canPlay() { return (0 < - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() }; // - * SpellAbility ability1 - * - * ability1.setDescription( - * "+1: Put a 1/1 white Soldier creature token onto the battlefield."); - * ability1.setStackDescription(card + - * " - put a 1/1 white Soldier creature token onto the battlefield."); - * card.addSpellAbility(ability1); - * - * ability2.setDescription( - * "+1: Target creature gets +3/+3 and gains flying until end of turn." - * ); ability2.setStackDescription(card + - * " - creature gets +3/+3 and gains flying until EOT."); - * - * card.addSpellAbility(ability2); - * - * ability3.setDescription("-8: You get an emblem with \"Artifacts, " + - * "creatures, enchantments, and lands you control are indestructible.\"" - * ); ability3.setStackDescription(card + - * " - You get an emblem with \"Artifacts, creatures, enchantments, " + - * "and lands you control are indestructible.\""); - * card.addSpellAbility(ability3); - * - * card.setSVars(card.getSVars()); card.setSets(card.getSets()); - * - * return card; } // *************** END ************ END - * ************************** - * - * - * - * // *************** START *********** START ************************** - * if (cardName.equals("Ajani Goldmane")) { // computer only plays - * ability 1 and 3, gain life and put X/X token // onto battlefield - * final int[] turn = new int[1]; turn[0] = -1; - * - * // ability2: Put a +1/+1 counter on each creature you control. Those - * // creatures gain vigilance until end of turn. final SpellAbility - * ability2 = new Ability(card, "0") { private final Command untilEOT = - * new Command() { private static final long serialVersionUID = - * -5436621445704076988L; - * - * @Override public void execute() { final Player player = - * card.getController(); final CardList creatures = - * AllZoneUtil.getCreaturesInPlay(player); - * - * for (int i = 0; i < creatures.size(); i++) { final Card card = - * creatures.get(i); card.removeExtrinsicKeyword("Vigilance"); } } }; - * - * @Override public void resolve() { - * card.subtractCounter(Counters.LOYALTY, 1); turn[0] = - * AllZone.getPhase().getTurn(); - * - * final Player player = card.getController(); final CardList creatures - * = AllZoneUtil.getCreaturesInPlay(player); - * - * for (int i = 0; i < creatures.size(); i++) { final Card card = - * creatures.get(i); card.addCounter(Counters.P1P1, 1); - * card.addExtrinsicKeyword("Vigilance"); } - * - * AllZone.getEndOfTurn().addUntil(this.untilEOT); } - * - * @Override public boolean canPlayAI() { return false; } - * - * @Override public boolean canPlay() { - * - * return (0 < card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); - * - * } // canPlay() }; // SpellAbility ability2 - * - * ability2.setBeforePayMana(new Input() { private static final long - * serialVersionUID = 6373573398967821630L; private int check = -1; - * - * @Override public void showMessage() { if (this.check != - * AllZone.getPhase().getTurn()) { this.check = - * AllZone.getPhase().getTurn(); turn[0] = AllZone.getPhase().getTurn(); - * AllZone.getStack().add(ability2); } this.stop(); } // showMessage() - * }); - * - * // ability3 final SpellAbility ability3 = new Ability(card, "0") { - * - * @Override public void resolve() { - * card.subtractCounter(Counters.LOYALTY, 6); turn[0] = - * AllZone.getPhase().getTurn(); - * - * // Create token final int n = card.getController().getLife(); - * CardFactoryUtil.makeToken("Avatar", "W N N Avatar", - * card.getController(), "W", new String[] { "Creature", "Avatar" }, n, - * n, new String[] { - * "This creature's power and toughness are each equal to your life total" - * }); } - * - * @Override public boolean canPlay() { return (6 <= - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() - * - * @Override public boolean canPlayAI() { // may be it's better to put - * only if you have less than 5 // life return true; } }; - * ability3.setBeforePayMana(new Input() { private static final long - * serialVersionUID = 7530960428366291386L; - * - * private int check = -1; - * - * @Override public void showMessage() { if (this.check != - * AllZone.getPhase().getTurn()) { this.check = - * AllZone.getPhase().getTurn(); turn[0] = AllZone.getPhase().getTurn(); - * AllZone.getStack().add(ability3); } this.stop(); } // showMessage() - * }); - * - * // ability 1: gain 2 life final SpellAbility ability1 = new - * Ability(card, "0") { - * - * @Override public void resolve() { - * card.addCounterFromNonEffect(Counters.LOYALTY, 1); turn[0] = - * AllZone.getPhase().getTurn(); - * - * card.getController().gainLife(2, card); Log.debug("Ajani Goldmane", - * "current phase: " + AllZone.getPhase().getPhase()); } - * - * @Override public boolean canPlayAI() { if (ability3.canPlay() && - * ability3.canPlayAI()) { return false; } else { return true; } } - * - * @Override public boolean canPlay() { return (0 < - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() }; // - * SpellAbility ability1 - * - * ability1.setBeforePayMana(new Input() { private static final long - * serialVersionUID = -7969603493514210825L; - * - * private int check = -1; - * - * @Override public void showMessage() { if (this.check != - * AllZone.getPhase().getTurn()) { this.check = - * AllZone.getPhase().getTurn(); turn[0] = AllZone.getPhase().getTurn(); - * AllZone.getStack().add(ability1); } this.stop(); } // showMessage() - * }); - * - * ability1.setDescription("+1: You gain 2 life."); final StringBuilder - * stack1 = new StringBuilder(); - * stack1.append("Ajani Goldmane - ").append - * (card.getController()).append(" gains 2 life"); - * ability1.setStackDescription(stack1.toString()); // - * ability1.setStackDescription("Ajani Goldmane - " + // - * card.getController() + " gains 2 life"); - * card.addSpellAbility(ability1); - * - * ability2.setDescription( - * "-1: Put a +1/+1 counter on each creature you control. " + - * " Those creatures gain vigilance until end of turn."); - * ability2.setStackDescription - * ("Ajani Goldmane - Put a +1/+1 counter on each " + - * "creature you control. They get vigilance."); - * card.addSpellAbility(ability2); - * - * ability3.setDescription( - * "-6: Put a white Avatar creature token onto the battlefield. " + - * "It has \"This creature's power and toughness are each equal to your life total.\"" - * ); ability3.setStackDescription( - * "Ajani Goldmane - Put a X/X white Avatar creature " + - * "token onto the battlefield."); card.addSpellAbility(ability3); - * - * card.setSVars(card.getSVars()); card.setSets(card.getSets()); - * - * return card; } // *************** END ************ END - * ************************** - * - * - * // *************** START *********** START ************************** - * else if (cardName.equals("Chandra Nalaar")) { // computer only plays - * ability 1 and 3, discard and return creature // from graveyard to - * play final int[] turn = new int[1]; turn[0] = -1; - * - * // ability 1 final SpellAbility ability1 = new Ability(card, "0") { - * - * @Override public void resolve() { - * card.addCounterFromNonEffect(Counters.LOYALTY, 1); turn[0] = - * AllZone.getPhase().getTurn(); - * - * if (this.getTargetCard() != null) { if - * (AllZoneUtil.isCardInPlay(this.getTargetCard()) && - * CardFactoryUtil.canTarget(card, this.getTargetCard())) { final Card c - * = this.getTargetCard(); c.addDamage(1, card); } } else { - * this.getTargetPlayer().addDamage(1, card); } } - * - * @Override public boolean canPlay() { for (int i = 0; i < - * AllZone.getStack().size(); i++) { if - * (AllZone.getStack().peekInstance(i).getSourceCard().equals(card)) { - * return false; } } - * - * return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && - * (turn[0] != AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } - * - * @Override public boolean canPlayAI() { - * this.setTargetPlayer(AllZone.getHumanPlayer()); - * this.setStackDescription("Chandra Nalaar - deals 1 damage to " + - * AllZone.getHumanPlayer()); return card.getCounters(Counters.LOYALTY) - * < 8; } }; // SpellAbility ability1 - * - * final Input target1 = new Input() { private static final long - * serialVersionUID = 5263705146686766284L; - * - * @Override public void showMessage() { - * AllZone.getDisplay().showMessage - * ("Select target Player or Planeswalker"); - * ButtonUtil.enableOnlyCancel(); } - * - * @Override public void selectButtonCancel() { this.stop(); } - * - * @Override public void selectCard(final Card card, final PlayerZone - * zone) { if (card.isPlaneswalker() && - * zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(card, - * card)) { ability1.setTargetCard(card); // stopSetNext(new - * Input_PayManaCost(ability1)); AllZone.getStack().add(ability1); - * this.stop(); } } // selectCard() - * - * @Override public void selectPlayer(final Player player) { - * ability1.setTargetPlayer(player); // stopSetNext(new - * Input_PayManaCost(ability1)); AllZone.getStack().add(ability1); - * this.stop(); } }; ability1.setBeforePayMana(target1); - * ability1.setDescription - * ("+1: Chandra Nalaar deals 1 damage to target player."); - * card.addSpellAbility(ability1); // end ability1 - * - * // ability 2 final int[] damage2 = new int[1]; - * - * final SpellAbility ability2 = new Ability(card, "0") { - * - * @Override public void resolve() { turn[0] = - * AllZone.getPhase().getTurn(); - * - * card.subtractCounter(Counters.LOYALTY, damage2[0]); - * this.getTargetCard().addDamage(damage2[0], card); - * - * damage2[0] = 0; } // resolve() - * - * @Override public boolean canPlay() { for (int i = 0; i < - * AllZone.getStack().size(); i++) { if - * (AllZone.getStack().peekInstance(i).getSourceCard().equals(card)) { - * return false; } } - * - * return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && - * (turn[0] != AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } - * - * @Override public boolean canPlayAI() { return false; } }; // - * SpellAbility ability2 - * - * final Input target2 = new Input() { private static final long - * serialVersionUID = -2160464080456452897L; - * - * @Override public void showMessage() { - * AllZone.getDisplay().showMessage("Select target creature"); - * ButtonUtil.enableOnlyCancel(); } - * - * @Override public void selectButtonCancel() { this.stop(); } - * - * @Override public void selectCard(final Card c, final PlayerZone zone) - * { if (!CardFactoryUtil.canTarget(card, c)) { - * AllZone.getDisplay().showMessage - * ("Cannot target this card (Shroud? Protection?)."); } else if - * (c.isCreature()) { turn[0] = AllZone.getPhase().getTurn(); - * - * damage2[0] = this.getDamage(); - * - * ability2.setTargetCard(c); - * ability2.setStackDescription("Chandra Nalaar - deals damage to " + - * c); - * - * AllZone.getStack().add(ability2); this.stop(); } } // selectCard() - * - * int getDamage() { final int size = - * card.getCounters(Counters.LOYALTY); final Object[] choice = new - * Object[size]; - * - * for (int i = 0; i < choice.length; i++) { choice[i] = - * Integer.valueOf(i + 1); } - * - * final Integer damage = (Integer) GuiUtils.getChoice("Select X", - * choice); return damage.intValue(); } }; // Input target - * ability2.setBeforePayMana(target2); ability2.setDescription( - * "-X: Chandra Nalaar deals X damage to target creature."); - * card.addSpellAbility(ability2); // end ability2 - * - * // ability 3 final SpellAbility ability3 = new Ability(card, "0") { - * - * @Override public void resolve() { - * card.subtractCounter(Counters.LOYALTY, 8); turn[0] = - * AllZone.getPhase().getTurn(); - * - * this.getTargetPlayer().addDamage(10, card); - * - * final CardList list = - * AllZoneUtil.getCreaturesInPlay(this.getTargetPlayer()); - * - * for (int i = 0; i < list.size(); i++) { list.get(i).addDamage(10, - * card); } } // resolve() - * - * @Override public boolean canPlay() { for (int i = 0; i < - * AllZone.getStack().size(); i++) { if - * (AllZone.getStack().peekInstance(i).getSourceCard().equals(card)) { - * return false; } } - * - * return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && - * (turn[0] != AllZone.getPhase().getTurn()) && (7 < - * card.getCounters(Counters.LOYALTY)) && - * Phase.canCastSorcery(card.getController()); } - * - * @Override public boolean canPlayAI() { - * this.setTargetPlayer(AllZone.getHumanPlayer()); final StringBuilder - * sb = new StringBuilder(); - * sb.append("Chandra Nalaar - deals 10 damage to " - * ).append(AllZone.getHumanPlayer()); - * sb.append(" and each creature he or she controls."); - * this.setStackDescription(sb.toString()); // - * setStackDescription("Chandra Nalaar - deals 10 damage to " // + - * AllZone.getHumanPlayer() // + - * " and each creature he or she controls."); return true; } }; // - * SpellAbility ability3 - * - * final Input target3 = new Input() { private static final long - * serialVersionUID = -3014450919506364666L; - * - * @Override public void showMessage() { - * AllZone.getDisplay().showMessage("Select target player"); - * ButtonUtil.enableOnlyCancel(); } - * - * @Override public void selectButtonCancel() { this.stop(); } - * - * @Override public void selectPlayer(final Player player) { turn[0] = - * AllZone.getPhase().getTurn(); - * - * ability3.setTargetPlayer(player); - * - * final StringBuilder stack3 = new StringBuilder(); - * stack3.append("Chandra Nalaar - deals 10 damage to ").append(player); - * stack3.append(" and each creature he or she controls."); - * ability3.setStackDescription(stack3.toString()); // - * ability3.setStackDescription("Chandra Nalaar - deals 10 damage to " - * // + player // + " and each creature he or she controls."); - * - * AllZone.getStack().add(ability3); this.stop(); } }; // Input target - * ability3.setBeforePayMana(target3); - * ability3.setDescription("-8: Chandra Nalaar deals 10 damage to target " - * + "player and each creature he or she controls."); - * card.addSpellAbility(ability3); // end ability3 - * - * card.setSVars(card.getSVars()); card.setSets(card.getSets()); - * - * return card; } // *************** END ************ END - * ************************** - */ // *************** START *********** START ************************** - if (cardName.equals("Tezzeret the Seeker")) { - final int[] turn = new int[1]; - turn[0] = -1; - - // ability1 - final SpellAbility ability1 = new Ability(card, "0") { - @Override - public void resolve() { - card.addCounterFromNonEffect(Counters.LOYALTY, 1); - - turn[0] = AllZone.getPhase().getTurn(); - - // only computer uses the stack - CardList tapped = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); - tapped = tapped.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - return c.isArtifact() && c.isTapped() && CardFactoryUtil.canTarget(card, c); - } - }); - - for (int i = 0; (i < 2) && (i < tapped.size()); i++) { - tapped.get(i).untap(); - } - } // resolve() - - @Override - public boolean canPlayAI() { - return (card.getCounters(Counters.LOYALTY) <= 6) - && AllZone.getPhase().getPhase().equals(Constant.Phase.MAIN2); - } - - @Override - public boolean canPlay() { - return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) - && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController()); - } // canPlay() - }; - final Input targetArtifact = new Input() { - - private static final long serialVersionUID = -7915255038817192835L; - private int count; - - @Override - public void showMessage() { - AllZone.getDisplay().showMessage("Select an artifact to untap"); - ButtonUtil.disableAll(); - } - - @Override - public void selectCard(final Card c, final PlayerZone zone) { - if (c.isArtifact() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(card, c)) { - this.count++; - c.untap(); - } - - // doesn't use the stack, its just easier this way - if (this.count == 2) { - this.count = 0; - turn[0] = AllZone.getPhase().getTurn(); - card.addCounterFromNonEffect(Counters.LOYALTY, 1); - this.stop(); - } - } // selectCard() - }; // Input - - final Input runtime1 = new Input() { - private static final long serialVersionUID = 871304623687370615L; - - @Override - public void showMessage() { - this.stopSetNext(targetArtifact); - } - }; // Input - ability1.setDescription("+1: Untap up to two target artifacts."); - ability1.setStackDescription("Tezzeret the Seeker - Untap two target artifacts."); - - ability1.setBeforePayMana(runtime1); - card.addSpellAbility(ability1); - // end ability 1 - - // ability 2 - final SpellAbility ability2 = new Ability(card, "0") { - @Override - public void resolve() { - turn[0] = AllZone.getPhase().getTurn(); - - final int size = card.getCounters(Counters.LOYALTY) + 1; - final Object[] choice = new Object[size]; - - for (int i = 0; i < choice.length; i++) { - choice[i] = Integer.valueOf(i); - } - - final Integer damage = (Integer) GuiUtils.getChoice("Select X", choice); - final int dam = damage.intValue(); - - card.subtractCounter(Counters.LOYALTY, dam); - - CardList list = card.getController().getCardsIn(Zone.Library); - list = list.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - return c.isArtifact() && (CardUtil.getConvertedManaCost(c.getManaCost()) <= dam); - } - }); - - if (list.size() > 0) { - final Object o = GuiUtils.getChoiceOptional("Select artifact", list.toArray()); - if (o != null) { - final Card c = (Card) o; - if (list.contains(c)) { - AllZone.getGameAction().moveToPlay(c); - } - } - } - } // resolve() - - @Override - public boolean canPlay() { - for (int i = 0; i < AllZone.getStack().size(); i++) { - if (AllZone.getStack().peekInstance(i).getSourceCard().equals(card)) { - return false; - } - } - - return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) - && (turn[0] != AllZone.getPhase().getTurn()) && Phase.canCastSorcery(card.getController()); - } - - @Override - public boolean canPlayAI() { - return false; - } - }; // SpellAbility ability2 - ability2.setDescription("-X: Search your library for an artifact card with " - + "converted mana cost X or less and put it onto the battlefield. Then shuffle your library."); - final StringBuilder stack2 = new StringBuilder(); - stack2.append(card.getName()); - stack2.append(" - Search your library for an artifact card with converted " - + "mana cost X or less and put it onto the battlefield. Then shuffle your library."); - ability2.setStackDescription(stack2.toString()); - card.addSpellAbility(ability2); - - final SpellAbility ability3 = new Ability(card, "0") { - @Override - public void resolve() { - - card.subtractCounter(Counters.LOYALTY, 5); - - turn[0] = AllZone.getPhase().getTurn(); - - CardList list = card.getController().getCardsIn(Zone.Battlefield); - list = list.getType("Artifact"); - final CardList creatures = list.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - return c.isCreature(); - } - }); - - final HashMap tempCardMap = new HashMap(); - - for (final Card creatureCard : creatures) { - final Card crd = CardFactoryPlaneswalkers.copyStats(creatureCard); - tempCardMap.put(creatureCard.getUniqueNumber(), crd); - // System.out.println("Just added:" + crd); - } - - for (final Card c : list) { - final Card[] art = new Card[1]; - art[0] = c; - if (AllZoneUtil.isCardInPlay(art[0])) { - if (c.isCreature()) { - // Card crd = copyStats(art[0]); - // tempCards[c.getUniqueNumber()] = crd; - - final Command creatureUntilEOT = new Command() { - private static final long serialVersionUID = 5063161656920609389L; - - @Override - public void execute() { - final int id = art[0].getUniqueNumber(); - - final Card tempCard = tempCardMap.get(id); - art[0].setBaseAttack(tempCard.getBaseAttack()); - art[0].setBaseDefense(tempCard.getBaseDefense()); - - } - }; // Command - - art[0].setBaseAttack(5); - art[0].setBaseDefense(5); - - AllZone.getEndOfTurn().addUntil(creatureUntilEOT); - } else { - final Command nonCreatureUntilEOT = new Command() { - private static final long serialVersionUID = 248122386218960073L; - - @Override - public void execute() { - art[0].removeType("Creature"); - art[0].setBaseAttack(0); - art[0].setBaseDefense(0); - } - }; // Command - - art[0].addType("Creature"); - art[0].setBaseAttack(5); - art[0].setBaseDefense(5); - - AllZone.getEndOfTurn().addUntil(nonCreatureUntilEOT); - } // noncreature artifact - - } - } // for - } // resolve - - @Override - public boolean canPlay() { - return AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) - && (turn[0] != AllZone.getPhase().getTurn()) && (card.getCounters(Counters.LOYALTY) >= 5) - && Phase.canCastSorcery(card.getController()); - } // canPlay() - - @Override - public boolean canPlayAI() { - CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); - list = list.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - return c.isArtifact() && (!c.isCreature() || (c.isCreature() && (c.getBaseAttack() < 4))) - && !c.hasSickness(); - } - }); - return (list.size() > 4) && AllZone.getPhase().getPhase().equals("Main1") - && (card.getCounters(Counters.LOYALTY) > 5); - } - }; - ability3.setDescription("-5: Artifacts you control become 5/5 artifact creatures until end of turn."); - final StringBuilder stack3 = new StringBuilder(); - stack3.append(card.getName()).append( - " - Artifacts you control become 5/5 artifact creatures until end of turn."); - ability3.setStackDescription(stack3.toString()); - card.addSpellAbility(ability3); - - card.setSVars(card.getSVars()); - card.setSets(card.getSets()); - - return card; - } // *************** END ************ END ************************** - - // *************** START *********** START ************************** - else if (cardName.equals("Jace, the Mind Sculptor")) { + if (cardName.equals("Jace, the Mind Sculptor")) { final int[] turn = new int[1]; turn[0] = -1; @@ -1155,219 +439,7 @@ public class CardFactoryPlaneswalkers { return card; } // *************** END ************ END ************************** - /* - * // *************** START *********** START ************************** - * else if (cardName.equals("Koth of the Hammer")) { // computer only - * plays ability 1 and 3, put 1/1 Soldier in play and // make everything - * indestructible final int[] turn = new int[1]; turn[0] = -1; - * - * // ability2: add R for each mountain final SpellAbility ability2 = - * new Ability(card, "0") { - * - * @Override public void resolve() { - * - * card.subtractCounter(Counters.LOYALTY, 2); - * - * turn[0] = AllZone.getPhase().getTurn(); - * - * CardList list = - * AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield); list = - * list.filter(new CardListFilter() { - * - * @Override public boolean addCard(final Card crd) { return - * crd.isType("Mountain"); } }); - * - * final Ability_Mana abMana = new Ability_Mana(card, "0", "R", - * list.size()) { private static final long serialVersionUID = - * -2182129023960978132L; }; abMana.setUndoable(false); - * abMana.produceMana(); - * - * } // resolve() - * - * @Override public boolean canPlayAI() { return false; } - * - * @Override public boolean canPlay() { - * - * return (0 < card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); - * - * } // canPlay() }; // SpellAbility ability2 - * - * // ability3 final SpellAbility ability3 = new Ability(card, "0") { - * - * @Override public void resolve() { - * card.subtractCounter(Counters.LOYALTY, 5); turn[0] = - * AllZone.getPhase().getTurn(); - * - * final Card emblem = new Card(); - * - * emblem.addIntrinsicKeyword("Indestructible"); - * emblem.addIntrinsicKeyword("Shroud"); emblem.addIntrinsicKeyword( - * "Mountains you control have 'tap: This land deals " + - * "1 damage to target creature or player.'"); - * emblem.setImmutable(true); emblem.addType("Emblem"); - * emblem.addController(card.getController()); - * emblem.setOwner(card.getOwner()); - * - * // TODO Emblems live in the command zone - * AllZone.getGameAction().moveToPlay(emblem); - * - * // AllZone.getGameAction().checkStateEffects(); - * AllZone.getStaticEffects().rePopulateStateBasedList(); for (final - * String effect : - * AllZone.getStaticEffects().getStateBasedMap().keySet()) { final - * Command com = GameActionUtil.commands.get(effect); com.execute(); } } - * - * @Override public boolean canPlay() { return (5 <= - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() - * - * @Override public boolean canPlayAI() { CardList list = - * AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); list = - * list.filter(new CardListFilter() { - * - * @Override public boolean addCard(final Card c) { return c.isEmblem() - * && c.hasKeyword("Mountains you control have 'tap: This land " + - * "deals 1 damage to target creature or player.'"); } }); return - * (list.size() == 0) && (card.getCounters(Counters.LOYALTY) > 5); } }; - * ability3.setBeforePayMana(new Input() { private static final long - * serialVersionUID = -2054686425541429389L; - * - * private int check = -1; - * - * @Override public void showMessage() { if (this.check != - * AllZone.getPhase().getTurn()) { this.check = - * AllZone.getPhase().getTurn(); turn[0] = AllZone.getPhase().getTurn(); - * AllZone.getStack().add(ability3); } this.stop(); } // showMessage() - * }); - * - * // ability 1: make 4/4 out of mountain final SpellAbility ability1 = - * new Ability(card, "0") { - * - * @Override public void resolve() { - * card.addCounterFromNonEffect(Counters.LOYALTY, 1); turn[0] = - * AllZone.getPhase().getTurn(); - * - * final Card[] card = new Card[1]; card[0] = this.getTargetCard(); - * - * final int[] oldAttack = new int[1]; final int[] oldDefense = new - * int[1]; - * - * oldAttack[0] = card[0].getBaseAttack(); oldDefense[0] = - * card[0].getBaseDefense(); - * - * if (card[0].isType("Mountain")) { card[0].untap(); - * - * card[0].setBaseAttack(4); card[0].setBaseDefense(4); - * card[0].addType("Creature"); card[0].addType("Elemental"); - * - * // EOT final Command untilEOT = new Command() { - * - * private static final long serialVersionUID = 6426615528873039915L; - * - * @Override public void execute() { - * card[0].setBaseAttack(oldAttack[0]); - * card[0].setBaseDefense(oldDefense[0]); - * - * card[0].removeType("Creature"); card[0].removeType("Elemental"); } }; - * AllZone.getEndOfTurn().addUntil(untilEOT); } } - * - * @Override public boolean canPlayAI() { CardList list = - * AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); list = - * list.filter(new CardListFilter() { - * - * @Override public boolean addCard(final Card crd) { return - * crd.isEmblem() && crd.hasKeyword("Mountains you control have 'tap: " - * + "This land deals 1 damage to target creature or player.'"); } }); - * - * CardList mountains = - * AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield); mountains = - * mountains.filter(new CardListFilter() { - * - * @Override public boolean addCard(final Card crd) { return - * crd.isType("Mountain") && CardFactoryUtil.canTarget(card, crd); } }); - * CardListUtil.sortByTapped(mountains); - * - * if (mountains.size() == 0) { return false; } - * - * if (ability3.canPlay() && ability3.canPlayAI() && (list.size() == 0)) - * { return false; } else { this.setTargetCard(mountains.get(0)); return - * true; } } - * - * @Override public boolean canPlay() { return (0 < - * card.getCounters(Counters.LOYALTY)) && - * AllZone.getZoneOf(card).is(Constant.Zone.Battlefield) && (turn[0] != - * AllZone.getPhase().getTurn()) && - * Phase.canCastSorcery(card.getController()); } // canPlay() }; // - * SpellAbility ability1 - * - * final Input runtime = new Input() { private static final long - * serialVersionUID = -7823269301012427007L; - * - * @Override public void showMessage() { final CardList lands = - * card.getController - * ().getCardsIn(Zone.Battlefield).getType("Mountain"); - * - * this.stopSetNext(CardFactoryUtil.input_targetSpecific(ability1, - * lands, "Select target Mountain", true, false)); } // showMessage() }; - * // Input - * - * ability1.setBeforePayMana(runtime); - * - * ability1.setDescription( - * "+1: Untap target Mountain. It becomes a 4/4 red " + - * "Elemental creature until end of turn. It's still a land."); // - * ability1.setStackDescription(""); card.addSpellAbility(ability1); - * - * ability2.setDescription( - * "-2: Add R to your mana pool for each Mountain you control."); - * ability2.setStackDescription( - * "Koth of the Hammer - Add R to your mana pool for each Mountain you control." - * ); card.addSpellAbility(ability2); - * - * ability3.setDescription( - * "-5: You get an emblem with \"Mountains you control " + - * "have 'tap: This land deals 1 damage to target creature or player.'\"" - * ); ability3.setStackDescription( - * "Koth of the Hammer - You get an emblem with \"Mountains " + - * "you control have 'tap: This land deals 1 damage to target creature or player.'\"" - * ); card.addSpellAbility(ability3); - * - * card.setSVars(card.getSVars()); card.setSets(card.getSets()); - * - * return card; } // *************** END ************ END - * ************************** - */ - return card; } - - // copies stats like attack, defense, etc.. - /** - *

- * copyStats. - *

- * - * @param o - * a {@link java.lang.Object} object. - * @return a {@link forge.Card} object. - */ - private static Card copyStats(final Object o) { - final Card sim = (Card) o; - final Card c = new Card(); - - c.setBaseAttack(sim.getBaseAttack()); - c.setBaseDefense(sim.getBaseDefense()); - c.setIntrinsicKeyword(sim.getKeyword()); - c.setName(sim.getName()); - c.setType(sim.getType()); - c.setText(sim.getSpellText()); - c.setManaCost(sim.getManaCost()); - - return c; - } // copyStats() -} + +} //end class CardFactoryPlaneswalkers