From 69322b3ef1e7e280076b6cee34a7a93e00ca4b59 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 02:39:43 +0000 Subject: [PATCH] Build 10/26: --- .gitattributes | 5 + src/CardFactory.java | 25142 +-------------------------- src/CardFactoryUtil.java | 32 +- src/CardFactory_Auras.java | 5145 ++++++ src/CardFactory_Creatures.java | 15165 ++++++++++++++++ src/CardFactory_Equipment.java | 1630 ++ src/CardFactory_Lands.java | 1867 ++ src/CardFactory_Planeswalkers.java | 1848 ++ src/Computer.java | 2 + src/ComputerAI_Burn.java | 26 +- src/ComputerAI_Burn2.java | 24 +- src/ComputerAI_General.java | 31 +- src/ComputerAI_Input.java | 6 + src/ComputerAI_Rats2.java | 14 +- src/ComputerAI_Testing.java | 7 + src/Input_Draw.java | 8 +- src/Input_Main.java | 25 +- src/PlayerZone_ComesIntoPlay.java | 33 +- 18 files changed, 26100 insertions(+), 24910 deletions(-) create mode 100644 src/CardFactory_Auras.java create mode 100644 src/CardFactory_Creatures.java create mode 100644 src/CardFactory_Equipment.java create mode 100644 src/CardFactory_Lands.java create mode 100644 src/CardFactory_Planeswalkers.java diff --git a/.gitattributes b/.gitattributes index 9ed8aef3a70..9b1f96d6cb5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -47,6 +47,11 @@ src/Card.java svneol=native#text/plain src/CardDetailUtil.java svneol=native#text/plain src/CardFactory.java svneol=native#text/plain src/CardFactoryUtil.java svneol=native#text/plain +src/CardFactory_Auras.java -text svneol=native#text/plain +src/CardFactory_Creatures.java -text svneol=native#text/plain +src/CardFactory_Equipment.java -text svneol=native#text/plain +src/CardFactory_Lands.java -text svneol=native#text/plain +src/CardFactory_Planeswalkers.java -text svneol=native#text/plain src/CardList.java svneol=native#text/plain src/CardListFilter.java svneol=native#text/plain src/CardListUtil.java svneol=native#text/plain diff --git a/src/CardFactory.java b/src/CardFactory.java index 6f881d07a43..d8f8cfe0fc6 100644 --- a/src/CardFactory.java +++ b/src/CardFactory.java @@ -2637,7 +2637,47 @@ public class CardFactory implements NewConstants { }; card.addComesIntoPlayCommand(intoPlay); }//end if - + + + //****************************************************************** + //************** Link to different CardFactories ******************* + if (card.getType().contains("Creature")) + { + Card card2 = new Card(); + card2 = CardFactory_Creatures.getCard(card, cardName, owner, this); + + return card2; + } + else if (card.getType().contains("Aura")) + { + Card card2 = new Card(); + card2 = CardFactory_Auras.getCard(card, cardName, owner); + + return card2; + } + else if (card.getType().contains("Equipment")) + { + Card card2 = new Card(); + card2 = CardFactory_Equipment.getCard(card, cardName, owner); + + return card2; + } + else if (card.getType().contains("Planeswalker")) + { + Card card2 = new Card(); + card2 = CardFactory_Planeswalkers.getCard(card, cardName, owner); + + return card2; + } + else if (card.getType().contains("Land")) + { + Card card2 = new Card(); + card2 = CardFactory_Lands.getCard(card, cardName, owner); + + return card2; + } + + //*************** START *********** START ************************** if( cardName.equals("Burst of Speed") || @@ -2931,1077 +2971,7 @@ public class CardFactory implements NewConstants { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Elspeth, Knight-Errant")) - { - //computer only plays ability 1 and 3, gain life and put X\X token into play - final int turn[] = new int[1]; - turn[0] = -1; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY, n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 4); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability2: target creature gets +3/+3 and flying until EOT - final SpellAbility ability2 = new Ability(card2, "0") - { - - public void resolve() - { - - card2.addCounter(Counters.LOYALTY, 1); - - turn[0] = AllZone.Phase.getTurn(); - - final Command eot = new Command() - { - private static final long serialVersionUID = 94488363210770877L; - - public void execute() - { - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c)) - { - c.addTempAttackBoost(-3); - c.addTempDefenseBoost(-3); - c.removeExtrinsicKeyword("Flying"); - } - }//execute() - };//Command - - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card2, c)) - { - c.addTempAttackBoost(3); - c.addTempDefenseBoost(3); - c.addExtrinsicKeyword("Flying"); - - AllZone.EndOfTurn.addUntil(eot); - } - }//resolve() - - public boolean canPlayAI() - { - return false; - } - - public boolean canPlay() - { - @SuppressWarnings("unused") // library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - return 0 < card2.getCounters(Counters.LOYALTY) && - AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - - }//canPlay() - };//SpellAbility ability2 - - ability2.setBeforePayMana(new Input() - { - private static final long serialVersionUID = 9062830120519820799L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - - - AllZone.Stack.push(ability2); - } - stop(); - }//showMessage() - }); - - - - //ability3 - final SpellAbility ability3 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 8); - turn[0] = AllZone.Phase.getTurn(); - - //make all permanents in play/hand/library and graveyard - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - - CardList list = new CardList(); - list.addAll(play.getCards()); - list.addAll(hand.getCards()); - list.addAll(library.getCards()); - list.addAll(grave.getCards()); - - - for (int i=0;i < list.size(); i++) - { - Card c = list.get(i); - if (c.isPermanent() && !c.isPlaneswalker()) - { - c.addExtrinsicKeyword("Indestructible"); - } - - } - - } - public boolean canPlay() - { - return 8 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - public boolean canPlayAI() - { - return true; - } - }; - ability3.setBeforePayMana(new Input() - { - private static final long serialVersionUID = -2054686425541429389L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability3); - } - stop(); - }//showMessage() - }); - - //ability 1: create white 1/1 token - final SpellAbility ability1 = new Ability(card2, "0") - { - public void resolve() - { - card2.addCounter(Counters.LOYALTY, 1); - turn[0] = AllZone.Phase.getTurn(); - - Card c = new Card(); - - c.setOwner(card2.getController()); - c.setController(card2.getController()); - - c.setManaCost("W"); - c.setToken(true); - - c.setImageName("W 1 1 Soldier"); - c.setName("Soldier"); - c.addType("Creature"); - c.addType("Soldier"); - c.setBaseAttack(1); - c.setBaseDefense(1); - //AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); - play.add(c); - } - public boolean canPlayAI() - { - if(ability3.canPlay() && ability3.canPlayAI()) { - return false; - } else - { - return true; - } - } - public boolean canPlay() - { - return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - };//SpellAbility ability1 - - ability1.setBeforePayMana(new Input() - { - private static final long serialVersionUID = -7892114885686285881L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability1); - } - stop(); - }//showMessage() - }); - - ability1.setDescription("+1: Put a white 1/1 Soldier creature token into play."); - ability1.setStackDescription("Elspeth, Knight-Errant - put 1/1 token into play."); - card2.addSpellAbility(ability1); - - ability2.setDescription("+1: Target creature gets +3/+3 and gains flying until end of turn."); - ability2.setStackDescription("Elspeth, Knight-Errant - creature gets +3/+3 and Flying until EOT."); - ability2.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability2)); - - card2.addSpellAbility(ability2); - - ability3.setDescription("-8: For the rest of the game, artifacts, creatures, enchantments, and lands you control are indestructible."); - ability3.setStackDescription("Elspeth, Knight-Errant - Make everything indestructible."); - card2.addSpellAbility(ability3); - - return card2; - } - //*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Nissa Revane")) - { - final int turn[] = new int[1]; - turn[0] = -1; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY, n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 2); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability2: gain 2 life for each elf controlled - final SpellAbility ability2 = new Ability(card2, "0") - { - - public void resolve() - { - - card2.addCounter(Counters.LOYALTY, 1); - - turn[0] = AllZone.Phase.getTurn(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); - CardList elves = new CardList(play.getCards()); - elves = elves.getType("Elf"); - - AllZone.GameAction.getPlayerLife(card.getController()).addLife(2*elves.size()); - - }//resolve() - - public boolean canPlayAI() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer); - - CardList chosens = new CardList(lib.getCards()); - chosens = chosens.getName("Nissa's Chosen"); - - if (chosens.size() > 0) - return false; - - return true; - } - - public boolean canPlay() - { - @SuppressWarnings("unused") // library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - return 0 < card2.getCounters(Counters.LOYALTY) && - AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - - }//canPlay() - };//SpellAbility ability2 - - ability2.setBeforePayMana(new Input() - { - - - private static final long serialVersionUID = 2828718386226165026L; - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - - - AllZone.Stack.push(ability2); - } - stop(); - }//showMessage() - }); - - - //ability3 - final SpellAbility ability3 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 7); - turn[0] = AllZone.Phase.getTurn(); - - //make all permanents in play/hand/library and graveyard - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - - CardList list = new CardList();; - list.addAll(library.getCards()); - list = list.getType("Elf"); - - //currently, just adds all elves into play. - for (int i=0;i < list.size(); i++) - { - Card c = list.get(i); - if (c.isCreature() ) - { - library.remove(c); - play.add(c); - } - } - } - public boolean canPlay() - { - return 7 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - public boolean canPlayAI() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer); - - CardList elves = new CardList(lib.getCards()); - elves = elves.getType("Elf"); - - return elves.size() > 3; - } - }; - ability3.setBeforePayMana(new Input() - { - - private static final long serialVersionUID = -7189927522150479572L; - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability3); - } - stop(); - }//showMessage() - }); - - //ability 1: search for Nessa's Chosen - final SpellAbility ability1 = new Ability(card2, "0") - { - public void resolve() - { - card2.addCounter(Counters.LOYALTY, 1); - turn[0] = AllZone.Phase.getTurn(); - - if (card2.getController().equals(Constant.Player.Human)){ - Object check = AllZone.Display.getChoiceOptional("Search for Nissa's Chosen", AllZone.Human_Library.getCards()); - if(check != null) - { - Card c = (Card)check; - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - if (c.getName().equals("Nissa's Chosen")) - { - lib.remove(c); - play.add(c); - } - } - AllZone.GameAction.shuffle(Constant.Player.Human); - }//human - else - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card2.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); - CardList nissas = new CardList(lib.getCards()); - nissas = nissas.getName("Nissa's Chosen"); - - if (nissas.size() > 0) - { - Card nissa = nissas.get(0); - lib.remove(nissa); - play.add(nissa); - } - AllZone.GameAction.shuffle(Constant.Player.Computer); - } - - } - public boolean canPlayAI() - { - if(ability3.canPlay() && ability3.canPlayAI()) { - return false; - } else - { - return true; - } - } - public boolean canPlay() - { - return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - };//SpellAbility ability1 - - ability1.setBeforePayMana(new Input() - { - - private static final long serialVersionUID = 7668642820407492396L; - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability1); - } - stop(); - }//showMessage() - }); - - ability1.setDescription("+1: Search your library for a card named Nissa's Chosen and put it onto the battlefield. Then shuffle your library."); - ability1.setStackDescription("Nissa Revane - Search for a card named Nissa's Chosen and put it onto the battlefield."); - card2.addSpellAbility(ability1); - - ability2.setDescription("+1: You gain 2 life for each Elf you control."); - ability2.setStackDescription("Nissa Revane - You gain 2 life for each Elf you control."); - - card2.addSpellAbility(ability2); - - ability3.setDescription("-7: Search your library for any number of Elf creature cards and put them onto the battlefield. Then shuffle your library."); - ability3.setStackDescription("Nissa Revane - Search your library for any number of Elf creature cards and put them onto the battlefield. Then shuffle your library."); - card2.addSpellAbility(ability3); - - return card2; - } - //*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Nicol Bolas, Planeswalker")) - { - - final int turn[] = new int[1]; - turn[0] = -1; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY, n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 5); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability3 - final SpellAbility ability3 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 9); - turn[0] = AllZone.Phase.getTurn(); - - String player = card2.getController(); - String opponent = AllZone.GameAction.getOpponent(player); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, opponent); - CardList oppPerms = new CardList(play.getCards()); - - PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); - life.subtractLife(7); - - for (int j=0; j<7; j++) - { - //will not actually let human choose which cards to discard - AllZone.GameAction.discardRandom(opponent); - } - - CardList permsToSac = new CardList(); - CardList oppPermTempList = new CardList(play.getCards()); - - if (player.equals("Human")) - { - for(int k=0; k < oppPerms.size(); k++) - { - Card c = oppPerms.get(k); - - permsToSac.add(c); - - if (k == 6) - break; - } - } - - else //computer - { - Object o = null; - for(int k=0; k < oppPerms.size(); k++) - { - o = AllZone.Display.getChoiceOptional("Select Card to sacrifice", oppPermTempList.toArray()); - Card c = (Card)o; - //AllZone.GameAction.sacrifice(c); - permsToSac.add(c); - oppPermTempList.remove(c); - - - if (k == 6) - break; - } - } - for(int m=0;m highestCost) - { - highestCost = CardUtil.getConvertedManaCost(nonCreaturePermanents.get(i).getManaCost()); - bestCard = nonCreaturePermanents.get(i); - } - } - if (bestCard == null && nonCreaturePermanents.size() > 0) - { - bestCard = nonCreaturePermanents.get(0); - return bestCard; - } - - return null; - } - };//SpellAbility ability1 - - ability1.setBeforePayMana(new Input() - { - private static final long serialVersionUID = 9167121234861249451L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability1); - } - stop(); - }//showMessage() - }); - - ability1.setDescription("+3: Destroy target noncreature permanent."); - ability1.setStackDescription("Nicol Bolas - Destroy target noncreature permanent."); - ability1.setBeforePayMana(CardFactoryUtil.input_targetNonCreaturePermanent(ability1, Command.Blank)); - - card2.addSpellAbility(ability1); - - ability2.setDescription("-2: Gain control of target creature."); - ability2.setStackDescription("Nicol Bolas - Gain control of target creature."); - ability2.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability2)); - - card2.addSpellAbility(ability2); - - ability3.setDescription("-9: Nicol Bolas deals 7 damage to target player. That player discards 7 cards, then sacrifices 7 permanents."); - ability3.setStackDescription("Nicol Bolas - deals 7 damage to target player. That player discards 7 cards, then sacrifices 7 permanents."); - card2.addSpellAbility(ability3); - - return card2; - } - //*************** END ************ END ************************** - - - - - -//*************** START *********** START ************************** - if(cardName.equals("Ajani Goldmane")) - { - //computer only plays ability 1 and 3, gain life and put X\X token into play - final int turn[] = new int[1]; - turn[0] = -1; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY,n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 4); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability2: all controller's creatures get +1\+1 and vigilance until EOT - final SpellAbility ability2 = new Ability(card2, "0") - { - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -5436621445704076988L; - - public void execute() - { - String player = card2.getController(); - CardList creatures; - if(player.equals(Constant.Player.Human)) { - creatures = new CardList(AllZone.Human_Play.getCards()); - } else { - creatures = new CardList(AllZone.Computer_Play.getCards()); - } - - creatures = creatures.getType("Creature"); - - for (int i = 0; i < creatures.size(); i++) { - Card card = creatures.get(i); - //card.setAttack(card.getAttack() - 1); - //card.setDefense(card.getDefense() - 1); - card.removeExtrinsicKeyword("Vigilance"); - } - } - }; - - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY,1); - turn[0] = AllZone.Phase.getTurn(); - - String player = card2.getController(); - CardList creatures; - if(player.equals(Constant.Player.Human)) { - creatures = new CardList(AllZone.Human_Play.getCards()); - } else { - creatures = new CardList(AllZone.Computer_Play.getCards()); - } - - creatures = creatures.getType("Creature"); - - for (int i = 0; i < creatures.size(); i++) { - Card card = creatures.get(i); - card.addCounter(Counters.P1P1,1); - card.addExtrinsicKeyword("Vigilance"); - } - - AllZone.EndOfTurn.addUntil(untilEOT); - } - - public boolean canPlayAI() - { - return false; - } - - public boolean canPlay() - { - @SuppressWarnings("unused") // library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - return 0 < card2.getCounters(Counters.LOYALTY) && - AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - - }//canPlay() - };//SpellAbility ability2 - - ability2.setBeforePayMana(new Input() - { - private static final long serialVersionUID = 6373573398967821630L; - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability2); - } - stop(); - }//showMessage() - }); - - //ability3 - final SpellAbility ability3 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 6); - turn[0] = AllZone.Phase.getTurn(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - //Create token - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setImageName("W N N Avatar"); - c.setName("Avatar"); - c.setManaCost("W"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Avatar"); - c.setBaseAttack(AllZone.GameAction.getPlayerLife(card.getController()).getLife()); - c.setBaseDefense(AllZone.GameAction.getPlayerLife(card.getController()).getLife()); - - c.addIntrinsicKeyword("This creature's power and toughness are each equal to your life total."); - - play.add(c); - } - public boolean canPlay() - { - return 6 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - 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; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability3); - } - stop(); - }//showMessage() - }); - - //ability 1: gain 2 life - final SpellAbility ability1 = new Ability(card2, "0") - { - public void resolve() - { - card2.addCounter(Counters.LOYALTY, 1); - turn[0] = AllZone.Phase.getTurn(); - - - AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); - System.out.println("current phase: " +AllZone.Phase.getPhase()); - } - public boolean canPlayAI() - { - if(ability3.canPlay() && ability3.canPlayAI()) { - return false; - } else - { - return true; - } - } - public boolean canPlay() - { - return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - };//SpellAbility ability1 - - ability1.setBeforePayMana(new Input() - { - private static final long serialVersionUID = -7969603493514210825L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability1); - } - stop(); - }//showMessage() - }); - - ability1.setDescription("+1: You gain 2 life."); - ability1.setStackDescription("Ajani Goldmane - " + card2.getController() + " gains 2 life"); - card2.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."); - card2.addSpellAbility(ability2); - - ability3.setDescription("-6: Put a white Avatar creature token into play with \"This creature's power and toughness are each equal to your life total.\""); - ability3.setStackDescription("Ajani Goldmane - Put X\\X white Avatar creature token into play."); - card2.addSpellAbility(ability3); - - return card2; - } - //*************** END ************ END ************************** + //contributed code @@ -4086,555 +3056,10 @@ public class CardFactory implements NewConstants { spell.setBeforePayMana(target); }//*************** END ************ END ************************** - - + //*************** START *********** START ************************** - if(cardName.equals("Filthy Cur")) - { - final Card newCard = new Card() - { - public void addDamage(final int n) - { - super.addDamage(n); - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); - } - }; - ability.setStackDescription("Filthy Cur - causes " +n +" damage to " +getController()); - AllZone.Stack.add(ability); - }//addDamage() - };//Card - - newCard.setOwner(card.getOwner()); - newCard.setController(card.getController()); - - newCard.setManaCost(card.getManaCost()); - newCard.setName(card.getName()); - newCard.addType("Creature"); - newCard.addType("Hound"); - newCard.setText(card.getSpellText()); - newCard.setBaseAttack(card.getBaseAttack()); - newCard.setBaseDefense(card.getBaseDefense()); - - newCard.addSpellAbility(new Spell_Permanent(newCard)); - - return newCard; - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Shinka Gatekeeper")) - { - final Card newCard = new Card() - { - public void addDamage(final int n) - { - super.addDamage(n); - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); - } - }; - ability.setStackDescription("Shinka Gatekeeper - causes " +n +" damage to " +getController()); - AllZone.Stack.add(ability); - }//addDamage() - };//Card - - newCard.setOwner(card.getOwner()); - newCard.setController(card.getController()); - - newCard.setManaCost(card.getManaCost()); - newCard.setName(card.getName()); - newCard.addType("Creature"); - newCard.addType("Ogre"); - newCard.addType("Warrior"); - newCard.setText(card.getSpellText()); - newCard.setBaseAttack(card.getBaseAttack()); - newCard.setBaseDefense(card.getBaseDefense()); - - newCard.addSpellAbility(new Spell_Permanent(newCard)); - - return newCard; - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Jackal Pup")) - { - final Card newCard = new Card() - { - public void addDamage(final int n) - { - super.addDamage(n); - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); - } - }; - ability.setStackDescription("Jackal Pup - causes " +n +" damage to " +getController()); - AllZone.Stack.add(ability); - }//addDamage() - };//Card - - newCard.setOwner(card.getOwner()); - newCard.setController(card.getController()); - - newCard.setManaCost(card.getManaCost()); - newCard.setName(card.getName()); - newCard.addType("Creature"); - newCard.addType("Hound"); - newCard.setText(card.getSpellText()); - newCard.setBaseAttack(card.getBaseAttack()); - newCard.setBaseDefense(card.getBaseDefense()); - - newCard.addSpellAbility(new Spell_Permanent(newCard)); - - return newCard; - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Stuffy Doll")) - { - final Card newCard = new Card() - { - Card c = this; - public void addDamage(final int n) - { - super.addDamage(n); - final String opponent = AllZone.GameAction.getOpponent(owner); - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(opponent).subtractLife(n); - - if (c.getKeyword().contains("Lifelink")) - GameActionUtil.executeLifeLinkEffects(c,n); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(c, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(c, n); - } - }; - ability.setStackDescription("Stuffy Doll - causes " +n +" damage to " +opponent); - AllZone.Stack.add(ability); - }//addDamage() - };//Card - - newCard.setOwner(card.getOwner()); - newCard.setController(card.getController()); - - newCard.setManaCost(card.getManaCost()); - newCard.setName(card.getName()); - newCard.addType("Artifact"); - newCard.addType("Creature"); - newCard.addType("Construct"); - newCard.setText("Whenever damage is dealt to Stuffy Doll, it deals that much damage to your opponent."); - newCard.setBaseAttack(0); - newCard.setBaseDefense(1); - - newCard.addIntrinsicKeyword("Indestructible"); - - final Ability_Tap ability = new Ability_Tap(newCard) - { - private static final long serialVersionUID = 577739727089395613L; - - public void resolve() - { - newCard.addDamage(1); - - if (newCard.getKeyword().contains("Lifelink")) - GameActionUtil.executeLifeLinkEffects(newCard, 1); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(newCard, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(newCard, 1); - } - };//SpellAbility - ability.setDescription("tap: Stuffy Doll deals 1 damage to itself."); - ability.setStackDescription("Stuffy Doll - deals 1 damage to itself."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - -// card.addSpellAbility(ability); -// return card; -///* - newCard.addSpellAbility(new Spell_Permanent(newCard)); - newCard.addSpellAbility(ability); - - return newCard; -//*/ - }//*************** END ************ END ************************** - - -// computer plays 2 land of these type instead of just 1 per turn - - //*************** START *********** START ************************** - //Ravinca Duel Lands - if(cardName.equals("Blood Crypt") || cardName.equals("Breeding Pool") || cardName.equals("Godless Shrine") || cardName.equals("Hallowed Fountain") || cardName.equals("Overgrown Tomb") || cardName.equals("Sacred Foundry") || cardName.equals("Steam Vents") || cardName.equals("Stomping Ground") || cardName.equals("Temple Garden") || cardName.equals("Watery Grave")) - { - //if this isn't done, computer plays more than 1 copy - //card.clearSpellAbility(); - card.clearSpellKeepManaAbility(); - - card.addComesIntoPlayCommand(new Command() - { - private static final long serialVersionUID = 7352127748114888255L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - humanExecute(); - else - computerExecute(); - } - public void computerExecute() - { - boolean pay = false; - - if(AllZone.Computer_Life.getLife() > 9) - pay = MyRandom.random.nextBoolean(); - - if(pay) - AllZone.Computer_Life.subtractLife(2); - else - card.tap(); - } - public void humanExecute() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - if(2 < life.getLife()) - { - String[] choices = {"Yes", "No"}; - Object o = AllZone.Display.getChoice("Pay 2 life?", choices); - if(o.equals("Yes")) - life.subtractLife(2); - else - tapCard(); - }//if - else - tapCard(); - }//execute() - private void tapCard() - { - card.tap(); - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Kabira Crossroads")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = card; - PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); - life.addLife(2); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -4550013855602477643L; - - public void execute() - { - card.tap(); - ability.setStackDescription(card.getName() + " - " +card.getController() +" gains 2 life"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Graypelt Refuge")|| cardName.equals("Sejiri Refuge")|| cardName.equals("Jwar Isle Refuge") || - cardName.equals("Akoum Refuge")|| cardName.equals("Kazandu Refuge")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = card; - c.tap(); - PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); - life.addLife(1); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 5055232386220487221L; - - public void execute() - { - card.tap(); - ability.setStackDescription(card.getName() + " - " +card.getController() +" gains 1 life"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Faerie Conclave")) - { - card.addComesIntoPlayCommand(new Command() - { - private static final long serialVersionUID = 2792041290726604698L; - - public void execute() - { - card.tap(); - } - }); - - final Command eot1 = new Command() - { - private static final long serialVersionUID = 5106629534549783845L; - - public void execute() - { - Card c = card; - - c.setBaseAttack(0); - c.setBaseDefense(0); - c.removeIntrinsicKeyword("Flying"); - c.removeType("Creature"); - c.removeType("Faerie"); - } - }; - - final SpellAbility a1 = new Ability(card, "1 U") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - Card c = card; - - c.setBaseAttack(2); - c.setBaseDefense(1); - - //to prevent like duplication like "Flying Flying Creature Creature" - if(! c.getIntrinsicKeyword().contains("Flying")) - { - c.addIntrinsicKeyword("Flying"); - c.addType("Creature"); - c.addType("Faerie"); - } - AllZone.EndOfTurn.addUntil(eot1); - } - };//SpellAbility - card.setManaCost("U"); - - card.clearSpellKeepManaAbility(); - card.addSpellAbility(a1); - a1.setDescription("1U: Faerie Conclave becomes a 2/1 blue Faerie creature with flying until end of turn. It's still a land."); - a1.setStackDescription(card +" becomes a 2/1 creature with flying until EOT"); - - Command paid1 = new Command() { - private static final long serialVersionUID = -601119544294387668L; - public void execute() {AllZone.Stack.add(a1);} - }; - - a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); - - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Forbidding Watchtower")) - { - card.addComesIntoPlayCommand(new Command() - { - private static final long serialVersionUID = 5212793782060828409L; - - public void execute() - { - card.tap(); - } - }); - - final Command eot1 = new Command() - { - private static final long serialVersionUID = 8806880921707550181L; - - public void execute() - { - Card c = card; - - c.setBaseAttack(0); - c.setBaseDefense(0); - c.removeType("Creature"); - c.removeType("Soldier"); - } - }; - - final SpellAbility a1 = new Ability(card, "1 W") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - Card c = card; - - c.setBaseAttack(1); - c.setBaseDefense(5); - - //to prevent like duplication like "Creature Creature" - if(! c.getType().contains("Creature")) - { - c.addType("Creature"); - c.addType("Soldier"); - } - AllZone.EndOfTurn.addUntil(eot1); - } - };//SpellAbility - - card.clearSpellKeepManaAbility(); - card.addSpellAbility(a1); - a1.setStackDescription(card +" becomes a 1/5 creature until EOT"); - - Command paid1 = new Command() { - private static final long serialVersionUID = -7211256926392695778L; - public void execute() {AllZone.Stack.add(a1);} - }; - - a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Treetop Village")) - { - card.addComesIntoPlayCommand(new Command() - { - private static final long serialVersionUID = -2246560994818997231L; - - public void execute() - { - card.tap(); - } - }); - - final Command eot1 = new Command() - { - private static final long serialVersionUID = -8535770979347971863L; - - public void execute() - { - Card c = card; - - c.setBaseAttack(0); - c.setBaseDefense(0); - c.removeType("Creature"); - c.removeType("Ape"); - c.removeIntrinsicKeyword("Trample"); - } - }; - - final SpellAbility a1 = new Ability(card, "1 G") - { - public boolean canPlayAI() - { - return ! card.getType().contains("Creature"); - } - public void resolve() - { - Card c = card; - - c.setBaseAttack(3); - c.setBaseDefense(3); - - //to prevent like duplication like "Creature Creature" - if(! c.getIntrinsicKeyword().contains("Trample")) - { - c.addType("Creature"); - c.addType("Ape"); - c.addIntrinsicKeyword("Trample"); - } - AllZone.EndOfTurn.addUntil(eot1); - } - };//SpellAbility - - card.clearSpellKeepManaAbility(); - card.addSpellAbility(a1); - a1.setStackDescription(card +" becomes a 3/3 creature with trample until EOT"); - - Command paid1 = new Command() { - private static final long serialVersionUID = -6800983290478844750L; - - public void execute() {AllZone.Stack.add(a1);} - }; - - a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); - - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Serra Avenger")) - { - SpellAbility spell = new Spell_Permanent(card) - { - private static final long serialVersionUID = -1148518222979323313L; - - public boolean canPlay() - { - return super.canPlay() && 6 < AllZone.Phase.getTurn(); - } - }; - card.clearSpellAbility(); - card.addSpellAbility(spell); - } - //*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Force of Savagery")) - { - SpellAbility spell = new Spell_Permanent(card) - { - private static final long serialVersionUID = 1603238129819160467L; - - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - - return list.containsName("Glorious Anthem") || list.containsName("Gaea's Anthem"); - } - }; - card.clearSpellAbility(); - card.addSpellAbility(spell); - } - //*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Pyrohemia")) + else if(cardName.equals("Pyrohemia")) { SpellAbility ability = new Ability(card, "R") { @@ -4690,11 +3115,8 @@ public class CardFactory implements NewConstants { //*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Pestilence")) + else if(cardName.equals("Pestilence")) { SpellAbility ability = new Ability(card, "B") { @@ -4751,1024 +3173,8 @@ public class CardFactory implements NewConstants { - //*************** START *********** START ************************** - if(cardName.equals("Greater Forgeling")) - { - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -4569751606008597903L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addTempAttackBoost(-3); - card.addTempDefenseBoost(3); - } - } - }; - - SpellAbility ability = new Ability(card, "1 R") - { - public boolean canPlayAI() - { - return MyRandom.random.nextBoolean() && CardFactoryUtil.AI_doesCreatureAttack(card) && - 3 < card.getNetDefense(); - } - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addTempAttackBoost(3); - card.addTempDefenseBoost(-3); - AllZone.EndOfTurn.addUntil(untilEOT); - } - } - }; - - ability.setDescription("1 R: Greater Forgeling gets +3/-3 until end of turn."); - ability.setStackDescription(card +" gets +3/-3 until end of turn."); - card.addSpellAbility(ability); - } - //*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Liliana Vess")) - { - //computer only plays ability 1 and 3, discard and return creature from graveyard to play - final int turn[] = new int[1]; - turn[0] = -1; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY,n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 5); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability2 - final SpellAbility ability2 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 2); - turn[0] = AllZone.Phase.getTurn(); - - String player = card2.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void computerResolve() - { - CardList creature = new CardList(AllZone.Computer_Library.getCards()); - creature = creature.getType("Creature"); - if(creature.size() != 0) - { - Card c = creature.get(0); - AllZone.GameAction.shuffle(card2.getController()); - - //move to top of library - AllZone.Computer_Library.remove(c); - AllZone.Computer_Library.add(c, 0); - } - }//computerResolve() - public void humanResolve() - { - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - CardList list = new CardList(library.getCards()); - - if(list.size() != 0) - { - Object o = AllZone.Display.getChoiceOptional("Select any card", list.toArray()); - - AllZone.GameAction.shuffle(card2.getController()); - if(o != null) - { - //put creature on top of library - library.remove(o); - library.add((Card)o, 0); - } - }//if - }//resolve() - public boolean canPlayAI() - { - return false; - } - - public boolean canPlay() - { - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); - - return 2 <= card2.getCounters(Counters.LOYALTY) && - AllZone.getZone(card2).is(Constant.Zone.Play) && - 1 < library.size() && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - };//SpellAbility ability2 - - ability2.setBeforePayMana(new Input() - { - private static final long serialVersionUID = 5726590384281714755L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability2); - } - stop(); - }//showMessage() - }); - - //ability3 - final SpellAbility ability3 = new Ability(card2, "0") - { - public void resolve() - { - card2.subtractCounter(Counters.LOYALTY, 8); - turn[0] = AllZone.Phase.getTurn(); - - //get all graveyard creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - list = list.getType("Creature"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); - PlayerZone grave = null; - Card c = null; - for(int i = 0; i < list.size(); i++) - { - //this is a rough hack, but no one will ever see this code anyways, lol ;+) - c = list.get(i); - c.setController(card.getController()); - - grave = AllZone.getZone(c); - if(grave != null) - grave.remove(c); - - play.add(c); - } - } - public boolean canPlay() - { - return 8 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - public boolean canPlayAI() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - list = list.getType("Creature"); - - return 3 < list.size(); - } - }; - ability3.setBeforePayMana(new Input() - { - private static final long serialVersionUID = -3297439284172874241L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - AllZone.Stack.push(ability3); - } - stop(); - }//showMessage() - }); - - //ability 1 - final SpellAbility ability1 = new Ability(card2, "0") - { - public void resolve() - { - card2.addCounter(Counters.LOYALTY,1); - turn[0] = AllZone.Phase.getTurn(); - - String s = getTargetPlayer(); - setStackDescription("Liliana Vess - " +s +" discards a card"); - - if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - else - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - public boolean canPlayAI() - { - if(ability3.canPlay() && ability3.canPlayAI()) - return false; - else - { - setTargetPlayer(Constant.Player.Human); - return true; - } - } - public boolean canPlay() - { - return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && - turn[0] != AllZone.Phase.getTurn() && - AllZone.Phase.getActivePlayer().equals(card2.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn"); - }//canPlay() - };//SpellAbility ability1 - - Input target = new Input() - { - private static final long serialVersionUID = 4997055112713151705L; - - public void showMessage() - { - AllZone.Display.showMessage("Select target player"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectPlayer(String player) - { - turn[0] = AllZone.Phase.getTurn(); - ability1.setTargetPlayer(player); - AllZone.Stack.add(ability1); - stop(); - } - };//Input target - ability1.setBeforePayMana(target); - ability1.setDescription("+1: Target player discards a card."); - card2.addSpellAbility(ability1); - - ability2.setDescription("-2: Search your library for a card, then shuffle your library and put that card on top of it."); - ability2.setStackDescription("Liliana Vess - Search your library for a card, then shuffle your library and put that card on top of it."); - card2.addSpellAbility(ability2); - - ability3.setDescription("-8: Put all creature cards in all graveyards into play under your control."); - ability3.setStackDescription("Liliana Vess - Put all creature cards in all graveyards into play under your control."); - card2.addSpellAbility(ability3); - - return card2; - } - //*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - 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; - - final Card card2 = new Card() - { - public void addDamage(int n) - { - subtractCounter(Counters.LOYALTY, n); - AllZone.GameAction.checkStateEffects(); - } - }; - card2.addCounter(Counters.LOYALTY, 6); - - card2.setOwner(owner); - card2.setController(owner); - - card2.setName(card.getName()); - card2.setType(card.getType()); - card2.setManaCost(card.getManaCost()); - card2.addSpellAbility(new Spell_Permanent(card2)); - - //ability 1 - final SpellAbility ability1 = new Ability(card2, "0") - { - public void resolve() - { - card2.addCounter(Counters.LOYALTY, 1); - turn[0] = AllZone.Phase.getTurn(); - - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card2,getTargetCard())) - { - Card c = getTargetCard(); - if (CardFactoryUtil.canDamage(card2, c)) - c.addDamage(1); - } - } - - else - { - PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - life.subtractLife(1); - } - } - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i= 4 && AllZone.Phase.getPhase().equals(Constant.Phase.Main1) && - AllZone.Phase.getActivePlayer().equals(card2.getController()); - } - };//SpellAbility ability3 - Input runtime3 = new Input() - { - private static final long serialVersionUID = 7697504647440222302L; - - int check = -1; - public void showMessage() - { - if(check != AllZone.Phase.getTurn()) - { - check = AllZone.Phase.getTurn(); - turn[0] = AllZone.Phase.getTurn(); - - AllZone.Stack.push(ability3); - stop(); - } - } - };//Input - ability3.setStackDescription(card2.getName() +" - Creatures you control get +3/+3 and trample until end of turn."); - ability3.setDescription("-4: Creatures you control get +3/+3 and trample until end of turn."); - ability3.setBeforePayMana(runtime3); - card2.addSpellAbility(ability3); - //end ability 3 - - return card2; - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Caller of the Claw")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - int stop = countGraveyard(); - for(int i = 0; i < stop; i++) - makeToken(); - }//resolve() - int countGraveyard() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && (c.getTurnInZone() == AllZone.Phase.getTurn()); - } - }); - return list.size(); - }//countGraveyard() - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setImageName("G 2 2 Bear"); - c.setName("Bear"); - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Bear"); - c.setBaseAttack(2); - c.setBaseDefense(2); - - play.add(c); - }//makeToken() - };//SpellAbility - - Command comesIntoPlay = new Command() - { - private static final long serialVersionUID = 8485080996453793968L; - - public void execute() - { - AllZone.Stack.add(ability); - } - };//Command - ability.setStackDescription("Caller of the Claw - Put a 2/2 green Bear creature token into play for each nontoken creature put into your graveyard from play this turn."); - card.addComesIntoPlayCommand(comesIntoPlay); - - SpellAbility spell = new Spell_Permanent(card) - { - private static final long serialVersionUID = 6946020026681536710L; - - public boolean canPlayAI() {return super.canPlay();} - }; - card.clearSpellAbility(); - card.addSpellAbility(spell); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Kiki-Jiki, Mirror Breaker")) - { - final SpellAbility ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -943706942500499644L; - - public boolean canPlayAI() {return getCreature().size() != 0;} - public void chooseTargetAI() - { - setTargetCard(getCreature().get(0)); - } - CardList getCreature() - { - CardList list = null; - if(card.getController().equals(Constant.Player.Human)){ - list = new CardList(AllZone.Human_Play.getCards()); - } - else{ - list = new CardList(AllZone.Computer_Play.getCards()); - } - - list = list.getType("Creature"); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (!c.getType().contains("Legendary") ); - } - }); - CardListUtil.sortAttack(list); - return list; - }//getCreature() - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && getTargetCard().getController().equals(card.getController()) - && CardFactoryUtil.canTarget(card,getTargetCard()) ) - { - Card copy; - if (!getTargetCard().isToken()) - { - //copy creature and put it into play - copy = getCard(getTargetCard().getName(), card.getController()); - copy.setToken(true); - - if (getTargetCard().isFaceDown()) { - copy.setIsFaceDown(true); - copy.setManaCost(""); - copy.setBaseAttack(2); - copy.setBaseDefense(2); - copy.setIntrinsicKeyword(new ArrayList()); //remove all keywords - copy.setType(new ArrayList()); //remove all types - copy.addType("Creature"); - copy.clearSpellAbility(); //disallow "morph_up" - } - copy.addIntrinsicKeyword("Haste"); - } - else //isToken() - { - Card c = getTargetCard(); - copy = new Card(); - - copy.setName(c.getName()); - - copy.setOwner(c.getController()); - copy.setController(c.getController()); - - copy.setManaCost(c.getManaCost()); - copy.setToken(true); - - copy.setType(c.getType()); - - copy.setBaseAttack(c.getBaseAttack()); - copy.setBaseDefense(c.getBaseDefense()); - copy.addIntrinsicKeyword("Haste"); - } - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(copy); - - - //have to do this since getTargetCard() might change - //if Kiki-Jiki somehow gets untapped again - final Card[] target = new Card[1]; - target[0] = copy; - Command atEOT = new Command() - { - private static final long serialVersionUID = 7803915905490565557L; - public void execute() - { - //technically your opponent could steal the token - //and the token shouldn't be sacrificed - if(AllZone.GameAction.isCardInPlay(target[0])) - AllZone.GameAction.sacrifice(target[0]); //maybe do a setSacrificeAtEOT, but probably not. - } - };//Command - AllZone.EndOfTurn.addAt(atEOT); - }//is card in play? - }//resolve() - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 7171284831370490875L; - - public void showMessage() - { - //get all non-legendary creatures you control - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && - (!c.getType().contains("Legendary")); - } - }); - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, list, "Select target creature to copy that is not legendary.", true)); - } - };//Input - ability.setStackDescription("Kiki-Jiki - copy card."); - ability.setDescription("tap: Put a token into play that's a copy of target nonlegendary creature you control. That creature token has haste. Sacrifice it at end of turn."); - ability.setBeforePayMana(runtime); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Nevinyrral's Disk")) + else if(cardName.equals("Nevinyrral's Disk")) { SpellAbility summoningSpell = new Spell_Permanent(card) { @@ -5847,7 +3253,7 @@ public class CardFactory implements NewConstants { //*************** START *********** START ************************** - if(cardName.equals("Magus of the Disk")) + else if(cardName.equals("Magus of the Disk")) { SpellAbility summoningSpell = new Spell_Permanent(card) { @@ -5926,7 +3332,7 @@ public class CardFactory implements NewConstants { //*************** START *********** START ************************** - if(cardName.equals("Tanglebloom")) + else if(cardName.equals("Tanglebloom")) { final SpellAbility a1 = new Ability_Tap(card, "1") { @@ -5945,74 +3351,10 @@ public class CardFactory implements NewConstants { a1.setBeforePayMana(new Input_PayManaCost(a1)); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Azusa, Lost but Seeking")) - { - - final Ability ability = new Ability(card, "0") - { - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0 && - (AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || AllZone.Phase.getPhase().equals(Constant.Phase.Main1)) - && AllZone.GameAction.isCardInPlay(card) && CardFactoryUtil.canUseAbility(card); - } - public void resolve() - { - - String player = card.getController(); - - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - - CardList lands = new CardList(hand.getCards()); - lands = lands.getType("Land"); - - if (lands.size() > 0) - { - if (player.equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select land to play", lands.toArray()); - if (o!=null) - { - Card c = (Card)o; - hand.remove(c); - play.add(c); - } - } - else - { - Card c = lands.get(0); - hand.remove(c); - play.add(c); - } - card.setAbilityUsed(card.getAbilityUsed()+1); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("You may play two additional lands on each of your turns."); - ability.setStackDescription(card.getName() + " - " + card.getController() + " plays an additional land."); - }//*************** END ************ END ************************** + /* //*************** START *********** START ************************** - if(cardName.equals("Exploration")) + else if(cardName.equals("Exploration")) { final int turn[] = new int[1]; turn[0] = -1; @@ -6077,8 +3419,9 @@ public class CardFactory implements NewConstants { ability.setStackDescription(card.getName() + " - " + card.getController() + " plays an additional land."); }//*************** END ************ END ************************** + //*************** START *********** START ************************** - if(cardName.equals("Fastbond")) + else if(cardName.equals("Fastbond")) { final Ability ability = new Ability(card, "0") { @@ -6152,1116 +3495,11 @@ public class CardFactory implements NewConstants { ability.setStackDescription(card.getName() + " - deals damage to " + card.getController() + ", plays another land."); }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Wellwisher")) - { - final SpellAbility ability = new Ability_Tap(card, "0") - { - private static final long serialVersionUID = 1446529067071763247L; - - public boolean canPlay() - { - setStackDescription(card.getName() +" - " +card.getController() +" gains " +countElf() +" life."); - - return super.canPlay(); - } - public void resolve() - { - AllZone.GameAction.getPlayerLife(card.getController()).addLife(countElf()); - } - int countElf() - { - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Elf"); - return list.size(); - } - };//SpellAbility - ability.setDescription("tap: You gain 1 life for each Elf in play."); - ability.setBeforePayMana(new Input_NoCost_TapAbility((Ability_Tap) ability)); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** + */ //*************** START *********** START ************************** - if(cardName.equals("Sliver Overlord")) - { - //final String player = card.getController(); - final SpellAbility ability = new Ability(card, "3") - { - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0) - return true; - else - return false; - - } - - - public void resolve() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - String player = card.getController(); - - CardList list = new CardList(lib.getCards()); - list = list.getType("Sliver"); - - if (list.size()==0) - return; - - if (player.equals(Constant.Player.Computer)) - { - Card sliver = CardFactoryUtil.AI_getBestCreature(list); - lib.remove(sliver); - hand.add(sliver); - } - else //human - { - Object o = AllZone.Display.getChoiceOptional("Select target Sliver", list.toArray()); - Card sliver = (Card)o; - lib.remove(sliver); - hand.add(sliver); - } - AllZone.GameAction.shuffle(player); - } - }; - - final SpellAbility ability2 = new Ability(card, "3") - { - - public void resolve() - { - - - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c) && (c.getType().contains("Sliver") || c.getKeyword().contains("Changeling") ) - && CardFactoryUtil.canTarget(card,c) ) - { - //set summoning sickness - if(c.getKeyword().contains("Haste")){ - c.setSickness(false); - } - else{ - c.setSickness(true); - } - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - - PlayerZone from = AllZone.getZone(c); - from.remove(c); - - c.setController(card.getController()); - - PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); - to.add(c); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - }//if - - - }//resolve() - - public boolean canPlayAI() - { - - CardList c = CardFactoryUtil.AI_getHumanCreature(card, true); - CardListUtil.sortAttack(c); - CardListUtil.sortFlying(c); - c = c.filter(new CardListFilter(){ - - public boolean addCard(Card c) { - return c.getType().contains("Sliver") || c.getKeyword().contains("Changeling"); - } - - }); - - if(c.isEmpty()) - return false; - - if(2 <= c.get(0).getNetAttack() && c.get(0).getKeyword().contains("Flying") && - c.get(0).getKeyword().contains("Sliver")) - { - setTargetCard(c.get(0)); - return true; - } - - CardListUtil.sortAttack(c); - if(4 <= c.get(0).getNetAttack() && c.get(0).getKeyword().contains("Sliver")) - { - setTargetCard(c.get(0)); - return true; - } - - return false; - }//canPlayAI() - - public boolean canPlay() - { - return AllZone.GameAction.isCardInPlay(card); - - }//canPlay() - };//SpellAbility ability2 - - ability2.setBeforePayMana(new Input() - { - private static final long serialVersionUID = 1489433384490805477L; - - public void showMessage() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - CardList slivers = new CardList(AllZone.getZone(Constant.Zone.Play, opponent).getCards()); - slivers = slivers.getType("Sliver"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability2, slivers, "Select a Sliver", true)); - } - }); - - ability.setDescription("3:Search your library for a Sliver card, reveal that card, and put it into your hand. Then shuffle your library."); - ability.setStackDescription(card.getName() +" - search for a Sliver card and put it into your hand."); - - ability2.setDescription("3:Gain control of target Sliver."); - ability.setStackDescription(card.getName() +" - Gain control of target Sliver."); - - card.addSpellAbility(ability); - card.addSpellAbility(ability2); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Sliver Queen")) - { - final SpellAbility a1 = new Ability(card, "2") - { - - public boolean canPlay() - { - SpellAbility sa; - //this is a hack, check the stack to see if this card has an ability on the stack - //if so, we can't use the ability - for (int i=0; i 0 && CardFactoryUtil.canTarget(card, c); - } - }); - perms.shuffle(); - setTargetCard(perms.get(0)); //TODO: improve this. - } - - public boolean canPlayAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - CardList perms = new CardList(play.getCards()); - perms = perms.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.sumAllCounters() > 0; - } - }); - return perms.size() > 0; - } - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 1571239319226728848L; - - public void showMessage() - { - PlayerZone human = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - CardList perms = new CardList(); - perms.addAll(human.getCards()); - perms.addAll(comp.getCards()); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a1, perms, "Select target permanent.", true)); - } - }; - - card.addSpellAbility(a1); - a1.setDescription("2 GU, Untap: For each counter on target permanent, put another of those counters on that permanent."); - - a1.setBeforePayMana(runtime); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Order of Whiteclay")) - { - final SpellAbility a1 = new Ability(card,"1 W W") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList creats = new CardList(grave.getCards()); - creats = creats.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return CardUtil.getConvertedManaCost(c.getManaCost()) <= 3; - } - - }); - - if (card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Choose a creature", creats.toArray()); - if (o!=null) - { - Card c = (Card)o; - grave.remove(c); - play.add(c); - card.untap(); - } - } - else //Computer - { - Card c = creats.get(0); - grave.remove(c); - play.add(c); - card.untap(); - } - - } - - public boolean canPlay() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList creats = new CardList(grave.getCards()); - creats = creats.filter(new CardListFilter() - { - - public boolean addCard(Card c) - { - return CardUtil.getConvertedManaCost(c.getManaCost()) <= 3; - } - - }); - if (card.isTapped() && !card.hasSickness() && creats.size() > 0) - return true; - else - return false; - } - - public boolean canPlayAI() - { - return true; - } - };//SpellAbility - card.addSpellAbility(a1); - a1.setDescription("1 W W, Untap: Return target creature card with converted mana cost 3 or less from your graveyard to play."); - a1.setStackDescription(card.getName() + " - return target creature card with converted mana cost 3 or less from your graveyard to play."); - - a1.setBeforePayMana(new Input_PayManaCost(a1)); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Patrol Signaler")) - { - final SpellAbility a1 = new Ability(card,"1 W") - { - public void resolve() - { - card.untap(); - makeToken(); - } - void makeToken() - { - Card c = new Card(); - - c.setName("Kithkin Soldier"); - c.setImageName("W 1 1 Kithkin Soldier"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("W"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Kithkin"); - c.addType("Soldier"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i3; - } - }; - card.clearSpellAbility(); - card.addSpellAbility(summoningSpell); - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 2334517567512130479L; - - public void execute() - { - ability.setStackDescription("Serpent Warrior - " - +card.getController() +" loses 3 life"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Eviscerator")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(5); - } - public boolean canPlayAI() - { - return 8 < AllZone.Computer_Life.getLife(); - } - }; - Command intoPlay = new Command() - { - - private static final long serialVersionUID = -221296021551561668L; - - public void execute() - { - ability.setStackDescription("Eviscerator - " +card.getController() +" loses 5 life"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Foul Imp")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2); - } - public boolean canPlayAI() - { - return 4 < AllZone.Computer_Life.getLife(); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -5371716833341661084L; - - public void execute() - { - ability.setStackDescription("Foul Imp - " +card.getController() +" loses 2 life"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Drekavac")) - { - final Input discard = new Input() - { - private static final long serialVersionUID = -6392468000100283596L; - - public void showMessage() - { - AllZone.Display.showMessage("Discard from your hand a non-creature card"); - ButtonUtil.disableAll(); - } - public void selectCard(Card c, PlayerZone zone) - { - if(zone.is(Constant.Zone.Hand)) - { - AllZone.GameAction.discard(c); - if(c.isCreature()) - AllZone.GameAction.sacrifice(card); - stop(); - } - } - };//Input - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(card.getController().equals(Constant.Player.Human)) - { - if(AllZone.Human_Hand.getCards().length == 0) - AllZone.GameAction.sacrifice(card); - else - AllZone.InputControl.setInput(discard); - } - else - { - CardList list = new CardList(AllZone.Computer_Hand.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (!c.isCreature()); - } - }); - AllZone.GameAction.discard(list.get(0)); - }//else - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = 9202753910259054021L; - - public void execute() - { - ability.setStackDescription(card.getController() +" sacrifices Drekavac unless he discards a non-creature card"); - AllZone.Stack.add(ability); - } - }; - SpellAbility spell = new Spell_Permanent(card) - { - private static final long serialVersionUID = -2940969025405788931L; - - //could never get the AI to work correctly - //it always played the same card 2 or 3 times - public boolean canPlayAI() {return false;} - - public boolean canPlay() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - CardList list = new CardList(hand.getCards()); - list.remove(card); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (!c.isCreature()); - } - }); - return list.size() != 0; - }//canPlay() - }; - card.addComesIntoPlayCommand(intoPlay); - card.clearSpellAbility(); - card.addSpellAbility(spell); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Minotaur Explorer")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - if(hand.getCards().length == 0) - AllZone.GameAction.sacrifice(card); - else - AllZone.GameAction.discardRandom(card.getController()); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 4986114285467649619L; - - public void execute() - { - ability.setStackDescription(card.getController() +" - discards at random or sacrifices Minotaur Explorer"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Goretusk Firebeast")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(4); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 2977308349468915040L; - - public void execute() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - ability.setStackDescription("Goretusk Firebeast - deals 4 damage to " +opponent); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Goblin Ringleader")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); - - //get top 4 cards of the library - CardList top = new CardList(); - Card[] library = libraryZone.getCards(); - for(int i = 0; i < 4 && i < library.length; i++) - top.add(library[i]); - - //put top 4 cards on bottom of library - for(int i = 0; i < top.size(); i++) - { - libraryZone.remove(top.get(i)); - libraryZone.add(top.get(i)); - } - - CardList goblin = top.getType("Goblin"); - - for(int i = 0; i < goblin.size(); i++) - AllZone.GameAction.moveTo(hand, goblin.get(i)); - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7538870520237796620L; - - public void execute() - { - AllZone.Stack.add(ability); - } - }; - ability.setStackDescription("Goblin Ringleader - reveal the top four cards of your library. Put all Goblin cards revealed this way into your hand and the rest on the bottom of your library."); - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Sylvan Messenger")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); - - //get top 4 cards of the library - CardList top = new CardList(); - Card[] library = libraryZone.getCards(); - for(int i = 0; i < 4 && i < library.length; i++) - top.add(library[i]); - - //put top 4 cards on bottom of library - for(int i = 0; i < top.size(); i++) - { - libraryZone.remove(top.get(i)); - libraryZone.add(top.get(i)); - } - - CardList goblin = top.getType("Elf"); - - for(int i = 0; i < goblin.size(); i++) - AllZone.GameAction.moveTo(hand, goblin.get(i)); - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = 4757054648163014149L; - - public void execute() - { - AllZone.Stack.add(ability); - } - }; - ability.setStackDescription("Sylvan Messenger - reveal the top four cards of your library. Put all Elf cards revealed this way into your hand and the rest on the bottom of your library."); - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Child of Alara")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - - - for(int i = 0; i < list.size(); i++) - if(!list.get(i).getType().contains("Land")) - { - Card c = list.get(i); - AllZone.GameAction.destroyNoRegeneration(c); - } - } - }; - Command destroy = new Command() - { - private static final long serialVersionUID = -2937565366066183385L; - - public void execute() - { - AllZone.Stack.add(ability); - } - }; - ability.setStackDescription("Child of Alara - Destroy all non-land permanents, they can't be regenerated"); - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Ryusei, the Falling Star")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - for(int i = 0; i < list.size(); i++) - if(! list.get(i).getKeyword().contains("Flying") && CardFactoryUtil.canDamage(card, list.get(i))) - list.get(i).addDamage(5); - } - }; - Command destroy = new Command() - { - private static final long serialVersionUID = -6585074939675844265L; - - public void execute() - { - AllZone.Stack.add(ability); - } - }; - ability.setStackDescription("Ryusei, the Falling Star - deals 5 damage to each creature without flying"); - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Sleeper Agent")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve(){ - @SuppressWarnings("unused") // opponent - String opponent = card.getController(); - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - - PlayerZone from = AllZone.getZone(card); - from.remove(card); - - card.setController(AllZone.GameAction.getOpponent(card.getOwner())); - - PlayerZone to = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(card.getOwner())); - to.add(card); - System.out.println("cards controller = " + card.getController()); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - } - }; - - ability.setStackDescription("When Sleeper Agent comes into play, target opponent gains control of it."); - Command intoPlay = new Command() - { - private static final long serialVersionUID = -3934471871041458847L; - - public void execute() - { - AllZone.Stack.add(ability); - - }//execute() - }; - card.addComesIntoPlayCommand(intoPlay); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Flametongue Kavu")) - { - final CommandReturn getCreature = new CommandReturn() - { - //get target card, may be null - public Object execute() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(4, card, true); - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - if(list.size() != 0) - { - Card c = list.get(0); - if(3 <= c.getNetAttack() || - (2 <= c.getNetAttack() && c.getKeyword().contains("Flying"))) - return c; - } - if((AllZone.Computer_Life.getLife() < 10) && - (CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0)) - { - list = CardFactoryUtil.AI_getHumanCreature(card, true); - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - return list.get(0); - } - return null; - }//execute() - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - AllZone.GameAction.addDamage(getTargetCard(), 4); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -1920425335456952853L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - Object o = getCreature.execute(); - if(o != null)//should never happen, but just in case - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - else { - ability.setTargetCard(card); - AllZone.Stack.add(ability); - } - }//else - }//execute() - }; - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 5741146386242415357L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - - return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Shriekmaw")) - { - final CommandReturn getCreature = new CommandReturn() - { - //get target card, may be null - public Object execute() - { - CardList nonblack = CardFactoryUtil.AI_getHumanCreature(card, true); - nonblack = nonblack.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return(!c.isArtifact() && !CardUtil.getColors(c).contains(Constant.Color.Black)); - } - }); - - CardList list = new CardList(nonblack.toArray()); - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - if(list.size() != 0) - { - Card c = list.get(0); - if(2 <= c.getNetAttack() && c.getKeyword().contains("Flying")) - return c; - } - - if((AllZone.Computer_Life.getLife() < 10) && list.size() != 0) - { - CardListUtil.sortAttack(list); - - if(MyRandom.percentTrue(50)) - CardListUtil.sortFlying(list); - - return list.get(0); - } - return null; - }//execute() - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) && - !CardUtil.getColors(c).contains(Constant.Color.Black) && - !c.isArtifact()) - { - AllZone.GameAction.destroy(c); - } - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = -70141932446179740L; - - public void execute() - { - Input target = new Input() - { - private static final long serialVersionUID = 2634600975568025031L; - - public void showMessage() - { - AllZone.Display.showMessage("Select target nonartifact, nonblack creature to destroy"); - ButtonUtil.disableAll(); - } - public void selectCard(Card card, PlayerZone zone) - { - if(!CardFactoryUtil.canTarget(ability, card)){ - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - else if(card.isCreature() && zone.is(Constant.Zone.Play) && - !card.isArtifact() && !CardUtil.getColors(card).contains(Constant.Color.Black)) - { - ability.setTargetCard(card); - AllZone.Stack.add(ability); - stop(); - } - } - };//Input target - - - if(card.getController().equals(Constant.Player.Human)) - { - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return(!c.isArtifact() && !CardUtil.getColors(c).contains(Constant.Color.Black)); - } - }); - - if(list.size() != 0) - AllZone.InputControl.setInput(target); -// AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - } - else//computer - { - Object o = getCreature.execute(); - if(o != null)//should never happen, but just in case - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - }//else - }//execute() - }; - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -7508374608705757486L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - - return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - card.addSpellAbility(new Spell_Evoke(card, "1 B") - { - private static final long serialVersionUID = 6838065487515852527L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - - return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Briarhorn")) - { - final CommandReturn getCreature = new CommandReturn() - { - //get target card, may be null - public Object execute() - { - Combat combat = ComputerUtil.getAttackers(); - Card[] c = combat.getAttackers(); - - if(c.length == 0) - { - CardList list = new CardList(); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return(c.isCreature() && !c.hasSickness()); - } - }); - - if(list.size() == 0) - return card; - else - { - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - for(int i = 0; i < list.size(); i++) - if(list.get(i).isUntapped()) - return list.get(i); - - return list.get(0); - } - - } - - return c[0]; - }//execute() - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - final Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c)) - { - c.addTempAttackBoost(3); - c.addTempDefenseBoost(3); - - AllZone.EndOfTurn.addUntil(new Command() - { - private static final long serialVersionUID = -5417966443737481535L; - - public void execute() - { - c.addTempAttackBoost(-3); - c.addTempDefenseBoost(-3); - } - }); - }//if - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = -5497111036332352337L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - } - else//computer - { - Object o = getCreature.execute(); - if(o != null)//should never happen, but just in case - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - }//else - }//execute() - }; - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -681505091538444209L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - - return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - card.addSpellAbility(new Spell_Evoke(card, "1 G") - { - private static final long serialVersionUID = 8565746177492779899L; - - public boolean canPlayAI() - { - return false; - } - //because this card has Flash - public boolean canPlay() - { - if (!AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - } - }); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Inner-Flame Acolyte")) - { - final CommandReturn getCreature = new CommandReturn() - { - //get target card, may be null - public Object execute() - { - Combat combat = ComputerUtil.getAttackers(); - Card[] c = combat.getAttackers(); - CardList list = new CardList(); - - if(c.length == 0) - { - list.addAll(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature(); - } - }); - - if(list.size() == 0) - return card; - else - { - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - for(int i = 0; i < list.size(); i++) - if(list.get(i).isUntapped()) - return list.get(i); - - return list.get(0); - } - } - - return c[0]; - }//execute() - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - final Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) ) - { - c.addTempAttackBoost(2); - c.addExtrinsicKeyword("Haste"); - - AllZone.EndOfTurn.addUntil(new Command() - { - private static final long serialVersionUID = -6478147896119509688L; - - public void execute() - { - c.addTempAttackBoost(-2); - c.removeExtrinsicKeyword("Haste"); - } - }); - }//if - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = -4514610171270596654L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - } - else//computer - { - Object o = getCreature.execute(); - if(o != null)//should never happen, but just in case - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - }//else - }//execute() - }; - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 7153795935713327863L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - - return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - card.addSpellAbility(new Spell_Evoke(card, "R") - { - private static final long serialVersionUID = 8173305091293824506L; - - public boolean canPlayAI() - { - return false; - } - }); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Timetwister")) + else if(cardName.equals("Timetwister")) { final SpellAbility spell = new Spell(card) { @@ -9583,314 +3732,8 @@ final Input target = new Input() }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Slaughterhouse Bouncer")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - getTargetCard().addDamage(3); - } - }; - Command destroy = new Command() - { - private static final long serialVersionUID = 1619442728548153928L; - - public void execute() - { - //check to see if any other creatures in play - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - //check to see if any cards in hand - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - if(hand.getCards().length == 0 && list.size() != 0) - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - //1.try to get human creature with defense of 3 - list = CardFactoryUtil.AI_getHumanCreature(card, true); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) {return c.getNetDefense() == 3;} - }); - //2.try to get human creature with defense of 2 or less - if(list.isEmpty()) - list = CardFactoryUtil.AI_getHumanCreature(2, card, true); - //3.get any computer creature - if(list.isEmpty()) - { - list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - } - list.shuffle(); - ability.setTargetCard(list.get(0)); - AllZone.Stack.add(ability); - } - }//if ok to play - }//execute() - };//Command - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Undying Beast")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - card.setDamage(0); - card.setAssignedDamage(0); - card.untap(); - - //moves card to top of library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); - library.add(card, 0); - } - }; - Command destroy = new Command() - { - private static final long serialVersionUID = -318081458847722674L; - - public void execute() - { - if(card.isToken()) - return; - - //remove from graveyard - PlayerZone grave = AllZone.getZone(card); - grave.remove(card); - - ability.setStackDescription("Put Undying Beast on top of its owner's library."); - AllZone.Stack.add(ability); - } - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Fire Imp") || cardName.equals("Corrupt Eunuchs")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - getTargetCard().addDamage(2); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7639628386947162984L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - if(list.isEmpty()) - { - list = CardFactoryUtil.AI_getHumanCreature(card, true); - list.shuffle(); - } - - if (list.size() > 0) - ability.setTargetCard(list.get(0)); - else - ability.setTargetCard(card); - - AllZone.Stack.add(ability); - }//else - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 1731831041621831246L; - - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Man-o'-War") || cardName.equals("Sun Ce, Young Conquerer")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - { - AllZone.getZone(c).remove(c); - - if(! c.isToken()) - { - Card newCard = AllZone.CardFactory.getCard(c.getName(), c.getOwner()); - hand.add(newCard); - } - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7628289586347295144L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - Card human = CardFactoryUtil.AI_getBestCreature(CardFactoryUtil.AI_getHumanCreature(card, true)); - ability.setTargetCard(human); - - - if (human == null) - ability.setTargetCard(card); - - AllZone.Stack.add(ability); - }//else - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 2458286917800051358L; - - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Keening Banshee")) - { - - final SpellAbility ability = new Ability(card, "0") - { - - public void resolve() - { - final Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) ) - { - c.addTempAttackBoost(-2); - c.addTempDefenseBoost(-2); - - AllZone.EndOfTurn.addUntil(new Command() - { - private static final long serialVersionUID = 8479364459667467780L; - - public void execute() - { - c.addTempAttackBoost(2); - c.addTempDefenseBoost(2); - } - }); - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 6283666887577455663L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - if(list.isEmpty()) - { - list = CardFactoryUtil.AI_getHumanCreature(card, true); - list.shuffle(); - } - - ability.setTargetCard(list.get(0)); - AllZone.Stack.add(ability); - }//else - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -1893090545602255371L; - - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Dragon Roost")) + else if(cardName.equals("Dragon Roost")) { final SpellAbility ability = new Ability(card, "5 R R") { @@ -9924,7 +3767,7 @@ final Input target = new Input() //*************** START *********** START ************************** - if(cardName.equals("The Hive")) + else if(cardName.equals("The Hive")) { final SpellAbility ability = new Ability_Tap(card, "5") { @@ -9959,8 +3802,8 @@ final Input target = new Input() card.addSpellAbility(ability); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Mobilization")) + //*************** START *********** START ************************** + else if(cardName.equals("Mobilization")) { final SpellAbility ability = new Ability(card, "2 W") { @@ -9993,42 +3836,10 @@ final Input target = new Input() }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Ant Queen")) - { - final SpellAbility ability = new Ability(card, "1 G") - { - public void resolve() - { - Card c = new Card(); - c.setName("Insect"); - c.setImageName("G 1 1 Insect"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Insect"); - - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - }; - ability.setDescription("1 G: Put a 1/1 green Insect creature token onto the battlefield."); - ability.setStackDescription(card.getName() + " - Put a 1/1 green Insect token onto the battlefield."); - card.addSpellAbility(ability); - - - }//*************** END ************ END ************************** + //*************** START *********** START ************************** - if(cardName.equals("Centaur Glade")) + else if(cardName.equals("Centaur Glade")) { final SpellAbility ability = new Ability(card, "2 G G") { @@ -10061,209 +3872,6 @@ final Input target = new Input() - //*************** START *********** START ************************** - if(cardName.equals("Eternal Witness")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - } - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 1658050744890095441L; - - public void execute() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - - if(grave.getCards().length == 0) - return; - - if(card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select target card", grave.getCards()); - if(o != null) - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - } - else//computer - { - CardList list = new CardList(grave.getCards()); - Card best = CardFactoryUtil.AI_getBestCreature(list); - - if(best == null) - { - list.shuffle(); - best = list.get(0); - } - ability.setTargetCard(best); - AllZone.Stack.add(ability); - } - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Gravedigger")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - } - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7433708170033536384L; - - public void execute() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return; - - if(card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select target card", list.toArray()); - if(o != null) - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - }//if - else//computer - { - Card best = CardFactoryUtil.AI_getBestCreature(list); - ability.setTargetCard(best); - AllZone.Stack.add(ability); - } - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Strongarm Thug")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - } - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 4519970074391756730L; - - public void execute() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.getType("Mercenary"); - - if(list.isEmpty()) - return; - - if(card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select target card", list.toArray()); - if(o != null) - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - }//if - else//computer - { - Card best = CardFactoryUtil.AI_getBestCreature(list); - ability.setTargetCard(best); - AllZone.Stack.add(ability); - } - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************ - if (cardName.equals("Aedun Oakenshield")) - { - final Ability_Tap ability = new Ability_Tap(card, "B R G") - { - private static final long serialVersionUID = -7913968639880781838L; - public boolean canPlayAI() {return getGraveCreatures().size() != 0;} - - public void chooseTargetAI() - { - CardList grave = getGraveCreatures(); - Card target = CardFactoryUtil.AI_getBestCreature(grave); - setTargetCard(target); - } - - public void resolve() - { - if(card.getController().equals(Constant.Player.Human)) - { - Card c = (Card) AllZone.Display.getChoice("Select card", getGraveCreatures().toArray()); - setTargetCard(c); - } - - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - - if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) - AllZone.GameAction.moveTo(hand, getTargetCard()); - }//resolve() - public boolean canPlay() - { - return getGraveCreatures().size() != 0; - } - CardList getGraveCreatures() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.getType("Creature"); - return list; - } - };//SpellAbility - ability.setDescription("B R G, Tap: Return target creature card from your graveyard to your hand."); - ability.setStackDescription(cardName + " - return target creature from your graveyard to your hand."); - - card.clearSpellAbility(); - card.addSpellAbility(ability); - - - }//*************** END ************ END ************************** - //*************** START *********** START ************************** if(cardName.equals("Raise Dead") || cardName.equals("Disentomb") || cardName.equals("Return to Battle") || cardName.equals("Recover")) @@ -10313,504 +3921,8 @@ final Input target = new Input() - //*************** START *********** START ************************** - if(cardName.equals("Anarchist")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - } - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7459412502903144952L; - - public void execute() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList sorcery = new CardList(grave.getCards()); - sorcery = sorcery.getType("Sorcery"); - - String controller = card.getController(); - - if(sorcery.size() == 0) - return; - - if(controller.equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select target card", sorcery.toArray()); - if(o != null) - { - ability.setTargetCard((Card)o); - AllZone.Stack.add(ability); - } - } - else //computer - { - sorcery.shuffle(); - ability.setTargetCard(sorcery.get(0)); - AllZone.Stack.add(ability); - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Penumbra Kavu")) - { - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Kavu"); - c.setImageName("B 3 3 Kavu"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Kavu"); - c.setBaseAttack(3); - c.setBaseDefense(3); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//Ability - - Command destroy = new Command() - { - private static final long serialVersionUID = 1281791927604583468L; - - public void execute() - { - ability.setStackDescription(card.getController() +" puts a 3/3 creature into play from Penumbra Kavu"); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Penumbra Bobcat")) - { - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Cat"); - c.setImageName("B 2 1 Cat"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Cat"); - c.setBaseAttack(2); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//Ability - - Command destroy = new Command() - { - private static final long serialVersionUID = -8057009255325020247L; - - public void execute() - { - ability.setStackDescription(card.getController() +" puts a 2/1 creature into play from Penumbra Bobcat"); - AllZone.Stack.add(ability); - } - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Penumbra Spider")) - { - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Spider"); - c.setImageName("B 2 4 Spider"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Spider"); - c.setBaseAttack(2); - c.setBaseDefense(4); - c.addIntrinsicKeyword("Reach"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//Ability - - Command destroy = new Command() - { - private static final long serialVersionUID = 9186718803540678064L; - - public void execute() - { - ability.setStackDescription(card.getController() +" puts a 2/4 Black Spider creature into play from Penumbra Spider"); - AllZone.Stack.add(ability); - } - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Penumbra Wurm")) - { - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Wurm"); - c.setImageName("B 6 6 Wurm"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Wurm"); - c.setBaseAttack(6); - c.setBaseDefense(6); - c.addIntrinsicKeyword("Trample"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//Ability - - Command destroy = new Command() - { - private static final long serialVersionUID = -8819664543962631239L; - - public void execute() - { - ability.setStackDescription(card.getController() +" puts a 6/6 Black Wurm creature with trample into play from Penumbra Wurm"); - AllZone.Stack.add(ability); - } - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Aven Fisher") || cardName.equals("Riptide Crab")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.drawCard(card.getController()); - } - }; - Command destroy = new Command() - { - private static final long serialVersionUID = -2786138225183288814L; - - public void execute() - { - ability.setStackDescription(card.getName() + " - " + card.getController() +" draws a card"); - AllZone.Stack.add(ability); - } - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Peregrine Drake")) - { - final Input untap = new Input() - { - private static final long serialVersionUID = 2287264826189281795L; - - int stop = 5; - int count = 0; - - public void showMessage() - { - AllZone.Display.showMessage("Select a land to untap"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - if(card.isLand() && zone.is(Constant.Zone.Play)) - { - card.untap(); - count++; - if(count == stop) - stop(); - } - }//selectCard() - }; - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(card.getController().equals("Human")) - AllZone.InputControl.setInput(untap); - else - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand() && c.isTapped(); - } - }); - for(int i = 0; i < 5 && i < list.size(); i++) - list.get(i).untap(); - }//else - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 3208277692165539396L; - - public void execute() - { - ability.setStackDescription(card.getController() +" untaps up to 5 lands."); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Cloud of Faeries")) - { - final Input untap = new Input() - { - private static final long serialVersionUID = -2167059918040912025L; - - int stop = 2; - int count = 0; - - public void showMessage() - { - AllZone.Display.showMessage("Select a land to untap"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - if(card.isLand() && zone.is(Constant.Zone.Play)) - { - card.untap(); - count++; - if(count == stop) - stop(); - } - }//selectCard() - }; - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(card.getController().equals("Human")) - AllZone.InputControl.setInput(untap); - else - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand() && c.isTapped(); - } - }); - for(int i = 0; i < 2 && i < list.size(); i++) - { - list.get(i).untap(); - } - }//else - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 7222997838166323277L; - - public void execute() - { - ability.setStackDescription(card.getController() +" untaps up to 2 lands."); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - - //add cycling - card.addSpellAbility(CardFactoryUtil.ability_cycle(card, "2")); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Vodalian Merchant")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - AllZone.GameAction.drawCard(card.getController()); - - if(card.getController().equals("Human")) - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - else - AllZone.GameAction.discardRandom("Computer"); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -8924243774757009091L; - - public void execute() - { - ability.setStackDescription(card.getController() +" draws a card, then discards a card"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Whirlpool Rider")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //shuffle hand into library, then shuffle library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); - Card c[] = hand.getCards(); - for(int i = 0; i < c.length; i++) - AllZone.GameAction.moveTo(library, c[i]); - AllZone.GameAction.shuffle(card.getController()); - - //draw same number of cards as before - for(int i = 0; i < c.length; i++) - AllZone.GameAction.drawCard(card.getController()); - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 6290392806910817877L; - - public void execute() - { - ability.setStackDescription(card.getController() +" shuffles the cards from his hand into his library, then draws that many cards."); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Sky Swallower")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - String opp = AllZone.GameAction.getOpponent(card.getController()); - PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, opp); - PlayerZone myPlay = AllZone.getZone(Constant.Zone.Play, card.getController()); - - CardList list = new CardList(myPlay.getCards()); - list.remove(card);//doesn't move Sky Swallower - while(! list.isEmpty()) - { - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - //so "comes into play" abilities don't trigger - ///list.get(0).addComesIntoPlayCommand(Command.Blank); - - oppPlay.add(list.get(0)); - myPlay.remove(list.get(0)); - - list.get(0).setController(opp); - list.remove(0); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - } - }//resolve() - }; - - Command intoPlay = new Command() - { - private static final long serialVersionUID = -453410206437839334L; - - public void execute() - { - ability.setStackDescription(AllZone.GameAction.getOpponent(card.getController()) +" gains control of all other permanents you control"); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Terror")) + else if(cardName.equals("Terror")) { final SpellAbility spell = new Spell(card) { @@ -10877,10 +3989,8 @@ final Input target = new Input() - - //*************** START *********** START ************************** - if(cardName.equals("Expunge")) + else if(cardName.equals("Expunge")) { final SpellAbility spell = new Spell(card) { @@ -10951,11 +4061,8 @@ final Input target = new Input() - - - //*************** START *********** START ************************** - if(cardName.equals("Pongify")) + else if(cardName.equals("Pongify")) { final SpellAbility spell = new Spell(card) { @@ -11021,10 +4128,8 @@ final Input target = new Input() - - //*************** START *********** START ************************** - if(cardName.equals("Devour in Shadow")) + else if(cardName.equals("Devour in Shadow")) { final SpellAbility spell = new Spell(card) { @@ -11070,7 +4175,7 @@ final Input target = new Input() }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Terminate")) + else if(cardName.equals("Terminate")) { final SpellAbility spell = new Spell(card) { @@ -11109,7 +4214,7 @@ final Input target = new Input() }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Kinsbaile Borderguard")) + else if(cardName.equals("Kinsbaile Borderguard")) { final SpellAbility ability = new Ability(card, "0") { @@ -11214,773 +4319,17 @@ final Input target = new Input() ability2.setStackDescription("When Kinsbaile Borderguard is put into a graveyard from play, put a 1/1 white Kithkin Soldier creature token into play for each counter on it."); AllZone.Stack.add(ability2); } - }; - + }; card.addComesIntoPlayCommand(intoPlay); card.addDestroyCommand(destroy); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Nova Chaser") || cardName.equals("Supreme Exemplar")) - { - final CommandReturn getCreature = new CommandReturn() - { - public Object execute() - { - //get all creatures - CardList list = new CardList(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - list.addAll(play.getCards()); - - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.getType().contains("Elemental") || c.getKeyword().contains("Changeling"); - } - }); - - return list; - } - };//CommandReturn - - final SpellAbility abilityComes = new Ability(card, "0") - { - public void resolve() - { - if (getTargetCard() == null || getTargetCard() == card) - AllZone.GameAction.sacrifice(card); - - else if(AllZone.GameAction.isCardInPlay(getTargetCard())) - { - /* - PlayerZone play = AllZone.getZone(getTargetCard()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); - play.remove(getTargetCard()); - removed.add(getTargetCard()); - */ - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - }; - - final Input inputComes = new Input() - { - private static final long serialVersionUID = -6066115143834426784L; - - public void showMessage() - { - CardList choice = (CardList)getCreature.execute(); - - stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select Elemental to remove from the game", false)); - ButtonUtil.disableAll(); - } - - }; - Command commandComes = new Command() - { - private static final long serialVersionUID = -3498068247359658023L; - - public void execute() - { - CardList creature = (CardList)getCreature.execute(); - String s = card.getController(); - if(creature.size() == 0) { - AllZone.GameAction.sacrifice(card); - return; - } - else if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(inputComes); - else //computer - { - Card target; - //must target computer creature - CardList computer = new CardList(AllZone.Computer_Play.getCards()); - computer = computer.getType("Elemental"); - computer.remove(card); - - computer.shuffle(); - if (computer.size()!= 0) { - target = computer.get(0); - abilityComes.setTargetCard(target); - AllZone.Stack.add(abilityComes); - } - }//else - }//execute() - };//CommandComes - Command commandLeavesPlay = new Command() - { - private static final long serialVersionUID = 4236503599017025393L; - - public void execute() - { - //System.out.println(abilityComes.getTargetCard().getName()); - Object o = abilityComes.getTargetCard(); - - if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) - return; - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //copy card to reset card attributes like attack and defense - Card c = abilityComes.getTargetCard(); - if(! c.isToken()) - { - c = AllZone.CardFactory.copyCard(c); - c.setController(c.getOwner()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); - removed.remove(c); - play.add(c); - - } - }//resolve() - };//SpellAbility - ability.setStackDescription(card.getName() + " - returning creature to play"); - AllZone.Stack.add(ability); - }//execute() - };//Command - - card.addComesIntoPlayCommand(commandComes); - card.addLeavesPlayCommand(commandLeavesPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -62128538015338896L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - if (o == null) - return false; - - CardList cl = (CardList)getCreature.execute(); - return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Wren's Run Packmaster")) - { - final CommandReturn getCreature = new CommandReturn() - { - public Object execute() - { - //get all creatures - CardList list = new CardList(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - list.addAll(play.getCards()); - - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.getType().contains("Elf") || c.getKeyword().contains("Changeling"); - } - }); - - return list; - } - };//CommandReturn - - final SpellAbility abilityComes = new Ability(card, "0") - { - public void resolve() - { - if (getTargetCard() == null || getTargetCard() == card) - AllZone.GameAction.sacrifice(card); - - else if(AllZone.GameAction.isCardInPlay(getTargetCard())) - { - /* - PlayerZone play = AllZone.getZone(getTargetCard()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); - play.remove(getTargetCard()); - removed.add(getTargetCard()); - */ - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - }; - - final Input inputComes = new Input() - { - private static final long serialVersionUID = 5210700665533271691L; - - public void showMessage() - { - CardList choice = (CardList)getCreature.execute(); - - stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select Elf to remove from the game", false)); - ButtonUtil.disableAll(); //target this card means: sacrifice this card - } - }; - Command commandComes = new Command() - { - - private static final long serialVersionUID = -3580408066322945328L; - - public void execute() - { - CardList creature = (CardList)getCreature.execute(); - String s = card.getController(); - if(creature.size() == 0) { - AllZone.GameAction.sacrifice(card); - return; - } - else if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(inputComes); - else //computer - { - Card target; - //must target computer creature - CardList computer = new CardList(AllZone.Computer_Play.getCards()); - computer = computer.getType("Elf"); - computer.remove(card); - - computer.shuffle(); - if (computer.size()!= 0) { - target = computer.get(0); - abilityComes.setTargetCard(target); - AllZone.Stack.add(abilityComes); - } - }//else - }//execute() - };//CommandComes - Command commandLeavesPlay = new Command() - { - - private static final long serialVersionUID = -5903638227914705191L; - - public void execute() - { - //System.out.println(abilityComes.getTargetCard().getName()); - Object o = abilityComes.getTargetCard(); - - if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) - return; - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //copy card to reset card attributes like attack and defense - Card c = abilityComes.getTargetCard(); - if(! c.isToken()) - { - c = AllZone.CardFactory.copyCard(c); - c.setController(c.getOwner()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); - removed.remove(c); - play.add(c); - - } - }//resolve() - };//SpellAbility - ability.setStackDescription(card.getName() + " - returning creature to play"); - AllZone.Stack.add(ability); - }//execute() - };//Command - - - final SpellAbility a1 = new Ability(card, "2 G") - { - public boolean canPlayAI() - { - return MyRandom.random.nextBoolean(); - } - public boolean canPlay() - { - SpellAbility sa; - //this is a hack, check the stack to see if this card has an ability on the stack - //if so, we can't use the ability - for (int i=0; i 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - - card.addSpellAbility(a1); - a1.setBeforePayMana(new Input_PayManaCost(a1)); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Changeling Berserker") || cardName.equals("Changeling Hero") || cardName.equals("Changeling Titan")) - { - final CommandReturn getCreature = new CommandReturn() - { - public Object execute() - { - //get all creatures - CardList list = new CardList(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - list.addAll(play.getCards()); - - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.getType().contains("Creature"); - } - }); - - return list; - } - };//CommandReturn - - final SpellAbility abilityComes = new Ability(card, "0") - { - public void resolve() - { - if (getTargetCard() == null || getTargetCard() == card) - AllZone.GameAction.sacrifice(card); - - else if(AllZone.GameAction.isCardInPlay(getTargetCard()) ) - { - /* - PlayerZone play = AllZone.getZone(getTargetCard()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); - play.remove(getTargetCard()); - removed.add(getTargetCard()); - */ - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - }; - - final Input inputComes = new Input() - { - - private static final long serialVersionUID = 5210700665533271691L; - - public void showMessage() - { - CardList choice = (CardList)getCreature.execute(); - - stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select creature to remove from the game", false)); - ButtonUtil.disableAll(); - } - }; - Command commandComes = new Command() - { - - private static final long serialVersionUID = -3580408066322945328L; - - public void execute() - { - CardList creature = (CardList)getCreature.execute(); - String s = card.getController(); - if(creature.size() == 0) { - AllZone.GameAction.sacrifice(card); - return; - } - else if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(inputComes); - else //computer - { - Card target; - //must target computer creature - CardList computer = new CardList(AllZone.Computer_Play.getCards()); - computer = computer.getType("Creature"); - computer.remove(card); - - computer.shuffle(); - if (computer.size()!= 0) { - target = computer.get(0); - abilityComes.setTargetCard(target); - AllZone.Stack.add(abilityComes); - } - }//else - }//execute() - };//CommandComes - Command commandLeavesPlay = new Command() - { - - private static final long serialVersionUID = -5903638227914705191L; - - public void execute() - { - //System.out.println(abilityComes.getTargetCard().getName()); - Object o = abilityComes.getTargetCard(); - - if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) - return; - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //copy card to reset card attributes like attack and defense - Card c = abilityComes.getTargetCard(); - if(! c.isToken()) - { - c = AllZone.CardFactory.copyCard(c); - c.setController(c.getOwner()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); - removed.remove(c); - play.add(c); - - } - }//resolve() - };//SpellAbility - ability.setStackDescription(card.getName() + " - returning creature to play"); - AllZone.Stack.add(ability); - }//execute() - };//Command - - card.addComesIntoPlayCommand(commandComes); - card.addLeavesPlayCommand(commandLeavesPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - - private static final long serialVersionUID = 2583297503017070549L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - if (o == null) - return false; - - CardList cl = (CardList)getCreature.execute(); - return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Devout Lightcaster")) - { - final CommandReturn getBlackPerm = new CommandReturn() - { - public Object execute() - { - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.isPermanent() && CardFactoryUtil.canTarget(card,c) && CardUtil.getColor(c).equals(Constant.Color.Black); - } - }); - - return list; - } - };//CommandReturn - - final SpellAbility abilityComes = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - { - - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - }; - - final Input inputComes = new Input() - { - private static final long serialVersionUID = 3762167908738465100L; - - public void showMessage() - { - CardList choice = (CardList)getBlackPerm.execute(); - - stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select target black permanent to remove from the game", true)); - ButtonUtil.disableAll();//to disable the Cancel button - } - }; - Command commandComes = new Command() - { - - private static final long serialVersionUID = 3878683618127503416L; - - public void execute() - { - CardList creature = (CardList)getBlackPerm.execute(); - String s = card.getController(); - if(creature.size() == 0) - return; - else if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(inputComes); - else //computer - { - Card target; - - //try to target human permanent - PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList human = new CardList(hum.getCards()); - human = human.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isPermanent() && CardUtil.getColor(c).equals(Constant.Color.Black); - } - - }); - //target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty - human.shuffle(); - target = null; - if (human.size()!=0) - target = human.get(0); - - if(target == null) - { - //must target computer creature - CardList computer = new CardList(AllZone.Computer_Play.getCards()); - computer = computer.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isPermanent() && CardUtil.getColor(c).equals(Constant.Color.Black); - } - - }); - - computer.shuffle(); - if (computer.size()!= 0) - target = computer.get(0); - } - abilityComes.setTargetCard(target); - AllZone.Stack.add(abilityComes); - }//else - }//execute() - };//CommandComes - - card.addComesIntoPlayCommand(commandComes); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - - private static final long serialVersionUID = -9059177006257139430L; - - public boolean canPlayAI() - { - Object o = getBlackPerm.execute(); - if (o == null) - return false; - - CardList cl = (CardList)getBlackPerm.execute(); - return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Faceless Butcher")) - { - final CommandReturn getCreature = new CommandReturn() - { - public Object execute() - { - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.isCreature() && CardFactoryUtil.canTarget(card,c); - } - }); - - //remove "this card" - list.remove(card); - - return list; - } - };//CommandReturn - - final SpellAbility abilityComes = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) - { - /* - PlayerZone play = AllZone.getZone(getTargetCard()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); - play.remove(getTargetCard()); - removed.add(getTargetCard()); - */ - AllZone.GameAction.removeFromGame(getTargetCard()); - } - }//resolve() - }; - - final Input inputComes = new Input() - { - private static final long serialVersionUID = -1932054059769056049L; - - public void showMessage() - { - CardList choice = (CardList)getCreature.execute(); - - stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select target creature to remove from the game", true)); - ButtonUtil.disableAll();//to disable the Cancel button - } - }; - Command commandComes = new Command() - { - private static final long serialVersionUID = -5675532512302863456L; - - public void execute() - { - CardList creature = (CardList)getCreature.execute(); - String s = card.getController(); - if(creature.size() == 0) - return; - else if(s.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(inputComes); - else //computer - { - Card target; - - //try to target human creature - CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); - target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty - - if(target == null) - { - //must target computer creature - CardList computer = new CardList(AllZone.Computer_Play.getCards()); - computer = computer.getType("Creature"); - computer.remove(card); - - computer.shuffle(); - if (computer.size()!= 0) - target = computer.get(0); - } - abilityComes.setTargetCard(target); - AllZone.Stack.add(abilityComes); - }//else - }//execute() - };//CommandComes - Command commandLeavesPlay = new Command() - { - private static final long serialVersionUID = 5518706316791622193L; - - public void execute() - { - //System.out.println(abilityComes.getTargetCard().getName()); - Object o = abilityComes.getTargetCard(); - - if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) - return; - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //copy card to reset card attributes like attack and defense - Card c = abilityComes.getTargetCard(); - if(! c.isToken()) - { - c = AllZone.CardFactory.copyCard(c); - c.setController(c.getOwner()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); - PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); - removed.remove(c); - play.add(c); - - } - }//resolve() - };//SpellAbility - ability.setStackDescription("Faceless Butcher - returning creature to play"); - AllZone.Stack.add(ability); - }//execute() - };//Command - - card.addComesIntoPlayCommand(commandComes); - card.addLeavesPlayCommand(commandLeavesPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - - private static final long serialVersionUID = -62128538015338896L; - - public boolean canPlayAI() - { - Object o = getCreature.execute(); - if (o == null) - return false; - - CardList cl = (CardList)getCreature.execute(); - return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Oblivion Ring")) + else if(cardName.equals("Oblivion Ring")) { final CommandReturn getPerm = new CommandReturn() { @@ -12154,102 +4503,7 @@ final Input target = new Input() }//*************** END ************ END ************************** - - - /* - //*************** START *********** START ************************** - else if(cardName.equals("Oblivion Ring")) - { - final SpellAbility enchantment = new Spell(card) - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard())) - { - PlayerZone play = AllZone.getZone(getTargetCard()); - play.remove(getTargetCard()); - - //put permanent into play - Card c = getSourceCard(); - AllZone.getZone(Constant.Zone.Play, c.getController()).add(c); - } - }//resolve() - - public boolean canPlayAI() - { - //try to target human creature - CardList human = CardFactoryUtil.AI_getHumanCreature(); - Card target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty - - if(target == null) - return false; - else - { - setTargetCard(target); - return true; - } - }//canPlayAI() - };//SpellAbility enchantment - - - final Input target = new Input() - { - //showMessage() is always the first method called - public void showMessage() - { - AllZone.Display.showMessage("Select non-land to remove from the game."); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - - public void selectCard(Card c, PlayerZone zone) - { - if(zone.is(Constant.Zone.Play) && !c.isLand()) - { - enchantment.setTargetCard(c); - - stopSetNext(new Input_PayManaCost(enchantment)); - } - } - };//Input target - - Command commandDestroy = new Command() - { - public void execute() - { - Object o = enchantment.getTargetCard(); - if(o == null || ((Card)o).isToken()) - return; - - SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //copy card to reset card attributes like attack and defense - Card c = enchantment.getTargetCard(); - if(! c.isToken()) - { - c = AllZone.CardFactory.copyCard(c); - c.setController(c.getOwner()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); - play.add(c); - } - }//resolve() - };//SpellAbility - ability.setStackDescription(card.getName() +" - returning creature to play"); - AllZone.Stack.add(ability); - }//execute() - };//Command - card.setDestroy(commandDestroy); - - card.clearSpellAbility(); - card.addSpellAbility(enchantment); - - enchantment.setBeforePayMana(target); - }//*************** END ************ END ************************** - - */ + //*************** START *********** START ************************** else if(cardName.equals("Oubliette")) @@ -12353,12 +4607,8 @@ final Input target = new Input() }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Test Destroy")) + else if(cardName.equals("Test Destroy")) { final SpellAbility spell = new Spell(card) { @@ -12378,10 +4628,8 @@ final Input target = new Input() }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Take Possession")) + else if(cardName.equals("Take Possession")) { final SpellAbility spell = new Spell(card) { @@ -12422,9 +4670,8 @@ final Input target = new Input() - //*************** START *********** START ************************** - if(cardName.equals("Night's Whisper")) + else if(cardName.equals("Night's Whisper")) { final SpellAbility spell = new Spell(card) { @@ -12451,9 +4698,8 @@ final Input target = new Input() - //*************** START *********** START ************************** - if(cardName.equals("Infest")) + else if(cardName.equals("Infest")) { final SpellAbility spell = new Spell(card) { @@ -12492,439 +4738,8 @@ final Input target = new Input() - - //*************** START *********** START ************************** - if(cardName.equals("Ember-Fist Zubera")) - { - //counts Zubera in all graveyards for this turn - final CommandReturn countZubera = new CommandReturn() - { - public Object execute() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.getTurnInZone() == AllZone.Phase.getTurn()) && - (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); - } - });//CardListFilter() - - return new Integer(list.size()); - } - }; - - final Input[] input = new Input[1]; - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - //human chooses target on resolve, - //computer chooses target in Command destroy - if(Constant.Player.Human.equals(card.getController())) - AllZone.InputControl.setInput(input[0]); - else - { - int damage = ((Integer)countZubera.execute()).intValue(); - - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) - && CardFactoryUtil.canTarget(card,getTargetCard()) ) - { - Card c = getTargetCard(); - c.addDamage(damage); - } - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); - } - }//resolve() - };//SpellAbility - - input[0] = new Input() - { - private static final long serialVersionUID = 1899925898843297992L; - - public void showMessage() - { - int damage = ((Integer)countZubera.execute()).intValue(); - AllZone.Display.showMessage("Select target Creature, Planeswalker or Player - " + damage +" damage "); - ButtonUtil.disableAll(); - } - public void selectCard(Card card, PlayerZone zone) - { - if((card.isCreature() || card.isPlaneswalker()) && zone.is(Constant.Zone.Play)) - { - int damage = ((Integer)countZubera.execute()).intValue(); - card.addDamage(damage); - - //have to do this since state effects aren't checked - //after this "Input" class is done - //basically this makes everything work right - //Ember-Fist Zubera can destroy a 2/2 creature - AllZone.GameAction.checkStateEffects(); - stop(); - } - }//selectCard() - public void selectPlayer(String player) - { - int damage = ((Integer)countZubera.execute()).intValue(); - AllZone.GameAction.getPlayerLife(player).subtractLife(damage); - stop(); - }//selectPlayer() - };//Input - - Command destroy = new Command() - { - private static final long serialVersionUID = -1889425992069348304L; - - public void execute() - { - ability.setStackDescription(card +" causes damage to creature or player"); - - @SuppressWarnings("unused") // damage - int damage = ((Integer)countZubera.execute()).intValue(); - - String con = card.getController(); - - //human chooses target on resolve, - //computer chooses target in Command destroy - if(con.equals(Constant.Player.Computer)) - ability.setTargetPlayer(Constant.Player.Human); - - AllZone.Stack.add(ability); - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Ashen-Skin Zubera")) - { - //counts Zubera in all graveyards for this turn - final CommandReturn countZubera = new CommandReturn() - { - public Object execute() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.getTurnInZone() == AllZone.Phase.getTurn()) && - (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); - } - });//CardListFilter() - return new Integer(list.size()); - } - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - int discard = ((Integer)countZubera.execute()).intValue(); - - if(Constant.Player.Human.equals(getTargetPlayer())) - AllZone.InputControl.setInput(CardFactoryUtil.input_discard(discard)); - else - { - for(int i = 0; i < discard; i++) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - }//resolve() - };//SpellAbility - - Command destroy = new Command() - { - private static final long serialVersionUID = -7494691537986218546L; - - public void execute() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - ability.setTargetPlayer(opponent); - ability.setStackDescription(card +" - " + opponent +" discards cards"); - - AllZone.Stack.add(ability); - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Floating-Dream Zubera")) - { - //counts Zubera in all graveyards for this turn - final CommandReturn countZubera = new CommandReturn() - { - public Object execute() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.getTurnInZone() == AllZone.Phase.getTurn()) && - (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); - } - });//CardListFilter() - return new Integer(list.size()); - } - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - int number = ((Integer)countZubera.execute()).intValue(); - - for(int i = 0; i < number; i++) - AllZone.GameAction.drawCard(getTargetPlayer()); - }//resolve() - };//SpellAbility - - Command destroy = new Command() - { - private static final long serialVersionUID = -5814070329854975419L; - - public void execute() - { - ability.setTargetPlayer(card.getController()); - ability.setStackDescription(card +" - " +card.getController() +" draws cards"); - AllZone.Stack.add(ability); - - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Silent-Chant Zubera")) - { - //counts Zubera in all graveyards for this turn - final CommandReturn countZubera = new CommandReturn() - { - public Object execute() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.getTurnInZone() == AllZone.Phase.getTurn()) && - (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); - } - });//CardListFilter() - return new Integer(list.size()); - } - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - int number = ((Integer)countZubera.execute()).intValue(); - - PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); - life.addLife(number * 2); - }//resolve() - };//SpellAbility - - Command destroy = new Command() - { - private static final long serialVersionUID = -2327085948421343657L; - - public void execute() - { - ability.setTargetPlayer(card.getController()); - ability.setStackDescription(card +" - " +card.getController() +" gains life"); - AllZone.Stack.add(ability); - - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Dripping-Tongue Zubera")) - { - //counts Zubera in all graveyards for this turn - final CommandReturn countZubera = new CommandReturn() - { - public Object execute() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Graveyard.getCards()); - list.addAll(AllZone.Computer_Graveyard.getCards()); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.getTurnInZone() == AllZone.Phase.getTurn()) && - (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); - } - });//CardListFilter() - return new Integer(list.size()); - } - };//CommandReturn - - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - int count = ((Integer)countZubera.execute()).intValue(); - for(int i = 0; i < count; i++) - makeToken(); - }//resolve() - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Spirit"); - c.setImageName("C 1 1 Spirit"); - c.setManaCost(""); - c.setToken(true); - - c.addType("Creature"); - c.addType("Spirit"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - play.add(c); - }//makeToken() - - };//SpellAbility - - Command destroy = new Command() - { - private static final long serialVersionUID = 8362692868619919330L; - public void execute() - { - ability.setTargetPlayer(card.getController()); - ability.setStackDescription(card +" - " +card.getController() +" puts tokens into play"); - AllZone.Stack.add(ability); - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Keiga, the Tide Star")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone oldPlay = AllZone.getZone(getTargetCard()); - - //so "comes into play" abilities don't trigger - //getTargetCard().addComesIntoPlayCommand(Command.Blank); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - - play.add(getTargetCard()); - oldPlay.remove(getTargetCard()); - - getTargetCard().setController(card.getController()); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - } - }//resolve() - }; - - final Input targetInput = new Input() - { - private static final long serialVersionUID = -8727869672234802473L; - - public void showMessage() - { - AllZone.Display.showMessage("Select target creature"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(!CardFactoryUtil.canTarget(card, c)){ - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - else if(c.isCreature() && zone.is(Constant.Zone.Play)) - { - ability.setTargetCard(c); - ability.setStackDescription("Gain control of " +ability.getTargetCard()); - AllZone.Stack.add(ability); - stop(); - } - } - };//Input - Command destroy = new Command() - { - private static final long serialVersionUID = -3868616119471172026L; - - public void execute() - { - String con = card.getController(); - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - if(con.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(targetInput); - else if(list.size() != 0) - { - Card target = CardFactoryUtil.AI_getBestCreature(list); - ability.setTargetCard(target); - AllZone.Stack.add(ability); - } - }//execute() - }; - card.addDestroyCommand(destroy); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Angelic Blessing")) + else if(cardName.equals("Angelic Blessing")) { SpellAbility spell = new Spell(card) { @@ -12985,95 +4800,9 @@ final Input target = new Input() }//*************** END ************ END ************************** -/* - - //*************** START *********** START ************************** - if(cardName.equals("Molten Rain")) - { - final SpellAbility spell = new Spell(card) - { - public boolean canPlayAI() - { - CardList land = new CardList(AllZone.Human_Play.getCards()); - land = land.getType("Basic"); - return land.size() != 0; - } - - public void chooseTargetAI() - { - //target basic land that Human only has 1 or 2 in play - CardList land = new CardList(AllZone.Human_Play.getCards()); - land = land.getType("Basic"); - - Card target = null; - - String[] name = {"Forest", "Swamp", "Plains", "Mountain", "Island"}; - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 1) - { - target = land.getName(name[i]).get(0); - break; - } - - //see if there are only 2 lands of the same type - if(target == null) - { - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 2) - { - target = land.getName(name[i]).get(0); - break; - } - }//if - if(target == null) - { - land.shuffle(); - target = land.get(0); - } - setTargetCard(target); - }//chooseTargetAI() - - public void resolve() - { - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c)) - { - AllZone.GameAction.destroy(c); - - if(! c.getType().contains("Basic")) - AllZone.GameAction.getPlayerLife(c.getController()).subtractLife(2); - } - }//resolve() - - };//Spell - card.clearSpellAbility(); - card.addSpellAbility(spell); - - Input target = new Input() - { - public void showMessage() - { - AllZone.Display.showMessage("Select target Land"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - if(card.isLand() && zone.is(Constant.Zone.Play)) - { - spell.setTargetCard(card); - stopSetNext(new Input_PayManaCost(spell)); - } - }//selectCard() - }; - spell.setBeforePayMana(target); - }//*************** END ************ END ************************** - -*/ - //*************** START *********** START ************************** - if (cardName.equals("Molten Rain")) + else if (cardName.equals("Molten Rain")) { final SpellAbility spell = new Spell(card) { @@ -13099,95 +4828,8 @@ final Input target = new Input() }// *************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Elvish Piper")) - { - final SpellAbility ability = new Ability_Tap(card, "G") - { - private static final long serialVersionUID = 8788555124182810249L; - - public boolean canPlayAI() {return getCreature().size() != 0;} - public void chooseTargetAI() - { - card.tap(); - Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); - setTargetCard(target); - } - CardList getCreature() - { - CardList list = new CardList(AllZone.Computer_Hand.getCards()); - list = list.getType("Creature"); - return list; - } - - public void resolve() - { - Card c = getTargetCard(); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - if(AllZone.GameAction.isCardInZone(c, hand)) - { - hand.remove(c); - play.add(c); - } - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("G, tap: Put a creature card from your hand into play."); - - final Command paid = new Command() - { - private static final long serialVersionUID = 6859737530872573139L; - public void execute() - { - AllZone.InputControl.resetInput(); - AllZone.Stack.add(ability); - } - }; - final Command unpaid = new Command() - { - private static final long serialVersionUID = -257927480355704167L; - - public void execute() - { - card.untap(); - } - }; - final Input target = new Input() - { - private static final long serialVersionUID = -1041198540673942649L; - - public void showMessage() - { - ButtonUtil.enableOnlyCancel(); - AllZone.Display.showMessage("Select creature from your hand to put into play"); - } - public void selectCard(Card c, PlayerZone zone) - { - if(c.isCreature() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) - { - card.tap(); - - ability.setTargetCard(c);//since setTargetCard() changes stack description - ability.setStackDescription("Put into play " +c); - - AllZone.InputControl.setInput(new Input_PayManaCost_Ability(ability.getManaCost(), paid, unpaid)); - } - } - public void selectButtonCancel() - { - card.untap(); - stop(); - } - };//Input target - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Belbe's Portal")) + else if(cardName.equals("Belbe's Portal")) { final SpellAbility ability = new Ability_Tap(card, "3") { @@ -13274,815 +4916,8 @@ final Input target = new Input() - - //*************** START *********** START ************************** - if(cardName.equals("Weathered Wayfarer")) - { - final SpellAbility ability = new Ability_Tap(card, "W") - { - private static final long serialVersionUID = 2902408879239353813L; - - public void resolve() - { - //getTargetCard() will NEVER be null - - //checks to see if card is still in the library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), library)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - } - }//resolve() - public boolean canPlay() - { - String oppPlayer = AllZone.GameAction.getOpponent(card.getController()); - - PlayerZone selfZone = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone oppZone = AllZone.getZone(Constant.Zone.Play, oppPlayer); - - CardList self = new CardList(selfZone.getCards()); - CardList opp = new CardList(oppZone.getCards()); - - self = self.getType("Land"); - opp = opp.getType("Land"); - - //checks to see if any land in library - PlayerZone selfLibrary = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList library = new CardList(selfLibrary.getCards()); - library = library.getType("Land"); - - return (self.size() < opp.size()) && (library.size() != 0) && super.canPlay(); - } - public void chooseTargetAI() - { - PlayerZone selfLibrary = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList library = new CardList(selfLibrary.getCards()); - library = library.getType("Land"); - - setTargetCard(library.get(0)); - } - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = 3492362297282622857L; - - public void showMessage() - { - CardList land = new CardList(AllZone.Human_Library.getCards()); - land = land.getType("Land"); - Object o = AllZone.Display.getChoiceOptional("Select a Land", land.toArray()); - - //techincally not correct, but correct enough - //this allows players to look at their decks without paying anything - if(o == null) - stop(); - else - { - AllZone.GameAction.shuffle("Human"); - ability.setTargetCard((Card)o); - stopSetNext(new Input_PayManaCost(ability)); - } - }//showMessage() - };//Input - target - - card.addSpellAbility(ability); - ability.setDescription("W, tap: Search your library for a land card, reveal it, and put it into your hand. Then shuffle your library. Play this ability only if an opponent controls more lands than you."); - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Disciple of Kangee")) - { - final SpellAbility ability = new Ability_Tap(card, "U") - { - private static final long serialVersionUID = -5169389637917649036L; - public boolean canPlayAI() - { - if(CardFactoryUtil.AI_doesCreatureAttack(card)) - return false; - - return CardFactoryUtil.AI_getHumanCreature("Flying", card, false).isEmpty() && - (getCreature().size() != 0); - } - public void chooseTargetAI() - { - card.tap(); - Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); - setTargetCard(target); - } - CardList getCreature() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && (!CardFactoryUtil.AI_doesCreatureAttack(c)) && - (! c.getKeyword().contains("Flying")) && CardFactoryUtil.canTarget(card, c); - } - }); - list.remove(card); - return list; - }//getCreature() - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - final Card[] creature = new Card[1]; - final Command EOT = new Command() - { - private static final long serialVersionUID = -1899153704584793548L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(creature[0])) - creature[0].removeExtrinsicKeyword("Flying"); - } - }; - creature[0] = getTargetCard(); - creature[0].addExtrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(EOT); - }//if (card is in play) - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("U, tap: Target creature gains flying."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Puppeteer")) - { - //tap - target creature - final SpellAbility ability = new Ability_Tap(card, "U") - { - private static final long serialVersionUID = 7698358771800336470L; - public boolean canPlayAI() {return getTapped().size() != 0;} - public void chooseTargetAI() - { - card.tap(); - Card target = CardFactoryUtil.AI_getBestCreature(getTapped()); - setTargetCard(target); - } - CardList getTapped() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && c.isTapped(); - } - }); - return list; - }//getTapped() - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - Card c = getTargetCard(); - if(c.isTapped()) - c.untap(); - else - c.tap(); - } - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("U, tap: Tap or untap target creature."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Sorceress Queen")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -6853184726011448677L; - public boolean canPlayAI() - { - Card c = getCreature(); - if(c == null) - return false; - else - { - setTargetCard(c); - return true; - } - }//canPlayAI() - //may return null - public Card getCreature() - { - CardList untapped = CardFactoryUtil.AI_getHumanCreature(card, true); - untapped = untapped.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isUntapped() && 2 < c.getNetDefense() && c != card; - } - }); - if(untapped.isEmpty()) - return null; - - Card big = CardFactoryUtil.AI_getBestCreature(untapped); - return big; - } - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - final Card[] creature = new Card[1]; - - creature[0] = getTargetCard(); - final int[] originalAttack = {creature[0].getBaseAttack()}; - final int[] originalDefense = {creature[0].getBaseDefense()}; - - creature[0].setBaseAttack(0); - creature[0].setBaseDefense(2); - - final Command EOT = new Command() - { - private static final long serialVersionUID = 6437463765161964445L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(creature[0])) - { - creature[0].setBaseAttack(originalAttack[0]); - creature[0].setBaseDefense(originalDefense[0]); - } - } - }; - AllZone.EndOfTurn.addUntil(EOT); - }//is card in play? - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Target creature other than Sorceress Queen becomes 0/2 until end of turn."); - //this ability can target "this card" when it shouldn't be able to - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility_NoTargetSelf(ability)); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Immaculate Magistrate")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 8976980151320100343L; - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList list = new CardList(zone.getCards()); - int nElf = list.getType("Elf").size(); - - Card c = getTargetCard(); - c.addCounter(Counters.P1P1, nElf); - - }//is card in play? - }//resolve() - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isUntapped() && !c.equals(card) && c.isCreature(); - } - }); - - if(list.isEmpty()) - return false; - - list.shuffle(); - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Put a +1/+1 counter on target creature for each Elf you control."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - /* - //*************** START *********** START ************************** - if(cardName.equals("Prodigal Sorcerer") || cardName.equals("Prodigal Pyromancer") - || cardName.equals("Razorfin Hunter") || cardName.equals("Vulshok Sorcerer") - || cardName.equals("Viashino Fangtail") || cardName.equals("Jeska, Warrior Adept")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -7560349014757367722L; - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); - list.shuffle(); - - if(list.isEmpty() || AllZone.Human_Life.getLife() < 5) - setTargetPlayer(Constant.Player.Human); - else - setTargetCard(list.get(0)); - } - public void resolve() - { - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - getTargetCard().addDamage(1); - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: " +card.getName() +" deals 1 damage to target creature or player."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if (cardName.equals("Anaba Shaman")) - { - final Ability_Tap ability = new Ability_Tap(card, "R") - { - private static final long serialVersionUID = -3954988810589187088L; - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); - list.shuffle(); - - if(list.isEmpty() || AllZone.Human_Life.getLife() < 5) - setTargetPlayer(Constant.Player.Human); - else - setTargetCard(list.get(0)); - } - public void resolve() - { - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - getTargetCard().addDamage(1); - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("R, tap: " +card.getName() +" deals 1 damage to target creature or player."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); - - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Kamahl, Pit Fighter")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 6922727343642792543L; - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - boolean b = true; - - //use ability only if no human creatures can block - for(int i = 0; i < list.size(); i++) - if(list.get(i).isUntapped()) - b = false; - - return b || AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(3, card, true); - list.shuffle(); - - if(list.isEmpty() || AllZone.Human_Life.getLife() < 17) - setTargetPlayer(Constant.Player.Human); - else - setTargetCard(list.get(0)); - } - public void resolve() - { - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - getTargetCard().addDamage(3); - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(3); - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: " +card.getName() +" deals 3 damage to target creature or player."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); - }//*************** END ************ END ************************** - - */ - - //*************** START *********** START ************************** - if(cardName.equals("Mawcor")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 6238678956434079L; - public boolean canPlayAI() - { - return AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - - public void chooseTargetAI() - { - setTargetPlayer(Constant.Player.Human); - } - public void resolve() - { - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - getTargetCard().addDamage(1); - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Mawcor deals 1 damage to target creature or player."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Orcish Artillery") || cardName.equals("Goblin Artillery") - || cardName.equals("Orcish Cannoneers")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -305363091630642003L; - public boolean canPlayAI() - { - return AllZone.Computer_Life.getLife() > 6; - } - - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); - list.shuffle(); - - if(list.isEmpty() || AllZone.Human_Life.getLife() < 5) - setTargetPlayer(Constant.Player.Human); - else - setTargetCard(list.get(0)); - } - public void resolve() - { - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - getTargetCard().addDamage(2); - //3 damage to self - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); - - if (card.getKeyword().contains("Lifelink")) - GameActionUtil.executeLifeLinkEffects(card, 5); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(card, 5); - - } - } - else - { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); - //3 damage to self - AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); - - if (card.getKeyword().contains("Lifelink")) - GameActionUtil.executeLifeLinkEffects(card, 5); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(card, 5); - } - - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: " +cardName + " deals 2 damage to target creature or player and 3 damage to you."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability,true)); - }//*************** END ************ END ************************** - - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Sparksmith")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 681102636956052363L; - public boolean canPlayAI() - { - int n = countGoblins(); - return (AllZone.Computer_Life.getLife() > n) && - (CardFactoryUtil.AI_getHumanCreature(n, card, true).size() != 0); - } - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(countGoblins(), card, true); - list.shuffle(); - setTargetCard(list.get(0)); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(countGoblins()); - - getTargetCard().addDamage(countGoblins()); - - if (card.getKeyword().contains("Lifelink")) - GameActionUtil.executeLifeLinkEffects(card, 2*countGoblins()); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(card, 2*countGoblins()); - } - }//resolve() - int countGoblins() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Goblin"); - return list.size(); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Sparksmith deals X damage to target creature and X damage to you, where X is the number of Goblins in play."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Rathi Assassin")) - { - final Ability_Tap ability = new Ability_Tap(card, "1 B B") - { - private static final long serialVersionUID = 1117792059002738977L; - public boolean canPlay() - { - return AllZone.GameAction.isCardInPlay(card) && !card.isTapped() && !card.hasSickness(); - } - public boolean canPlayAI() - { - CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); - human = human.filter(new CardListFilter() - { - public boolean addCard(Card c) {return c.isTapped() && !CardUtil.getColor(c).equals(Constant.Color.Black);} - }); - - CardListUtil.sortAttack(human); - CardListUtil.sortFlying(human); - - if(0 < human.size()) - setTargetCard(human.get(0)); - - return 0 < human.size(); - } - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c) && !CardUtil.getColor(c).equals(Constant.Color.Black) ) - { - AllZone.GameAction.destroy(c); - } - }//resolve() - };//SpellAbility - - /* - Input target = new Input() - { - public void showMessage() - { - AllZone.Display.showMessage("Select target tapped nonblack creature to destroy"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped() && ! CardUtil.getColor(c).equals(Constant.Color.Black) ) - { - //tap ability - card.tap(); - - ability.setTargetCard(c); - AllZone.Stack.add(ability); - stop(); - } - }//selectCard() - };//Input - */ - - ability.setBeforePayMana(new Input() - { - private static final long serialVersionUID = -7903295056497483023L; - - public void showMessage() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - CardList slivers = new CardList(AllZone.getZone(Constant.Zone.Play, opponent).getCards()); - slivers = slivers.filter(new CardListFilter() - { - - public boolean addCard(Card c) - { - PlayerZone zone = AllZone.getZone(c); - return c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped() && ! CardUtil.getColor(c).equals(Constant.Color.Black); - } - - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, slivers, "Select a tapped non-black creature", true)); - } - }); - - card.addSpellAbility(ability); - ability.setDescription("1 B B, tap: Destroy target tapped nonblack creature."); - //ability.setBeforePayMana(target); - //ability.setAfterPayMana(target); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Royal Assassin")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 1974437552336643722L; - public boolean canPlayAI() - { - CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); - human = human.filter(new CardListFilter() - { - public boolean addCard(Card c) {return c.isTapped();} - }); - - CardListUtil.sortAttack(human); - CardListUtil.sortFlying(human); - - if(0 < human.size()) - setTargetCard(human.get(0)); - - return 0 < human.size(); - } - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c) ) - { - AllZone.GameAction.destroy(c); - } - }//resolve() - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = -5894703805950364923L; - public void showMessage() - { - AllZone.Display.showMessage("Select target tapped creature to destroy"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(!CardFactoryUtil.canTarget(card, c)){ - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - else if(c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped()) - { - //tap ability - card.tap(); - - ability.setTargetCard(c); - AllZone.Stack.add(ability); - stop(); - } - }//selectCard() - };//Input - - card.addSpellAbility(ability); - ability.setDescription("tap: Destroy target tapped creature."); - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Giltspire Avenger")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -1117719063688165635L; - - public boolean canPlayAI() - { - return false; - } - - public boolean canPlay() - { - System.out.println("phase =" + AllZone.Phase.getPhase()); - if ((AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || - AllZone.Phase.getPhase().equals(Constant.Phase.End_Of_Turn)) && - !card.hasSickness() && card.isUntapped()) - return true; - else - return false; - - } - - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && (c.getDealtCombatDmgToOppThisTurn() || c.getDealtDmgToOppThisTurn()) - && CardFactoryUtil.canTarget(card, c) ) - { - AllZone.GameAction.destroy(c); - } - }//resolve() - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = -4946540988877576202L; - public void showMessage() - { - AllZone.Display.showMessage("Select target creature to destroy"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(!CardFactoryUtil.canTarget(card, c)){ - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - else if(c.isCreature() && zone.is(Constant.Zone.Play) && (c.getDealtCombatDmgToOppThisTurn() || - c.getDealtDmgToOppThisTurn()) ) - { - //tap ability - card.tap(); - - ability.setTargetCard(c); - AllZone.Stack.add(ability); - stop(); - } - }//selectCard() - };//Input - - card.addSpellAbility(ability); - ability.setDescription("tap: Destroy target creature that dealt damage to you this turn."); - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Hex")) + else if(cardName.equals("Hex")) { final Card[] target = new Card[6]; final int[] index = new int[1]; @@ -14161,112 +4996,9 @@ final Input target = new Input() spell.setBeforePayMana(runtime); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Vedalken Plotter")) - { - final Card[] target = new Card[2]; - final int[] index = new int[1]; - - final Ability ability = new Ability(card, "") - { - - private static final long serialVersionUID = -3075569295823682336L; - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - - Card crd0 = target[0]; - Card crd1 = target[1]; - - if (crd0 != null && crd1 != null) - { - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - - PlayerZone from0 = AllZone.getZone(crd0); - from0.remove(crd0); - PlayerZone from1 = AllZone.getZone(crd1); - from1.remove(crd1); - - crd0.setController(AllZone.GameAction.getOpponent(card.getController())); - crd1.setController(card.getController()); - - PlayerZone to0 = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(card.getController())); - to0.add(crd0); - PlayerZone to1 = AllZone.getZone(Constant.Zone.Play, card.getController()); - to1.add(crd1); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - } - - }//resolve() - };//SpellAbility - - - final Input input = new Input() - { - - private static final long serialVersionUID = -7143706716256752987L; - public void showMessage() - { - if(index[0] == 0) - AllZone.Display.showMessage("Select target land you control."); - else - AllZone.Display.showMessage("Select target land opponent controls."); - - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - //must target creature you control - if(index[0] == 0 && !c.getController().equals(card.getController())) - return; - - //must target creature you don't control - if(index[0] == 1 && c.getController().equals(card.getController())) - return; - - - if(c.isLand() && zone.is(Constant.Zone.Play) && CardFactoryUtil.canTarget(card, c)) - { - //System.out.println("c is: " +c); - target[index[0]] = c; - index[0]++; - showMessage(); - - if(index[0] == target.length) { - AllZone.Stack.add(ability); - stop(); - } - } - }//selectCard() - };//Input - - Command comesIntoPlay = new Command() - { - private static final long serialVersionUID = 6513203926272187582L; - - public void execute() { - index[0] = 0; - if(card.getController().equals(Constant.Player.Human)) - AllZone.InputControl.setInput(input); - } - }; - - //card.clearSpellAbility(); - ability.setStackDescription(cardName + " - Exchange control of target land you control and target land an opponent controls."); - card.addComesIntoPlayCommand(comesIntoPlay); - }//*************** END ************ END ************************** - - + //*************** START *********** START ************************** - if(cardName.equals("Political Trickery")) + else if(cardName.equals("Political Trickery")) { final Card[] target = new Card[2]; final int[] index = new int[1]; @@ -14369,7 +5101,7 @@ final Input target = new Input() //*************** START *********** START ************************** - if(cardName.equals("Peel from Reality")) + else if(cardName.equals("Peel from Reality")) { final Card[] target = new Card[2]; final int[] index = new int[1]; @@ -14452,7 +5184,7 @@ final Input target = new Input() //*************** START *********** START ************************** - if(cardName.equals("Ashes to Ashes")) + else if(cardName.equals("Ashes to Ashes")) { final Card[] target = new Card[2]; final int[] index = new int[1]; @@ -14548,1332 +5280,6 @@ final Input target = new Input() spell.setBeforePayMana(runtime); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Ramses Overdark")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = 3560953910041049722L; - - public boolean canPlayAI() - { - if(CardFactoryUtil.AI_doesCreatureAttack(card)) - return false; - - return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0; - } - public void chooseTargetAI() - { - CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true); - Card target = CardFactoryUtil.AI_getBestCreature(creature); - setTargetCard(target); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && getTargetCard().isEnchanted() ) - { - AllZone.GameAction.destroy(getTargetCard()); - } - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Destroy target enchanted creature."); - - Input runtime = new Input() - { - - private static final long serialVersionUID = 7538894357147291895L; - - public void showMessage() - { - CardList all = new CardList(); - all.addAll(AllZone.Human_Play.getCards()); - all.addAll(AllZone.Computer_Play.getCards()); - all = all.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return AllZone.GameAction.isCardInPlay(c) && c.isCreature() && CardFactoryUtil.canTarget(card, c) && c.isEnchanted(); - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all, "Destroy target enchanted creature.", true)); - } - }; - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Visara the Dreadful")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 6371765024236754171L; - - public boolean canPlayAI() - { - if(CardFactoryUtil.AI_doesCreatureAttack(card)) - return false; - - return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0; - } - public void chooseTargetAI() - { - CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true); - Card target = CardFactoryUtil.AI_getBestCreature(creature); - setTargetCard(target); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - AllZone.GameAction.destroyNoRegeneration(getTargetCard()); - } - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Destroy target creature. It can't be regenerated"); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Ethersworn Adjudicator")) - { - final Ability_Tap ability = new Ability_Tap(card, "1 W B") - { - private static final long serialVersionUID = 4160943954590944389L; - - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0){ - Card target = CardFactoryUtil.AI_getBestCreature(creature); - setTargetCard(target); - } - else - { - CardList enchantment = CardFactoryUtil.AI_getHumanEnchantment(card, true); - if (enchantment.size() > 0) - { - Card target = CardFactoryUtil.AI_getBestEnchantment(enchantment, card, true); - setTargetCard(target); - } - } - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - AllZone.GameAction.destroy(getTargetCard()); - } - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap, 1 W B: Destroy target creature or enchantment."); - - //ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - - Input runtime = new Input() - { - private static final long serialVersionUID = -8099713981623158814L; - - public void showMessage() - { - CardList all = new CardList(); - all.addAll(AllZone.Human_Play.getCards()); - all.addAll(AllZone.Computer_Play.getCards()); - all = all.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return (c.isEnchantment() || c.isCreature() ) && CardFactoryUtil.canTarget(card, c); - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all, "Destroy target creature or enchantment.", true)); - } - }; - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Wojek Embermage")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -1208482961653326721L; - public boolean canPlayAI() - { - return (CardFactoryUtil.AI_getHumanCreature(1, card, true).size() != 0) && - (AllZone.Phase.getPhase().equals(Constant.Phase.Main2)); - } - - public void chooseTargetAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); - list.shuffle(); - setTargetCard(list.get(0)); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - CardList list = getRadiance(getTargetCard()); - for(int i = 0; i < list.size(); i++) - list.get(i).addDamage(1); - } - }//resolve() - //parameter Card c, is included in CardList - //no multi-colored cards - CardList getRadiance(Card c) - { - String color = CardUtil.getColor(c); - if(color.equals(Constant.Color.Colorless)) - { - CardList list = new CardList(); - list.add(c); - return list; - } - - CardList sameColor = new CardList(); - - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - for(int i = 0; i < list.size(); i++) - if(CardUtil.getColor(list.get(i)).equals(color)) - sameColor.add(list.get(i)); - - return sameColor; - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("Radiance - tap: Wojek Embermage deals 1 damage to target creature and each other creature that shares a color with it."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Timberwatch Elf")) - { - final Card[] creature = new Card[1]; - final int[] pump = new int[1]; - final Command EOT = new Command() - { - private static final long serialVersionUID = -2764970883655205904L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(creature[0])) - { - creature[0].addTempAttackBoost(-pump[0]); - creature[0].addTempDefenseBoost(-pump[0]); - } - } - }; - - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -7536296719726210357L; - public boolean canPlayAI() - { - CardList c = getAttackers(); - if(c.isEmpty()) - return false; - else - { - setTargetCard(c.get(0)); - return true; - } - }//canPlayAI() - CardList getAttackers() - { - Card[] c = ComputerUtil.getAttackers().getAttackers(); - CardList list = new CardList(c); - list = list.filter(new CardListFilter(){ - - public boolean addCard(Card c) { - return CardFactoryUtil.canTarget(card, c); - } - - }); - - //remove "this card" from attackers, if it is there - list.remove(card); - list.shuffle(); - return list; - }//getAttackers() - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - creature[0] = getTargetCard(); - pump[0] = countElves(); - - creature[0].addTempAttackBoost(pump[0]); - creature[0].addTempDefenseBoost(pump[0]); - - AllZone.EndOfTurn.addUntil(EOT); - } - }//resolve() - int countElves() - { - CardList elf = new CardList(); - elf.addAll(AllZone.Human_Play.getCards()); - elf.addAll(AllZone.Computer_Play.getCards()); - - elf = elf.getType("Elf"); - return elf.size(); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Target creature gets +X/+X until end of turn, where X is the number of Elves in play."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Mad Auntie")) - { - final Card[] creature = new Card[1]; - final Command EOT = new Command() - { - private static final long serialVersionUID = -5143708900761432510L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(creature[0])) - { - creature[0].setShield(0); - } - } - }; - - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -1280855188535819509L; - public boolean canPlayAI() - { - return false; - }//canPlayAI() - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - getTargetCard().addShield(); - AllZone.EndOfTurn.addUntil(EOT); - } - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Regenerate another target Goblin."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Intrepid Hero")) - { - //tap ability - no cost - target creature - - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -7825416464364928117L; - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && - getTargetCard().getNetAttack() >= 4) - { - AllZone.GameAction.destroy(getTargetCard()); - } - }//resolve() - public boolean canPlayAI() - { - return getHumanCreatures().size() != 0; - } - public void chooseTargetAI() - { - CardList human = getHumanCreatures(); - human.shuffle(); - setTargetCard(human.get(0)); - } - CardList getHumanCreatures() - { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && 3 < c.getNetAttack(); - } - }); - return list; - } - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = -7024383930124942288L; - public void showMessage() - { - AllZone.Display.showMessage("Select target creature with power 4 or greater"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - if(card.isCreature() && zone.is(Constant.Zone.Play) && 3 < card.getNetAttack()) - { - ability.setTargetCard(card); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("tap: Destroy target creature with power 4 or greater."); - - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Tetsuo Umezawa")) - { - //tap ability - no cost - target creature - - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = -8034678094689484203L; - public void resolve() - { - CardList blockers = AllZone.Combat.getAllBlockers(); - - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && - (blockers.contains(getTargetCard()) || getTargetCard().isTapped()) ) - { - AllZone.GameAction.destroy(getTargetCard()); - } - }//resolve() - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input target = new Input() - { - - private static final long serialVersionUID = -1939019440028116051L; - public void showMessage() - { - AllZone.Display.showMessage("Select target tapped or blocking creature."); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - CardList blockers = AllZone.Combat.getAllBlockers(); - if(card.isCreature() && zone.is(Constant.Zone.Play) && - (blockers.contains(card) || card.isTapped()) ) - { - ability.setTargetCard(card); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("U B B R, Tap: Destroy target tapped or blocking creature."); - - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Tor Wauki")) - { - //tap ability - no cost - target creature - - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = -8034678094689484203L; - public void resolve() - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - CardList blockers = AllZone.Combat.getAllBlockers(); - - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && - (attackers.contains(getTargetCard()) || blockers.contains(getTargetCard()) ) ) - { - getTargetCard().addDamage(2); - } - }//resolve() - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input target = new Input() - { - - private static final long serialVersionUID = -1939019440028116051L; - public void showMessage() - { - AllZone.Display.showMessage("Select target attacking or blocking creature."); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - CardList blockers = AllZone.Combat.getAllBlockers(); - if(card.isCreature() && zone.is(Constant.Zone.Play) && - (attackers.contains(card) || blockers.contains(card) ) ) - { - ability.setTargetCard(card); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("tap: Tor Wauki deals 2 damage to target attacking or blocking creature."); - - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Lady Caleria")) - { - //tap ability - no cost - target creature - - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = -8034678094689484203L; - public void resolve() - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - CardList blockers = AllZone.Combat.getAllBlockers(); - - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && - (attackers.contains(getTargetCard()) || blockers.contains(getTargetCard()) ) ) - { - getTargetCard().addDamage(3); - } - }//resolve() - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input target = new Input() - { - - private static final long serialVersionUID = -1939019440028116051L; - public void showMessage() - { - AllZone.Display.showMessage("Select target attacking or blocking creature."); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - CardList blockers = AllZone.Combat.getAllBlockers(); - if(card.isCreature() && zone.is(Constant.Zone.Play) && - (attackers.contains(card) || blockers.contains(card) ) ) - { - ability.setTargetCard(card); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("tap: Lady Caleria deals 3 damage to target attacking or blocking creature."); - - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Femeref Archers")) - { - //tap ability - no cost - target creature - - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = -4369831076920644547L; - public void resolve() - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && - attackers.contains(getTargetCard()) && getTargetCard().getKeyword().contains("Flying")) - { - getTargetCard().addDamage(4); - } - }//resolve() - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input target = new Input() - { - - private static final long serialVersionUID = 3455890565752527632L; - public void showMessage() - { - AllZone.Display.showMessage("Select target attacking creature with flying."); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card card, PlayerZone zone) - { - CardList attackers = new CardList(AllZone.Combat.getAttackers()); - if(card.isCreature() && zone.is(Constant.Zone.Play) && card.getKeyword().contains("Flying") && - attackers.contains(card)) - { - ability.setTargetCard(card); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("tap: Femeref Archers deals 4 damage to target attacking creature with flying."); - - ability.setBeforePayMana(target); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Adarkar Valkyrie")) - { - //tap ability - no cost - target creature - EOT - - final Card[] target = new Card[1]; - - final Command destroy = new Command() - { - private static final long serialVersionUID = -2433442359225521472L; - - public void execute() - { - AllZone.Stack.add(new Ability(card, "0", "Return " +target[0] +" from graveyard to play") - { - public void resolve() - { - PlayerZone grave = AllZone.getZone(target[0]); - //checks to see if card is still in the graveyard - if(AllZone.GameAction.isCardInZone(target[0], grave)) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - AllZone.GameAction.moveTo(play, target[0]); - target[0].setController(card.getController()); - } - } - }); - }//execute() - }; - - final Command untilEOT = new Command() - { - private static final long serialVersionUID = 2777978927867867610L; - - public void execute() - { - //resets the Card destroy Command - //target[0].addDestroy(Command.Blank); - target[0].removeDestroyCommand(destroy); - - } - }; - - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -8454685126878522607L; - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard())) - { - target[0] = getTargetCard(); - AllZone.EndOfTurn.addUntil(untilEOT); - - //when destroyed, return to play - //add triggered ability to target card - target[0].addDestroyCommand(destroy); - }//if - }//resolve() - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input targetInput = new Input() - { - private static final long serialVersionUID = 913860087744941946L; - public void showMessage() - { - AllZone.Display.showMessage("Select target non-token creature other than this card"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - //must target non-token creature, and cannot target itself - if(c.isCreature() && (!c.isToken()) && (!c.equals(card))) - { - ability.setTargetCard(c); - stopSetNext(new Input_NoCost_TapAbility(ability)); - } - } - }; - - card.addSpellAbility(ability); - ability.setDescription("tap: When target creature other than Adarkar Valkyrie is put into a graveyard this turn, return that card to play under your control."); - - ability.setBeforePayMana(targetInput); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Imperious Perfect")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "G") - { - private static final long serialVersionUID = -3266607637871879336L; - - public boolean canPlayAI() - { - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2); - } - public void chooseTargetAI() {card.tap();} - - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Elf Warrior"); - c.setImageName("G 1 1 Elf Warrior"); - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Elf"); - c.addType("Warrior"); - - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - - ability.setDescription("G, tap: Put a 1/1 green Elf Warrior creature token into play."); - ability.setStackDescription("Imperious Perfect - Put a 1/1 green Elf Warrior creature token into play."); - ability.setBeforePayMana(new Input_PayManaCost(ability)); - }//*************** END ************ END ************************** - - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Wall of Kelp")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "U U") - { - private static final long serialVersionUID = 2893813929304858905L; - - public boolean canPlayAI() - { - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2); - } - public void chooseTargetAI() {card.tap();} - - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Kelp"); - c.setManaCost("U"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Plant"); - c.addType("Wall"); - c.addIntrinsicKeyword("Defender"); - - c.setBaseAttack(0); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - - ability.setDescription("UU, tap: Put a 0/1 blue Kelp Wall creature token with defender into play."); - ability.setStackDescription("Wall of Kelp - Put a 0/1 blue Kelp Wall creature token with defender into play"); - ability.setBeforePayMana(new Input_PayManaCost(ability)); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Vedalken Mastermind")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "U") - { - private static final long serialVersionUID = -6131368241135911606L; - - public boolean canPlayAI() {return false;} - - public void resolve() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetCard().getOwner()); - AllZone.GameAction.moveTo(hand, getTargetCard()); - - if (getTargetCard().isToken()) - hand.remove(getTargetCard()); - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = -5218098811060156481L; - - public void showMessage() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList choice = new CardList(play.getCards()); - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, choice, "Select a permanent you control.", true)); - } - }; - card.addSpellAbility(ability); - ability.setDescription("U, tap: Return target permanent you control to its owner's hand."); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Helldozer")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "B B B") - { - private static final long serialVersionUID = 6426884086364885861L; - - public boolean canPlayAI() - { - if(CardFactoryUtil.AI_doesCreatureAttack(card)) - return false; - - CardList land = new CardList(AllZone.Human_Play.getCards()); - land = land.getType("Land"); - return land.size() != 0; - } - - public void chooseTargetAI() - { - card.tap(); - - //target basic land that Human only has 1 or 2 in play - CardList land = new CardList(AllZone.Human_Play.getCards()); - land = land.getType("Land"); - - Card target = null; - - String[] name = {"Forest", "Swamp", "Plains", "Mountain", "Island"}; - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 1) - { - target = land.getName(name[i]).get(0); - break; - } - - //see if there are only 2 lands of the same type - if(target == null) - { - for(int i = 0; i < name.length; i++) - if(land.getName(name[i]).size() == 2) - { - target = land.getName(name[i]).get(0); - break; - } - }//if - if(target == null) - { - land.shuffle(); - target = land.get(0); - } - setTargetCard(target); - }//chooseTargetAI() - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - AllZone.GameAction.destroy(getTargetCard()); - - //if non-basic, untap Helldozer - if(! getTargetCard().getType().contains("Basic")) - card.untap(); - } - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("BBB, tap: Destroy target land. If that land is nonbasic, untap Helldozer."); - ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Land")); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Cao Cao, Lord of Wei")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "0") - { - private static final long serialVersionUID = 6760838700101179614L; - public void chooseTargetAI() {card.tap();} - public boolean canPlayAI() - { - int hand = AllZone.Human_Hand.getCards().length; - if((! CardFactoryUtil.AI_doesCreatureAttack(card)) && hand != 0) - return true; - - return 2 <= hand; - } - - public void resolve() - { - String player = AllZone.GameAction.getOpponent(card.getController()); - - if(player.equals(Constant.Player.Human)) - AllZone.InputControl.setInput(CardFactoryUtil.input_discard(2)); - else - { - AllZone.GameAction.discardRandom(player); - AllZone.GameAction.discardRandom(player); - } - }//resolve() - public boolean canPlay() - { - String opp = AllZone.GameAction.getOpponent(card.getController()); - setStackDescription(card.getName() +" - " +opp +" discards 2 cards"); - - String phase = AllZone.Phase.getPhase(); - String activePlayer = AllZone.Phase.getActivePlayer(); - - return super.canPlay() && - phase.equals(Constant.Phase.Main1) && - card.getController().equals(activePlayer); - } - };//SpellAbility - - ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); - ability.setDescription("tap: Target opponent discards two cards. Play this ability only during your turn, before the combat phase."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Gwendlyn Di Corci")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "0") - { - - private static final long serialVersionUID = -4211234606012596777L; - public void chooseTargetAI() {setTargetPlayer(Constant.Player.Human); } - public boolean canPlayAI() - { - int hand = AllZone.Human_Hand.getCards().length; - return hand > 0; - } - - public void resolve() - { - String player = getTargetPlayer(); - - AllZone.GameAction.discardRandom(player); - - }//resolve() - public boolean canPlay() - { - setStackDescription(card.getName() +" - " +getTargetPlayer() +" discards a card at random."); - - String activePlayer = AllZone.Phase.getActivePlayer(); - - return super.canPlay() && - card.getController().equals(activePlayer); - } - };//SpellAbility - - Input input = new Input() - { - private static final long serialVersionUID = 3312693459353844120L; - - public void showMessage() - { - //prevents this from running multiple times, which it is for some reason - if(ability.getSourceCard().isUntapped()) - { - ability.getSourceCard().tap(); - stopSetNext(CardFactoryUtil.input_targetPlayer(ability)); - } - } - }; - - ability.setDescription("Tap: Target player discards a card at random. Activate this ability only during your turn."); - ability.setBeforePayMana(input); - //ability.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability)); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Xira Arien")) - { - //mana tap ability - final Ability_Tap ability = new Ability_Tap(card, "G R B") - { - - private static final long serialVersionUID = 5373361883064666451L; - public void chooseTargetAI() {setTargetPlayer(Constant.Player.Computer);} - public boolean canPlayAI() - { - int hand = AllZone.Computer_Hand.getCards().length; - int lib = AllZone.Computer_Library.getCards().length; - return hand < 6 && lib > 0; - } - - public void resolve() - { - String player = getTargetPlayer(); - - AllZone.GameAction.drawCard(player); - - }//resolve() - public boolean canPlay() - { - - setStackDescription(card.getName() +" - " +getTargetPlayer() +" discards a card at random."); - - return super.canPlay(); - } - };//SpellAbility - - ability.setDescription("Tap: Target player draws a card."); - //ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - ability.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability)); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Wayward Soul")) - { - //mana ability - final Ability ability = new Ability(card, "U") - { - public boolean canPlayAI() {return false;} - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card) ) - { - card.setBaseAttack(3); - card.setBaseDefense(2); - card.setIntrinsicKeyword(new ArrayList()); - card.addIntrinsicKeyword("Flying"); - - card.setAssignedDamage(0); - card.setDamage(0); - card.untap(); - AllZone.getZone(card).remove(card); - - //put card on top of library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); - library.add(card, 0); - } - }//resolve() - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 1469011418219527227L; - - public void showMessage() - { - ability.setStackDescription("Put " +card +" on top of its owner's library"); - - stopSetNext(new Input_PayManaCost(ability)); - } - }; - ability.setDescription("U: Put Wayward Soul on top of its owner's library."); - ability.setStackDescription("Put Wayward Soul on top of its owner's library."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Coastal Hornclaw")) - { - //sacrifice ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = 7538741250040204529L; - - public void execute() - { - card.removeIntrinsicKeyword("Flying"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - CardList land = new CardList(AllZone.Computer_Play.getCards()); - land = land.getType("Land"); - - CardList canBlock = CardFactoryUtil.AI_getHumanCreature(card, true); - canBlock = canBlock.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isUntapped(); - } - }); - - return (land.size() != 0) && - (! card.getKeyword().contains("Flying")) && - CardFactoryUtil.AI_getHumanCreature("Flying", card, false).isEmpty() && - (! card.hasSickness()) && - (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); - } - - public void chooseTargetAI() - { - CardList land = new CardList(AllZone.Computer_Play.getCards()); - land = land.getType("Land"); - land.shuffle(); - AllZone.GameAction.sacrifice(land.get(0)); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = 4874019210748846864L; - - public void showMessage() - { - ability.setStackDescription(card +" gains flying until EOT."); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList choice = new CardList(play.getCards()); - choice = choice.getType("Land"); - stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a land to sacrifice.")); - } - }; - ability.setStackDescription(card +" gains flying until end of turn."); - ability.setDescription("Sacrifice a land: Coastal Hornclaw gains flying until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Spitting Spider")) - { - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && c.getKeyword().contains("Flying"); - } - }); - - for(int i = 0; i < list.size(); i++) - list.get(i).addDamage(1); - }//resolve() - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 2004031367305867525L; - - public void showMessage() - { - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList choice = new CardList(play.getCards()); - choice = choice.getType("Land"); - stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a land to sacrifice.")); - } - }; - ability.setStackDescription(card +" deals 1 damage to each creature with flying."); - ability.setDescription("Sacrifice a land: Spitting Spider deals 1 damage to each creature with flying."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Killer Whale")) - { - final Ability ability = new Ability(card, "U") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -8494294720368074013L; - - public void execute() - { - card.removeIntrinsicKeyword("Flying"); - } - }; - - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - ability.setStackDescription(card +" gains flying until end of turn."); - ability.setDescription("U: Killer Whale gains flying until end of turn."); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** // *************** START *********** START ************************** if (cardName.equals("Lay Waste") || cardName.equals("Stone Rain") @@ -15937,497 +5343,10 @@ final Input target = new Input() return card; }// *************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Obsidian Fireheart")) - { - final Ability ability = new Ability(card, "1 R R") - { - public void resolve() { - Card c = getTargetCard(); - - if (AllZone.GameAction.isCardInPlay(c) && c.isLand() && (c.getCounters(Counters.BLAZE)==0) ) - c.addCounter(Counters.BLAZE, 1); - - } - public boolean canPlayAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList land = new CardList(play.getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isLand() && c.getCounters(Counters.BLAZE) < 1; - } - }); - - if (land.size() > 0) - setTargetCard(land.get(0)); - - return land.size() > 0; - } - - }; - - ability.setDescription("1 R R: Put a blaze counter on target land without a blaze counter on it. For as long as that land has a blaze counter on it, it has \"At the beginning of your upkeep, this land deals 1 damage to you.\" (The land continues to burn after Obsidian Fireheart has left the battlefield.)"); - ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Land")); - card.addSpellAbility(ability); - - }// *************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Glint-Eye Nephilim")) - { - final Command untilEOT = new Command() - { - private static final long serialVersionUID = 5790680475821014099L; - - public void execute() - { - card.addTempAttackBoost(-1); - card.addTempDefenseBoost(-1); - } - }; - - final Ability ability = new Ability(card, "1") - { - public boolean canPlayAI() - { - Card[] hand = AllZone.Computer_Hand.getCards(); - return CardFactoryUtil.AI_doesCreatureAttack(card) && (hand.length != 0); - } - public void chooseTargetAI() {AllZone.GameAction.discardRandom(Constant.Player.Computer);} - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card) ) - { - card.addTempAttackBoost(1); - card.addTempDefenseBoost(1); - - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = -4302110760957471033L; - - public void showMessage() - { - ability.setStackDescription(card +" gets +1/+1 until EOT."); - //stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a card to discard.")); - stopSetNext(CardFactoryUtil.input_discard(ability, 1)); - - } - }; - ability.setStackDescription(card +" gets +1/+1 until end of turn."); - ability.setDescription("1, Discard a card: Glint-Eye Nephilim gets +1/+1 until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Wild Mongrel")) - { - //sacrifice ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -5563743272875711445L; - - public void execute() - { - card.addTempAttackBoost(-1); - card.addTempDefenseBoost(-1); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - Card[] hand = AllZone.Computer_Hand.getCards(); - return CardFactoryUtil.AI_doesCreatureAttack(card) && (hand.length > 3); - } - public void chooseTargetAI() {AllZone.GameAction.discardRandom(Constant.Player.Computer);} - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addTempAttackBoost(1); - card.addTempDefenseBoost(1); - - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = -4209163355325441624L; - - public void showMessage() - { - ability.setStackDescription(card +" gets +1/+1 until EOT."); - //stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a card to discard.")); - stopSetNext(CardFactoryUtil.input_discard(ability, 1)); - //AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - } - }; - ability.setStackDescription(card +" gets +1/+1 until end of turn."); - ability.setDescription("Discard a card: Wild Mongrel gets +1/+1 until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Hell-Bent Raider")) - { - final Command untilEOT = new Command() - { - - private static final long serialVersionUID = -2693050198371979012L; - - public void execute() - { - card.removeIntrinsicKeyword("Protection from white"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - return false; - } - - public void resolve() - { - AllZone.GameAction.discardRandom(card.getController()); - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Protection from white"); - - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - ability.setStackDescription(card +" gets Protection from white until end of turn."); - ability.setDescription("Discard a card at random: Hell-Bent Raider gets protection from white until end of turn."); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Whiptongue Frog")) - { - //mana ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -2693050198371979012L; - - public void execute() - { - card.removeIntrinsicKeyword("Flying"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "U") - { - public boolean canPlayAI() - { - return (! card.hasSickness()) && - (! card.getKeyword().contains("Flying")) && - (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = 1268037036474796569L; - - public void showMessage() - { - ability.setStackDescription(card +" gains flying until EOT."); - stopSetNext(new Input_PayManaCost(ability)); - } - }; - ability.setStackDescription("Whiptongue Frog gains flying until EOT."); - ability.setDescription("U: Whiptongue Frog gains flying until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Sarcomite Myr")) - { - //mana ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -1726670429352834671L; - - public void execute() - { - card.removeIntrinsicKeyword("Flying"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "2") - { - public boolean canPlayAI() - { - return (! card.hasSickness()) && - (! card.getKeyword().contains("Flying")) && - (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); - } - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = -685958984421033465L; - - public void showMessage() - { - ability.setStackDescription(card +" gains flying until EOT."); - stopSetNext(new Input_PayManaCost(ability)); - } - }; - ability.setStackDescription(card +" - gains flying until EOT."); - ability.setDescription("2: Sarcomite Myr gains flying until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - - //ability 2 - final Ability ability2 = new Ability(card, "2") - { - public boolean canPlayAI() - { - return false; - } - - public void resolve() - { - AllZone.GameAction.drawCard(card.getController()); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability2); - ability2.setDescription("2, Sacrifice Sarcomite Myr: Draw a card."); - ability2.setStackDescription("Sarcomite Myr - draw a card"); - ability2.setBeforePayMana(new Input_PayManaCost_Ability(ability2.getManaCost(), new Command() - { - private static final long serialVersionUID = -4357239016463815380L; - - public void execute() - { - AllZone.GameAction.sacrifice(card); - AllZone.Stack.add(ability2); - } - })); - - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Goblin Balloon Brigade")) - { - //mana ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = 3574792977266468264L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(card)) - card.removeIntrinsicKeyword("Flying"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "R") - { - public boolean canPlayAI() - { - CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, false); - return flying.isEmpty() && - (! card.hasSickness()) && - (! card.getKeyword().contains("Flying")) && - (! CardFactoryUtil.AI_getHumanCreature(card, true).isEmpty()); - } - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = 7757347395564372034L; - - public void showMessage() - { - ability.setStackDescription(card +" gains flying until EOT."); - stopSetNext(new Input_PayManaCost(ability)); - } - }; - ability.setStackDescription("Goblin Balloon Brigade gains flying until EOT."); - ability.setDescription("R: Goblin Balloon Brigade gains flying until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Manta Riders")) - { - //mana ability - targets itself - until EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -8732007889935536106L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(card)) - card.removeIntrinsicKeyword("Flying"); - } - }; - - //mana tap ability - final Ability ability = new Ability(card, "U") - { - public boolean canPlayAI() - { - CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, false); - return flying.isEmpty() && - (! card.hasSickness()) && - (! card.getKeyword().contains("Flying")) && - (! CardFactoryUtil.AI_getHumanCreature(card, true).isEmpty()); - } - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.addIntrinsicKeyword("Flying"); - AllZone.EndOfTurn.addUntil(untilEOT); - } - }//resolve() - };//SpellAbility - - - Input runtime = new Input() - { - private static final long serialVersionUID = -3889041123558196949L; - - public void showMessage() - { - ability.setStackDescription(card +" gains flying until EOT."); - stopSetNext(new Input_PayManaCost(ability)); - } - }; - ability.setStackDescription(card.getName() +" gains flying until EOT."); - ability.setDescription("U: Manta Riders gains flying until end of turn."); - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Turtleshell Changeling")) - { - //mana ability - targets itself - until EOT - //mana ability - final Ability ability = new Ability(card, "1 U") - { - public boolean canPlayAI() - { - return CardFactoryUtil.AI_doesCreatureAttack(card) && card.getNetAttack() == 1; - } - public void resolve() - { - //in case ability is played twice - final int[] oldAttack = new int[1]; - final int[] oldDefense = new int[1]; - - oldAttack[0] = card.getBaseAttack(); - oldDefense[0] = card.getBaseDefense(); - - card.setBaseAttack(oldDefense[0]); - card.setBaseDefense(oldAttack[0]); - - //EOT - final Command untilEOT = new Command() - { - private static final long serialVersionUID = -5494886974452901728L; - - public void execute() - { - card.setBaseAttack(oldAttack[0]); - card.setBaseDefense(oldDefense[0]); - } - }; - - AllZone.EndOfTurn.addUntil(untilEOT); - }//resolve() - };//SpellAbility - - - ability.setStackDescription(card +" - switch power and toughness until EOT."); - ability.setDescription("1 U: Switch Turtleshell Changeling's power and toughness until end of turn."); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Wings of Velis Vel")) + else if(cardName.equals("Wings of Velis Vel")) { final SpellAbility spell = new Spell(card) { @@ -16492,3236 +5411,8 @@ final Input target = new Input() }//*************** END ************ END ************************** - -/* //*************** START *********** START ************************** -if(cardName.equals("Epic Proportions")) -{ - final SpellAbility spell = new Spell(card) - { - private static final long serialVersionUID = 358340213887424783L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - public void resolve() - { - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - c.addSemiPermanentAttackBoost(5); - c.addSemiPermanentDefenseBoost(5); - c.addExtrinsicKeyword("Trample"); - } - }//resolve() - };//SpellAbility - card.clearSpellAbility(); - card.addSpellAbility(spell); - - spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); -}//*************** END ************ END ************************** - -*/ - - - - -//*************** START *********** START ************************** -if(cardName.equals("Epic Proportions")) -{ - final SpellAbility spell = new Spell(card) - { - private static final long serialVersionUID = 358340213887424783L; - - public boolean canPlay() - { - return true; // for flash, which is not working through the keyword for some reason - } - - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(card); - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - { - card.enchantCard(c); - System.out.println("Enchanted: " +getTargetCard()); - } - }//resolve() - };//SpellAbility - card.clearSpellAbility(); - card.addSpellAbility(spell); - - Command onEnchant = new Command() - { - private static final long serialVersionUID = 5133552158526053493L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - crd.addExtrinsicKeyword("Trample"); - crd.addSemiPermanentAttackBoost(5); - crd.addSemiPermanentDefenseBoost(5); - } - }//execute() - };//Command - - - Command onUnEnchant = new Command() - { - private static final long serialVersionUID = -2404250578944336031L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - crd.removeExtrinsicKeyword("Trample"); - crd.addSemiPermanentAttackBoost(-5); - crd.addSemiPermanentDefenseBoost(-5); - } - - }//execute() - };//Command - - Command onLeavesPlay = new Command() - { - private static final long serialVersionUID = -6076263565995301138L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - card.unEnchantCard(crd); - } - } - }; - - card.addEnchantCommand(onEnchant); - card.addUnEnchantCommand(onUnEnchant); - card.addLeavesPlayCommand(onLeavesPlay); - - spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); -}//*************** END ************ END ************************** - -//*************** START *********** START ************************** -if(cardName.equals("Mythic Proportions")) -{ - final SpellAbility spell = new Spell(card) - { - - private static final long serialVersionUID = 4227124619270545652L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(card); - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - { - card.enchantCard(c); - System.out.println("Enchanted: " +getTargetCard()); - } - }//resolve() - };//SpellAbility - card.clearSpellAbility(); - card.addSpellAbility(spell); - - Command onEnchant = new Command() - { - private static final long serialVersionUID = -6642467768059387172L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - crd.addExtrinsicKeyword("Trample"); - crd.addSemiPermanentAttackBoost(8); - crd.addSemiPermanentDefenseBoost(8); - } - }//execute() - };//Command - - - Command onUnEnchant = new Command() - { - - private static final long serialVersionUID = 3550678810412528973L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - crd.removeExtrinsicKeyword("Trample"); - crd.addSemiPermanentAttackBoost(-8); - crd.addSemiPermanentDefenseBoost(-8); - } - - }//execute() - };//Command - - Command onLeavesPlay = new Command() - { - private static final long serialVersionUID = -8590925715809196436L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - card.unEnchantCard(crd); - } - } - }; - - card.addEnchantCommand(onEnchant); - card.addUnEnchantCommand(onUnEnchant); - card.addLeavesPlayCommand(onLeavesPlay); - - spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); -}//*************** END ************ END ************************** - -//*************** START *********** START ************************** -if(cardName.equals("Nimbus Wings")) -{ - final SpellAbility spell = new Spell(card) - { - - - private static final long serialVersionUID = -4759884801420518565L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - for (int i=0;i 0) - { - setTargetCard(stuffy.get(0)); - return true; - } - else - { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - for (int i=0;i= list.get(i).getNetDefense()) && list.get(i).getNetAttack() >= 3) - { - setTargetCard(list.get(i)); - return true; - } - } - } - return false; - - }//canPlayAI() - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(card); - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - card.enchantCard(c); - - }//resolve() - };//SpellAbility - card.clearSpellAbility(); - card.addSpellAbility(spell); - - - spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); -}//*************** END ************ END ************************** - -//*************** START *********** START ************************** -if(cardName.equals("Cessation")) -{ - final SpellAbility spell = new Spell(card) - { - - private static final long serialVersionUID = 3681531440398159146L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.getType("Creature"); - - if(list.isEmpty()) - return false; - - //else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); - - for (int i=0;i 0 && AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - - }//canPlay() - public void resolve() - { - if(owner.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void computerResolve() - { - CardList play = new CardList(AllZone.Computer_Play.getCards()); - play = play.getType("Basic"); - - CardList library = new CardList(AllZone.Computer_Library.getCards()); - library = library.getType("Basic"); - - //this shouldn't happen, but it is defensive programming, haha - if(library.isEmpty()) - return; - - Card land = null; - - //try to find a basic land that isn't in play - for(int i = 0; i < library.size(); i++) - if(! play.containsName(library.get(i))) - { - land = library.get(i); - break; - } - - //if not found - //library will have at least 1 basic land because canPlay() checks that - if(land == null) - land = library.get(0); - - land.tap(); - AllZone.Computer_Library.remove(land); - AllZone.Computer_Play.add(land); - - AllZone.GameAction.shuffle(Constant.Player.Computer); - }//computerResolve() - - public void humanResolve() - { - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); - - CardList basicLand = new CardList(library.getCards()); - basicLand = basicLand.getType("Basic"); - - Object o = AllZone.Display.getChoiceOptional("Choose a basic land", basicLand.toArray()); - if(o != null) - { - Card land = (Card)o; - land.tap(); - - library.remove(land); - play.add(land); - } - AllZone.GameAction.shuffle(card.getController()); - }//resolve() - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = -4379321114820908030L; - boolean once = true; - public void showMessage() - { - //this is necessary in order not to have a StackOverflowException - //because this updates a card, it creates a circular loop of observers - if(once) - { - once = false; - AllZone.GameAction.sacrifice(card); - - ability.setStackDescription(card.getController() +" - Search your library for a basic land card and put it into play tapped. Then shuffle your library."); - AllZone.Stack.add(ability); - - stop(); - } - }//showMessage() - }; - card.addSpellAbility(ability); - ability.setDescription("tap, Sacrifice Terramorphic Expanse: Search your library for a basic land card and put it into play tapped. Then shuffle your library."); - ability.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Frostling")) - { - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() {return getCreature().size() != 0;} - - public void chooseTargetAI() - { - CardList list = getCreature(); - list.shuffle(); - setTargetCard(list.get(0)); - - AllZone.GameAction.sacrifice(card); - } - CardList getCreature() - { - //toughness of 1 - CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - //only get 1/1 flyers or 2/1 creatures - return (2 <= c.getNetAttack()) || c.getKeyword().contains("Flying"); - } - }); - return list; - }//getCreature() - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - getTargetCard().addDamage(1); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("Sacrifice Frostling: Frostling deals 1 damage to target creature."); - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability, new Command() - { - private static final long serialVersionUID = 3482118508536148313L; - - public void execute() - { - AllZone.GameAction.sacrifice(card); - } - })); - }//*************** END ************ END ************************** - + //*************** START *********** START ************************** - if(cardName.equals("Bottle Gnomes")) - { - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - return AllZone.Computer_Life.getLife() < 3; - - } - - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0 && super.canPlay(); - }//canPlay() - public void resolve() - { - if(owner.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void computerResolve() - { - CardList play = new CardList(AllZone.Computer_Play.getCards()); - play = play.getType("Basic"); - - CardList library = new CardList(AllZone.Computer_Library.getCards()); - library = library.getType("Basic"); - - //this shouldn't happen, but it is defensive programming, haha - if(library.isEmpty()) - return; - - Card land = null; - - //try to find a basic land that isn't in play - for(int i = 0; i < library.size(); i++) - if(! play.containsName(library.get(i))) - { - land = library.get(i); - break; - } - - //if not found - //library will have at least 1 basic land because canPlay() checks that - if(land == null) - land = library.get(0); - - land.tap(); - AllZone.Computer_Library.remove(land); - AllZone.Computer_Play.add(land); - - AllZone.GameAction.shuffle(Constant.Player.Computer); - }//computerResolve() - public void humanResolve() - { - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); - - CardList basicLand = new CardList(library.getCards()); - basicLand = basicLand.getType("Basic"); - if(basicLand.isEmpty()) - return; - - Object o = AllZone.Display.getChoiceOptional("Choose a basic land", basicLand.toArray()); - if(o != null) - { - Card land = (Card)o; - land.tap(); - - library.remove(land); - play.add(land); - } - - AllZone.GameAction.shuffle(card.getController()); - }//resolve() - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 1959709104655340395L; - boolean once = true; - public void showMessage() - { - //this is necessary in order not to have a StackOverflowException - //because this updates a card, it creates a circular loop of observers - if(once) - { - once = false; - AllZone.GameAction.sacrifice(card); - AllZone.Stack.add(ability); - - stop(); - } - }//showMessage() - }; - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - ability.setDescription("Sacrifice Sakura-Tribe Elder: Search your library for a basic land card, put that card into play tapped, then shuffle your library."); - ability.setStackDescription("Search your library for a basic land card, put that card into play tapped, then shuffle your library."); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Transluminant")) - { - final Command atEOT = new Command() - { - private static final long serialVersionUID = -5126793112740563180L; - - public void execute() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Spirit"); - c.setImageName("W 1 1 Spirit"); - c.setManaCost("W"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Spirit"); - c.setBaseAttack(1); - c.setBaseDefense(1); - c.addIntrinsicKeyword("Flying"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); - play.add(c); - }//execute() - };//Command - - final Ability ability = new Ability(card, "W") - { - public boolean canPlayAI() - { /* - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.getType("Creature"); - - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2) && list.size() != 0; - */ - return false; - } - public void chooseTargetAI() - { - AllZone.GameAction.sacrifice(card); - } - - public void resolve() - { - AllZone.EndOfTurn.addAt(atEOT); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("W, Sacrifice Transluminant: Put a 1/1 white Spirit creature token with flying into play at end of turn."); - ability.setStackDescription("Put a 1/1 white Spirit creature token with flying into play at end of turn."); - ability.setBeforePayMana(new Input_PayManaCost_Ability(ability.getManaCost(), new Command() - { - private static final long serialVersionUID = -6553009833190713980L; - - public void execute() - { - AllZone.GameAction.sacrifice(card); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Llanowar Behemoth")) - { - final Ability ability = new Ability(card, "0") - { - public boolean canPlayAI() - { - return (getUntapped().size() != 0) && CardFactoryUtil.AI_doesCreatureAttack(card); - } - public void chooseTargetAI() - { - Card c = getUntapped().get(0); - c.tap(); - setTargetCard(c); - } - CardList getUntapped() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && c.isUntapped() && (!CardFactoryUtil.AI_doesCreatureAttack(c)); - } - }); - return list; - }//getUntapped() - - public void resolve() - { - card.addTempAttackBoost(1); - card.addTempDefenseBoost(1); - - Command untilEOT = new Command() - { - private static final long serialVersionUID = 6445782721494547172L; - - public void execute() - { - card.addTempAttackBoost(-1); - card.addTempDefenseBoost(-1); - }//execute() - };//Command - - AllZone.EndOfTurn.addUntil(untilEOT); - }//resolve() - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = 7721637420366357272L; - public void showMessage() - { - AllZone.Display.showMessage("Select an untapped creature you control"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(c.isCreature() && zone.is(Constant.Zone.Play, card.getController()) && c.isUntapped()) - { - ability.setStackDescription(card +" gets +1/+1 until end of turn."); - c.tap(); - AllZone.Stack.add(ability); - stop(); - } - } - };//Input - ability.setBeforePayMana(target); - ability.setDescription("Tap an untapped creature you control: Llanowar Behemoth gets +1/+1 until end of turn."); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Memnarch")) - { - //has 2 non-tap abilities that effects itself - final SpellAbility ability1 = new Ability(card, "1 U U") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - getTargetCard().addType("Artifact"); - } - }//resolve() - public boolean canPlayAI() - { - CardList list = getCreature(); - return list.size() != 0; - } - public void chooseTargetAI() - { - Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); - setTargetCard(target); - }//chooseTargetAI() - CardList getCreature() - { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && (!c.isArtifact()); - } - }); - return list; - }//getCreature() - };//SpellAbility - - //**** start of ability2 - final SpellAbility ability2 = new Ability(card, "3 U") - { - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - //gain control of target artifact - PlayerZone from = AllZone.getZone(Constant.Zone.Play, getTargetCard().getController()); - from.remove(getTargetCard()); - - - getTargetCard().setController(card.getController()); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); - - PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); - to.add(getTargetCard()); - to.setUpdate(true); - - ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); - ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); - - -// AllZone.GameAction.moveTo(play, getTargetCard()); - - //TODO: controller probably is not set correctly - //TODO: when you take control, the creature looses type "Artifact" since - // GameAction.moveTo() makes a new card object - } - }//resolve() - public boolean canPlayAI() - { - CardList list = getArtifactCreatures(); - return list.size() != 0; - } - public void chooseTargetAI() - { - CardList list = getArtifactCreatures(); - Card target = CardFactoryUtil.AI_getBestCreature(list); - if(target == null) - target = AllZone.Human_Play.get(0); - - setTargetCard(target); - } - CardList getArtifactCreatures() - { - CardList list = new CardList(AllZone.Human_Play.getCards()); - list = list.getType("Artifact"); - list = list.getType("Creature"); - return list; - } - };//SpellAbility - card.addSpellAbility(ability1); - card.addSpellAbility(ability2); - - ability1.setDescription("1UU: Target permanent becomes an artifact in addition to its other types.(This effect doesn't end at end of turn.)"); - ability2.setDescription("3U: Gain control of target artifact.(This effect doesn't end at end of turn.)"); - - ability1.setBeforePayMana(CardFactoryUtil.input_targetType(ability1, "All")); - ability2.setBeforePayMana(CardFactoryUtil.input_targetType(ability2, "Artifact")); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Meloku the Clouded Mirror")) - { - final SpellAbility ability = new Ability(card, "1") - { - public void resolve() - { - Card c = new Card(); - c.setToken(true); - c.setImageName("U 1 1 Illusion"); - c.setName("Illusion"); - - c.setManaCost("U"); - c.setBaseAttack(1); - c.setBaseDefense(1); - c.addIntrinsicKeyword("Flying"); - c.addType("Creature"); - c.addType("Illusion"); - c.setOwner(card.getController()); - c.setController(card.getController()); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - - //TODO: the "bounced" land should be chosen by the user - //instead of "automatically" done for him - CardList island = new CardList(play.getCards()); - island = island.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.getType().contains("Land") && c.isTapped(); - } - }); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - - if(! island.isEmpty()) - AllZone.GameAction.moveTo(hand, island.get(0)); - }//resolve() - - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("1, Return a land you control to its owner's hand: Put a 1/1 blue Illusion creature token with flying into play."); - ability.setStackDescription("Put 1/1 token with flying into play"); - ability.setBeforePayMana(new Input_PayManaCost(ability)); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Squall Drifter")) - { - final SpellAbility ability = new Ability_Tap(card, "W") - { - private static final long serialVersionUID = 3862705592994953819L; - public void resolve() - { - Card c = getTargetCard(); - c.tap(); - } - public boolean canPlayAI() {return false;} - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("W, tap: Tap target creature."); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("That Which Was Taken")) + else if(cardName.equals("That Which Was Taken")) { final SpellAbility ability = new Ability_Tap(card, "4") { @@ -20913,377 +5548,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Stern Judge")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 3059547795996737707L; - public void resolve() - { - AllZone.Human_Life.subtractLife(countSwamps("Human")); - AllZone.Computer_Life.subtractLife(countSwamps("Computer")); - } - int countSwamps(String player) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList swamps = new CardList(play.getCards()); - swamps = swamps.getType("Swamp"); - return swamps.size(); - } - public boolean canPlayAI() - { - int computer = countSwamps(Constant.Player.Computer); - int human = countSwamps(Constant.Player.Human); - - if((computer >= AllZone.Computer_Life.getLife()) || (human == 0)) - return false; - - return computer <= human; - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Each player loses 1 life for each Swamp he or she controls."); - ability.setStackDescription("Stern Judge - Each player loses 1 life for each Swamp he or she controls"); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Cackling Imp") || cardName.equals("Blightspeaker")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = -8034678094689484203L; - public void resolve() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(1); - } - public boolean canPlayAI() - { - //computer should play ability if this creature doesn't attack - Combat c = ComputerUtil.getAttackers(); - CardList list = new CardList(c.getAttackers()); - - //could this creature attack?, if attacks, do not use ability - return (! list.contains(card)); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Target player loses 1 life."); - ability.setStackDescription(card.getName() + " - Opponent loses 1 life."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Sea Gate Loremaster")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - - private static final long serialVersionUID = -1701216509507402535L; - public boolean canPlayAI() {return false;} - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList list = new CardList(play.getCards()); - list = list.filter(new CardListFilter() - { - - public boolean addCard(Card c) { - return c.getType().contains("Ally") || c.getKeyword().contains("Changeling"); - } - - }); - - for (int i=0;i 3 && 6 < AllZone.Computer_Life.getLife(); - }//canPlayAI() - public void resolve() - { - //get all creatures - CardList list = new CardList(); - list.addAll(AllZone.Human_Play.getCards()); - list.addAll(AllZone.Computer_Play.getCards()); - list = list.getType("Creature"); - - list = list.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return ! c.getKeyword().contains("Flying") && CardFactoryUtil.canDamage(card, c); - } - }); - for(int i = 0; i < list.size(); i++) - list.get(i).addDamage(4); - - AllZone.Human_Life.subtractLife(4); - AllZone.Computer_Life.subtractLife(4); - }//resolve() - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Hammerfist Giant deals 4 damage to each creature without flying and each player."); - ability.setStackDescription("Hammerfist Giant - deals 4 damage to each creature without flying and each player."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Urborg Syphon-Mage")) - { - final Ability_Tap ability = new Ability_Tap(card, "2 B") - { - private static final long serialVersionUID = -1965170715774280112L; - - public void resolve() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - AllZone.GameAction.getPlayerLife(opponent).subtractLife(2); - - AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - public boolean canPlay() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - return super.canPlay() && hand.getCards().length != 0; - } - public boolean canPlayAI() - { - int life = AllZone.Human_Life.getLife(); - Card[] hand = AllZone.Computer_Hand.getCards(); - return ((life < 11) || (5 < AllZone.Phase.getTurn())) && - hand.length > 0; - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("2B, tap, Discard a card: Each other player loses 2 life. You gain life equal to the life lost this way."); - ability.setStackDescription("Urborg Syphon-Mage - Opponent loses 2 life, and you gain 2 life"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("2 B", new Command() - { - private static final long serialVersionUID = 1186455545951390853L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Spectral Procession")) + else if(cardName.equals("Spectral Procession")) { final SpellAbility spell = new Spell(card) { @@ -21322,537 +5588,40 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if (cardName.equals("Stangg")){ - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setName("Stangg Twin"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("R G"); - c.setToken(true); - - c.addType("Legendary"); - c.addType("Creature"); - c.addType("Human"); - c.addType("Warrior"); - c.setBaseAttack(3); - c.setBaseDefense(4); - - c.addLeavesPlayCommand(new Command() - { - private static final long serialVersionUID = 3367390368512271319L; - - public void execute() { - if (AllZone.GameAction.isCardInPlay(card)) - AllZone.GameAction.sacrifice(card); - } - - }); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - - } - }; - ability.setStackDescription("When Stangg enters the battlefield, if Stangg is on the battlefield, put a legendary 3/4 red and green Human Warrior creature token named Stangg Twin onto the battlefield."); - - card.addComesIntoPlayCommand(new Command() - { - private static final long serialVersionUID = 6667896040611028600L; - - public void execute() { - AllZone.Stack.add(ability); - } - }); - - card.addLeavesPlayCommand(new Command() - { - private static final long serialVersionUID = 1786900359843939456L; - - public void execute() { - CardList list = new CardList(); - list.addAll(AllZone.Computer_Play.getCards()); - list.addAll(AllZone.Human_Play.getCards()); - list = list.getName("Stangg Twin"); - - if (list.size() == 1) - AllZone.GameAction.removeFromGame(list.get(0)); - } - }); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Llanowar Mentor")) - { - final Ability_Tap ability = new Ability_Tap(card, "G") - { - private static final long serialVersionUID = 752280918226277729L; - - public void resolve() - { - makeToken(); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Elf"); - c.addType("Druid"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - - //custom settings - c.setName("Llanowar Elves"); - c.setImageName("G 1 1 Llanowar Elves"); - //c.addIntrinsicKeyword("tap: add G"); - c.addSpellAbility(new Ability_Mana(card, "tap: add G") - { - private static final long serialVersionUID = 7871036527184588884L; - }); - - - play.add(c); - }//makeToken() - - public boolean canPlay() - { - Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); - - return super.canPlay() && (0 < c.length); - } - - public boolean canPlayAI() - { - boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; - return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("G, tap, Discard a card: Put a 1/1 green Elf Druid creature token named Llanowar Elves into play with \"tap: add G\" "); - ability.setStackDescription("Llanowar Mentor - Put a 1/1 token into play"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("G", new Command() - { - private static final long serialVersionUID = -8140640118045101485L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Sparkspitter")) - { - final Ability_Tap ability = new Ability_Tap(card, "R") - { - private static final long serialVersionUID = -6381252527344512333L; - - public void resolve() - { - makeToken(); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = CardFactory.this.getCard("Spark Elemental", card.getController()); - c.setToken(true); - c.setImageName("R 3 1 Spark Elemental"); - play.add(c); - }//makeToken() - - public boolean canPlay() - { - Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); - - return super.canPlay() && (0 < c.length); - } - - public boolean canPlayAI() - { - boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; - return canPlay() && canDiscard; - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("R, tap, Discard a card: Put a 3/1 red Elemental creature token named Spark Elemental into play with trample, haste, and \"At end of turn, sacrifice Spark Elemental.\" "); - ability.setStackDescription("Sparkspitter - Put a 3/1 token into play"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("R", new Command() - { - private static final long serialVersionUID = 4717424466422508064L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Sliversmith")) - { - final Ability_Tap ability = new Ability_Tap(card, "1") - { - private static final long serialVersionUID = -901356795848120643L; - - public void resolve() - { - makeToken(); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("1"); - c.setToken(true); - - c.addType("Artifact"); - c.addType("Creature"); - c.addType("Sliver"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - - //custom settings - c.setName("Metallic Sliver"); - c.setImageName("C 1 1 Metallic Sliver"); - - play.add(c); - }//makeToken() - - public boolean canPlay() - { - Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); - - return super.canPlay() && (0 < c.length); - } - - public boolean canPlayAI() - { - boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; - return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("1, tap, Discard a card: Put a 1/1 Sliver artifact creature token named Metallic Sliver into play."); - ability.setStackDescription(card +" - Put a 1/1 token into play"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("1", new Command() - { - private static final long serialVersionUID = 7980998398222481323L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - - - - - //*************** START *********** START ************************** - if(cardName.equals("Cloudseeder")) - { - final Ability_Tap ability = new Ability_Tap(card, "U") - { - private static final long serialVersionUID = -4685908556244137496L; - - public void resolve() - { - makeToken(); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("U"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Faerie"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - - //custom settings - c.setName("Cloud Sprite"); - c.setImageName("U 1 1 Cloud Sprite"); - c.addIntrinsicKeyword("Flying"); - c.addIntrinsicKeyword("This creature can block only creatures with flying"); - - play.add(c); - }//makeToken() - - public boolean canPlay() - { - Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); - - return super.canPlay() && (0 < c.length); - } - - public boolean canPlayAI() - { - boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; - return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("U, tap, Discard a card: Put a 1/1 blue Sprite creature token named Cloud Sprite into play with flying and \"this creature can block only creatures with flying\"."); - ability.setStackDescription("Cloudseeker - Put a 1/1 token into play"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("U", new Command() - { - private static final long serialVersionUID = 7707504858274558816L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Goldmeadow Lookout")) - { - final Ability_Tap ability = new Ability_Tap(card, "G") - { - private static final long serialVersionUID = -8413409735529340094L; - - public void resolve() - { - makeToken(); - - //computer discards here, todo: should discard when ability put on stack - if(card.getController().equals(Constant.Player.Computer)) - AllZone.GameAction.discardRandom(Constant.Player.Computer); - } - void makeToken() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("W"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Kithkin"); - c.addType("Soldier"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - - //custom settings - c.setName("Goldmeadow Harrier"); - c.setImageName("W 1 1 Goldmeadow Harrier"); - final SpellAbility ability = new Ability_Tap(c, "W") - { - private static final long serialVersionUID = -7327585136675896817L; - - public void resolve() - { - Card c = getTargetCard(); - c.tap(); - } - public boolean canPlayAI() {return false;} - };//SpellAbility - c.addSpellAbility(new Spell_Permanent(c)); - c.addSpellAbility(ability); - ability.setDescription("W, tap: Tap target creature."); - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - - - play.add(c); - }//makeToken() - - public boolean canPlay() - { - Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); - - return super.canPlay() && (0 < c.length); - } - - public boolean canPlayAI() - { - boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; - return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); - } - };//SpellAbility - - card.addSpellAbility(ability); - ability.setDescription("W, tap, Discard a card: Put a 1/1 white Kithkin Soldier creature token named Goldmeadow Harrier into play with \"W, tap target creature.\""); - ability.setStackDescription("Goldmeadow Lookout - Put a 1/1 token into play"); - ability.setBeforePayMana(new Input_PayManaCost_Ability("W", new Command() - { - private static final long serialVersionUID = 8621733943286161557L; - - public void execute() - { - card.tap(); - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - AllZone.Stack.add(ability); - } - })); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if (cardName.equals("Goldmeadow Harrier") || cardName.equals("Loxodon Mystic") - || cardName.equals("Master Decoy")) - { - final SpellAbility ability = new Ability_Tap(card, "W") - { - - private static final long serialVersionUID = 4424848120984319655L; - public void resolve() - { - Card c = getTargetCard(); - c.tap(); - } - public boolean canPlayAI() {return false;} - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("W, tap: Tap target creature."); - ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); - - }//*************** END ************ END ************************** + //*************** START *********** START ************************** - if(cardName.equals("Silent Attendant")) + else if(cardName.equals("Sacred Nectar")) { - final Ability_Tap ability = new Ability_Tap(card) + SpellAbility spell = new Spell(card) { - /** - * - */ - private static final long serialVersionUID = -2602340080268657851L; - public void resolve() - { - - AllZone.GameAction.getPlayerLife(card.getController()).addLife(1); - } - public boolean canPlayAI() - { - //computer should play ability if this creature doesn't attack - Combat c = ComputerUtil.getAttackers(); - CardList list = new CardList(c.getAttackers()); - //could this creature attack?, if attacks, do not use ability - return (! list.contains(card)); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: You gain 1 life."); - ability.setStackDescription(card.getName() + " - you gain 1 life."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Ghost-Lit Redeemer")) - { - final SpellAbility ability = new Ability_Tap(card, "W") - { - private static final long serialVersionUID = -7119153679100849498L; + private static final long serialVersionUID = -2280675656970845618L; - public boolean canPlayAI() {return AllZone.Phase.getPhase().equals(Constant.Phase.Main2);} + public boolean canPlay() + { + setStackDescription(card.getName() +" - " +card.getController() +" gains 4 life."); + return super.canPlay(); + } public void resolve() { - Card c = card; - PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); - life.addLife(2); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("W, tap: You gain 2 life"); - ability.setStackDescription("Computer gains 2 life"); - - final Command paid = new Command() - { - private static final long serialVersionUID = 3649597692883194760L; - - public void execute() - { - Card c = card; - c.tap(); - AllZone.Human_Play.updateObservers();//so the card will tap at the correct time - - ability.setStackDescription(c.getController()+" gains 2 life"); - AllZone.Stack.add(ability); - AllZone.InputControl.resetInput(); + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.addLife(4); } }; - ability.setBeforePayMana(new Input_PayManaCost_Ability(ability.getManaCost(), paid, Command.Blank)); + spell.setDescription("You gain 4 life."); + + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** - - + + //*************** START *********** START ************************** - if(cardName.equals("Tremor")) + else if(cardName.equals("Tremor")) { SpellAbility spell = new Spell(card) { @@ -21901,7 +5670,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Reviving Dose")) + else if(cardName.equals("Reviving Dose")) { SpellAbility spell = new Spell(card) { @@ -21922,7 +5691,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Swords to Plowshares")) + else if(cardName.equals("Swords to Plowshares")) { SpellAbility spell = new Spell(card) { @@ -21967,7 +5736,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Unmake")) + else if(cardName.equals("Unmake")) { SpellAbility spell = new Spell(card) { @@ -22008,7 +5777,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Crib Swap")) + else if(cardName.equals("Crib Swap")) { SpellAbility spell = new Spell(card) { @@ -22071,7 +5840,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Demonic Tutor") || cardName.equals("Diabolic Tutor") || cardName.equals("Grim Tutor")) + else if(cardName.equals("Demonic Tutor") || cardName.equals("Diabolic Tutor") || cardName.equals("Grim Tutor")) { final SpellAbility spell = new Spell(card) { @@ -22145,7 +5914,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Entomb")) + else if(cardName.equals("Entomb")) { final SpellAbility spell = new Spell(card) { @@ -22203,7 +5972,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Do or Die")) + else if(cardName.equals("Do or Die")) { final SpellAbility spell = new Spell(card) { @@ -22261,7 +6030,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Beacon of Destruction")) + else if(cardName.equals("Beacon of Destruction")) { final SpellAbility spell = new Spell(card) { @@ -22301,7 +6070,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Capsize")) + else if(cardName.equals("Capsize")) { final SpellAbility spell_one = new Spell(card) { @@ -22416,7 +6185,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Whispers of the Muse")) + else if(cardName.equals("Whispers of the Muse")) { final SpellAbility spell_one = new Spell(card) { @@ -22463,7 +6232,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Elvish Fury")) + else if(cardName.equals("Elvish Fury")) { final SpellAbility spell_one = new Spell(card) { @@ -22577,264 +6346,10 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Ramosian Revivalist")) - { - @SuppressWarnings("unused") // costMinusOne - String costMinusOne = ""; - int a = Integer.parseInt("6"); - a--; - costMinusOne = Integer.toString(a); - final int converted = a; - final String player = card.getController(); - - final SpellAbility ability = new Ability_Tap(card, "6") - { - private static final long serialVersionUID = 2675327938055139432L; - - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i0) - return true; - else - return false; - - } - - public void resolve() - { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - CardList rebels = new CardList(); - CardList list = new CardList(grave.getCards()); - list = list.getType("Rebel"); - - if (list.size()>0) - { - for (int i=0;i < list.size(); i++) - { - if (CardUtil.getConvertedManaCost(list.get(i).getManaCost()) <= converted) - { - rebels.add(list.get(i)); - } - - } - - if (rebels.size() > 0) - { - if (player.equals(Constant.Player.Computer)) - { - Card rebel = CardFactoryUtil.AI_getBestCreature(rebels); - grave.remove(rebel); - play.add(rebel); - } - else //human - { - Object o = AllZone.Display.getChoiceOptional("Select target Rebel", rebels.toArray()); - Card rebel = (Card)o; - grave.remove(rebel); - play.add(rebel); - } - }//rebels.size() >0 - }//list.size() > 0 - }//resolve - }; - ability.setDescription("6: Return target Rebel permanent card with converted mana cost 5 or less from your graveyard to play."); - ability.setStackDescription(card.getName() +" - return Rebel from graveyard to play."); - card.addSpellAbility(ability); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Marrow-Gnawer")) - { - final String player = card.getController(); - - final SpellAbility ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 447190529377334168L; - - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList cards = new CardList(play.getCards()); - - Card c = getTargetCard(); - if (c != null) - { - AllZone.GameAction.sacrifice(c); - - CardList rats = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - if (cards.get(i).getType().contains("Rat") || cards.get(i).getKeyword().contains("Changeling")){ - Card k = cards.get(i); - rats.add(k); - } - } - - if (!c.getName().equals("Marrow-Gnawer")) - { - for (int j=0; j < rats.size()-1; j++) - { - makeToken(); - } - } - else //some weird thing when targeting marrow himself, number of rats is different... so here's a hack: - { - for (int k=0; k < rats.size(); k++) - { - makeToken(); - } - } - } - }//resolve() - - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Rat"); - - for (int i=0;i < list.size(); i++) - { - String name = list.get(i).getName(); - if (!name.equals("Marrow-Gnawer") && !name.equals("Relentless Rats")) - setTargetCard(list.get(i)); - if (name.equals("B 1 1 Rat")) - { - setTargetCard(list.get(i)); - break; - } - - } - - if (getTargetCard() == null) - System.out.println("getTargetCard null"); - if(getTargetCard() != null && list.size() > 3) - return true; - else - return false; - } - - - public void makeToken() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Rat"); - c.setImageName("B 1 1 Rat"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Rat"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - } - - - };//ability - - Input runtime = new Input() - { - private static final long serialVersionUID = 8552290582665041908L; - - public void showMessage() - { - CardList rats = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - rats = rats.getType("Rat"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, rats, "Select a Rat to sacrifice.", false)); - } - }; - - card.addSpellAbility(ability); - ability.setDescription("Tap, Sacrifice a rat: Put X 1/1 black Rat creature tokens into play, where X is the number of Rats you control."); - ability.setStackDescription(card.getName() + " - Put X 1/1 black Rat creature tokens into play, where X is the number of Rats you control."); - ability.setBeforePayMana(runtime); - - - }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Arcanis the Omnipotent")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 4743686230518855738L; - - public boolean canPlayAI() - { - return true; - } - - public void resolve() - { - AllZone.GameAction.drawCard(card.getController()); - AllZone.GameAction.drawCard(card.getController()); - AllZone.GameAction.drawCard(card.getController()); - } - };//SpellAbility - - final SpellAbility ability2 = new Ability(card,"2 U U") - { - public void resolve() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); - - card.untap(); - AllZone.getZone(card).remove(card); - if (!card.isToken()) - hand.add(card); - - } - public boolean canPlayAI() - { - return false; - } - }; //ability2 - - card.addSpellAbility(ability); - ability.setDescription("tap: Draw three cards."); - ability.setStackDescription("Arcanis - " + card.getController() + " draws three cards."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - - card.addSpellAbility(ability2); - ability2.setStackDescription(card.getController() + " returns Arcanis back to owner's hand."); - ability2.setDescription("2 U U: Return Arcanis the Omnipotent to its owner's hand."); - - }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Lab Rats")) + else if(cardName.equals("Lab Rats")) { final Command makeToken = new Command() { @@ -22911,7 +6426,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Sprout Swarm")) + else if(cardName.equals("Sprout Swarm")) { final Command makeToken = new Command() { @@ -22984,7 +6499,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Threaten") || cardName.equals("Act of Treason")) + else if(cardName.equals("Threaten") || cardName.equals("Act of Treason")) { final PlayerZone[] orig = new PlayerZone[1]; final PlayerZone[] temp = new PlayerZone[1]; @@ -23076,7 +6591,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Beacon of Unrest")) + else if(cardName.equals("Beacon of Unrest")) { final SpellAbility spell = new Spell(card) { @@ -23179,7 +6694,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Breath of Life") || cardName.equals("Resurrection") || cardName.equals("False Defeat") || cardName.equals("Zombify")) + else if(cardName.equals("Breath of Life") || cardName.equals("Resurrection") || cardName.equals("False Defeat") || cardName.equals("Zombify")) { final SpellAbility spell = new Spell(card) { @@ -23250,69 +6765,9 @@ if(cardName.equals("Jugan, the Rising Star")) spell.setBeforePayMana(target); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Horde of Notions")) - { - final Ability ability = new Ability(card, "W U B R G") - { - public void resolve() - { - Card c = null; - if (card.getController().equals("Human")) - { - Object o = AllZone.Display.getChoiceOptional("Select Elemental", getCreatures()); - c = (Card)o; - - } - else - { - c = getAIElemental(); - } - - PlayerZone grave = AllZone.getZone(c); - - if(AllZone.GameAction.isCardInZone(c, grave)) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); - AllZone.GameAction.moveTo(play, c); - } - }//resolve() - public boolean canPlay() - { - return getCreatures().length != 0 && AllZone.GameAction.isCardInPlay(card); - } - public Card[] getCreatures() - { - CardList creature = new CardList(); - PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - creature.addAll(zone.getCards()); - creature = creature.getType("Elemental"); - return creature.toArray(); - } - public Card getAIElemental() - { - Card c[] = getCreatures(); - Card biggest = c[0]; - for(int i = 0; i < c.length; i++) - if(biggest.getNetAttack() < c[i].getNetAttack()) - biggest = c[i]; - - return biggest; - } - };//SpellAbility - card.addSpellAbility(ability); - - ability.setDescription("W U B R G: You may play target Elemental card from your graveyard without paying its mana cost."); - //ability.setBeforePayMana(new Input_); - ability.setStackDescription("Horde of Notions - play Elemental card from graveyard without paying its mana cost."); - ability.setBeforePayMana(new Input_PayManaCost(ability)); - - }//*************** END ************ END ************************** - - - + //*************** START *********** START ************************** - if(cardName.equals("Animate Dead")) + else if(cardName.equals("Animate Dead")) { final SpellAbility spell = new Spell(card) { @@ -23409,7 +6864,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Blinding Light")) + else if(cardName.equals("Blinding Light")) { SpellAbility spell = new Spell(card) { @@ -23443,7 +6898,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Raise the Alarm")) + else if(cardName.equals("Raise the Alarm")) { SpellAbility spell = new Spell(card) { @@ -23478,7 +6933,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Dragon Fodder")) + else if(cardName.equals("Dragon Fodder")) { SpellAbility spell = new Spell(card) { @@ -23516,7 +6971,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Empty the Warrens")) + else if(cardName.equals("Empty the Warrens")) { SpellAbility spell = new Spell(card) { @@ -23567,7 +7022,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Feudkiller's Verdict")) + else if(cardName.equals("Feudkiller's Verdict")) { SpellAbility spell = new Spell(card) { @@ -23613,11 +7068,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Reach of Branches")) + else if(cardName.equals("Reach of Branches")) { SpellAbility spell = new Spell(card) { @@ -23654,7 +7106,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Pyroclasm")) + else if(cardName.equals("Pyroclasm")) { SpellAbility spell = new Spell(card) { @@ -23693,7 +7145,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Volcanic Fallout")) + else if(cardName.equals("Volcanic Fallout")) { SpellAbility spell = new Spell(card) { @@ -23742,7 +7194,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Flamebreak")) + else if(cardName.equals("Flamebreak")) { SpellAbility spell = new Spell(card) { @@ -23778,10 +7230,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Renewed Faith") || cardName.equals("Dosan's Oldest Chant") || cardName.equals("Nourish")) + else if(cardName.equals("Renewed Faith") || cardName.equals("Dosan's Oldest Chant") || cardName.equals("Nourish")) { SpellAbility spell = new Spell(card) { @@ -23820,7 +7270,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("TestLife")) + else if(cardName.equals("TestLife")) { SpellAbility ability1 = new Ability_Activated(card, "1") { @@ -23853,7 +7303,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Life Burst")) + else if(cardName.equals("Life Burst")) { final SpellAbility spell = new Spell(card) { @@ -23884,7 +7334,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Accumulated Knowledge")) + else if(cardName.equals("Accumulated Knowledge")) { final SpellAbility spell = new Spell(card) { @@ -23917,10 +7367,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Wit's End")) + else if(cardName.equals("Wit's End")) { final SpellAbility spell = new Spell(card) { @@ -23943,7 +7391,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Cranial Extraction")) + else if(cardName.equals("Cranial Extraction")) { final SpellAbility spell = new Spell(card) { @@ -24062,7 +7510,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Coercion")) + else if(cardName.equals("Coercion")) { final SpellAbility spell = new Spell(card) { @@ -24111,7 +7559,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Brainbite")) + else if(cardName.equals("Brainbite")) { final SpellAbility spell = new Spell(card) { @@ -24167,7 +7615,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Thoughtseize") || cardName.equals("Distress")) + else if(cardName.equals("Thoughtseize") || cardName.equals("Distress")) { final SpellAbility spell = new Spell(card) { @@ -24230,7 +7678,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Douse in Gloom")) + else if(cardName.equals("Douse in Gloom")) { final SpellAbility spell = new Spell(card) { @@ -24288,7 +7736,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Echoing Decay")) + else if(cardName.equals("Echoing Decay")) { final SpellAbility spell = new Spell(card) { @@ -24386,7 +7834,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Maelstrom Pulse")) + else if(cardName.equals("Maelstrom Pulse")) { final SpellAbility spell = new Spell(card) { @@ -24476,404 +7924,9 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Ravenous Rats") || cardName.equals("Corrupt Court Official")) - { - final Ability ability = new Ability(card,"0") - { - public boolean canPlayAI() - { - return true; - } - public void resolve() - { - if(Constant.Player.Computer.equals(getTargetPlayer())) - AllZone.GameAction.discardRandom(getTargetPlayer()); - else - AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); - }//resolve() - };//SpellAbility - - Command intoPlay = new Command() - { - private static final long serialVersionUID = -2028008593708491452L; - - public void execute() - { - if(card.getController().equals(Constant.Player.Human)) - { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); - ButtonUtil.disableAll(); - } - else//computer - { - ability.setTargetPlayer(Constant.Player.Human); - AllZone.Stack.add(ability); - }//else - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Boris Devilboon")) - { - final Ability_Tap tokenAbility1 = new Ability_Tap(card, "2 B R") - { - private static final long serialVersionUID = -6343382804503119405L; - - public boolean canPlayAI() - { - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2); - } - public void chooseTargetAI() {card.tap();} - - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Minor Demon"); - c.setImageName("BR 1 1 Demon"); - c.setManaCost("B R"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Demon"); - - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//SpellAbility - - card.addSpellAbility(tokenAbility1); - - tokenAbility1.setDescription("2 B R, tap: Put a 1/1 black and red Demon creature token named Minor Demon onto the battlefield."); - tokenAbility1.setStackDescription(card.getName() + " - Put a 1/1 black and red Demon creature token named Minor Demon onto the battlefield."); - tokenAbility1.setBeforePayMana(new Input_PayManaCost(tokenAbility1)); - } - - //*************** START *********** START ************************** - if(cardName.equals("Rhys the Redeemed")) - { - final Ability_Tap tokenAbility1 = new Ability_Tap(card, "2 GW") - { - private static final long serialVersionUID = 411298860775527337L; - - public boolean canPlayAI() - { - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2); - } - public void chooseTargetAI() {card.tap();} - - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Elf Warrior"); - c.setImageName("GW 1 1 Elf Warrior"); - c.setManaCost("GW"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Elf"); - c.addType("Warrior"); - - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//resolve() - };//SpellAbility - - card.addSpellAbility(tokenAbility1); - - tokenAbility1.setDescription("2 GW, tap: Put a 1/1 green and white Elf Warrior creature token into play."); - tokenAbility1.setStackDescription(card.getName() + " - Put a 1/1 green and white Elf Warrior creature token into play."); - tokenAbility1.setBeforePayMana(new Input_PayManaCost(tokenAbility1)); - - ///////////////////////////////////////////////////////////////////// - - final Ability_Tap copyTokens1 = new Ability_Tap(card, "4 GW GW") - { - private static final long serialVersionUID = 6297992502069547478L; - - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList allTokens = new CardList(); - allTokens.addAll(play.getCards()); - allTokens = allTokens.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isCreature() && c.isToken(); - } - }); - - for (int i=0;i= 2; - } - }; - - card.addSpellAbility(copyTokens1); - - copyTokens1.setDescription("4 GW GW, tap: For each creature token you control, put a token into play that's a copy of that creature."); - copyTokens1.setStackDescription(card.getName() + " - For each creature token you control, put a token into play that's a copy of that creature."); - copyTokens1.setBeforePayMana(new Input_PayManaCost(copyTokens1)); - - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Bringer of the Green Dawn") || cardName.equals("Bringer of the Blue Dawn") || - cardName.equals("Bringer of the White Dawn")) - { - final SpellAbility diffCost = new Spell(card) - { - private static final long serialVersionUID = -1598664186463358630L; - public void resolve() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand ,card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play ,card.getController()); - - - hand.remove(card); - play.add(card); - card.comesIntoPlay(); //do i need this? - } - public boolean canPlay() - { - return AllZone.Phase.getActivePlayer().equals(card.getController()) && - !AllZone.Phase.getPhase().equals("End of Turn") && !AllZone.GameAction.isCardInPlay(card); - } - - }; - diffCost.setManaCost("W U B R G"); - diffCost.setDescription("You may pay W U B R G rather than pay "+card.getName() +"'s mana cost. "); - diffCost.setStackDescription(card.getName() + " - Creature 5/5"); - card.addSpellAbility(diffCost); - - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Thelonite Hermit")) - { - - Command turnsFaceUp = new Command() - { - private static final long serialVersionUID = -3882798504865405413L; - - public void execute() - { - makeToken(); - makeToken(); - makeToken(); - makeToken(); - - }//execute() - - public void makeToken() - { - Card c = new Card(); - - - c.setName("Saproling"); - c.setImageName("G 1 1 Saproling"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Saproling"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - } - };//Command - - - card.addTurnFaceUpCommand(turnsFaceUp); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Imperial Hellkite")) - { - final String player = card.getController(); - Command turnsFaceUp = new Command() - { - private static final long serialVersionUID = -1407485989096862288L; - - public void execute() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - - CardList list = new CardList(lib.getCards()); - list = list.getType("Dragon"); - - if (list.size()==0) - return; - - - if (player.equals(Constant.Player.Computer)) - { - Card dragon = CardFactoryUtil.AI_getBestCreature(list); - lib.remove(dragon); - hand.add(dragon); - } - else //human - { - Object o = AllZone.Display.getChoiceOptional("Select Dragon", list.toArray()); - Card dragon = (Card)o; - lib.remove(dragon); - hand.add(dragon); - } - AllZone.GameAction.shuffle(card.getController()); - }//execute() - };//Command - - card.addTurnFaceUpCommand(turnsFaceUp); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Corrupt")) - { - - final SpellAbility spell = new Spell(card) - { - private static final long serialVersionUID = 335838994716307031L; - - Card check; - public boolean canPlayAI() - { - if(AllZone.Human_Life.getLife() <= countSwamps(card)) - return true; - - check = getFlying(); - return check != null; - } - - public int countSwamps(Card c) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); - CardList swamps = new CardList(play.getCards()); - swamps = swamps.getType("Swamp"); - return swamps.size(); - } - - public void chooseTargetAI() - { - if(AllZone.Human_Life.getLife() <= 12) //12? mebbe 15? - { - setTargetPlayer(Constant.Player.Human); - return; - } - - Card c = getFlying(); - if((c == null) || (! check.equals(c))) - throw new RuntimeException(card +" error in chooseTargetAI() - Card c is " +c +", Card check is " +check); - - setTargetCard(c); - }//chooseTargetAI() - - //uses "damage" variable - Card getFlying() - { - CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true); - for(int i = 0; i < flying.size(); i++) - if(flying.get(i).getNetDefense() <= countSwamps(card)) - return flying.get(i); - - return null; - } - - public void resolve() - { - int damage = countSwamps(card); - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - Card c = getTargetCard(); - c.addDamage(damage); - AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage); - } - } - else { - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); - AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage); - } - }//resolve() - };//SpellAbility - card.clearSpellAbility(); - card.addSpellAbility(spell); - - spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell,true)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Sunlance")) + else if(cardName.equals("Sunlance")) { final SpellAbility spell = new Spell(card) { @@ -24948,7 +8001,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Saltblast")) + else if(cardName.equals("Saltblast")) { final SpellAbility spell = new Spell(card) { @@ -25022,7 +8075,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Firebolt")) + else if(cardName.equals("Firebolt")) { final SpellAbility spell = new Spell(card) { @@ -25173,7 +8226,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Spark Spray")) + else if(cardName.equals("Spark Spray")) { final SpellAbility spell = new Spell(card) { @@ -25215,7 +8268,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Cackling Flames")) + else if(cardName.equals("Cackling Flames")) { final SpellAbility spell = new Spell(card) { @@ -25257,8 +8310,6 @@ if(cardName.equals("Jugan, the Rising Star")) return null; } - - public void resolve() { int damage = getDamage(); @@ -25292,7 +8343,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Mob Justice")) + else if(cardName.equals("Mob Justice")) { final SpellAbility spell = new Spell(card) { @@ -25343,10 +8394,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Tribal Flames")) + else if(cardName.equals("Tribal Flames")) { final SpellAbility spell = new Spell(card) { @@ -25452,10 +8501,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Erratic Explosion")) + else if(cardName.equals("Erratic Explosion")) { final SpellAbility spell = new Spell(card) { @@ -25547,7 +8594,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Char")) + else if(cardName.equals("Char")) { final SpellAbility spell = new Spell(card) { @@ -25657,7 +8704,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Psionic Blast")) + else if(cardName.equals("Psionic Blast")) { final SpellAbility spell = new Spell(card) { @@ -25767,7 +8814,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Hidetsugu's Second Rite")) + else if(cardName.equals("Hidetsugu's Second Rite")) { final SpellAbility spell = new Spell(card) { @@ -25833,9 +8880,8 @@ if(cardName.equals("Jugan, the Rising Star")) }// *************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("March of Souls")) + else if(cardName.equals("March of Souls")) { final SpellAbility spell = new Spell(card) { @@ -26024,8 +9070,7 @@ if(cardName.equals("Jugan, the Rising Star")) if (c.isEnchantment()) AllZone.GameAction.destroy(c); - } - + } }// resolve() @@ -26099,7 +9144,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Incendiary Command")) + else if(cardName.equals("Incendiary Command")) { //not sure what to call variables, so I just made up something final String[] m_player = new String[1]; @@ -26324,7 +9369,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Boil") || cardName.equals("Boiling Seas")) + else if(cardName.equals("Boil") || cardName.equals("Boiling Seas")) { final SpellAbility spell = new Spell(card) { @@ -26358,7 +9403,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Plague Wind")) + else if(cardName.equals("Plague Wind")) { final SpellAbility spell = new Spell(card) { @@ -26385,7 +9430,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Overwhelming Forces")) + else if(cardName.equals("Overwhelming Forces")) { final SpellAbility spell = new Spell(card) { @@ -26415,7 +9460,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Path of Anger's Flame")) + else if(cardName.equals("Path of Anger's Flame")) { final SpellAbility spell = new Spell(card) { @@ -26466,7 +9511,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Kjeldoran War Cry")) + else if(cardName.equals("Kjeldoran War Cry")) { final SpellAbility spell = new Spell(card) { @@ -26534,7 +9579,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Akroma's Vengeance") || + else if(cardName.equals("Akroma's Vengeance") || cardName.equals("Devastation") || cardName.equals("Jokulhaups") || cardName.equals("Purify") || @@ -26582,10 +9627,8 @@ if(cardName.equals("Jugan, the Rising Star")) card.setText("Obliterate can't be countered. \r\n" + card.getText()); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Wheel of Fortune")) + else if(cardName.equals("Wheel of Fortune")) { final SpellAbility spell = new Spell(card) { @@ -26612,10 +9655,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Armageddon") || cardName.equals("Ravages of War")) + else if(cardName.equals("Armageddon") || cardName.equals("Ravages of War")) { final SpellAbility spell = new Spell(card) { @@ -26658,7 +9699,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Remove Soul") || cardName.equals("False Summoning") || cardName.equals("Essence Scatter") || cardName.equals("Preemptive Strike")) + else if(cardName.equals("Remove Soul") || cardName.equals("False Summoning") || cardName.equals("Essence Scatter") || cardName.equals("Preemptive Strike")) { SpellAbility spell = new Spell(card) { @@ -26689,10 +9730,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Counterspell") || cardName.equals("Cancel") || cardName.equals("Last Word")) + else if(cardName.equals("Counterspell") || cardName.equals("Cancel") || cardName.equals("Last Word")) { SpellAbility spell = new Spell(card) { @@ -26722,9 +9761,8 @@ if(cardName.equals("Jugan, the Rising Star")) - //*************** START *********** START ************************** - if(cardName.equals("Remand")) + else if(cardName.equals("Remand")) { SpellAbility spell = new Spell(card) { @@ -26760,7 +9798,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Regress")) + else if(cardName.equals("Regress")) { SpellAbility spell = new Spell(card) { @@ -26806,10 +9844,8 @@ if(cardName.equals("Jugan, the Rising Star")) - - //*************** START *********** START ************************** - if(cardName.equals("Echoing Truth")) + else if(cardName.equals("Echoing Truth")) { final SpellAbility spell = new Spell(card) { @@ -26886,9 +9922,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Repulse")) + else if(cardName.equals("Repulse")) { final SpellAbility spell = new Spell(card) { @@ -26956,7 +9991,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Unsummon")) + else if(cardName.equals("Unsummon")) { final SpellAbility spell = new Spell(card) { @@ -27021,10 +10056,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Impulse")) + else if(cardName.equals("Impulse")) { final SpellAbility spell = new Spell(card) { @@ -27070,10 +10103,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Bribery")) + else if(cardName.equals("Bribery")) { SpellAbility spell = new Spell(card) { @@ -27161,10 +10192,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Words of Wisdom")) + else if(cardName.equals("Words of Wisdom")) { SpellAbility spell = new Spell(card) { @@ -27185,9 +10214,8 @@ if(cardName.equals("Jugan, the Rising Star")) - //*************** START *********** START ************************** - if(cardName.equals("Counsel of the Soratami") || cardName.equals("Inspiration") || cardName.equals("Touch of Brilliance")) + else if(cardName.equals("Counsel of the Soratami") || cardName.equals("Inspiration") || cardName.equals("Touch of Brilliance")) { SpellAbility spell = new Spell(card) { @@ -27206,7 +10234,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Concentrate") || cardName.equals("Harmonize") ) + else if(cardName.equals("Concentrate") || cardName.equals("Harmonize") ) { SpellAbility spell = new Spell(card) { @@ -27226,7 +10254,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Amnesia")) + else if(cardName.equals("Amnesia")) { SpellAbility spell = new Spell(card) { @@ -27251,10 +10279,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Evacuation")) + else if(cardName.equals("Evacuation")) { SpellAbility spell = new Spell(card) { @@ -27330,28 +10356,10 @@ if(cardName.equals("Jugan, the Rising Star")) };//command card.addDestroyCommand(destroy); } - //*************** START *********** START ************************** - if(cardName.equals("Serra Avatar")) - { - Command leavesPlay = new Command() - { - private static final long serialVersionUID = -2274397219668820020L; - - public void execute() - { - //moveto library - PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getOwner()); - AllZone.GameAction.moveTo(libraryZone, card); - //shuffle library - AllZone.GameAction.shuffle(card.getOwner()); - }//execute() - };//Command - card.addDestroyCommand(leavesPlay); - }//*************** //*************** START *********** START ************************** - if(cardName.equals("Ancestral Recall")) + else if(cardName.equals("Ancestral Recall")) { SpellAbility spell = new Spell(card) { @@ -27375,7 +10383,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Deep Analysis")) + else if(cardName.equals("Deep Analysis")) { SpellAbility spell = new Spell(card) { @@ -27403,7 +10411,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Allied Strategies")) + else if(cardName.equals("Allied Strategies")) { SpellAbility spell = new Spell(card) { @@ -27447,7 +10455,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Opt")) + else if(cardName.equals("Opt")) { SpellAbility spell = new Spell(card) { @@ -27503,7 +10511,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Needle Storm")) + else if(cardName.equals("Needle Storm")) { SpellAbility spell = new Spell(card) { @@ -27533,13 +10541,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Wandering Stream")) + else if(cardName.equals("Wandering Stream")) { SpellAbility spell = new Spell(card) { @@ -27572,10 +10575,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Worldly Tutor") || cardName.equals("Sylvan Tutor")) + else if(cardName.equals("Worldly Tutor") || cardName.equals("Sylvan Tutor")) { SpellAbility spell = new Spell(card) { @@ -27633,7 +10634,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Enlightened Tutor")) + else if(cardName.equals("Enlightened Tutor")) { SpellAbility spell = new Spell(card) { @@ -27707,10 +10708,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Pulse of the Tangle")) + else if(cardName.equals("Pulse of the Tangle")) { SpellAbility spell = new Spell(card) { @@ -27781,7 +10780,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Call of the Herd")) + else if(cardName.equals("Call of the Herd")) { SpellAbility spell = new Spell(card) { @@ -27821,7 +10820,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Elephant Ambush")) + else if(cardName.equals("Elephant Ambush")) { SpellAbility spell = new Spell(card) { @@ -27862,7 +10861,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Chatter of the Squirrel")) + else if(cardName.equals("Chatter of the Squirrel")) { SpellAbility spell = new Spell(card) { @@ -27906,7 +10905,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Acorn Harvest")) + else if(cardName.equals("Acorn Harvest")) { SpellAbility spell = new Spell(card) { @@ -27950,7 +10949,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Beast Attack")) + else if(cardName.equals("Beast Attack")) { SpellAbility spell = new Spell(card) { @@ -28000,7 +10999,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Roar of the Wurm")) + else if(cardName.equals("Roar of the Wurm")) { SpellAbility spell = new Spell(card) { @@ -28044,7 +11043,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Crush of Wurms")) + else if(cardName.equals("Crush of Wurms")) { SpellAbility spell = new Spell(card) { @@ -28090,7 +11089,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Grizzly Fate")) + else if(cardName.equals("Grizzly Fate")) { SpellAbility spell = new Spell(card) { @@ -28141,7 +11140,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Sprout")) + else if(cardName.equals("Sprout")) { SpellAbility spell = new Spell(card) { @@ -28184,7 +11183,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Delirium Skeins")) + else if(cardName.equals("Delirium Skeins")) { SpellAbility spell = new Spell(card) { @@ -28203,10 +11202,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Wrap in Vigor")) + else if(cardName.equals("Wrap in Vigor")) { SpellAbility spell = new Spell(card) { @@ -28253,7 +11250,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Smother")) + else if(cardName.equals("Smother")) { final SpellAbility spell = new Spell(card) { @@ -28311,7 +11308,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Strangling Soot")) + else if(cardName.equals("Strangling Soot")) { final SpellAbility spell = new Spell(card) { @@ -28442,7 +11439,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Minions' Murmurs")) + else if(cardName.equals("Minions' Murmurs")) { final SpellAbility spell = new Spell(card) { @@ -28480,7 +11477,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Tendrils of Corruption")) + else if(cardName.equals("Tendrils of Corruption")) { final SpellAbility spell = new Spell(card) { @@ -28528,7 +11525,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Ichor Slick")) + else if(cardName.equals("Ichor Slick")) { final SpellAbility spell = new Spell(card) { @@ -28608,10 +11605,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Funeral Charm")) + else if(cardName.equals("Funeral Charm")) { //discard final SpellAbility spell_one = new Spell(card) @@ -28688,10 +11683,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Regrowth")) + else if(cardName.equals("Regrowth")) { final SpellAbility spell = new Spell(card) { @@ -28739,10 +11732,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Commune with Nature")) + else if(cardName.equals("Commune with Nature")) { SpellAbility spell = new Spell(card) { @@ -28811,10 +11802,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Kodama's Reach")) + else if(cardName.equals("Kodama's Reach")) { SpellAbility spell = new Spell(card) { @@ -28901,136 +11890,7 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Pestermite")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) - { - if(c.isTapped()) - c.untap(); - else - c.tap(); - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 5202575895575352408L; - - public void execute() - { - CardList all = new CardList(); - all.addAll(AllZone.Human_Play.getCards()); - all.addAll(AllZone.Computer_Play.getCards()); - - CardList hum = new CardList(); - hum.addAll(AllZone.Human_Play.getCards()); - - if (all.size() != 0) { - - if(card.getController().equals(Constant.Player.Human)) { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target permanent to tap/untap.", true)); - ButtonUtil.enableAll(); - } - else if (card.getController().equals(Constant.Player.Computer)) { - Card human = CardFactoryUtil.AI_getBestCreature(hum); - ability.setTargetCard(human); - AllZone.Stack.add(ability); - } - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -3055232264358172133L; - - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - list = list.filter(new CardListFilter(){ - public boolean addCard(Card c) { - return c.isUntapped(); - } - }); - - return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Angel of Despair")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) - { - if(c.isToken()) - AllZone.getZone(c).remove(c); - - else - AllZone.GameAction.destroy(c); - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -3583483691705438214L; - - public void execute() - { - CardList all = new CardList(); - all.addAll(AllZone.Human_Play.getCards()); - all.addAll(AllZone.Computer_Play.getCards()); - - CardList hum = new CardList(); - hum.addAll(AllZone.Human_Play.getCards()); - - if (all.size() != 0) { - - if(card.getController().equals(Constant.Player.Human)) { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target permanent.", true)); - ButtonUtil.disableAll(); - } - else if (card.getController().equals(Constant.Player.Computer)) { - Card human = CardFactoryUtil.AI_getBestCreature(hum); - ability.setTargetCard(human); - AllZone.Stack.add(ability); - } - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -173202865726476053L; - - public boolean canPlayAI() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - - return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); - } - }); - }//*************** END ************ END ************************** - + //*************** START *********** START ************************** else if(cardName.equals("Yawgmoth's Bargain")){ final SpellAbility ability = new Ability(card, "0") @@ -29235,51 +12095,10 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Mystic Snake")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - if(AllZone.Stack.size() > 0) { - SpellAbility sa = AllZone.Stack.peek(); - if (sa.isSpell() && CardFactoryUtil.isCounterable(sa.getSourceCard()) ) { - sa = AllZone.Stack.pop(); - AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); - } - } - }//resolve() - };//SpellAbility - Command intoPlay = new Command() - { - private static final long serialVersionUID = -6564365394043612388L; - - public void execute() - { - if(AllZone.Stack.size() > 0) { - ability.setStackDescription("Mystic Snake counters " +AllZone.Stack.peek().getSourceCard().getName()); - AllZone.Stack.add(ability); - } - } - }; - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 6440845807532409545L; - - public boolean canPlayAI() - { - return false; - } - }); - - }//*************** END ************ END ************************** + //*************** START *********** START ************************** - if(cardName.equals("Absorb")) + else if(cardName.equals("Absorb")) { SpellAbility spell = new Spell(card) { @@ -29311,7 +12130,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Undermine")) + else if(cardName.equals("Undermine")) { SpellAbility spell = new Spell(card) { @@ -29343,7 +12162,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Punish Ignorance")) + else if(cardName.equals("Punish Ignorance")) { SpellAbility spell = new Spell(card) { @@ -29378,7 +12197,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Exclude")) + else if(cardName.equals("Exclude")) { SpellAbility spell = new Spell(card) { @@ -29410,7 +12229,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Eladamri's Call")) + else if(cardName.equals("Eladamri's Call")) { final SpellAbility spell = new Spell(card) { @@ -29468,7 +12287,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Dismiss")) + else if(cardName.equals("Dismiss")) { SpellAbility spell = new Spell(card) { @@ -30232,312 +13051,7 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Captain Sisay")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 7978812786945030021L; - public void resolve() - { - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - }//resolve() - public void humanResolve() - { - CardList cards = new CardList(AllZone.Human_Library.getCards()); - //legends = legends.getType().contains("Legendary"); - CardList legends = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - //System.out.println("type: " +cards.get(i).getType()); - if (cards.get(i).getType().contains("Legendary")){ - //System.out.println(cards.get(i).getName()); - Card c = cards.get(i); - legends.add(c); - - } - } - - if (legends.size() != 0) { - Object check = AllZone.Display.getChoiceOptional("Select Legend", legends.toArray()); - if(check != null) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, (Card)check); - } - AllZone.GameAction.shuffle(Constant.Player.Human); - } - } - public void computerResolve() - { - Card[] library = AllZone.Computer_Library.getCards(); - CardList list = new CardList(library); - CardList legends = new CardList(); - //list = list.getType("Creature"); - - for (int i=0;i < list.size(); i++) - { - if (list.get(i).getType().contains("Legendary")){ - Card k = list.get(i); - legends.add(k); - } - - } - - //pick best creature - if (legends.size() != 0){ - Card c = CardFactoryUtil.AI_getBestCreature(legends); - if(c == null) - c = library[0]; - System.out.println("computer picked - " +c); - AllZone.Computer_Library.remove(c); - AllZone.Computer_Hand.add(c); - } - } - - - };//SpellAbility - //card.addSpellAbility(ability); - ability.setDescription("tap: Search your library for a Legend or legendary card, reveal that card, and put it into your hand. Then shuffle your library."); - ability.setBeforePayMana(new Input_NoCost_TapAbility((Ability_Tap) ability)); - ability.setStackDescription("Captain Sisay searches for a Legend or Legendary card..."); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Siege-Gang Commander")) - { - - final SpellAbility comesIntoPlayAbility = new Ability(card, "0") - { - public void resolve() - { - makeToken(); - makeToken(); - makeToken(); - }//resolve() - - public void makeToken() - { - Card c = new Card(); - - c.setName("Goblin"); - c.setImageName("R 1 1 Goblin"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("R"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Goblin"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - } - - }; //comesIntoPlayAbility - - Command intoPlay = new Command() - { - private static final long serialVersionUID = 8778828278589063477L; - - public void execute() - { - comesIntoPlayAbility.setStackDescription(card.getName() + " - put three 1/1 red Goblin creature tokens into play."); - AllZone.Stack.add(comesIntoPlayAbility); - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - - final SpellAbility ability = new Ability(card, "1 R") - { - - private static final long serialVersionUID = -6653781740344703908L; - - public void resolve() - { - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - }//resolve() - - public void humanResolve() { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList cards = new CardList(play.getCards()); - - CardList creatures = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - if (cards.get(i).getType().contains("Goblin") || cards.get(i).getKeyword().contains("Changeling")){ - Card k = cards.get(i); - creatures.add(k); - } - } - - if (creatures.size() != 0) { - Object check = AllZone.Display.getChoiceOptional("Select Goblin to Sacrifice", creatures.toArray()); - if(check != null) - { - Card c = (Card)check; - if(AllZone.GameAction.isCardInPlay(c)) - { - AllZone.GameAction.sacrifice(c); - - if(getTargetCard() != null) - { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) - { - Card crd = getTargetCard(); - //c.addDamage(damage); - AllZone.GameAction.addDamage(crd, 2); - } - } - else - AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); - - } - } - } - }//humanResolve - - public void computerResolve() { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList cards = new CardList(play.getCards()); - - CardList creatures = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - if (cards.get(i).getType().contains("Goblin") || cards.get(i).getType().contains("Changeling")){ - Card k = cards.get(i); - creatures.add(k); - } - } - //.... TODO - - }//compResolve - - public boolean canPlayAI() - { - return false; - } - - };//ability - - card.addSpellAbility(ability); - ability.setDescription("1 R, Sacrifice a goblin: Siege-Gang Commander deals 2 damage to target creature or player ."); - ability.setStackDescription("Siege-Gang Commander deals 2 damage to target creature or player"); - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if(cardName.equals("Brion Stoutarm")) - { - - final SpellAbility ability = new Ability_Tap(card, "R") - { - private static final long serialVersionUID = -7755879134314608010L; - - public void resolve() - { - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - }//resolve() - - public void humanResolve() { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList cards = new CardList(play.getCards()); - - CardList creatures = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - if (cards.get(i).getType().contains("Creature") && !cards.get(i).getName().equals("Brion Stoutarm")){ - Card k = cards.get(i); - creatures.add(k); - } - } - - if (creatures.size() != 0) { - Object check = AllZone.Display.getChoiceOptional("Select Creature to Sacrifice", creatures.toArray()); - if(check != null) - { - Card c = (Card)check; - if(AllZone.GameAction.isCardInPlay(c)) - { - int power = c.getNetAttack(); - AllZone.GameAction.sacrifice(c); - String opponent = AllZone.GameAction.getOpponent(player); - - PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); - life.subtractLife(power); - - GameActionUtil.executeLifeLinkEffects(card, power); - for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) - GameActionUtil.executeGuiltyConscienceEffects(card, power); - - card.setDealtDmgToOppThisTurn(true); - } - } - } - }//humanResolve - - public void computerResolve() { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - CardList cards = new CardList(play.getCards()); - - CardList creatures = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - if (cards.get(i).getType().contains("Creature") && !cards.get(i).getName().equals("Brion Stoutarm")){ - Card k = cards.get(i); - creatures.add(k); - } - } - //.... TODO - - }//compResolve - - public boolean canPlayAI() - { - return false; - } - - };//ability - - card.addSpellAbility(ability); - ability.setDescription("R, tap, Sacrifice a creature other than Brion Stoutarm: Brion Stoutarm deals damage equal to the sacrificed creature's power to target player ."); - ability.setStackDescription("Brion Stoutarm deals damage equal to sacrificed creature's power"); - }//*************** END ************ END ************************** - - + //*************** START *********** START ************************** else if(cardName.equals("Duress")) { @@ -30683,268 +13197,7 @@ if(cardName.equals("Jugan, the Rising Star")) spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell)); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Trinket Mage")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) - { - Card c = getTargetCard(); - AllZone.GameAction.shuffle(card.getController()); - lib.remove(c); - hand.add(c); - - } - }//resolve() - }; - Command intoPlay = new Command() - { - - /** - * - */ - private static final long serialVersionUID = 4022442363194287539L; - - public void execute() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList arts = new CardList(); - - for (int i=0;i 0) - { - if (card.getController().equals(Constant.Player.Computer)) - { - lib.remove(landInLib.get(0)); - play.add(landInLib.get(0)); - } - else - { - Object o = AllZone.Display.getChoiceOptional("Select land card to put into play: ", landInLib.toArray()); - if (o != null) - { - Card crd = (Card)o; - lib.remove(crd); - play.add(crd); - } - } - AllZone.GameAction.shuffle(card.getController()); - } - }//if(isCardInPlay) - } - - public boolean canPlayAI() - { - CardList landInLib = new CardList(AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer).getCards()); - CardList landInPlay = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards()); - - landInLib = landInLib.getType("Land"); - landInPlay = landInPlay.getType("Land"); - - if (landInLib.size() > 0 && landInPlay.size() > 0) - return true; - else - return false; - - } - public void chooseTargetAI() - { - CardList land = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - if(c.getType().contains("Plains") || c.getType().contains("Forest")) - return true; - else - return false; - } - }); - if(land.size()>0) - setTargetCard(land.get(0)); - } - }; - - Input runtime = new Input() - { - private static final long serialVersionUID = -4320917612145305541L; - - public void showMessage() - { - CardList land = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - if(c.getType().contains("Plains") || c.getType().contains("Forest")) - return true; - else - return false; - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, land, "Select a Plains or Forest to sacrifice.", false)); - } - }; - ability.setBeforePayMana(runtime); - ability.setDescription("T, Sacrifice a Forest or Plains: Search your library for a land card, put it into play, then shuffle your library."); - ability.setStackDescription(card.getName() + " - Search your library for a card and put it into play, then shuffle your library"); - card.addSpellAbility(ability); - - } - - //*************** START *********** START ************************** - if(cardName.equals("Knight of the White Orchid")) - { - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - - - CardList basic = new CardList(lib.getCards()); - basic = basic.getType("Plains"); - - - - if (card.getController().equals(Constant.Player.Computer)) - { - if (basic.size() > 0) - { - Card c = basic.get(0); - lib.remove(c); - play.add(c); - - } - } - else // human - { - if (basic.size() > 0) - { - Object o = AllZone.Display.getChoiceOptional("Select Plains card to put into play: ", basic.toArray()); - if (o != null) - { - Card c = (Card)o; - lib.remove(c); - play.add(c); - } - } - } - AllZone.GameAction.shuffle(card.getController()); - }//resolve() - - };//Ability - - Command fetchBasicLand = new Command() - { - - private static final long serialVersionUID = -1086551054597721988L; - - public void execute() - { - String player = card.getController(); - PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(player)); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - CardList self = new CardList(play.getCards()); - CardList opp = new CardList(oppPlay.getCards()); - - self = self.getType("Land"); - opp = opp.getType("Land"); - - if (self.size() < opp.size()) - { - ability.setStackDescription(card.getName()+ " - search library for a plains and put it into play"); - AllZone.Stack.add(ability); - } - } - }; - - card.addComesIntoPlayCommand(fetchBasicLand); - - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Niv-Mizzet, the Firemind")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 8670005059055071206L; - public boolean canPlayAI() {return false;} - public void resolve() - { - AllZone.GameAction.drawCard(card.getController()); - } - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("tap: Draw a card."); - ability.setStackDescription(card.getName() + " - draw a card."); - ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); - }//*************** END ************ END ************************** - + //*************** START *********** START ************************** else if(cardName.equals("Hoofprints of the Stag")) { @@ -31369,369 +13372,7 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(a2); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Elvish Farmer") || cardName.equals("Mycologist")) - { - Command intoPlay = new Command() - { - private static final long serialVersionUID = 882942955555047018L; - public boolean firstTime = true; - public void execute() - { - - if(firstTime){ - card.setCounter(Counters.SPORE, 0); - } - firstTime = false; - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - final SpellAbility a2 = new Ability(card, "0") - { - public void chooseTargetAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - CardList saps = new CardList(play.getCards()); - saps = saps.filter(new CardListFilter() - { - - public boolean addCard(Card c) { - if((c.getType().contains("Saproling") || c.getKeyword().contains("Changeling")) && - AllZone.GameAction.isCardInPlay(c) ) - return true; - return false; - } - - }); - - if (saps.size() != 0) - setTargetCard(saps.getCard(0)); - } - public void resolve() - { - //get all saprolings: - Card c = getTargetCard(); - if(c == null ) - return; - - if (!AllZone.GameAction.isCardInPlay(c)) - return; - - if(AllZone.GameAction.isCardInPlay(c)) - { - //AllZone.getZone(c).remove(c); - AllZone.GameAction.sacrifice(c); - - PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); - life.addLife(2); - } - }//resolve - public boolean canPlayAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - CardList saps = new CardList(play.getCards()); - saps = saps.filter(new CardListFilter() - { - - public boolean addCard(Card c) { - if(c.getType().contains("Saproling") || c.getKeyword().contains("Changeling") && - AllZone.GameAction.isCardInPlay(c)) - return true; - return false; - } - - }); - if(AllZone.Computer_Life.getLife() < 6 && saps.size() > 0) - return true; - else - return false; - } - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = -4803541385354247499L; - - public void showMessage() - { - CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - saps = saps.getType("Saproling"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); - } - }; - - card.addSpellAbility(a2); - a2.setDescription("Sacrifice a Saproling: You gain 2 life."); - a2.setStackDescription(card.getController() + " gains 2 life."); - a2.setBeforePayMana(runtime); - - - }//*************** END ************ END ************************** - - else if (cardName.equals("Pallid Mycoderm")) - { - - Command intoPlay = new Command() - { - private static final long serialVersionUID = 3400057700040211691L; - public boolean firstTime = true; - public void execute() - { - - if(firstTime){ - card.setCounter(Counters.SPORE, 0); - } - firstTime = false; - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - final SpellAbility a2 = new Ability(card, "0") - { - final Command eot1 = new Command() - { - private static final long serialVersionUID = -4485431571276851181L; - - public void execute() - { - String player = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - CardList creats = new CardList(play.getCards()); - creats = creats.getType("Creature"); - - for (int i=0; i < creats.size(); i++) - { - Card creat = creats.get(i); - - if (creat.getType().contains("Fungus") || creat.getType().contains("Saproling") || creat.getKeyword().contains("Changeling")) - { - creat.addTempAttackBoost(-1); - creat.addTempDefenseBoost(-1); - } - } - - } - }; - public void resolve() - { - //get all player controls saprolings: - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - CardList creats = new CardList(play.getCards()); - creats = creats.getType("Creature"); - - @SuppressWarnings("unused") // saps - CardList saps = new CardList(); - - Card c = getTargetCard(); - @SuppressWarnings("unused") // hand - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); - - if(AllZone.GameAction.isCardInPlay(c)) - { - //AllZone.getZone(c).remove(c); - AllZone.GameAction.sacrifice(c); - - - for (int i=0; i < creats.size(); i++) - { - Card creat = creats.get(i); - - if (creat.getType().contains("Fungus") || creat.getType().contains("Saproling")) - { - creat.addTempAttackBoost(1); - creat.addTempDefenseBoost(1); - } - } - - } - AllZone.EndOfTurn.addUntil(eot1); - } - public boolean canPlayAI() - { - return false; - } - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = 6754180514935882692L; - - public void showMessage() - { - CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - saps = saps.getType("Saproling"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); - } - }; - - card.addSpellAbility(a2); - a2.setDescription("Sacrifice a Saproling: Each Fungus and each Saproling you control gets +1/+1 until end of turn"); - a2.setStackDescription("Saprolings and Fungi you control get +1/+1 until end of turn."); - - a2.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Psychotrope Thallid")) - { - Command intoPlay = new Command() - { - private static final long serialVersionUID = 8020106056714209199L; - public boolean firstTime = true; - public void execute() - { - - if(firstTime){ - card.setCounter(Counters.SPORE, 0); - } - firstTime = false; - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - final SpellAbility a2 = new Ability(card, "1") - { - public void resolve() - { - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c)) - { - //AllZone.getZone(c).remove(c); - AllZone.GameAction.sacrifice(c); - - AllZone.GameAction.drawCard(c.getController()); - } - }//resolve - public boolean canPlayAI() - { - //TODO: make AI able to use this - return false; - } - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = -6388866343458002392L; - - public void showMessage() - { - CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - saps = saps.getType("Saproling"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); - } - }; - - card.addSpellAbility(a2); - a2.setDescription("1, Sacrifice a Saproling: You draw a card."); - a2.setStackDescription(card.getController() + " draws a card."); - a2.setBeforePayMana(runtime); - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Wall of Mulch")) - { - - final SpellAbility a2 = new Ability(card, "G") - { - public void resolve() - { - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c)) - { - //AllZone.getZone(c).remove(c); - AllZone.GameAction.sacrifice(c); - AllZone.GameAction.drawCard(c.getController()); - } - }//resolve - public boolean canPlayAI() - { - //TODO: make AI able to use this - return false; - } - };//SpellAbility - - Input runtime = new Input() - { - private static final long serialVersionUID = -4390488827563977718L; - - public void showMessage() - { - CardList walls = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - walls = walls.getType("Wall"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, walls, "Select a Wall to sacrifice.", false)); - } - }; - - card.addSpellAbility(a2); - a2.setDescription("G, Sacrifice a Wall: You draw a card."); - a2.setStackDescription(card.getController() + " draws a card."); - a2.setBeforePayMana(runtime); - - - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - else if (cardName.equals("Rootwater Thief")) - { - //final String player = card.getController(); - //final String opponent = AllZone.GameAction.getOpponent(player); - - final Ability ability2 = new Ability(card, "2") - { - public void resolve() - { - String opponent = AllZone.GameAction.getOpponent(card.getController()); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, opponent); - CardList cards = new CardList(lib.getCards()); - - if (cards.size() > 0 ) - { - if (card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select card to remove: ", cards.toArray()); - Card c = (Card)o; - AllZone.GameAction.removeFromGame(c); - AllZone.GameAction.shuffle(opponent); - } - else - { - Card c = lib.get(0); - AllZone.GameAction.removeFromGame(c); - AllZone.GameAction.shuffle(opponent); - } - } - - } - public boolean canPlay() - { - //this is set to false, since it should only TRIGGER - return false; - } - };// ability2 - //card.clearSpellAbility(); - card.addSpellAbility(ability2); - ability2.setStackDescription(card.getName() + " - search opponent's library and remove a card from game."); - - }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if (cardName.equals("Goblin Trenches")) @@ -31860,86 +13501,7 @@ if(cardName.equals("Jugan, the Rising Star")) ability.setBeforePayMana(runtime); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if (cardName.equals("Dark Depths")) - { - Command intoPlay = new Command() - { - private static final long serialVersionUID = 6805304924956145866L; - - public boolean firstTime = true; - public void execute() - { - if(firstTime){ - card.setCounter(Counters.ICE, 10); - } - firstTime = false; - } - }; - - card.addComesIntoPlayCommand(intoPlay); - - final SpellAbility ability = new Ability(card, "3") - { - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0 && AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - } - public boolean canPlayAI() { - String phase = AllZone.Phase.getPhase(); - return phase.equals(Constant.Phase.Main2); - } - - public void resolve() - { - card.subtractCounter(Counters.ICE, 1); - - if (card.getCounters(Counters.ICE) == 0) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - //make token - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Marit Lage"); - c.setManaCost("B"); - c.setToken(true); - - c.addType("Legendary"); - c.addType("Creature"); - c.addType("Avatar"); - c.addIntrinsicKeyword("Flying"); - c.addExtrinsicKeyword("Indestructible"); - c.setBaseAttack(20); - c.setBaseDefense(20); - - play.add(c); - AllZone.GameAction.sacrifice(card); - }// if counters == 0 - } - }; - ability.setDescription("3: Remove an ice counter from Dark Depths."); - ability.setStackDescription(card.getName() +" - remove an ice counter."); - - card.addSpellAbility(ability); - - }//*************** END ************ END ************************** /* //*************** START *********** START ************************** else if (cardName.equals("Acridian")) @@ -31973,858 +13535,8 @@ if(cardName.equals("Jugan, the Rising Star")) */ - //*************** START *********** START ************************** - else if (cardName.equals("Oros, the Avenger")) - { - final String player = card.getController(); - - final Ability ability2 = new Ability(card, "2 W") - { - public void resolve() - { - if (player.equals("Human")) - { - CardList cards = new CardList(); - PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - cards.addAll(hum.getCards()); - cards.addAll(comp.getCards()); - cards = cards.getType("Creature"); - - for (int i=0;i 0; - } - - public void resolve() - { - Card c = getTargetCard(); - - if (c!=null) - { - if ( CardFactoryUtil.canTarget(card, c) && c.isCreature() && c.getType().contains("Legendary") ) - AllZone.GameAction.moveTo(AllZone.getZone(Constant.Zone.Hand, card.getOwner()), c); - } - } - }; - - Input runtime = new Input() - { - - private static final long serialVersionUID = -7649200192384343204L; - - public void showMessage() - { - CardList choice = new CardList(); - choice.addAll(AllZone.Human_Play.getCards()); - choice.addAll(AllZone.Computer_Play.getCards()); - - choice = choice.getType("Creature"); - choice = choice.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return (c.isCreature() && c.getType().contains("Legendary")); - } - }); - - //System.out.println("size of choice: " + choice.size()); - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, choice, "Select target Legendary creature:", true)); - } - }; - - ability.setDescription("tap: Return target legendary creature to its owner's hand."); - //ability.setStackDescription(card.getName() + " - gives target creature +1/+2 until end of turn."); - - card.addSpellAbility(ability); - ability.setBeforePayMana(runtime); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add G"); - card.setText(card.getSpellText() + "\r\ntap: Return target legendary creature to its owner's hand."); - //card.addIntrinsicKeyword("tap: add G"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Pendelhaven")) - { - final Ability_Tap ability = new Ability_Tap(card, "0") - { - private static final long serialVersionUID = 8154776336533992188L; - - public boolean canPlayAI() - { - return getAttacker() != null; - } - - public void chooseTargetAI() - { - setTargetCard(getAttacker()); - } - public Card getAttacker() - { - //target creature that is going to attack - Combat c = ComputerUtil.getAttackers(); - CardList att = new CardList(); - att.addAll(c.getAttackers()); - - for (int i=0; i 0 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) - return true; - else - return false; - } - - }; - - ability.setDescription("1 U, tap: Put target artifact card in your graveyard on top of your library."); - ability.setStackDescription(card.getName() + " - put artifact card in your graveyard on top of your library."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n1 U, tap: Put target artifact card in your graveyard on top of your library."); - //card.addExtrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Volrath's Stronghold")) - { - final Ability_Tap ability = new Ability_Tap(card, "1 B") - { - private static final long serialVersionUID = 2821525387844776907L; - - public void resolve() - { - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - - public void humanResolve() - { - CardList cards = new CardList(AllZone.Human_Graveyard.getCards()); - - CardList list = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - //System.out.println("type: " +cards.get(i).getType()); - if (cards.get(i).getType().contains("Creature")){ - //System.out.println(cards.get(i).getName()); - Card c = cards.get(i); - list.add(c); - - } - } - - if (list.size() != 0) { - Object check = AllZone.Display.getChoiceOptional("Select Creature", list.toArray()); - if(check != null) - { - //PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); - //library.add((Card)check, 0); - AllZone.GameAction.moveToTopOfLibrary((Card)check); - } - } - } - public void computerResolve() - { - Card[] grave = AllZone.Computer_Graveyard.getCards(); - CardList list = new CardList(grave); - CardList creats = new CardList(); - - for (int i=0;i < list.size(); i++) - { - if (list.get(i).getType().contains("Creature")){ - Card k = list.get(i); - creats.add(k); - } - - } - - //pick best artifact - if (creats.size() != 0){ - Card c = CardFactoryUtil.AI_getBestCreature(list); - if(c == null) - c = grave[0]; - //System.out.println("computer picked - " +c); - AllZone.Computer_Graveyard.remove(c); - //AllZone.Computer_Library.add(c, 0); - AllZone.GameAction.moveToTopOfLibrary(c); - } - }//computerResolve - - public boolean canPlay(){ - String controller = card.getController(); - - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, controller); - CardList list = new CardList(grave.getCards()); - CardList cards = new CardList(); - - for (int i=0;i 0 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) - return true; - else - return false; - } - - }; - - ability.setDescription("1 B, tap: Put target creature card in your graveyard on top of your library."); - ability.setStackDescription(card.getName() + " - put creature card in your graveyard on top of your library."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n1 U, tap: Put target creature card in your graveyard on top of your library."); - //card.addExtrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Oboro, Palace in the Clouds")) - { - final Ability ability = new Ability(card, "1") - { - - public boolean canPlayAI() - { - return false; - } - - public void resolve() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, card); - } - }; - - ability.setDescription("1: Return Oboro, Palace in the Clouds to your hand."); - ability.setStackDescription("Return " + card.getName() + " to your hand."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n1: Return Oboro, Palace in the Clouds to your hand."); - //card.addExtrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Mikokoro, Center of the Sea")) - { - final Ability_Tap ability = new Ability_Tap(card, "2") - { - private static final long serialVersionUID = -199960897120235012L; - - public void resolve() - { - AllZone.GameAction.drawCard(Constant.Player.Computer); - AllZone.GameAction.drawCard(Constant.Player.Human); - } - }; - - ability.setDescription("2, tap: Each player draws a card."); - ability.setStackDescription(card.getName() + " - Each player draws a card."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n2, tap: Each player draws a card."); - //card.addExtrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Gargoyle Castle")) - { - final Ability_Tap ability = new Ability_Tap(card, "5") - { - - private static final long serialVersionUID = 8524185208900629992L; - - public boolean canPlay() - { - if (AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) - return true; - else - return false; - } - - public void resolve() - { - String player = card.getController(); - AllZone.GameAction.sacrifice(card); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - //make token - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Gargoyle"); - c.setImageName("C 3 4 Gargoyle"); - c.setManaCost("1"); - c.setToken(true); - - c.addType("Artifact"); - c.addType("Creature"); - c.addType("Gargoyle"); - c.setBaseAttack(3); - c.setBaseDefense(4); - c.addIntrinsicKeyword("Flying"); - - play.add(c); - } - }; - - ability.setDescription("5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); - ability.setStackDescription(card.getName() + " - Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); - //card.addIntrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Kher Keep")) - { - final Ability_Tap ability = new Ability_Tap(card, "1 R") - { - private static final long serialVersionUID = 4037838521451709399L; - - public boolean canPlay() - { - if (AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) - return true; - else - return false; - } - - public void resolve() - { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - //make token - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Kobolds of Kher Keep"); - c.setManaCost("R"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Kobold"); - c.setBaseAttack(0); - c.setBaseDefense(1); - - play.add(c); - } - }; - - ability.setDescription("1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); - ability.setStackDescription(card.getName() + " - Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); - //card.addIntrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Vitu-Ghazi, the City-Tree")) - { - final Ability_Tap ability = new Ability_Tap(card, "2 G W") - { - private static final long serialVersionUID = 1781653158406511188L; - - public boolean canPlay() - { - if (AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - } - - public void resolve() - { - String player = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); - - //make token - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Saproling"); - c.setImageName("G 1 1 Saproling"); - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Saproling"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - play.add(c); - } - }; - - ability.setDescription("2 G W, tap: Put a 1/1 green Saproling creature token into play."); - ability.setStackDescription(card.getName() + " - Put a 1/1 green Saproling creature token named into play."); - - card.addSpellAbility(ability); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - //card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getSpellText() + "\r\n 2 G W, tap: Put a 1/1 green Saproling creature token into play."); - //card.addIntrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** //*************** START *********** START ************************** else if(cardName.equals("Hatching Plans")) @@ -32856,525 +13568,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Anodet Lurker")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.addLife(3); - } - }; - - Command gain3Life = new Command() - { - private static final long serialVersionUID = 9156307402354672176L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - Gain 3 life."); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(gain3Life); - }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - else if(cardName.equals("Tarpan")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.addLife(1); - } - }; - - Command gain1Life = new Command() - { - private static final long serialVersionUID = 206350020224577500L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - Gain 1 life."); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(gain1Life); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Onulet")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.addLife(2); - } - }; - - Command gain2Life = new Command() - { - private static final long serialVersionUID = 7840609060047275126L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - Gain 2 life."); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(gain2Life); - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Sprouting Thrinax")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - makeToken(); - makeToken(); - makeToken(); - }//resolve() - - void makeToken() - { - Card c = new Card(); - - c.setName("Saproling"); - c.setImageName("G 1 1 Saproling"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Saproling"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - };//Ability - - Command make3Tokens = new Command() - { - private static final long serialVersionUID = 5246587197020320581L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - put three 1/1 Saproling creature tokens into play."); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(make3Tokens); - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - else if(cardName.equals("Solemn Simulacrum")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - - CardList basic = new CardList(lib.getCards()); - basic = basic.getType("Basic"); - - if (card.getController().equals(Constant.Player.Computer)) - { - if (basic.size() > 0) - { - Card c = basic.get(0); - lib.remove(c); - play.add(c); - c.tap(); - - } - } - else // human - { - if (basic.size() > 0) - { - Object o = AllZone.Display.getChoiceOptional("Select Basic Land card to put into play tapped: ", basic.toArray()); - if (o != null) - { - Card c = (Card)o; - lib.remove(c); - play.add(c); - c.tap(); - } - } - } - AllZone.GameAction.shuffle(card.getController()); - }//resolve() - };//Ability - - Command fetchBasicLand = new Command() - { - private static final long serialVersionUID = -7912757481694029348L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - search library for a basic land card and put it into play tapped."); - AllZone.Stack.add(ability); - } - }; - - final Ability ability2 = new Ability(card, "0") - { - public void resolve() - { - - AllZone.GameAction.drawCard(card.getController()); - }//resolve() - };//Ability - - Command draw = new Command() - { - private static final long serialVersionUID = -549395102229088642L; - - public void execute() - { - ability2.setStackDescription(card.getName()+ " - Draw a card."); - AllZone.Stack.add(ability2); - } - }; - - card.addDestroyCommand(draw); - card.addComesIntoPlayCommand(fetchBasicLand); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Gods' Eye, Gate to the Reikai")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("1"); - c.setToken(true); - - c.setName("Spirit"); - c.setImageName("C 1 1 Spirit"); - - c.addType("Creature"); - c.addType("Spirit"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - play.add(c); - - }//resolve() - };//Ability - - Command makeToken = new Command() - { - private static final long serialVersionUID = 2339209292936869322L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - put a 1/1 Spirit creature token into play"); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(makeToken); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Flagstones of Trokair")) - { - - final Ability ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - - CardList plains = new CardList(lib.getCards()); - plains = plains.getType("Plains"); - - if (card.getController().equals(Constant.Player.Computer)) - { - if (plains.size() > 0) - { - Card c = plains.get(0); - lib.remove(c); - play.add(c); - c.tap(); - - } - } - else // human - { - if (plains.size() > 0) - { - Object o = AllZone.Display.getChoiceOptional("Select plains card to put into play tapped: ", plains.toArray()); - if (o != null) - { - Card c = (Card)o; - lib.remove(c); - play.add(c); - c.tap(); - } - } - } - AllZone.GameAction.shuffle(card.getController()); - }//resolve() - };//Ability - - Command fetchPlains = new Command() - { - - private static final long serialVersionUID = 5991465998493672076L; - - public void execute() - { - ability.setStackDescription(card.getName()+ " - search library for a plains card and put it into play tapped."); - AllZone.Stack.add(ability); - } - }; - - card.addDestroyCommand(fetchPlains); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if (cardName.equals("Master Transmuter")) - { - final Ability_Tap ability = new Ability_Tap(card, "U") - { - - private static final long serialVersionUID = -9076784333448226913L; - - public void resolve() { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - CardList artifacts = new CardList(hand.getCards()); - artifacts = artifacts.getType("Artifact"); - if (card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Select artifact to put onto the battlefield: ", artifacts.toArray()); - if(o!=null) - { - Card c = (Card)o; - hand.remove(c); - play.add(c); - } - } - else - { - //CardList arts = new CardList(play.getCards()); - //arts = arts.getType("Artifact"); - - Card c = getTargetCard(); - AllZone.GameAction.moveTo(hand, c); - - Card crd = CardFactoryUtil.AI_getMostExpensivePermanent(artifacts, card, false); - hand.remove(crd); - play.add(crd); - - } - } - - public boolean canPlayAI() - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - - CardList handArts = new CardList(hand.getCards()); - handArts = handArts.getType("Artifact"); - - CardList playArts = new CardList(play.getCards()); - playArts = playArts.getType("Artifact"); - - if (handArts.size() > 0 && playArts.size() > 0){ - - if (CardUtil.getConvertedManaCost(CardFactoryUtil.AI_getCheapestPermanent(playArts, card, false).getManaCost()) < - CardUtil.getConvertedManaCost(CardFactoryUtil.AI_getMostExpensivePermanent(handArts, card, false).getManaCost())) - { - setTargetCard(CardFactoryUtil.AI_getCheapestPermanent(playArts, card, false)); - return true; - } - - } - return false; - } - }; - - Input target = new Input() - { - - private static final long serialVersionUID = 4246650335595231655L; - public void showMessage() - { - AllZone.Display.showMessage("Select artifact to return to hand"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play,card.getController()); - if(c.isArtifact() && AllZone.GameAction.isCardInZone(c, play)) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand,card.getController()); - - AllZone.GameAction.moveTo(hand, c); - AllZone.Stack.add(ability); - stopSetNext(new ComputerAI_StackNotEmpty()); - } - }//selectCard() - };//Input - - card.addSpellAbility(ability); - ability.setDescription("U, tap, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield."); - ability.setStackDescription(card + "You may put an artifact card from your hand onto the battlefield"); - ability.setAfterPayMana(target); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Hanna, Ship's Navigator")) - { - final Ability_Tap ability = new Ability_Tap(card, "1 U W") - { - private static final long serialVersionUID = 7959233413572648987L; - - public void resolve() - { - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - }//resolve() - public void humanResolve() - { - CardList cards = new CardList(AllZone.Human_Graveyard.getCards()); - //legends = legends.getType().contains("Legendary"); - CardList list = new CardList(); - - for (int i=0;i < cards.size(); i++) - { - //System.out.println("type: " +cards.get(i).getType()); - if (cards.get(i).getType().contains("Artifact") || cards.get(i).getType().contains("Enchantment")){ - //System.out.println(cards.get(i).getName()); - Card c = cards.get(i); - list.add(c); - - } - } - - if (list.size() != 0) { - Object check = AllZone.Display.getChoiceOptional("Select Artifact or Enchantment", list.toArray()); - if(check != null) - { - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - AllZone.GameAction.moveTo(hand, (Card)check); - } - } - } - public void computerResolve() - { - Card[] grave = AllZone.Computer_Graveyard.getCards(); - CardList list = new CardList(grave); - CardList artenchants = new CardList(); - //list = list.getType("Creature"); - - for (int i=0;i < list.size(); i++) - { - if (list.get(i).getType().contains("Artifact") || list.get(i).getType().contains("Enchantment")){ - Card k = list.get(i); - artenchants.add(k); - } - - } - - //pick best artifact / enchantment - if (artenchants.size() != 0){ - Card c = CardFactoryUtil.AI_getBestArtifact(list); - if(c == null) - c = CardFactoryUtil.AI_getBestEnchantment(list,card, true); - if(c == null) - c = grave[0]; - System.out.println("computer picked - " +c); - AllZone.Computer_Graveyard.remove(c); - AllZone.Computer_Hand.add(c); - } - }//computerResolve - - public boolean canPlay(){ - String controller = card.getController(); - - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, controller); - CardList list = new CardList(grave.getCards()); - CardList cards = new CardList(); - - for (int i=0;i 0 && AllZone.GameAction.isCardInPlay(card) && !card.hasSickness() && card.isUntapped()) - return true; - else - return false; - } - - - };//SpellAbility - //card.addSpellAbility(ability); - ability.setDescription("1 U W, tap: Return target artifact or enchantment card from your graveyard to your hand."); - ability.setBeforePayMana(new Input_PayManaCost(ability)); - ability.setStackDescription("Hanna, Ship's Navigator - Returns an artifact or enchantment card from graveyard to hand."); - card.addSpellAbility(ability); - - - }//*************** END ************ END ************************** - - + //*************** START *********** START ************************** else if(cardName.equals("Sleight of Hand")) { @@ -33527,7 +13721,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Banishing Knack")) + else if(cardName.equals("Banishing Knack")) { SpellAbility spell = new Spell(card) { @@ -33583,153 +13777,11 @@ if(cardName.equals("Jugan, the Rising Star")) spell.setStackDescription("Target creature gains \"T: Return target nonland permanent to its owner's hand.\""); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if (cardName.equals("Cromat")){ - - //LibBounce Ability - final Ability a1 = new Ability(card, "G U") - { - public boolean canPlayAI() {return false;} - - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card) ) - { - card.setBaseAttack(5); - card.setBaseDefense(5); - - card.setAssignedDamage(0); - card.setDamage(0); - card.untap(); - AllZone.getZone(card).remove(card); - - //put card on top of library - PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); - library.add(card, 0); - } - }//resolve() - };//SpellAbility - - Input runtime1 = new Input() - { - private static final long serialVersionUID = 1469011418219527227L; - - public void showMessage() - { - a1.setStackDescription("Put " +card +" on top of its owner's library"); - - stopSetNext(new Input_PayManaCost(a1)); - } - }; - a1.setDescription("G U: Put Cromat on top of its owner's library."); - a1.setStackDescription("Put Cromat on top of its owner's library."); - card.addSpellAbility(a1); - a1.setBeforePayMana(runtime1); - //Kill ability + - final Ability a2 = new Ability(card, "W B"){ - public boolean canPlay() - { - return (AllZone.GameAction.isCardInPlay(card) && (AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card))); - } - public boolean canPlayAI() - { - return false; - //TODO - } - public void resolve() - { - AllZone.GameAction.destroy(getTargetCard()); - }//resolve() - }; - Input runtime2 = new Input() - { - private static final long serialVersionUID = 1L; - - public void showMessage() - { - CardList targets = new CardList(); - if(AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card)){ - if (AllZone.Combat.isBlocked(card)){ targets = AllZone.Combat.getBlockers(card); } - else { - targets = new CardList(); - for (Card c : AllZone.Combat.getAttackers()){ - if (AllZone.Combat.isBlocked(c)) - if (AllZone.Combat.getBlockers(c).contains(card)) targets.add(c); - } - } - } - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, targets, "Select target blocking or blocked by Cromat.", true)); - } - }; - card.addSpellAbility(a2); - a2.setBeforePayMana(runtime2); - a2.setDescription("W B: Destroy target creature blocking or blocked by Cromat."); - }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Mutavault")) - { - final Command eot1 = new Command() - { - private static final long serialVersionUID = 5106629534549783845L; - - public void execute() - { - Card c = card; - - c.setBaseAttack(0); - c.setBaseDefense(0); - c.removeIntrinsicKeyword("Changeling"); - c.removeType("Creature"); - } - }; - - final SpellAbility a1 = new Ability(card, "1") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - Card c = card; - - c.setBaseAttack(2); - c.setBaseDefense(2); - - //to prevent like duplication like "Changeling Changeling Creature Creature" - if(! c.getIntrinsicKeyword().contains("Changeling")) - { - c.addIntrinsicKeyword("Changeling"); - c.addType("Creature"); - } - AllZone.EndOfTurn.addUntil(eot1); - } - };//SpellAbility - - card.clearSpellAbility(); - card.addSpellAbility(a1); - a1.setDescription("1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land."); - a1.setStackDescription(card +" becomes a 2/2 creature with changeling until EOT"); - - Command paid1 = new Command() { - private static final long serialVersionUID = -601119544294387668L; - public void execute() {AllZone.Stack.add(a1);} - }; - - a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); - - //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? - //anyway, this does the trick: - card.removeIntrinsicKeyword("tap: add 1"); - card.setText(card.getText() + "\r\n1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land."); - card.addIntrinsicKeyword("tap: add 1"); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Dragon Blood")) + else if(cardName.equals("Dragon Blood")) { Ability_Tap ability = new Ability_Tap(card, "3") { @@ -33754,7 +13806,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Reminisce")) + else if(cardName.equals("Reminisce")) { final SpellAbility spell = new Spell(card) { @@ -33788,28 +13840,10 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Energizer")) - { - Ability_Tap ability = new Ability_Tap(card, "2") - { - private static final long serialVersionUID = 6444406158364728638L; - public void resolve() - { - card.addCounter(Counters.P1P1,1); - } - public boolean canPlayAI() - { - return(true); - } - }; - ability.setDescription("2, T: Put a +1/+1 counter on Energizer."); - ability.setStackDescription("Put a +1/+1 counter on target Energizer."); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** + //*************** START *********** START ************************** - if(cardName.equals("AEther Vial")) + else if(cardName.equals("AEther Vial")) { //final int[] converted = null; final Ability_Tap ability = new Ability_Tap(card, "0") @@ -33870,7 +13904,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("AEther Spellbomb")) + else if(cardName.equals("AEther Spellbomb")) { final Ability ability = new Ability(card, "U") @@ -33907,7 +13941,7 @@ if(cardName.equals("Jugan, the Rising Star")) ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); } //*************** START *********** START ************************** - if(cardName.equals("Lifespark Spellbomb")) + else if(cardName.equals("Lifespark Spellbomb")) { final SpellAbility ability = new Ability_Activated(card, "G") { @@ -33976,7 +14010,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Pyrite Spellbomb")) + else if(cardName.equals("Pyrite Spellbomb")) { final SpellAbility ability = new Ability_Activated(card, "R") @@ -34025,7 +14059,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Sunbeam Spellbomb")) + else if(cardName.equals("Sunbeam Spellbomb")) { final Ability ability = new Ability(card, "W") { @@ -34049,7 +14083,7 @@ if(cardName.equals("Jugan, the Rising Star")) } //*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Necrogen Spellbomb")) + else if(cardName.equals("Necrogen Spellbomb")) { final Ability ability = new Ability(card, "B") { @@ -34191,523 +14225,10 @@ if(cardName.equals("Jugan, the Rising Star")) } //*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Sphinx of Jwar Isle")) - { - final SpellAbility ability1 = new Ability(card, "0") - { - public void resolve() - { - String player = card.getController(); - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); - - if (lib.size() < 1) - return; - - CardList cl = new CardList(); - cl.add(lib.get(0)); - - AllZone.Display.getChoiceOptional("Top card", cl.toArray()); - } - public boolean canPlayAI() - { - return false; - } - }; - - ability1.setStackDescription(card.getName() + " - look at top card of library."); - ability1.setDescription("You may look at the top card of your library."); - card.addSpellAbility(ability1); - } - //*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Imperial Recruiter")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - - if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) - { - Card c = getTargetCard(); - AllZone.GameAction.shuffle(card.getController()); - lib.remove(c); - hand.add(c, 0); - - } - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -8887306085997352723L; - - public void execute() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - CardList cards = new CardList(lib.getCards()); - CardList powerTwoCreatures = new CardList(); - - for (int i=0;i 0) - { - if (card.getController().equals("Human")) - { - Object o = AllZone.Display.getChoiceOptional("Select a card in opponent's graveyard to remove", gravecards.toArray()); - if (o!=null) - { - Card removedCard = (Card)o; - AllZone.GameAction.removeFromGame(removedCard); - } - } - else - { - AllZone.GameAction.removeFromGame(gravecards.get(0)); - } - } - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - CardList creatures = new CardList(play.getCards()); - creatures = creatures.getType("Creature"); - - //Object o = AllZone.Display.getChoiceOptional("Select a creature card to bounce", blackBlue.toArray()); - - - AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, creatures, "Select a creature you control.", false)); - ButtonUtil.disableAll(); - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = 3089921616375272120L; - - public boolean canPlayAI() - { - return false; - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Cavern Harpy")) - { - final SpellAbility a1 = new Ability(card,"0") - { - public void resolve() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); - - if (card.isToken()) - AllZone.getZone(card).remove(card); - else - AllZone.GameAction.moveTo(hand, card); - - - } - public boolean canPlayAI() - { - return false; - } - }; - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); - - if(AllZone.GameAction.isCardInPlay(c)) - { - AllZone.getZone(c).remove(c); - - if(! c.isToken()) - { - Card newCard = AllZone.CardFactory.getCard(c.getName(), c.getOwner()); - hand.add(newCard); - } - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -7855081477395863590L; - - public void execute() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - - CardList creatures = new CardList(play.getCards()); - creatures = creatures.getType("Creature"); - - CardList blackBlue = new CardList(); - - - for(int i=0;i 0) - return true; - else - return false; - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Aven Cloudchaser") || cardName.equals("Cloudchaser Eagle") || cardName.equals("Monk Realist")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - { - if(c.isToken()) - AllZone.getZone(c).remove(c); - - else - AllZone.GameAction.destroy(c); - } - } - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 8586704292133752803L; - - public void execute() - { - CardList all = new CardList(); - all.addAll(AllZone.Human_Play.getCards()); - all.addAll(AllZone.Computer_Play.getCards()); - all = all.getType("Enchantment"); - - - if (all.size() != 0) { - - if(card.getController().equals(Constant.Player.Human)) { - AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target enchantment.", true)); - ButtonUtil.disableAll(); - } - else if (card.getController().equals(Constant.Player.Computer)) { - Card human = CardFactoryUtil.AI_getBestEnchantment(all, card, true); - ability.setTargetCard(human); - AllZone.Stack.add(ability); - } - } - - }//execute() - };//Command - card.addComesIntoPlayCommand(intoPlay); - - card.clearSpellAbility(); - - card.addSpellAbility(new Spell_Permanent(card) - { - private static final long serialVersionUID = -8467111038318551304L; - - public boolean canPlayAI() - { - CardList ench = new CardList(); - ench.addAll(AllZone.Human_Play.getCards()); - ench = ench.getType("Enchantment"); - - if (ench.size() > 0) - return true; - else - return false; - } - }); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Intuition")) + else if(cardName.equals("Intuition")) { final SpellAbility spell = new Spell(card) { @@ -35527,104 +14566,7 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Rakka Mar")) - { - final SpellAbility a1 = new Ability_Tap(card, "R") - { - private static final long serialVersionUID = -3868544882464692305L; - - public boolean canPlayAI() - { - return true; - - } - public void resolve() - { - makeToken(); - } - void makeToken() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Elemental"); - c.setImageName("R 3 1 Elemental"); - c.setManaCost("R"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Elemental"); - c.setBaseAttack(3); - c.setBaseDefense(1); - c.addIntrinsicKeyword("Haste"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - };//SpellAbility - card.addSpellAbility(a1); - a1.setDescription("R, T: Put a 3/1 red Elemental creature token with haste into play."); - a1.setStackDescription("Put a 3/1 red Elemental creature token with haste into play."); - - a1.setBeforePayMana(new Input_PayManaCost(a1)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Tolsimir Wolfblood")) - { - final SpellAbility a1 = new Ability_Tap(card) - { - private static final long serialVersionUID = -1900858280382389010L; - - public boolean canPlayAI() - { - String controller = card.getController(); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - CardList voja = new CardList(play.getCards()); - voja = voja.getName("Voja"); - - if (voja.size() == 0) - return true; - else - return false; - - } - public void resolve() - { - makeToken(); - } - void makeToken() - { - Card c = new Card(); - - c.setName("Voja"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("W G"); - c.setToken(true); - - c.addType("Legendary"); - c.addType("Creature"); - c.addType("Wolf"); - c.setBaseAttack(2); - c.setBaseDefense(2); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - };//SpellAbility - card.addSpellAbility(a1); - a1.setDescription("T: Put a legendary 2/2 green and white Wolf creature token named Voja into play."); - a1.setStackDescription("Put a 2/2 white green Legendary Wolf creature token named Voja into play."); - - a1.setBeforePayMana(new Input_PayManaCost(a1)); - }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if(cardName.equals("Invincible Hymn")) @@ -35666,274 +14608,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if (cardName.equals("Ranger of Eos")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - - - CardList cards = new CardList(lib.getCards()); - CardList oneCostCreatures = new CardList(); - - for (int i=0;i= 1) - { - Card c1 = oneCostCreatures.getCard(0); - lib.remove(c1); - hand.add(c1); - oneCostCreatures.remove(c1); - - if (oneCostCreatures.size() >= 1) - { - Card c2 = oneCostCreatures.getCard(0); - lib.remove(c2); - hand.add(c2); - oneCostCreatures.remove(c2); - - } - - - } - //ability.setTargetCard(powerTwoCreatures.get(0)); - //AllZone.Stack.add(ability); - AllZone.GameAction.shuffle(controller); - } - - - //... - - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = -5697680711324878027L; - - public void execute() - { - ability.setStackDescription("Ranger of Eos - Grab 2 creatures"); - AllZone.Stack.add(ability); - }//execute() - };//Command - //ability.setStackDescription("Ranger of Eos - Grab 2 creatures"); - //AllZone.Stack.add(ability); - card.addComesIntoPlayCommand(intoPlay); - - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Scarblade Elite")) - { - final Ability_Tap ability = new Ability_Tap(card) - { - private static final long serialVersionUID = 3505019464802566898L; - - public boolean canPlay() - { - String controller = card.getController(); - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard ,controller); - - CardList sins = new CardList(graveyard.getCards()); - sins = sins.getType("Assassin"); - - if (sins.size() > 0 && AllZone.GameAction.isCardInPlay(card) && CardFactoryUtil.canTarget(card, getTargetCard()) ) - return true; - else - return false; - - } - public boolean canPlayAI() - { - CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); - human = human.filter(new CardListFilter() - { - public boolean addCard(Card c) {return AllZone.GameAction.isCardInPlay(c);} - }); - - CardListUtil.sortAttack(human); - CardListUtil.sortFlying(human); - - //if(0 < human.size()) - // setTargetCard(human.get(0)); - - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Computer); - - CardList grave = new CardList(graveyard.getCards()); - grave = grave.getType("Assassin"); - - if (human.size() > 0 && grave.size() > 0) - setTargetCard(human.get(0)); - - return 0 < human.size() && 0 < grave.size(); - } - - public void resolve() - { - String controller = card.getController(); - PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard ,controller); - - CardList sins = new CardList(graveyard.getCards()); - sins = sins.getType("Assassin"); - - if (card.getController().equals(Constant.Player.Human)) - { - Object o = AllZone.Display.getChoiceOptional("Pick an Assassin to remove", sins.toArray()); - - if(o != null) - { - Card crd = (Card)o; - graveyard.remove(crd); - - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - { - AllZone.GameAction.destroy(c); - } - } //if o!= null - }//player.equals("human") - else - { - Card crd = sins.get(0); - graveyard.remove(crd); - - Card c = getTargetCard(); - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - { - AllZone.GameAction.destroy(c); - } - } - }//resolve() - };//SpellAbility - - Input target = new Input() - { - private static final long serialVersionUID = -4853162388286494888L; - - public void showMessage() - { - AllZone.Display.showMessage("Select target creature to destroy"); - ButtonUtil.enableOnlyCancel(); - } - public void selectButtonCancel() {stop();} - public void selectCard(Card c, PlayerZone zone) - { - if(!CardFactoryUtil.canTarget(ability, card)){ - AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); - } - if(c.isCreature() && zone.is(Constant.Zone.Play)) - { - //tap ability - card.tap(); - - ability.setTargetCard(c); - AllZone.Stack.add(ability); - stop(); - } - }//selectCard() - };//Input - - card.addSpellAbility(ability); - ability.setDescription("tap: Remove an Assassin card in your graveyard from the game: Destroy target creature."); - ability.setBeforePayMana(target); - - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Broodmate Dragon")) - { - final SpellAbility ability = new Ability(card, "0") - { - public void resolve() - { - Card c = new Card(); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setName("Dragon"); - c.setImageName("R 4 4 Dragon"); - c.setManaCost("R"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Dragon"); - - c.addIntrinsicKeyword("Flying"); - - c.setBaseAttack(4); - c.setBaseDefense(4); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - - }//resolve() - }; - Command intoPlay = new Command() - { - private static final long serialVersionUID = 2848700532090223394L; - - public void execute() - { - ability.setStackDescription("Broodmate Dragon - put a 4/4 red Dragon creature token into play."); - AllZone.Stack.add(ability); - } - }; - card.addComesIntoPlayCommand(intoPlay); - - }//*************** END ************ END ************************** - + //*************** START *********** START ************************** else if(cardName.equals("Gift of Estates")) { @@ -36021,7 +14696,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Survival of the Fittest")) + else if(cardName.equals("Survival of the Fittest")) { SpellAbility ability = new Ability(card, "G") { @@ -36077,7 +14752,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Gerrard's Command")) + else if(cardName.equals("Gerrard's Command")) { SpellAbility spell = new Spell(card) { @@ -36137,7 +14812,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Brute Force")) + else if(cardName.equals("Brute Force")) { SpellAbility spell = new Spell(card) { @@ -36206,9 +14881,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Nameless Inversion")) + else if(cardName.equals("Nameless Inversion")) { SpellAbility spell = new Spell(card) { @@ -36261,11 +14935,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Tromp the Domains")) + else if(cardName.equals("Tromp the Domains")) { SpellAbility spell = new Spell(card) { @@ -36350,7 +15021,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Titanic Ultimatum")) + else if(cardName.equals("Titanic Ultimatum")) { SpellAbility spell = new Spell(card) { @@ -36421,10 +15092,8 @@ if(cardName.equals("Jugan, the Rising Star")) - - //*************** START *********** START ************************** - if(cardName.equals("Primal Boost")) + else if(cardName.equals("Primal Boost")) { SpellAbility spell = new Spell(card) { @@ -36486,11 +15155,8 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(CardFactoryUtil.ability_cycle(card, "2 G")); }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Wildsize")) + else if(cardName.equals("Wildsize")) { SpellAbility spell = new Spell(card) { @@ -36555,13 +15221,8 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Feral Lightning")) + else if(cardName.equals("Feral Lightning")) { SpellAbility spell = new Spell(card) { @@ -36622,13 +15283,8 @@ if(cardName.equals("Jugan, the Rising Star")) card.addSpellAbility(spell); }//*************** END ************ END ************************** - - - - - //*************** START *********** START ************************** - if(cardName.equals("Inspirit")) + else if(cardName.equals("Inspirit")) { SpellAbility spell = new Spell(card) { @@ -36690,7 +15346,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Might of Oaks")) + else if(cardName.equals("Might of Oaks")) { SpellAbility spell = new Spell(card) { @@ -36747,7 +15403,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Guided Strike")) + else if(cardName.equals("Guided Strike")) { final Card[] target = new Card[1]; final Command untilEOT = new Command() @@ -36806,7 +15462,7 @@ if(cardName.equals("Jugan, the Rising Star")) //*************** START *********** START ************************** - if(cardName.equals("Aggressive Urge")) + else if(cardName.equals("Aggressive Urge")) { final Card[] target = new Card[1]; final Command untilEOT = new Command() @@ -36864,7 +15520,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Vindicate")) + else if(cardName.equals("Vindicate")) { final SpellAbility spell = new Spell(card) { @@ -36920,7 +15576,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Shatter")) + else if(cardName.equals("Shatter")) { final SpellAbility spell = new Spell(card) { @@ -37068,7 +15724,7 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** //*************** START *********** START ************************** - if(cardName.equals("Demystify")) + else if(cardName.equals("Demystify")) { final SpellAbility spell = new Spell(card) { @@ -37116,11 +15772,8 @@ if(cardName.equals("Jugan, the Rising Star")) }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Animate Land")) + else if(cardName.equals("Animate Land")) { final Card[] target = new Card[1]; final Command untilEOT = new Command() @@ -37179,122 +15832,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); card.addSpellAbility(spell); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Aven Riftwatcher")) - { - Command gain2Life = new Command() - { - private static final long serialVersionUID = 5588978023269625349L; - - public boolean firstTime = true; - public void execute() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.addLife(2); - - //testAndSet - only needed when comes into play. - if(firstTime){ - card.setCounter(Counters.AGE, 3); //vanishing - } - firstTime = false; - } - }; - - card.addLeavesPlayCommand(gain2Life); - card.addComesIntoPlayCommand(gain2Life); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Calciderm")) - { - Command ageCounters = new Command() - { - private static final long serialVersionUID = 431920157968451817L; - public boolean firstTime = true; - public void execute() - { - - //testAndSet - only needed when comes into play. - if(firstTime){ - card.setCounter(Counters.AGE, 4); - } - firstTime = false; - } - }; - card.addComesIntoPlayCommand(ageCounters); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if(cardName.equals("Blastoderm")) - { - Command fadeCounters = new Command() - { - private static final long serialVersionUID = -580691660706977218L; - public boolean firstTime = true; - public void execute() - { - - //testAndSet - only needed when comes into play. - if(firstTime){ - card.setCounter(Counters.FADE, 3); - } - firstTime = false; - } - }; - - card.addComesIntoPlayCommand(fadeCounters); - - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Godsire")) - { - final SpellAbility a1 = new Ability_Tap(card) - { - private static final long serialVersionUID = -1160527561099142816L; - - public void resolve() - { - makeToken(); - } - void makeToken() - { - Card c = new Card(); - - c.setName("Beast"); - c.setImageName("RGW 8 8 Beast"); - - c.setOwner(card.getController()); - c.setController(card.getController()); - - c.setManaCost("R G W"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Beast"); - c.setBaseAttack(8); - c.setBaseDefense(8); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - - public boolean canPlayAI() - { - return AllZone.Phase.getPhase().equals("Main2"); - } - - };//SpellAbility - card.addSpellAbility(a1); - a1.setDescription("T: Put an 8/8 Beast creature token into play that's red, green, and white."); - a1.setStackDescription("Put an 8/8 Beast creature token into play that's red, green, and white."); - - //a1.setBeforePayMana(new Input_PayManaCost(a1)); - }//*************** END ************ END ************************** + if (cardName.equals("Ior Ruin Expedition")) { @@ -37319,44 +15857,10 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); card.addSpellAbility(ability); } - //*************** START *********** START ************************** - if(cardName.equals("Wydwen, the Biting Gale")) - { - final SpellAbility a1 = new Ability(card,"U B") - { - public boolean canPlayAI() - { - return false; - } - public void resolve() - { - PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); - life.subtractLife(1); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); - /* - AllZone.getZone(card).remove(card); - hand.add(card); - */ - if (card.isToken()) - AllZone.getZone(card).remove(card); - else - AllZone.GameAction.moveTo(hand, card); - - - } - };//a1 - - //card.clearSpellAbility(); - card.addSpellAbility(a1); - a1.setStackDescription(card.getController() + " pays 1 life and returns Wydwen back to owner's hand."); - a1.setDescription("U B, Pay 1 life: Return Wydwen, the Biting Gale to its owner's hand."); - - - }//*************** END ************ END ************************** - + //*************** START *********** START ************************** - if(cardName.equals("Earthcraft")) + else if(cardName.equals("Earthcraft")) { final SpellAbility a1 = new Ability(card,"0") { @@ -37467,662 +15971,10 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if(cardName.equals("Tradewind Rider")) - { - final SpellAbility a1 = new Ability_Tap(card,"0") - { - private static final long serialVersionUID = 3438865371487994984L; - - public void chooseTargetAI() - { - if(getCreature().size() != 0) - { - Card bestCreature = CardFactoryUtil.AI_getBestCreature(getCreature()); - if(getEnchantment().size() != 0){ - Card bestEnchantment = CardFactoryUtil.AI_getBestEnchantment(getEnchantment(), card, true); - if(CardUtil.getConvertedManaCost(bestCreature.getManaCost()) > CardUtil.getConvertedManaCost(bestEnchantment.getManaCost())){ - setTargetCard(bestCreature); - } - else{ - setTargetCard(bestEnchantment); - } - } - else{ - setTargetCard(bestCreature); - } - } - else if(getArtifact().size() != 0){ - Card bestArtifact = CardFactoryUtil.AI_getBestArtifact(getArtifact()); - setTargetCard(bestArtifact); - } - - }//ChooseTargetAI() - CardList getCreature() - { - CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); - return list; - }//getEnchantment() - CardList getArtifact() - { - CardList list = CardFactoryUtil.AI_getHumanArtifact(card, true); - return list; - }//getArtifact() - CardList getEnchantment() - { - CardList list = CardFactoryUtil.AI_getHumanEnchantment(card, true); - return list; - } - - - - public boolean canPlayAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList cards = new CardList(); - - cards.addAll(play.getCards()); - cards = cards.filter(new CardListFilter(){ - - public boolean addCard(Card c) { - return (c.isArtifact() || c.isEnchantment() || c.isCreature() ) && CardFactoryUtil.canTarget(card, c); - } - - }); - - return cards.size() > 0; - - } - public boolean canPlay() - { - String controller = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - - CardList creats = new CardList(); - - creats.addAll(play.getCards()); - creats = creats.getType("Creature"); - creats = creats.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isUntapped() && !c.equals(card); - } - }); - - if (creats.size() > 1 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped() && !card.hasSickness()) - return true; - else - return false; - } - public void resolve() - { - - if (getTargetCard()== null) - return; - - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void humanResolve() - { - String controller = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - CardList creats = new CardList(); - - creats.addAll(play.getCards()); - creats = creats.getType("Creature"); - creats = creats.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isUntapped() && !c.equals(card); - } - }); - - CardList tappedCreats = new CardList(); - - Object o = AllZone.Display.getChoice("Pick first creature to tap", creats.toArray()); - - if (o!= null) - { - Card c1 = (Card)o; - creats.remove(c1); - tappedCreats.add(c1); - } - else - return; - - o = AllZone.Display.getChoice("Pick second creature to tap", creats.toArray()); - if (o!= null) - { - Card c2 = (Card)o; - creats.remove(c2); - tappedCreats.add(c2); - } - else - return; - - for(int i = 0; i CardUtil.getConvertedManaCost(bestEnchantment.getManaCost())){ - setTargetCard(bestArtifact); - } - else{ - setTargetCard(bestEnchantment); - } - } - else{ - setTargetCard(bestEnchantment); - } - } - else if(getArtifact().size() != 0){ - Card bestArtifact = CardFactoryUtil.AI_getBestArtifact(getArtifact()); - setTargetCard(bestArtifact); - } - - } - CardList getEnchantment() - { - CardList list = CardFactoryUtil.AI_getHumanEnchantment(card, true); - return list; - }//getEnchantment() - CardList getArtifact() - { - CardList list = CardFactoryUtil.AI_getHumanArtifact(card, true); - return list; - }//getArtifact() - - - public boolean canPlayAI() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList cards = new CardList(); - - cards.addAll(play.getCards()); - cards = cards.filter(new CardListFilter(){ - - public boolean addCard(Card c) { - return (c.isArtifact() || c.isEnchantment() ) && CardFactoryUtil.canTarget(card, c); - } - - }); - - return cards.size() > 0; - - } - public boolean canPlay() - { - String controller = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - - CardList creats = new CardList(); - - creats.addAll(play.getCards()); - creats = creats.getType("Creature"); - creats = creats.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isUntapped(); - } - }); - - if (creats.size() > 3 && AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - } - public void resolve() - { - - if (getTargetCard()== null) - return; - - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void humanResolve() - { - String controller = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - CardList creats = new CardList(); - - creats.addAll(play.getCards()); - creats = creats.getType("Creature"); - creats = creats.filter(new CardListFilter() - { - public boolean addCard(Card c) { - return c.isUntapped(); - } - }); - - CardList tappedCreats = new CardList(); - - Object o = AllZone.Display.getChoice("Pick first creature to tap", creats.toArray()); - - if (o!= null) - { - Card c1 = (Card)o; - creats.remove(c1); - tappedCreats.add(c1); - } - else - return; - - o = AllZone.Display.getChoice("Pick second creature to tap", creats.toArray()); - if (o!= null) - { - Card c2 = (Card)o; - creats.remove(c2); - tappedCreats.add(c2); - } - else - return; - - o = AllZone.Display.getChoice("Pick third creature to tap", creats.toArray()); - if (o!= null) - { - Card c3 = (Card) o; - creats.remove(c3); - tappedCreats.add(c3); - } - else - return; - - o = AllZone.Display.getChoice("Pick fourth creature to tap", creats.toArray()); - if (o!= null) - { - Card c4 = (Card) o; - creats.remove(c4); - tappedCreats.add(c4); - } - else - return; - - - for(int i = 0; i 6 && druidsUntapped > 6 && AllZone.GameAction.isCardInPlay(card)) - return true; - else - return false; - } - public void resolve() - { - - String player = card.getController(); - if(player.equals(Constant.Player.Human)) - humanResolve(); - else - computerResolve(); - } - public void humanResolve() - { - String controller = card.getController(); - PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); - CardList druids = new CardList(); - - druids.addAll(play.getCards()); - druids = druids.getType("Druid"); - - CardList tappedDruids = new CardList(); - - Object o = AllZone.Display.getChoice("Pick first druid to tap", druids.toArray()); - - if (o!= null) - { - Card c1 = (Card)o; - druids.remove(c1); - tappedDruids.add(c1); - } - else - return; - - o = AllZone.Display.getChoice("Pick second druid to tap", druids.toArray()); - if (o!= null) - { - Card c2 = (Card)o; - druids.remove(c2); - tappedDruids.add(c2); - } - else - return; - - o = AllZone.Display.getChoice("Pick third druid to tap", druids.toArray()); - if (o!= null) - { - Card c3 = (Card) o; - druids.remove(c3); - tappedDruids.add(c3); - } - else - return; - - o = AllZone.Display.getChoice("Pick fourth druid to tap", druids.toArray()); - if (o!= null) - { - Card c4 = (Card) o; - druids.remove(c4); - tappedDruids.add(c4); - } - else - return; - o = AllZone.Display.getChoice("Pick fifth druid to tap", druids.toArray()); - if (o!= null) - { - Card c5 = (Card) o; - druids.remove(c5); - tappedDruids.add(c5); - } - else - return; - - o = AllZone.Display.getChoice("Pick sixth druid to tap", druids.toArray()); - if (o!= null) - { - Card c6 = (Card) o; - druids.remove(c6); - tappedDruids.add(c6); - } - else - return; - - o = AllZone.Display.getChoice("Pick seventh druid to tap", druids.toArray()); - if (o!=null) - { - Card c7 = (Card) o; - druids.remove(c7); - tappedDruids.add(c7); - } - else - return; - - for(int i = 0; i 1 && CardFactoryUtil.AI_isMainPhase(); }); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if (cardName.equals("Chameleon Colossus")) - { - final int attack[] = new int[1]; - final int defense[] = new int[1]; - - - final Command untilEOT = new Command() - { - - private static final long serialVersionUID = 861635058350850025L; - - public void execute() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - card.setTempAttackBoost(0); - card.setTempDefenseBoost(0); - } - } - }; - - SpellAbility ability = new Ability_Activated(card, "2 G G") - { - - private static final long serialVersionUID = -4910313985049099384L; - public boolean canPlayAI() - { - return CardFactoryUtil.AI_doesCreatureAttack(card); - } - public boolean canPlay() - { - if (CardFactoryUtil.canUseAbility(card) && AllZone.GameAction.isCardInPlay(card) && - !card.isFaceDown()) - return true; - else - return false; - } - public void resolve() - { - if(AllZone.GameAction.isCardInPlay(card)) - { - attack[0] = card.getNetAttack(); - defense[0] = attack[0]; - - card.addTempAttackBoost(attack[0]); - card.addTempDefenseBoost(defense[0]); - - AllZone.EndOfTurn.addUntil(untilEOT); - } - } - }; - - - ability.setDescription("2 G G : Chameleon Colossus gets +X/+X until end of turn, where X is its power." ); - ability.setStackDescription("Chameleon Colossus gets +X/+X until end of turn, where X is its power."); - - card.addSpellAbility(ability); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if (cardName.equals("Figure of Destiny")) - { - Ability ability1 = new Ability(card, "RW") - { - public void resolve() - { - boolean artifact = false; - card.setBaseAttack(2); - card.setBaseDefense(2); - - card.removeIntrinsicKeyword("Flying"); - card.removeIntrinsicKeyword("First Strike"); - - if (card.isArtifact()) - artifact = true; - - card.setType(new ArrayList()); - if (artifact) - card.addType("Artifact"); - card.addType("Creature"); - card.addType("Kithkin"); - card.addType("Spirit"); - } - - public boolean canPlayAI() - { - return !card.getType().contains("Spirit"); - } - - };// ability1 - - ability1.setDescription("RW: Figure of Destiny becomes a 2/2 Kithkin Spirit."); - ability1.setStackDescription("Figure of Destiny becomes a 2/2 Kithkin Spirit."); - card.addSpellAbility(ability1); - - - Ability ability2 = new Ability(card, "RW RW RW") - { - public void resolve() - { - boolean artifact = false; - card.setBaseAttack(4); - card.setBaseDefense(4); - - card.removeIntrinsicKeyword("Flying"); - card.removeIntrinsicKeyword("First Strike"); - - if (card.isArtifact()) - artifact = true; - - card.setType(new ArrayList()); - if (artifact) - card.addType("Artifact"); - card.addType("Creature"); - card.addType("Kithkin"); - card.addType("Spirit"); - card.addType("Warrior"); - } - - public boolean canPlay() - { - return card.getType().contains("Spirit"); - } - - public boolean canPlayAI() - { - return !card.getType().contains("Warrior"); - } - - };// ability2 - - ability2.setDescription("RW RW RW: If Figure of Destiny is a Spirit, it becomes a 4/4 Kithkin Spirit Warrior."); - ability2.setStackDescription("Figure of Destiny becomes a 4/4 Kithkin Spirit Warrior."); - card.addSpellAbility(ability2); - - - Ability ability3 = new Ability(card, "RW RW RW RW RW RW") - { - public void resolve() - { - boolean artifact = false; - card.setBaseAttack(8); - card.setBaseDefense(8); - - card.addIntrinsicKeyword("Flying"); - card.addIntrinsicKeyword("First Strike"); - - if (card.isArtifact()) - artifact = true; - - card.setType(new ArrayList()); - if (artifact) - card.addType("Artifact"); - card.addType("Creature"); - card.addType("Kithkin"); - card.addType("Spirit"); - card.addType("Warrior"); - card.addType("Avatar"); - } - public boolean canPlay() - { - return card.getType().contains("Warrior"); - } - public boolean canPlayAI() - { - return !card.getType().contains("Avatar"); - } - };// ability3 - - ability3.setDescription("RW RW RW RW RW RW: If Figure of Destiny is a Warrior, it becomes an 8/8 Kithkin Spirit Warrior Avatar with flying and first strike. "); - ability3.setStackDescription("Figure of Destiny becomes an 8/8 Kithkin Spirit Warrior Avatar with flying and first strike."); - card.addSpellAbility(ability3); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - if (cardName.equals("Jenara, Asura of War")) - { - - Ability ability2 = new Ability(card, "1 W") - { - public void resolve() - { - card.addCounter(Counters.P1P1, 1); - } - };// ability2 - - ability2.setStackDescription(card.getName() + " - gets a +1/+1 counter."); - card.addSpellAbility(ability2); - }//*************** END ************ END ************************** + //*************** START *********** START ************************** if (cardName.equals("Legacy Weapon")) @@ -38653,2247 +16314,11 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); card.addSpellAbility(ability); }//*************** END ************ END ************************** - //*************** START *********** START ************************** - if (cardName.equals("Composite Golem")) - { - final Ability ability = new Ability(card, "0") - { - - public boolean canPlay() - { - SpellAbility sa; - for (int i=0; i 0) - return true; - else - return false; - } - };//SpellAbility - - Input runtime = new Input() - { - - private static final long serialVersionUID = 1408675899387720506L; - - public void showMessage() - { - CardList cars = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - cars = cars.getType("Caribou"); - - stopSetNext(CardFactoryUtil.input_targetSpecific(a2, cars, "Select a Caribou to sacrifice.", false)); - } - }; - - card.addSpellAbility(a2); - a2.setDescription("Sacrifice a Caribou: You gain 1 life."); - a2.setStackDescription(card.getController() + " gains 1 life."); - a2.setBeforePayMana(runtime); - - - card.addEnchantCommand(onEnchant); - card.addUnEnchantCommand(onUnEnchant); - card.addLeavesPlayCommand(onLeavesPlay); - - Input runtime2 = new Input() - { - - private static final long serialVersionUID = -6674543815905055287L; - - public void showMessage() - { - PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList land = new CardList(); - land.addAll(hum.getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand(); - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land you control", true)); - } - }; - spell.setBeforePayMana(runtime2); - }//*************** END ************ END ************************** - - - - //*************** START *********** START ************************** - if(cardName.equals("Leafdrake Roost")) - { - - final SpellAbility spell = new Spell(card) - { - - private static final long serialVersionUID = -4695012002471107694L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Land"); - - if(list.isEmpty()) - return false; - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(card); - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - card.enchantCard(c); - - }//resolve() - };//SpellAbility - spell.setType("Extrinsic"); - card.clearSpellAbility(); - card.addSpellAbility(spell); - - final SpellAbility produceDrakes = new Ability_Tap(spell.getTargetCard(), "G U") - { - - private static final long serialVersionUID = -3849765771560556442L; - public void resolve() - { - makeToken(); - } - void makeToken() - { - Card c = new Card(); - Card crd = spell.getTargetCard(); - - c.setName("Drake"); - c.setImageName("G U 2 2 Drake"); - - c.setOwner(crd.getController()); - c.setController(crd.getController()); - - c.setManaCost("G U"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Drake"); - c.setBaseAttack(2); - c.setBaseDefense(2); - c.addIntrinsicKeyword("Flying"); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - };//SpellAbility - - produceDrakes.setDescription("G U, Tap: Put a 2/2 green and blue Drake creature token with flying onto the battlefield."); - produceDrakes.setStackDescription("Put a 2/2 green and blue Drake creature token with flying onto the battlefield."); - - Command onEnchant = new Command() - { - - private static final long serialVersionUID = -5501311059855861341L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - //crd.clearSpellAbility(); - crd.addSpellAbility(produceDrakes); - - } - }//execute() - };//Command - - - Command onUnEnchant = new Command() - { - - private static final long serialVersionUID = 3589766088284055294L; - - public void execute() - { - if (card.isEnchanting()) - { - - Card crd = card.getEnchanting().get(0); - crd.removeSpellAbility(produceDrakes); - - } - - }//execute() - };//Command - - Command onLeavesPlay = new Command() - { - - private static final long serialVersionUID = -3747590484749776557L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - card.unEnchantCard(crd); - } - } - }; - - card.addEnchantCommand(onEnchant); - card.addUnEnchantCommand(onUnEnchant); - card.addLeavesPlayCommand(onLeavesPlay); - - Input runtime = new Input() - { - - private static final long serialVersionUID = 967525396666242309L; - - public void showMessage() - { - PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList land = new CardList(); - land.addAll(comp.getCards()); - land.addAll(hum.getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand(); - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true)); - } - }; - spell.setBeforePayMana(runtime); - }//*************** END ************ END ************************** - - - //*************** START *********** START ************************** - if(cardName.equals("Squirrel Nest")) - { - - final SpellAbility spell = new Spell(card) - { - - private static final long serialVersionUID = 6115713202262504968L; - public boolean canPlayAI() - { - CardList list = new CardList(AllZone.Computer_Play.getCards()); - list = list.getType("Land"); - - if(list.isEmpty()) - return false; - - setTargetCard(list.get(0)); - return true; - }//canPlayAI() - public void resolve() - { - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(card); - - Card c = getTargetCard(); - - if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) - card.enchantCard(c); - - }//resolve() - };//SpellAbility - spell.setType("Extrinsic"); - - card.clearSpellAbility(); - card.addSpellAbility(spell); - - final SpellAbility produceSquirrels = new Ability_Tap(spell.getTargetCard()) - { - private static final long serialVersionUID = -4800170026789001271L; - public void resolve() - { - makeToken(); - } - void makeToken() - { - Card c = new Card(); - Card crd = spell.getTargetCard(); - - c.setName("Squirrel"); - c.setImageName("G 1 1 Squirrel"); - - c.setOwner(crd.getController()); - c.setController(crd.getController()); - - c.setManaCost("G"); - c.setToken(true); - - c.addType("Creature"); - c.addType("Squirrel"); - c.setBaseAttack(1); - c.setBaseDefense(1); - - PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); - play.add(c); - }//makeToken() - };//SpellAbility - - produceSquirrels.setDescription("Tap: Put a 1/1 green Squirrel creature token into play."); - produceSquirrels.setStackDescription("Put a 1/1 green Squirrel creature token into play."); - - Command onEnchant = new Command() - { - - - private static final long serialVersionUID = 3528675502863241126L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - //crd.clearSpellAbility(); - crd.addSpellAbility(produceSquirrels); - - } - }//execute() - };//Command - - - Command onUnEnchant = new Command() - { - private static final long serialVersionUID = -2021446345291180334L; - - public void execute() - { - if (card.isEnchanting()) - { - - Card crd = card.getEnchanting().get(0); - crd.removeSpellAbility(produceSquirrels); - - } - - }//execute() - };//Command - - Command onLeavesPlay = new Command() - { - - private static final long serialVersionUID = -4543302260602460839L; - - public void execute() - { - if (card.isEnchanting()) - { - Card crd = card.getEnchanting().get(0); - card.unEnchantCard(crd); - } - } - }; - - card.addEnchantCommand(onEnchant); - card.addUnEnchantCommand(onUnEnchant); - card.addLeavesPlayCommand(onLeavesPlay); - - Input runtime = new Input() - { - - private static final long serialVersionUID = 967525396666242309L; - - public void showMessage() - { - PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); - PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); - CardList land = new CardList(); - land.addAll(comp.getCards()); - land.addAll(hum.getCards()); - land = land.filter(new CardListFilter() - { - public boolean addCard(Card c) - { - return c.isLand(); - } - }); - - stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true)); - } - }; - spell.setBeforePayMana(runtime); - }//*************** END ************ END ************************** + //*************** START ************ START ************************** if (cardName.equals("Ashnod's Transmogrant")) { @@ -40974,9 +16399,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); }; retrieve.choices_made = new String[1]; retrieve.setBeforePayMana(new Input(){ - /** - * - */ + private static final long serialVersionUID = 376497609786542558L; public void showMessage() @@ -40991,28 +16414,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); card.addSpellAbility(retrieve); }//*************** END ************ END ************************** - //*************** START ************ START ************************** - if (cardName.equals("Rats of Rath")) - { - final Ability ability = new Ability(card,"B") - { - public boolean canPlayAI(){return false;}; - public void resolve(){AllZone.GameAction.destroy(getTargetCard());}; - }; - ability.setBeforePayMana(new Input(){ - private static final long serialVersionUID = 7691864588170864421L; - - public void showMessage() - { - CardList choices = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); - choices.filter(new CardListFilter(){public boolean addCard(Card c){ - return c.isArtifact() || c.isCreature() || c.isLand();}}); - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, choices, "Select an artifact, creature, or land you control", true));} - }); - ability.setDescription("B: Destroy target artifact, creature, or land you control."); - card.addSpellAbility(ability); - } - //*************** END ************ END ************************** + //*************** START ************ START ************************** if (cardName.equals("Goblin Grenade")) @@ -41208,9 +16610,7 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); return card; }//getCard2 - - - + // copies stats like attack, defense, etc.. private Card copyStats(Object o) { Card sim = (Card) o; diff --git a/src/CardFactoryUtil.java b/src/CardFactoryUtil.java index 70f639fe202..84337d3fcf7 100644 --- a/src/CardFactoryUtil.java +++ b/src/CardFactoryUtil.java @@ -2349,8 +2349,38 @@ public class CardFactoryUtil } return s; } - + public static int getCanPlayNumberOfLands(String player) + { + int count = 1; + CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.getName().equals("Exploration") || c.getName().equals("Azusa, Lost but Seeking") || c.getName().equals("Fastbond"); + } + }); + + for (Card var : list) + { + if (var.getName().equals("Exploration")) + count++; + else if (var.getName().equals("Azusa, Lost but Seeking")) + count = count + 2; + else if (var.getName().equals("Fastbond")) + count = 100; + } + + return count; + } + + public static CardList getFastbonds(String player) + { + CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards()); + list = list.getName("Fastbond"); + return list; + } + //may return null static public Card getRandomCard(CardList list) { diff --git a/src/CardFactory_Auras.java b/src/CardFactory_Auras.java new file mode 100644 index 00000000000..d41cbcd09d6 --- /dev/null +++ b/src/CardFactory_Auras.java @@ -0,0 +1,5145 @@ +class CardFactory_Auras { + public static Card getCard(final Card card, String cardName, String owner) + { + + //*************** START *********** START ************************** + if(cardName.equals("Epic Proportions")) + { + final SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = 358340213887424783L; + + public boolean canPlay() + { + return true; // for flash, which is not working through the keyword for some reason + } + + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + card.enchantCard(c); + System.out.println("Enchanted: " +getTargetCard()); + } + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + Command onEnchant = new Command() + { + private static final long serialVersionUID = 5133552158526053493L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + crd.addExtrinsicKeyword("Trample"); + crd.addSemiPermanentAttackBoost(5); + crd.addSemiPermanentDefenseBoost(5); + } + }//execute() + };//Command + + + Command onUnEnchant = new Command() + { + private static final long serialVersionUID = -2404250578944336031L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + crd.removeExtrinsicKeyword("Trample"); + crd.addSemiPermanentAttackBoost(-5); + crd.addSemiPermanentDefenseBoost(-5); + } + + }//execute() + };//Command + + Command onLeavesPlay = new Command() + { + private static final long serialVersionUID = -6076263565995301138L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Mythic Proportions")) + { + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = 4227124619270545652L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + card.enchantCard(c); + System.out.println("Enchanted: " +getTargetCard()); + } + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + Command onEnchant = new Command() + { + private static final long serialVersionUID = -6642467768059387172L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + crd.addExtrinsicKeyword("Trample"); + crd.addSemiPermanentAttackBoost(8); + crd.addSemiPermanentDefenseBoost(8); + } + }//execute() + };//Command + + + Command onUnEnchant = new Command() + { + + private static final long serialVersionUID = 3550678810412528973L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + crd.removeExtrinsicKeyword("Trample"); + crd.addSemiPermanentAttackBoost(-8); + crd.addSemiPermanentDefenseBoost(-8); + } + + }//execute() + };//Command + + Command onLeavesPlay = new Command() + { + private static final long serialVersionUID = -8590925715809196436L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Nimbus Wings")) + { + final SpellAbility spell = new Spell(card) + { + + + private static final long serialVersionUID = -4759884801420518565L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for (int i=0;i 0) + { + setTargetCard(stuffy.get(0)); + return true; + } + else + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for (int i=0;i= list.get(i).getNetDefense()) && list.get(i).getNetAttack() >= 3) + { + setTargetCard(list.get(i)); + return true; + } + } + } + return false; + + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + card.enchantCard(c); + + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Cessation")) + { + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = 3681531440398159146L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for (int i=0;i 0) + return true; + else + return false; + } + };//SpellAbility + + Input runtime = new Input() + { + + private static final long serialVersionUID = 1408675899387720506L; + + public void showMessage() + { + CardList cars = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + cars = cars.getType("Caribou"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, cars, "Select a Caribou to sacrifice.", false)); + } + }; + + card.addSpellAbility(a2); + a2.setDescription("Sacrifice a Caribou: You gain 1 life."); + a2.setStackDescription(card.getController() + " gains 1 life."); + a2.setBeforePayMana(runtime); + + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + Input runtime2 = new Input() + { + + private static final long serialVersionUID = -6674543815905055287L; + + public void showMessage() + { + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList land = new CardList(); + land.addAll(hum.getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land you control", true)); + } + }; + spell.setBeforePayMana(runtime2); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Leafdrake Roost")) + { + + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = -4695012002471107694L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Land"); + + if(list.isEmpty()) + return false; + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + card.enchantCard(c); + + }//resolve() + };//SpellAbility + spell.setType("Extrinsic"); + card.clearSpellAbility(); + card.addSpellAbility(spell); + + final SpellAbility produceDrakes = new Ability_Tap(spell.getTargetCard(), "G U") + { + + private static final long serialVersionUID = -3849765771560556442L; + public void resolve() + { + makeToken(); + } + void makeToken() + { + Card c = new Card(); + Card crd = spell.getTargetCard(); + + c.setName("Drake"); + c.setImageName("G U 2 2 Drake"); + + c.setOwner(crd.getController()); + c.setController(crd.getController()); + + c.setManaCost("G U"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Drake"); + c.setBaseAttack(2); + c.setBaseDefense(2); + c.addIntrinsicKeyword("Flying"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + };//SpellAbility + + produceDrakes.setDescription("G U, Tap: Put a 2/2 green and blue Drake creature token with flying onto the battlefield."); + produceDrakes.setStackDescription("Put a 2/2 green and blue Drake creature token with flying onto the battlefield."); + + Command onEnchant = new Command() + { + + private static final long serialVersionUID = -5501311059855861341L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + //crd.clearSpellAbility(); + crd.addSpellAbility(produceDrakes); + + } + }//execute() + };//Command + + + Command onUnEnchant = new Command() + { + + private static final long serialVersionUID = 3589766088284055294L; + + public void execute() + { + if (card.isEnchanting()) + { + + Card crd = card.getEnchanting().get(0); + crd.removeSpellAbility(produceDrakes); + + } + + }//execute() + };//Command + + Command onLeavesPlay = new Command() + { + + private static final long serialVersionUID = -3747590484749776557L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + Input runtime = new Input() + { + + private static final long serialVersionUID = 967525396666242309L; + + public void showMessage() + { + PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList land = new CardList(); + land.addAll(comp.getCards()); + land.addAll(hum.getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true)); + } + }; + spell.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Squirrel Nest")) + { + + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = 6115713202262504968L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Land"); + + if(list.isEmpty()) + return false; + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + card.enchantCard(c); + + }//resolve() + };//SpellAbility + spell.setType("Extrinsic"); + + card.clearSpellAbility(); + card.addSpellAbility(spell); + + final SpellAbility produceSquirrels = new Ability_Tap(spell.getTargetCard()) + { + private static final long serialVersionUID = -4800170026789001271L; + public void resolve() + { + makeToken(); + } + void makeToken() + { + Card c = new Card(); + Card crd = spell.getTargetCard(); + + c.setName("Squirrel"); + c.setImageName("G 1 1 Squirrel"); + + c.setOwner(crd.getController()); + c.setController(crd.getController()); + + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Squirrel"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + };//SpellAbility + + produceSquirrels.setDescription("Tap: Put a 1/1 green Squirrel creature token into play."); + produceSquirrels.setStackDescription("Put a 1/1 green Squirrel creature token into play."); + + Command onEnchant = new Command() + { + + + private static final long serialVersionUID = 3528675502863241126L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + //crd.clearSpellAbility(); + crd.addSpellAbility(produceSquirrels); + + } + }//execute() + };//Command + + + Command onUnEnchant = new Command() + { + private static final long serialVersionUID = -2021446345291180334L; + + public void execute() + { + if (card.isEnchanting()) + { + + Card crd = card.getEnchanting().get(0); + crd.removeSpellAbility(produceSquirrels); + + } + + }//execute() + };//Command + + Command onLeavesPlay = new Command() + { + + private static final long serialVersionUID = -4543302260602460839L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + + card.addEnchantCommand(onEnchant); + card.addUnEnchantCommand(onUnEnchant); + card.addLeavesPlayCommand(onLeavesPlay); + + Input runtime = new Input() + { + + private static final long serialVersionUID = 967525396666242309L; + + public void showMessage() + { + PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList land = new CardList(); + land.addAll(comp.getCards()); + land.addAll(hum.getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true)); + } + }; + spell.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Cursed Land")) + { + + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = 5394181222737344498L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Land"); + + if(list.isEmpty()) + return false; + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(card); + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + card.enchantCard(c); + + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + Command onLeavesPlay = new Command() + { + + private static final long serialVersionUID = 1395122135234314967L; + + public void execute() + { + if (card.isEnchanting()) + { + Card crd = card.getEnchanting().get(0); + card.unEnchantCard(crd); + } + } + }; + card.addLeavesPlayCommand(onLeavesPlay); + + Input runtime = new Input() + { + + private static final long serialVersionUID = -6237279587146079880L; + + public void showMessage() + { + PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList land = new CardList(); + land.addAll(comp.getCards()); + land.addAll(hum.getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(spell, land, "Select target land", true)); + } + }; + spell.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Reflexes")) + { + final SpellAbility spell = new Spell(card) + { + + private static final long serialVersionUID = -3805000291281670685L; + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return false; + + //else + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for (int i=0;i a = c.getKeyword(); + for (int i = 0; i < a.size(); i++) + if (a.get(i).toString().startsWith("Cycling")) + return i; + + return -1; + } + + + public static Card getCard(final Card card, String cardName, String owner, CardFactory cf) + { + + //*************** START *********** START ************************** + if(cardName.equals("Filthy Cur")) + { + final Card newCard = new Card() + { + public void addDamage(final int n) + { + super.addDamage(n); + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + } + }; + ability.setStackDescription("Filthy Cur - causes " +n +" damage to " +getController()); + AllZone.Stack.add(ability); + }//addDamage() + };//Card + + newCard.setOwner(card.getOwner()); + newCard.setController(card.getController()); + + newCard.setManaCost(card.getManaCost()); + newCard.setName(card.getName()); + newCard.addType("Creature"); + newCard.addType("Hound"); + newCard.setText(card.getSpellText()); + newCard.setBaseAttack(card.getBaseAttack()); + newCard.setBaseDefense(card.getBaseDefense()); + + newCard.addSpellAbility(new Spell_Permanent(newCard)); + + return newCard; + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Shinka Gatekeeper")) + { + final Card newCard = new Card() + { + public void addDamage(final int n) + { + super.addDamage(n); + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + } + }; + ability.setStackDescription("Shinka Gatekeeper - causes " +n +" damage to " +getController()); + AllZone.Stack.add(ability); + }//addDamage() + };//Card + + newCard.setOwner(card.getOwner()); + newCard.setController(card.getController()); + + newCard.setManaCost(card.getManaCost()); + newCard.setName(card.getName()); + newCard.addType("Creature"); + newCard.addType("Ogre"); + newCard.addType("Warrior"); + newCard.setText(card.getSpellText()); + newCard.setBaseAttack(card.getBaseAttack()); + newCard.setBaseDefense(card.getBaseDefense()); + + newCard.addSpellAbility(new Spell_Permanent(newCard)); + + return newCard; + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Jackal Pup")) + { + final Card newCard = new Card() + { + public void addDamage(final int n) + { + super.addDamage(n); + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(getController()).subtractLife(n); + } + }; + ability.setStackDescription("Jackal Pup - causes " +n +" damage to " +getController()); + AllZone.Stack.add(ability); + }//addDamage() + };//Card + + newCard.setOwner(card.getOwner()); + newCard.setController(card.getController()); + + newCard.setManaCost(card.getManaCost()); + newCard.setName(card.getName()); + newCard.addType("Creature"); + newCard.addType("Hound"); + newCard.setText(card.getSpellText()); + newCard.setBaseAttack(card.getBaseAttack()); + newCard.setBaseDefense(card.getBaseDefense()); + + newCard.addSpellAbility(new Spell_Permanent(newCard)); + + return newCard; + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Stuffy Doll")) + { + final Card newCard = new Card() + { + Card c = this; + public void addDamage(final int n) + { + super.addDamage(n); + final String opponent = AllZone.GameAction.getOpponent(card.getOwner()); + + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(opponent).subtractLife(n); + + if (c.getKeyword().contains("Lifelink")) + GameActionUtil.executeLifeLinkEffects(c,n); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(c, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(c, n); + } + }; + ability.setStackDescription("Stuffy Doll - causes " +n +" damage to " +opponent); + AllZone.Stack.add(ability); + }//addDamage() + };//Card + + newCard.setOwner(card.getOwner()); + newCard.setController(card.getController()); + + newCard.setManaCost(card.getManaCost()); + newCard.setName(card.getName()); + newCard.addType("Artifact"); + newCard.addType("Creature"); + newCard.addType("Construct"); + newCard.setText("Whenever damage is dealt to Stuffy Doll, it deals that much damage to your opponent."); + newCard.setBaseAttack(0); + newCard.setBaseDefense(1); + + newCard.addIntrinsicKeyword("Indestructible"); + + final Ability_Tap ability = new Ability_Tap(newCard) + { + private static final long serialVersionUID = 577739727089395613L; + + public void resolve() + { + newCard.addDamage(1); + + if (newCard.getKeyword().contains("Lifelink")) + GameActionUtil.executeLifeLinkEffects(newCard, 1); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(newCard, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(newCard, 1); + } + };//SpellAbility + ability.setDescription("tap: Stuffy Doll deals 1 damage to itself."); + ability.setStackDescription("Stuffy Doll - deals 1 damage to itself."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + +// card.addSpellAbility(ability); +// return card; + ///* + newCard.addSpellAbility(new Spell_Permanent(newCard)); + newCard.addSpellAbility(ability); + + return newCard; + //*/ + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Serra Avenger")) + { + SpellAbility spell = new Spell_Permanent(card) + { + private static final long serialVersionUID = -1148518222979323313L; + + public boolean canPlay() + { + return super.canPlay() && 6 < AllZone.Phase.getTurn(); + } + }; + card.clearSpellAbility(); + card.addSpellAbility(spell); + } + //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Force of Savagery")) + { + SpellAbility spell = new Spell_Permanent(card) + { + private static final long serialVersionUID = 1603238129819160467L; + + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + + return list.containsName("Glorious Anthem") || list.containsName("Gaea's Anthem"); + } + }; + card.clearSpellAbility(); + card.addSpellAbility(spell); + } + //*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Greater Forgeling")) + { + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -4569751606008597903L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addTempAttackBoost(-3); + card.addTempDefenseBoost(3); + } + } + }; + + SpellAbility ability = new Ability(card, "1 R") + { + public boolean canPlayAI() + { + return MyRandom.random.nextBoolean() && CardFactoryUtil.AI_doesCreatureAttack(card) && + 3 < card.getNetDefense(); + } + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addTempAttackBoost(3); + card.addTempDefenseBoost(-3); + AllZone.EndOfTurn.addUntil(untilEOT); + } + } + }; + + ability.setDescription("1 R: Greater Forgeling gets +3/-3 until end of turn."); + ability.setStackDescription(card +" gets +3/-3 until end of turn."); + card.addSpellAbility(ability); + } + //*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Caller of the Claw")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + int stop = countGraveyard(); + for(int i = 0; i < stop; i++) + makeToken(); + }//resolve() + int countGraveyard() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList list = new CardList(grave.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && (c.getTurnInZone() == AllZone.Phase.getTurn()); + } + }); + return list.size(); + }//countGraveyard() + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setImageName("G 2 2 Bear"); + c.setName("Bear"); + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Bear"); + c.setBaseAttack(2); + c.setBaseDefense(2); + + play.add(c); + }//makeToken() + };//SpellAbility + + Command comesIntoPlay = new Command() + { + private static final long serialVersionUID = 8485080996453793968L; + + public void execute() + { + AllZone.Stack.add(ability); + } + };//Command + ability.setStackDescription("Caller of the Claw - Put a 2/2 green Bear creature token into play for each nontoken creature put into your graveyard from play this turn."); + card.addComesIntoPlayCommand(comesIntoPlay); + + SpellAbility spell = new Spell_Permanent(card) + { + private static final long serialVersionUID = 6946020026681536710L; + + public boolean canPlayAI() {return super.canPlay();} + }; + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Kiki-Jiki, Mirror Breaker")) + { + final CardFactory cfact = cf; + + final SpellAbility ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -943706942500499644L; + + public boolean canPlayAI() {return getCreature().size() != 0;} + public void chooseTargetAI() + { + setTargetCard(getCreature().get(0)); + } + CardList getCreature() + { + CardList list = null; + if(card.getController().equals(Constant.Player.Human)){ + list = new CardList(AllZone.Human_Play.getCards()); + } + else{ + list = new CardList(AllZone.Computer_Play.getCards()); + } + + list = list.getType("Creature"); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (!c.getType().contains("Legendary") ); + } + }); + CardListUtil.sortAttack(list); + return list; + }//getCreature() + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && getTargetCard().getController().equals(card.getController()) + && CardFactoryUtil.canTarget(card,getTargetCard()) ) + { + Card copy; + if (!getTargetCard().isToken()) + { + //CardFactory cf = new CardFactory("cards.txt"); + + + //copy creature and put it into play + //copy = getCard(getTargetCard(), getTargetCard().getName(), card.getController()); + copy = cfact.getCard(getTargetCard().getName(), getTargetCard().getOwner()); + copy.setToken(true); + + if (getTargetCard().isFaceDown()) { + copy.setIsFaceDown(true); + copy.setManaCost(""); + copy.setBaseAttack(2); + copy.setBaseDefense(2); + copy.setIntrinsicKeyword(new ArrayList()); //remove all keywords + copy.setType(new ArrayList()); //remove all types + copy.addType("Creature"); + copy.clearSpellAbility(); //disallow "morph_up" + } + copy.addIntrinsicKeyword("Haste"); + } + else //isToken() + { + Card c = getTargetCard(); + copy = new Card(); + + copy.setName(c.getName()); + + copy.setOwner(c.getController()); + copy.setController(c.getController()); + + copy.setManaCost(c.getManaCost()); + copy.setToken(true); + + copy.setType(c.getType()); + + copy.setBaseAttack(c.getBaseAttack()); + copy.setBaseDefense(c.getBaseDefense()); + copy.addIntrinsicKeyword("Haste"); + } + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(copy); + + + + //have to do this since getTargetCard() might change + //if Kiki-Jiki somehow gets untapped again + final Card[] target = new Card[1]; + target[0] = copy; + Command atEOT = new Command() + { + private static final long serialVersionUID = 7803915905490565557L; + public void execute() + { + //technically your opponent could steal the token + //and the token shouldn't be sacrificed + if(AllZone.GameAction.isCardInPlay(target[0])) + AllZone.GameAction.sacrifice(target[0]); //maybe do a setSacrificeAtEOT, but probably not. + } + };//Command + AllZone.EndOfTurn.addAt(atEOT); + }//is card in play? + }//resolve() + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 7171284831370490875L; + + public void showMessage() + { + //get all non-legendary creatures you control + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && + (!c.getType().contains("Legendary")); + } + }); + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, list, "Select target creature to copy that is not legendary.", true)); + } + };//Input + ability.setStackDescription("Kiki-Jiki - copy card."); + ability.setDescription("tap: Put a token into play that's a copy of target nonlegendary creature you control. That creature token has haste. Sacrifice it at end of turn."); + ability.setBeforePayMana(runtime); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + /* + //*************** START *********** START ************************** + else if(cardName.equals("Azusa, Lost but Seeking")) + { + + final Ability ability = new Ability(card, "0") + { + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0 && + (AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || AllZone.Phase.getPhase().equals(Constant.Phase.Main1)) + && AllZone.GameAction.isCardInPlay(card) && CardFactoryUtil.canUseAbility(card); + } + public void resolve() + { + + String player = card.getController(); + + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, player); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + + CardList lands = new CardList(hand.getCards()); + lands = lands.getType("Land"); + + if (lands.size() > 0) + { + if (player.equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select land to play", lands.toArray()); + if (o!=null) + { + Card c = (Card)o; + hand.remove(c); + play.add(c); + } + } + else + { + Card c = lands.get(0); + hand.remove(c); + play.add(c); + } + card.setAbilityUsed(card.getAbilityUsed()+1); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("You may play two additional lands on each of your turns."); + ability.setStackDescription(card.getName() + " - " + card.getController() + " plays an additional land."); + }//*************** END ************ END ************************** + + */ + + //*************** START *********** START ************************** + else if(cardName.equals("Wellwisher")) + { + final SpellAbility ability = new Ability_Tap(card, "0") + { + private static final long serialVersionUID = 1446529067071763247L; + + public boolean canPlay() + { + setStackDescription(card.getName() +" - " +card.getController() +" gains " +countElf() +" life."); + + return super.canPlay(); + } + public void resolve() + { + AllZone.GameAction.getPlayerLife(card.getController()).addLife(countElf()); + } + int countElf() + { + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Elf"); + return list.size(); + } + };//SpellAbility + ability.setDescription("tap: You gain 1 life for each Elf in play."); + ability.setBeforePayMana(new Input_NoCost_TapAbility((Ability_Tap) ability)); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Sliver Overlord")) + { + //final String player = card.getController(); + final SpellAbility ability = new Ability(card, "3") + { + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0) + return true; + else + return false; + + } + + + public void resolve() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + String player = card.getController(); + + CardList list = new CardList(lib.getCards()); + list = list.getType("Sliver"); + + if (list.size()==0) + return; + + if (player.equals(Constant.Player.Computer)) + { + Card sliver = CardFactoryUtil.AI_getBestCreature(list); + lib.remove(sliver); + hand.add(sliver); + } + else //human + { + Object o = AllZone.Display.getChoiceOptional("Select target Sliver", list.toArray()); + Card sliver = (Card)o; + lib.remove(sliver); + hand.add(sliver); + } + AllZone.GameAction.shuffle(player); + } + }; + + final SpellAbility ability2 = new Ability(card, "3") + { + + public void resolve() + { + + + Card c = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c) && (c.getType().contains("Sliver") || c.getKeyword().contains("Changeling") ) + && CardFactoryUtil.canTarget(card,c) ) + { + //set summoning sickness + if(c.getKeyword().contains("Haste")){ + c.setSickness(false); + } + else{ + c.setSickness(true); + } + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + PlayerZone from = AllZone.getZone(c); + from.remove(c); + + c.setController(card.getController()); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); + to.add(c); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + }//if + + + }//resolve() + + public boolean canPlayAI() + { + + CardList c = CardFactoryUtil.AI_getHumanCreature(card, true); + CardListUtil.sortAttack(c); + CardListUtil.sortFlying(c); + c = c.filter(new CardListFilter(){ + + public boolean addCard(Card c) { + return c.getType().contains("Sliver") || c.getKeyword().contains("Changeling"); + } + + }); + + if(c.isEmpty()) + return false; + + if(2 <= c.get(0).getNetAttack() && c.get(0).getKeyword().contains("Flying") && + c.get(0).getKeyword().contains("Sliver")) + { + setTargetCard(c.get(0)); + return true; + } + + CardListUtil.sortAttack(c); + if(4 <= c.get(0).getNetAttack() && c.get(0).getKeyword().contains("Sliver")) + { + setTargetCard(c.get(0)); + return true; + } + + return false; + }//canPlayAI() + + public boolean canPlay() + { + return AllZone.GameAction.isCardInPlay(card); + + }//canPlay() + };//SpellAbility ability2 + + ability2.setBeforePayMana(new Input() + { + private static final long serialVersionUID = 1489433384490805477L; + + public void showMessage() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + CardList slivers = new CardList(AllZone.getZone(Constant.Zone.Play, opponent).getCards()); + slivers = slivers.getType("Sliver"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability2, slivers, "Select a Sliver", true)); + } + }); + + ability.setDescription("3:Search your library for a Sliver card, reveal that card, and put it into your hand. Then shuffle your library."); + ability.setStackDescription(card.getName() +" - search for a Sliver card and put it into your hand."); + + ability2.setDescription("3:Gain control of target Sliver."); + ability.setStackDescription(card.getName() +" - Gain control of target Sliver."); + + card.addSpellAbility(ability); + card.addSpellAbility(ability2); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Sliver Queen")) + { + final SpellAbility a1 = new Ability(card, "2") + { + + public boolean canPlay() + { + SpellAbility sa; + //this is a hack, check the stack to see if this card has an ability on the stack + //if so, we can't use the ability + for (int i=0; i 0 && CardFactoryUtil.canTarget(card, c); + } + }); + perms.shuffle(); + setTargetCard(perms.get(0)); //TODO: improve this. + } + + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList perms = new CardList(play.getCards()); + perms = perms.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.sumAllCounters() > 0; + } + }); + return perms.size() > 0; + } + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 1571239319226728848L; + + public void showMessage() + { + PlayerZone human = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList perms = new CardList(); + perms.addAll(human.getCards()); + perms.addAll(comp.getCards()); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a1, perms, "Select target permanent.", true)); + } + }; + + card.addSpellAbility(a1); + a1.setDescription("2 GU, Untap: For each counter on target permanent, put another of those counters on that permanent."); + + a1.setBeforePayMana(runtime); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Order of Whiteclay")) + { + final SpellAbility a1 = new Ability(card,"1 W W") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList creats = new CardList(grave.getCards()); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return CardUtil.getConvertedManaCost(c.getManaCost()) <= 3; + } + + }); + + if (card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Choose a creature", creats.toArray()); + if (o!=null) + { + Card c = (Card)o; + grave.remove(c); + play.add(c); + card.untap(); + } + } + else //Computer + { + Card c = creats.get(0); + grave.remove(c); + play.add(c); + card.untap(); + } + + } + + public boolean canPlay() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList creats = new CardList(grave.getCards()); + creats = creats.filter(new CardListFilter() + { + + public boolean addCard(Card c) + { + return CardUtil.getConvertedManaCost(c.getManaCost()) <= 3; + } + + }); + if (card.isTapped() && !card.hasSickness() && creats.size() > 0) + return true; + else + return false; + } + + public boolean canPlayAI() + { + return true; + } + };//SpellAbility + card.addSpellAbility(a1); + a1.setDescription("1 W W, Untap: Return target creature card with converted mana cost 3 or less from your graveyard to play."); + a1.setStackDescription(card.getName() + " - return target creature card with converted mana cost 3 or less from your graveyard to play."); + + a1.setBeforePayMana(new Input_PayManaCost(a1)); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Patrol Signaler")) + { + final SpellAbility a1 = new Ability(card,"1 W") + { + public void resolve() + { + card.untap(); + makeToken(); + } + void makeToken() + { + Card c = new Card(); + + c.setName("Kithkin Soldier"); + c.setImageName("W 1 1 Kithkin Soldier"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("W"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Kithkin"); + c.addType("Soldier"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i3; + } + }; + card.clearSpellAbility(); + card.addSpellAbility(summoningSpell); + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 2334517567512130479L; + + public void execute() + { + ability.setStackDescription("Serpent Warrior - " + +card.getController() +" loses 3 life"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Eviscerator")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(5); + } + public boolean canPlayAI() + { + return 8 < AllZone.Computer_Life.getLife(); + } + }; + Command intoPlay = new Command() + { + + private static final long serialVersionUID = -221296021551561668L; + + public void execute() + { + ability.setStackDescription("Eviscerator - " +card.getController() +" loses 5 life"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Foul Imp")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(2); + } + public boolean canPlayAI() + { + return 4 < AllZone.Computer_Life.getLife(); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -5371716833341661084L; + + public void execute() + { + ability.setStackDescription("Foul Imp - " +card.getController() +" loses 2 life"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Drekavac")) + { + final Input discard = new Input() + { + private static final long serialVersionUID = -6392468000100283596L; + + public void showMessage() + { + AllZone.Display.showMessage("Discard from your hand a non-creature card"); + ButtonUtil.disableAll(); + } + public void selectCard(Card c, PlayerZone zone) + { + if(zone.is(Constant.Zone.Hand)) + { + AllZone.GameAction.discard(c); + if(c.isCreature()) + AllZone.GameAction.sacrifice(card); + stop(); + } + } + };//Input + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(card.getController().equals(Constant.Player.Human)) + { + if(AllZone.Human_Hand.getCards().length == 0) + AllZone.GameAction.sacrifice(card); + else + AllZone.InputControl.setInput(discard); + } + else + { + CardList list = new CardList(AllZone.Computer_Hand.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (!c.isCreature()); + } + }); + AllZone.GameAction.discard(list.get(0)); + }//else + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = 9202753910259054021L; + + public void execute() + { + ability.setStackDescription(card.getController() +" sacrifices Drekavac unless he discards a non-creature card"); + AllZone.Stack.add(ability); + } + }; + SpellAbility spell = new Spell_Permanent(card) + { + private static final long serialVersionUID = -2940969025405788931L; + + //could never get the AI to work correctly + //it always played the same card 2 or 3 times + public boolean canPlayAI() {return false;} + + public boolean canPlay() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + CardList list = new CardList(hand.getCards()); + list.remove(card); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (!c.isCreature()); + } + }); + return list.size() != 0; + }//canPlay() + }; + card.addComesIntoPlayCommand(intoPlay); + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Minotaur Explorer")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + if(hand.getCards().length == 0) + AllZone.GameAction.sacrifice(card); + else + AllZone.GameAction.discardRandom(card.getController()); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 4986114285467649619L; + + public void execute() + { + ability.setStackDescription(card.getController() +" - discards at random or sacrifices Minotaur Explorer"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Goretusk Firebeast")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(4); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 2977308349468915040L; + + public void execute() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + ability.setStackDescription("Goretusk Firebeast - deals 4 damage to " +opponent); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Goblin Ringleader")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); + + //get top 4 cards of the library + CardList top = new CardList(); + Card[] library = libraryZone.getCards(); + for(int i = 0; i < 4 && i < library.length; i++) + top.add(library[i]); + + //put top 4 cards on bottom of library + for(int i = 0; i < top.size(); i++) + { + libraryZone.remove(top.get(i)); + libraryZone.add(top.get(i)); + } + + CardList goblin = top.getType("Goblin"); + + for(int i = 0; i < goblin.size(); i++) + AllZone.GameAction.moveTo(hand, goblin.get(i)); + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7538870520237796620L; + + public void execute() + { + AllZone.Stack.add(ability); + } + }; + ability.setStackDescription("Goblin Ringleader - reveal the top four cards of your library. Put all Goblin cards revealed this way into your hand and the rest on the bottom of your library."); + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sylvan Messenger")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); + + //get top 4 cards of the library + CardList top = new CardList(); + Card[] library = libraryZone.getCards(); + for(int i = 0; i < 4 && i < library.length; i++) + top.add(library[i]); + + //put top 4 cards on bottom of library + for(int i = 0; i < top.size(); i++) + { + libraryZone.remove(top.get(i)); + libraryZone.add(top.get(i)); + } + + CardList goblin = top.getType("Elf"); + + for(int i = 0; i < goblin.size(); i++) + AllZone.GameAction.moveTo(hand, goblin.get(i)); + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = 4757054648163014149L; + + public void execute() + { + AllZone.Stack.add(ability); + } + }; + ability.setStackDescription("Sylvan Messenger - reveal the top four cards of your library. Put all Elf cards revealed this way into your hand and the rest on the bottom of your library."); + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Child of Alara")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + + + for(int i = 0; i < list.size(); i++) + if(!list.get(i).getType().contains("Land")) + { + Card c = list.get(i); + AllZone.GameAction.destroyNoRegeneration(c); + } + } + }; + Command destroy = new Command() + { + private static final long serialVersionUID = -2937565366066183385L; + + public void execute() + { + AllZone.Stack.add(ability); + } + }; + ability.setStackDescription("Child of Alara - Destroy all non-land permanents, they can't be regenerated"); + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Ryusei, the Falling Star")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + for(int i = 0; i < list.size(); i++) + if(! list.get(i).getKeyword().contains("Flying") && CardFactoryUtil.canDamage(card, list.get(i))) + list.get(i).addDamage(5); + } + }; + Command destroy = new Command() + { + private static final long serialVersionUID = -6585074939675844265L; + + public void execute() + { + AllZone.Stack.add(ability); + } + }; + ability.setStackDescription("Ryusei, the Falling Star - deals 5 damage to each creature without flying"); + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Sleeper Agent")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve(){ + @SuppressWarnings("unused") // opponent + String opponent = card.getController(); + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + PlayerZone from = AllZone.getZone(card); + from.remove(card); + + card.setController(AllZone.GameAction.getOpponent(card.getOwner())); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(card.getOwner())); + to.add(card); + System.out.println("cards controller = " + card.getController()); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + } + }; + + ability.setStackDescription("When Sleeper Agent comes into play, target opponent gains control of it."); + Command intoPlay = new Command() + { + private static final long serialVersionUID = -3934471871041458847L; + + public void execute() + { + AllZone.Stack.add(ability); + + }//execute() + }; + card.addComesIntoPlayCommand(intoPlay); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Flametongue Kavu")) + { + final CommandReturn getCreature = new CommandReturn() + { + //get target card, may be null + public Object execute() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(4, card, true); + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + if(list.size() != 0) + { + Card c = list.get(0); + if(3 <= c.getNetAttack() || + (2 <= c.getNetAttack() && c.getKeyword().contains("Flying"))) + return c; + } + if((AllZone.Computer_Life.getLife() < 10) && + (CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0)) + { + list = CardFactoryUtil.AI_getHumanCreature(card, true); + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + return list.get(0); + } + return null; + }//execute() + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + AllZone.GameAction.addDamage(getTargetCard(), 4); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -1920425335456952853L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + Object o = getCreature.execute(); + if(o != null)//should never happen, but just in case + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + else { + ability.setTargetCard(card); + AllZone.Stack.add(ability); + } + }//else + }//execute() + }; + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 5741146386242415357L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + + return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Shriekmaw")) + { + final CommandReturn getCreature = new CommandReturn() + { + //get target card, may be null + public Object execute() + { + CardList nonblack = CardFactoryUtil.AI_getHumanCreature(card, true); + nonblack = nonblack.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return(!c.isArtifact() && !CardUtil.getColors(c).contains(Constant.Color.Black)); + } + }); + + CardList list = new CardList(nonblack.toArray()); + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + if(list.size() != 0) + { + Card c = list.get(0); + if(2 <= c.getNetAttack() && c.getKeyword().contains("Flying")) + return c; + } + + if((AllZone.Computer_Life.getLife() < 10) && list.size() != 0) + { + CardListUtil.sortAttack(list); + + if(MyRandom.percentTrue(50)) + CardListUtil.sortFlying(list); + + return list.get(0); + } + return null; + }//execute() + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) && + !CardUtil.getColors(c).contains(Constant.Color.Black) && + !c.isArtifact()) + { + AllZone.GameAction.destroy(c); + } + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = -70141932446179740L; + + public void execute() + { + Input target = new Input() + { + private static final long serialVersionUID = 2634600975568025031L; + + public void showMessage() + { + AllZone.Display.showMessage("Select target nonartifact, nonblack creature to destroy"); + ButtonUtil.disableAll(); + } + public void selectCard(Card card, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(ability, card)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(card.isCreature() && zone.is(Constant.Zone.Play) && + !card.isArtifact() && !CardUtil.getColors(card).contains(Constant.Color.Black)) + { + ability.setTargetCard(card); + AllZone.Stack.add(ability); + stop(); + } + } + };//Input target + + + if(card.getController().equals(Constant.Player.Human)) + { + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return(!c.isArtifact() && !CardUtil.getColors(c).contains(Constant.Color.Black)); + } + }); + + if(list.size() != 0) + AllZone.InputControl.setInput(target); +// AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + } + else//computer + { + Object o = getCreature.execute(); + if(o != null)//should never happen, but just in case + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + }//else + }//execute() + }; + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -7508374608705757486L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + + return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + card.addSpellAbility(new Spell_Evoke(card, "1 B") + { + private static final long serialVersionUID = 6838065487515852527L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + + return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Briarhorn")) + { + final CommandReturn getCreature = new CommandReturn() + { + //get target card, may be null + public Object execute() + { + Combat combat = ComputerUtil.getAttackers(); + Card[] c = combat.getAttackers(); + + if(c.length == 0) + { + CardList list = new CardList(); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return(c.isCreature() && !c.hasSickness()); + } + }); + + if(list.size() == 0) + return card; + else + { + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for(int i = 0; i < list.size(); i++) + if(list.get(i).isUntapped()) + return list.get(i); + + return list.get(0); + } + + } + + return c[0]; + }//execute() + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + final Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c)) + { + c.addTempAttackBoost(3); + c.addTempDefenseBoost(3); + + AllZone.EndOfTurn.addUntil(new Command() + { + private static final long serialVersionUID = -5417966443737481535L; + + public void execute() + { + c.addTempAttackBoost(-3); + c.addTempDefenseBoost(-3); + } + }); + }//if + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = -5497111036332352337L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + } + else//computer + { + Object o = getCreature.execute(); + if(o != null)//should never happen, but just in case + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + }//else + }//execute() + }; + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -681505091538444209L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + + return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + card.addSpellAbility(new Spell_Evoke(card, "1 G") + { + private static final long serialVersionUID = 8565746177492779899L; + + public boolean canPlayAI() + { + return false; + } + //because this card has Flash + public boolean canPlay() + { + if (!AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + } + }); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Inner-Flame Acolyte")) + { + final CommandReturn getCreature = new CommandReturn() + { + //get target card, may be null + public Object execute() + { + Combat combat = ComputerUtil.getAttackers(); + Card[] c = combat.getAttackers(); + CardList list = new CardList(); + + if(c.length == 0) + { + list.addAll(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature(); + } + }); + + if(list.size() == 0) + return card; + else + { + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + for(int i = 0; i < list.size(); i++) + if(list.get(i).isUntapped()) + return list.get(i); + + return list.get(0); + } + } + + return c[0]; + }//execute() + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + final Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) ) + { + c.addTempAttackBoost(2); + c.addExtrinsicKeyword("Haste"); + + AllZone.EndOfTurn.addUntil(new Command() + { + private static final long serialVersionUID = -6478147896119509688L; + + public void execute() + { + c.addTempAttackBoost(-2); + c.removeExtrinsicKeyword("Haste"); + } + }); + }//if + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = -4514610171270596654L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + } + else//computer + { + Object o = getCreature.execute(); + if(o != null)//should never happen, but just in case + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + }//else + }//execute() + }; + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 7153795935713327863L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + + return (o != null) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + card.addSpellAbility(new Spell_Evoke(card, "R") + { + private static final long serialVersionUID = 8173305091293824506L; + + public boolean canPlayAI() + { + return false; + } + }); + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Slaughterhouse Bouncer")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + getTargetCard().addDamage(3); + } + }; + Command destroy = new Command() + { + private static final long serialVersionUID = 1619442728548153928L; + + public void execute() + { + //check to see if any other creatures in play + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + //check to see if any cards in hand + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + if(hand.getCards().length == 0 && list.size() != 0) + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + //1.try to get human creature with defense of 3 + list = CardFactoryUtil.AI_getHumanCreature(card, true); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) {return c.getNetDefense() == 3;} + }); + //2.try to get human creature with defense of 2 or less + if(list.isEmpty()) + list = CardFactoryUtil.AI_getHumanCreature(2, card, true); + //3.get any computer creature + if(list.isEmpty()) + { + list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + } + list.shuffle(); + ability.setTargetCard(list.get(0)); + AllZone.Stack.add(ability); + } + }//if ok to play + }//execute() + };//Command + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Undying Beast")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + card.setDamage(0); + card.setAssignedDamage(0); + card.untap(); + + //moves card to top of library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); + library.add(card, 0); + } + }; + Command destroy = new Command() + { + private static final long serialVersionUID = -318081458847722674L; + + public void execute() + { + if(card.isToken()) + return; + + //remove from graveyard + PlayerZone grave = AllZone.getZone(card); + grave.remove(card); + + ability.setStackDescription("Put Undying Beast on top of its owner's library."); + AllZone.Stack.add(ability); + } + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Fire Imp") || cardName.equals("Corrupt Eunuchs")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + getTargetCard().addDamage(2); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7639628386947162984L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + if(list.isEmpty()) + { + list = CardFactoryUtil.AI_getHumanCreature(card, true); + list.shuffle(); + } + + if (list.size() > 0) + ability.setTargetCard(list.get(0)); + else + ability.setTargetCard(card); + + AllZone.Stack.add(ability); + }//else + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 1731831041621831246L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + + return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Man-o'-War") || cardName.equals("Sun Ce, Young Conquerer")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + { + AllZone.getZone(c).remove(c); + + if(! c.isToken()) + { + Card newCard = AllZone.CardFactory.getCard(c.getName(), c.getOwner()); + hand.add(newCard); + } + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7628289586347295144L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + Card human = CardFactoryUtil.AI_getBestCreature(CardFactoryUtil.AI_getHumanCreature(card, true)); + ability.setTargetCard(human); + + + if (human == null) + ability.setTargetCard(card); + + AllZone.Stack.add(ability); + }//else + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 2458286917800051358L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + + return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Keening Banshee")) + { + + final SpellAbility ability = new Ability(card, "0") + { + + public void resolve() + { + final Card c = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) ) + { + c.addTempAttackBoost(-2); + c.addTempDefenseBoost(-2); + + AllZone.EndOfTurn.addUntil(new Command() + { + private static final long serialVersionUID = 8479364459667467780L; + + public void execute() + { + c.addTempAttackBoost(2); + c.addTempDefenseBoost(2); + } + }); + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 6283666887577455663L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); + CardListUtil.sortAttack(list); + CardListUtil.sortFlying(list); + + if(list.isEmpty()) + { + list = CardFactoryUtil.AI_getHumanCreature(card, true); + list.shuffle(); + } + + ability.setTargetCard(list.get(0)); + AllZone.Stack.add(ability); + }//else + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -1893090545602255371L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + + return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ant Queen")) + { + final SpellAbility ability = new Ability(card, "1 G") + { + public void resolve() + { + Card c = new Card(); + c.setName("Insect"); + c.setImageName("G 1 1 Insect"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Insect"); + + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + }; + ability.setDescription("1 G: Put a 1/1 green Insect creature token onto the battlefield."); + ability.setStackDescription(card.getName() + " - Put a 1/1 green Insect token onto the battlefield."); + card.addSpellAbility(ability); + + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Eternal Witness")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 1658050744890095441L; + + public void execute() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + + if(grave.getCards().length == 0) + return; + + if(card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select target card", grave.getCards()); + if(o != null) + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + } + else//computer + { + CardList list = new CardList(grave.getCards()); + Card best = CardFactoryUtil.AI_getBestCreature(list); + + if(best == null) + { + list.shuffle(); + best = list.get(0); + } + ability.setTargetCard(best); + AllZone.Stack.add(ability); + } + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Gravedigger")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7433708170033536384L; + + public void execute() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList list = new CardList(grave.getCards()); + list = list.getType("Creature"); + + if(list.isEmpty()) + return; + + if(card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select target card", list.toArray()); + if(o != null) + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + }//if + else//computer + { + Card best = CardFactoryUtil.AI_getBestCreature(list); + ability.setTargetCard(best); + AllZone.Stack.add(ability); + } + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Strongarm Thug")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 4519970074391756730L; + + public void execute() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList list = new CardList(grave.getCards()); + list = list.getType("Mercenary"); + + if(list.isEmpty()) + return; + + if(card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select target card", list.toArray()); + if(o != null) + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + }//if + else//computer + { + Card best = CardFactoryUtil.AI_getBestCreature(list); + ability.setTargetCard(best); + AllZone.Stack.add(ability); + } + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************ + if (cardName.equals("Adun Oakenshield")) + { + final Ability_Tap ability = new Ability_Tap(card, "B R G") + { + private static final long serialVersionUID = -7913968639880781838L; + public boolean canPlayAI() {return getGraveCreatures().size() != 0;} + + public void chooseTargetAI() + { + CardList grave = getGraveCreatures(); + Card target = CardFactoryUtil.AI_getBestCreature(grave); + setTargetCard(target); + } + + public void resolve() + { + if(card.getController().equals(Constant.Player.Human)) + { + Card c = (Card) AllZone.Display.getChoice("Select card", getGraveCreatures().toArray()); + setTargetCard(c); + } + + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + + if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) + AllZone.GameAction.moveTo(hand, getTargetCard()); + }//resolve() + public boolean canPlay() + { + return getGraveCreatures().size() != 0; + } + CardList getGraveCreatures() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList list = new CardList(grave.getCards()); + list = list.getType("Creature"); + return list; + } + };//SpellAbility + ability.setDescription("B R G, Tap: Return target creature card from your graveyard to your hand."); + ability.setStackDescription(cardName + " - return target creature from your graveyard to your hand."); + + card.clearSpellAbility(); + card.addSpellAbility(ability); + + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Anarchist")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), grave)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7459412502903144952L; + + public void execute() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList sorcery = new CardList(grave.getCards()); + sorcery = sorcery.getType("Sorcery"); + + String controller = card.getController(); + + if(sorcery.size() == 0) + return; + + if(controller.equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select target card", sorcery.toArray()); + if(o != null) + { + ability.setTargetCard((Card)o); + AllZone.Stack.add(ability); + } + } + else //computer + { + sorcery.shuffle(); + ability.setTargetCard(sorcery.get(0)); + AllZone.Stack.add(ability); + } + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Penumbra Kavu")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Kavu"); + c.setImageName("B 3 3 Kavu"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Kavu"); + c.setBaseAttack(3); + c.setBaseDefense(3); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//Ability + + Command destroy = new Command() + { + private static final long serialVersionUID = 1281791927604583468L; + + public void execute() + { + ability.setStackDescription(card.getController() +" puts a 3/3 creature into play from Penumbra Kavu"); + AllZone.Stack.add(ability); + } + }; + + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Penumbra Bobcat")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Cat"); + c.setImageName("B 2 1 Cat"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Cat"); + c.setBaseAttack(2); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//Ability + + Command destroy = new Command() + { + private static final long serialVersionUID = -8057009255325020247L; + + public void execute() + { + ability.setStackDescription(card.getController() +" puts a 2/1 creature into play from Penumbra Bobcat"); + AllZone.Stack.add(ability); + } + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Penumbra Spider")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Spider"); + c.setImageName("B 2 4 Spider"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Spider"); + c.setBaseAttack(2); + c.setBaseDefense(4); + c.addIntrinsicKeyword("Reach"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//Ability + + Command destroy = new Command() + { + private static final long serialVersionUID = 9186718803540678064L; + + public void execute() + { + ability.setStackDescription(card.getController() +" puts a 2/4 Black Spider creature into play from Penumbra Spider"); + AllZone.Stack.add(ability); + } + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Penumbra Wurm")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Wurm"); + c.setImageName("B 6 6 Wurm"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Wurm"); + c.setBaseAttack(6); + c.setBaseDefense(6); + c.addIntrinsicKeyword("Trample"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//Ability + + Command destroy = new Command() + { + private static final long serialVersionUID = -8819664543962631239L; + + public void execute() + { + ability.setStackDescription(card.getController() +" puts a 6/6 Black Wurm creature with trample into play from Penumbra Wurm"); + AllZone.Stack.add(ability); + } + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Aven Fisher") || cardName.equals("Riptide Crab")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + } + }; + Command destroy = new Command() + { + private static final long serialVersionUID = -2786138225183288814L; + + public void execute() + { + ability.setStackDescription(card.getName() + " - " + card.getController() +" draws a card"); + AllZone.Stack.add(ability); + } + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Peregrine Drake")) + { + final Input untap = new Input() + { + private static final long serialVersionUID = 2287264826189281795L; + + int stop = 5; + int count = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select a land to untap"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + if(card.isLand() && zone.is(Constant.Zone.Play)) + { + card.untap(); + count++; + if(count == stop) + stop(); + } + }//selectCard() + }; + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(card.getController().equals("Human")) + AllZone.InputControl.setInput(untap); + else + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand() && c.isTapped(); + } + }); + for(int i = 0; i < 5 && i < list.size(); i++) + list.get(i).untap(); + }//else + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 3208277692165539396L; + + public void execute() + { + ability.setStackDescription(card.getController() +" untaps up to 5 lands."); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Cloud of Faeries")) + { + final Input untap = new Input() + { + private static final long serialVersionUID = -2167059918040912025L; + + int stop = 2; + int count = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select a land to untap"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + if(card.isLand() && zone.is(Constant.Zone.Play)) + { + card.untap(); + count++; + if(count == stop) + stop(); + } + }//selectCard() + }; + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(card.getController().equals("Human")) + AllZone.InputControl.setInput(untap); + else + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isLand() && c.isTapped(); + } + }); + for(int i = 0; i < 2 && i < list.size(); i++) + { + list.get(i).untap(); + } + }//else + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 7222997838166323277L; + + public void execute() + { + ability.setStackDescription(card.getController() +" untaps up to 2 lands."); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + + //add cycling + card.addSpellAbility(CardFactoryUtil.ability_cycle(card, "2")); + }//*************** END ************ END *************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Vodalian Merchant")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + + if(card.getController().equals("Human")) + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + else + AllZone.GameAction.discardRandom("Computer"); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -8924243774757009091L; + + public void execute() + { + ability.setStackDescription(card.getController() +" draws a card, then discards a card"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Whirlpool Rider")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //shuffle hand into library, then shuffle library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand , card.getController()); + Card c[] = hand.getCards(); + for(int i = 0; i < c.length; i++) + AllZone.GameAction.moveTo(library, c[i]); + AllZone.GameAction.shuffle(card.getController()); + + //draw same number of cards as before + for(int i = 0; i < c.length; i++) + AllZone.GameAction.drawCard(card.getController()); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 6290392806910817877L; + + public void execute() + { + ability.setStackDescription(card.getController() +" shuffles the cards from his hand into his library, then draws that many cards."); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sky Swallower")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + String opp = AllZone.GameAction.getOpponent(card.getController()); + PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, opp); + PlayerZone myPlay = AllZone.getZone(Constant.Zone.Play, card.getController()); + + CardList list = new CardList(myPlay.getCards()); + list.remove(card);//doesn't move Sky Swallower + while(! list.isEmpty()) + { + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + //so "comes into play" abilities don't trigger + ///list.get(0).addComesIntoPlayCommand(Command.Blank); + + oppPlay.add(list.get(0)); + myPlay.remove(list.get(0)); + + list.get(0).setController(opp); + list.remove(0); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + } + }//resolve() + }; + + Command intoPlay = new Command() + { + private static final long serialVersionUID = -453410206437839334L; + + public void execute() + { + ability.setStackDescription(AllZone.GameAction.getOpponent(card.getController()) +" gains control of all other permanents you control"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Nova Chaser") || cardName.equals("Supreme Exemplar")) + { + final CommandReturn getCreature = new CommandReturn() + { + public Object execute() + { + //get all creatures + CardList list = new CardList(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + list.addAll(play.getCards()); + + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.getType().contains("Elemental") || c.getKeyword().contains("Changeling"); + } + }); + + return list; + } + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") + { + public void resolve() + { + if (getTargetCard() == null || getTargetCard() == card) + AllZone.GameAction.sacrifice(card); + + else if(AllZone.GameAction.isCardInPlay(getTargetCard())) + { + /* + PlayerZone play = AllZone.getZone(getTargetCard()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); + play.remove(getTargetCard()); + removed.add(getTargetCard()); + */ + AllZone.GameAction.removeFromGame(getTargetCard()); + } + }//resolve() + }; + + final Input inputComes = new Input() + { + private static final long serialVersionUID = -6066115143834426784L; + + public void showMessage() + { + CardList choice = (CardList)getCreature.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select Elemental to remove from the game", false)); + ButtonUtil.disableAll(); + } + + }; + Command commandComes = new Command() + { + private static final long serialVersionUID = -3498068247359658023L; + + public void execute() + { + CardList creature = (CardList)getCreature.execute(); + String s = card.getController(); + if(creature.size() == 0) { + AllZone.GameAction.sacrifice(card); + return; + } + else if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.getType("Elemental"); + computer.remove(card); + + computer.shuffle(); + if (computer.size()!= 0) { + target = computer.get(0); + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + } + }//else + }//execute() + };//CommandComes + Command commandLeavesPlay = new Command() + { + private static final long serialVersionUID = 4236503599017025393L; + + public void execute() + { + //System.out.println(abilityComes.getTargetCard().getName()); + Object o = abilityComes.getTargetCard(); + + if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) + return; + + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //copy card to reset card attributes like attack and defense + Card c = abilityComes.getTargetCard(); + if(! c.isToken()) + { + c = AllZone.CardFactory.copyCard(c); + c.setController(c.getOwner()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); + removed.remove(c); + play.add(c); + + } + }//resolve() + };//SpellAbility + ability.setStackDescription(card.getName() + " - returning creature to play"); + AllZone.Stack.add(ability); + }//execute() + };//Command + + card.addComesIntoPlayCommand(commandComes); + card.addLeavesPlayCommand(commandLeavesPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -62128538015338896L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + if (o == null) + return false; + + CardList cl = (CardList)getCreature.execute(); + return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Wren's Run Packmaster")) + { + final CommandReturn getCreature = new CommandReturn() + { + public Object execute() + { + //get all creatures + CardList list = new CardList(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + list.addAll(play.getCards()); + + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.getType().contains("Elf") || c.getKeyword().contains("Changeling"); + } + }); + + return list; + } + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") + { + public void resolve() + { + if (getTargetCard() == null || getTargetCard() == card) + AllZone.GameAction.sacrifice(card); + + else if(AllZone.GameAction.isCardInPlay(getTargetCard())) + { + /* + PlayerZone play = AllZone.getZone(getTargetCard()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); + play.remove(getTargetCard()); + removed.add(getTargetCard()); + */ + AllZone.GameAction.removeFromGame(getTargetCard()); + } + }//resolve() + }; + + final Input inputComes = new Input() + { + private static final long serialVersionUID = 5210700665533271691L; + + public void showMessage() + { + CardList choice = (CardList)getCreature.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select Elf to remove from the game", false)); + ButtonUtil.disableAll(); //target this card means: sacrifice this card + } + }; + Command commandComes = new Command() + { + + private static final long serialVersionUID = -3580408066322945328L; + + public void execute() + { + CardList creature = (CardList)getCreature.execute(); + String s = card.getController(); + if(creature.size() == 0) { + AllZone.GameAction.sacrifice(card); + return; + } + else if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.getType("Elf"); + computer.remove(card); + + computer.shuffle(); + if (computer.size()!= 0) { + target = computer.get(0); + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + } + }//else + }//execute() + };//CommandComes + Command commandLeavesPlay = new Command() + { + + private static final long serialVersionUID = -5903638227914705191L; + + public void execute() + { + //System.out.println(abilityComes.getTargetCard().getName()); + Object o = abilityComes.getTargetCard(); + + if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) + return; + + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //copy card to reset card attributes like attack and defense + Card c = abilityComes.getTargetCard(); + if(! c.isToken()) + { + c = AllZone.CardFactory.copyCard(c); + c.setController(c.getOwner()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); + removed.remove(c); + play.add(c); + + } + }//resolve() + };//SpellAbility + ability.setStackDescription(card.getName() + " - returning creature to play"); + AllZone.Stack.add(ability); + }//execute() + };//Command + + + final SpellAbility a1 = new Ability(card, "2 G") + { + public boolean canPlayAI() + { + return MyRandom.random.nextBoolean(); + } + public boolean canPlay() + { + SpellAbility sa; + //this is a hack, check the stack to see if this card has an ability on the stack + //if so, we can't use the ability + for (int i=0; i 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + + card.addSpellAbility(a1); + a1.setBeforePayMana(new Input_PayManaCost(a1)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Changeling Berserker") || cardName.equals("Changeling Hero") || cardName.equals("Changeling Titan")) + { + final CommandReturn getCreature = new CommandReturn() + { + public Object execute() + { + //get all creatures + CardList list = new CardList(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + list.addAll(play.getCards()); + + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.getType().contains("Creature"); + } + }); + + return list; + } + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") + { + public void resolve() + { + if (getTargetCard() == null || getTargetCard() == card) + AllZone.GameAction.sacrifice(card); + + else if(AllZone.GameAction.isCardInPlay(getTargetCard()) ) + { + /* + PlayerZone play = AllZone.getZone(getTargetCard()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); + play.remove(getTargetCard()); + removed.add(getTargetCard()); + */ + AllZone.GameAction.removeFromGame(getTargetCard()); + } + }//resolve() + }; + + final Input inputComes = new Input() + { + + private static final long serialVersionUID = 5210700665533271691L; + + public void showMessage() + { + CardList choice = (CardList)getCreature.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select creature to remove from the game", false)); + ButtonUtil.disableAll(); + } + }; + Command commandComes = new Command() + { + + private static final long serialVersionUID = -3580408066322945328L; + + public void execute() + { + CardList creature = (CardList)getCreature.execute(); + String s = card.getController(); + if(creature.size() == 0) { + AllZone.GameAction.sacrifice(card); + return; + } + else if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.getType("Creature"); + computer.remove(card); + + computer.shuffle(); + if (computer.size()!= 0) { + target = computer.get(0); + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + } + }//else + }//execute() + };//CommandComes + Command commandLeavesPlay = new Command() + { + + private static final long serialVersionUID = -5903638227914705191L; + + public void execute() + { + //System.out.println(abilityComes.getTargetCard().getName()); + Object o = abilityComes.getTargetCard(); + + if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) + return; + + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //copy card to reset card attributes like attack and defense + Card c = abilityComes.getTargetCard(); + if(! c.isToken()) + { + c = AllZone.CardFactory.copyCard(c); + c.setController(c.getOwner()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); + removed.remove(c); + play.add(c); + + } + }//resolve() + };//SpellAbility + ability.setStackDescription(card.getName() + " - returning creature to play"); + AllZone.Stack.add(ability); + }//execute() + };//Command + + card.addComesIntoPlayCommand(commandComes); + card.addLeavesPlayCommand(commandLeavesPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + + private static final long serialVersionUID = 2583297503017070549L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + if (o == null) + return false; + + CardList cl = (CardList)getCreature.execute(); + return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Devout Lightcaster")) + { + final CommandReturn getBlackPerm = new CommandReturn() + { + public Object execute() + { + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.isPermanent() && CardFactoryUtil.canTarget(card,c) && CardUtil.getColor(c).equals(Constant.Color.Black); + } + }); + + return list; + } + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + { + + AllZone.GameAction.removeFromGame(getTargetCard()); + } + }//resolve() + }; + + final Input inputComes = new Input() + { + private static final long serialVersionUID = 3762167908738465100L; + + public void showMessage() + { + CardList choice = (CardList)getBlackPerm.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select target black permanent to remove from the game", true)); + ButtonUtil.disableAll();//to disable the Cancel button + } + }; + Command commandComes = new Command() + { + + private static final long serialVersionUID = 3878683618127503416L; + + public void execute() + { + CardList creature = (CardList)getBlackPerm.execute(); + String s = card.getController(); + if(creature.size() == 0) + return; + else if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + + //try to target human permanent + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList human = new CardList(hum.getCards()); + human = human.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isPermanent() && CardUtil.getColor(c).equals(Constant.Color.Black); + } + + }); + //target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty + human.shuffle(); + target = null; + if (human.size()!=0) + target = human.get(0); + + if(target == null) + { + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isPermanent() && CardUtil.getColor(c).equals(Constant.Color.Black); + } + + }); + + computer.shuffle(); + if (computer.size()!= 0) + target = computer.get(0); + } + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + }//else + }//execute() + };//CommandComes + + card.addComesIntoPlayCommand(commandComes); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + + private static final long serialVersionUID = -9059177006257139430L; + + public boolean canPlayAI() + { + Object o = getBlackPerm.execute(); + if (o == null) + return false; + + CardList cl = (CardList)getBlackPerm.execute(); + return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Faceless Butcher")) + { + final CommandReturn getCreature = new CommandReturn() + { + public Object execute() + { + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.isCreature() && CardFactoryUtil.canTarget(card,c); + } + }); + + //remove "this card" + list.remove(card); + + return list; + } + };//CommandReturn + + final SpellAbility abilityComes = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card,getTargetCard()) ) + { + /* + PlayerZone play = AllZone.getZone(getTargetCard()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, getTargetCard().getController()); + play.remove(getTargetCard()); + removed.add(getTargetCard()); + */ + AllZone.GameAction.removeFromGame(getTargetCard()); + } + }//resolve() + }; + + final Input inputComes = new Input() + { + private static final long serialVersionUID = -1932054059769056049L; + + public void showMessage() + { + CardList choice = (CardList)getCreature.execute(); + + stopSetNext(CardFactoryUtil.input_targetSpecific(abilityComes, choice, "Select target creature to remove from the game", true)); + ButtonUtil.disableAll();//to disable the Cancel button + } + }; + Command commandComes = new Command() + { + private static final long serialVersionUID = -5675532512302863456L; + + public void execute() + { + CardList creature = (CardList)getCreature.execute(); + String s = card.getController(); + if(creature.size() == 0) + return; + else if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(inputComes); + else //computer + { + Card target; + + //try to target human creature + CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); + target = CardFactoryUtil.AI_getBestCreature(human);//returns null if list is empty + + if(target == null) + { + //must target computer creature + CardList computer = new CardList(AllZone.Computer_Play.getCards()); + computer = computer.getType("Creature"); + computer.remove(card); + + computer.shuffle(); + if (computer.size()!= 0) + target = computer.get(0); + } + abilityComes.setTargetCard(target); + AllZone.Stack.add(abilityComes); + }//else + }//execute() + };//CommandComes + Command commandLeavesPlay = new Command() + { + private static final long serialVersionUID = 5518706316791622193L; + + public void execute() + { + //System.out.println(abilityComes.getTargetCard().getName()); + Object o = abilityComes.getTargetCard(); + + if(o == null || ((Card)o).isToken()|| !AllZone.GameAction.isCardRemovedFromGame((Card)o) ) + return; + + SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //copy card to reset card attributes like attack and defense + Card c = abilityComes.getTargetCard(); + if(! c.isToken()) + { + c = AllZone.CardFactory.copyCard(c); + c.setController(c.getOwner()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); + removed.remove(c); + play.add(c); + + } + }//resolve() + };//SpellAbility + ability.setStackDescription("Faceless Butcher - returning creature to play"); + AllZone.Stack.add(ability); + }//execute() + };//Command + + card.addComesIntoPlayCommand(commandComes); + card.addLeavesPlayCommand(commandLeavesPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + + private static final long serialVersionUID = -62128538015338896L; + + public boolean canPlayAI() + { + Object o = getCreature.execute(); + if (o == null) + return false; + + CardList cl = (CardList)getCreature.execute(); + return (o != null) && cl.size() > 0 && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Ember-Fist Zubera")) + { + //counts Zubera in all graveyards for this turn + final CommandReturn countZubera = new CommandReturn() + { + public Object execute() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.getTurnInZone() == AllZone.Phase.getTurn()) && + (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); + } + });//CardListFilter() + + return new Integer(list.size()); + } + }; + + final Input[] input = new Input[1]; + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + //human chooses target on resolve, + //computer chooses target in Command destroy + if(Constant.Player.Human.equals(card.getController())) + AllZone.InputControl.setInput(input[0]); + else + { + int damage = ((Integer)countZubera.execute()).intValue(); + + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canDamage(card, getTargetCard()) + && CardFactoryUtil.canTarget(card,getTargetCard()) ) + { + Card c = getTargetCard(); + c.addDamage(damage); + } + } + else + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + } + }//resolve() + };//SpellAbility + + input[0] = new Input() + { + private static final long serialVersionUID = 1899925898843297992L; + + public void showMessage() + { + int damage = ((Integer)countZubera.execute()).intValue(); + AllZone.Display.showMessage("Select target Creature, Planeswalker or Player - " + damage +" damage "); + ButtonUtil.disableAll(); + } + public void selectCard(Card card, PlayerZone zone) + { + if((card.isCreature() || card.isPlaneswalker()) && zone.is(Constant.Zone.Play)) + { + int damage = ((Integer)countZubera.execute()).intValue(); + card.addDamage(damage); + + //have to do this since state effects aren't checked + //after this "Input" class is done + //basically this makes everything work right + //Ember-Fist Zubera can destroy a 2/2 creature + AllZone.GameAction.checkStateEffects(); + stop(); + } + }//selectCard() + public void selectPlayer(String player) + { + int damage = ((Integer)countZubera.execute()).intValue(); + AllZone.GameAction.getPlayerLife(player).subtractLife(damage); + stop(); + }//selectPlayer() + };//Input + + Command destroy = new Command() + { + private static final long serialVersionUID = -1889425992069348304L; + + public void execute() + { + ability.setStackDescription(card +" causes damage to creature or player"); + + @SuppressWarnings("unused") // damage + int damage = ((Integer)countZubera.execute()).intValue(); + + String con = card.getController(); + + //human chooses target on resolve, + //computer chooses target in Command destroy + if(con.equals(Constant.Player.Computer)) + ability.setTargetPlayer(Constant.Player.Human); + + AllZone.Stack.add(ability); + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Ashen-Skin Zubera")) + { + //counts Zubera in all graveyards for this turn + final CommandReturn countZubera = new CommandReturn() + { + public Object execute() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.getTurnInZone() == AllZone.Phase.getTurn()) && + (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); + } + });//CardListFilter() + return new Integer(list.size()); + } + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + int discard = ((Integer)countZubera.execute()).intValue(); + + if(Constant.Player.Human.equals(getTargetPlayer())) + AllZone.InputControl.setInput(CardFactoryUtil.input_discard(discard)); + else + { + for(int i = 0; i < discard; i++) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + }//resolve() + };//SpellAbility + + Command destroy = new Command() + { + private static final long serialVersionUID = -7494691537986218546L; + + public void execute() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + ability.setTargetPlayer(opponent); + ability.setStackDescription(card +" - " + opponent +" discards cards"); + + AllZone.Stack.add(ability); + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Floating-Dream Zubera")) + { + //counts Zubera in all graveyards for this turn + final CommandReturn countZubera = new CommandReturn() + { + public Object execute() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.getTurnInZone() == AllZone.Phase.getTurn()) && + (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); + } + });//CardListFilter() + return new Integer(list.size()); + } + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + int number = ((Integer)countZubera.execute()).intValue(); + + for(int i = 0; i < number; i++) + AllZone.GameAction.drawCard(getTargetPlayer()); + }//resolve() + };//SpellAbility + + Command destroy = new Command() + { + private static final long serialVersionUID = -5814070329854975419L; + + public void execute() + { + ability.setTargetPlayer(card.getController()); + ability.setStackDescription(card +" - " +card.getController() +" draws cards"); + AllZone.Stack.add(ability); + + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Silent-Chant Zubera")) + { + //counts Zubera in all graveyards for this turn + final CommandReturn countZubera = new CommandReturn() + { + public Object execute() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.getTurnInZone() == AllZone.Phase.getTurn()) && + (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); + } + });//CardListFilter() + return new Integer(list.size()); + } + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + int number = ((Integer)countZubera.execute()).intValue(); + + PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); + life.addLife(number * 2); + }//resolve() + };//SpellAbility + + Command destroy = new Command() + { + private static final long serialVersionUID = -2327085948421343657L; + + public void execute() + { + ability.setTargetPlayer(card.getController()); + ability.setStackDescription(card +" - " +card.getController() +" gains life"); + AllZone.Stack.add(ability); + + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Dripping-Tongue Zubera")) + { + //counts Zubera in all graveyards for this turn + final CommandReturn countZubera = new CommandReturn() + { + public Object execute() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.getTurnInZone() == AllZone.Phase.getTurn()) && + (c.getType().contains("Zubera") || c.getKeyword().contains("Changeling") ); + } + });//CardListFilter() + return new Integer(list.size()); + } + };//CommandReturn + + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + int count = ((Integer)countZubera.execute()).intValue(); + for(int i = 0; i < count; i++) + makeToken(); + }//resolve() + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Spirit"); + c.setImageName("C 1 1 Spirit"); + c.setManaCost(""); + c.setToken(true); + + c.addType("Creature"); + c.addType("Spirit"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + play.add(c); + }//makeToken() + + };//SpellAbility + + Command destroy = new Command() + { + private static final long serialVersionUID = 8362692868619919330L; + public void execute() + { + ability.setTargetPlayer(card.getController()); + ability.setStackDescription(card +" - " +card.getController() +" puts tokens into play"); + AllZone.Stack.add(ability); + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Keiga, the Tide Star")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone oldPlay = AllZone.getZone(getTargetCard()); + + //so "comes into play" abilities don't trigger + //getTargetCard().addComesIntoPlayCommand(Command.Blank); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + play.add(getTargetCard()); + oldPlay.remove(getTargetCard()); + + getTargetCard().setController(card.getController()); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + } + }//resolve() + }; + + final Input targetInput = new Input() + { + private static final long serialVersionUID = -8727869672234802473L; + + public void showMessage() + { + AllZone.Display.showMessage("Select target creature"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(card, c)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(c.isCreature() && zone.is(Constant.Zone.Play)) + { + ability.setTargetCard(c); + ability.setStackDescription("Gain control of " +ability.getTargetCard()); + AllZone.Stack.add(ability); + stop(); + } + } + };//Input + Command destroy = new Command() + { + private static final long serialVersionUID = -3868616119471172026L; + + public void execute() + { + String con = card.getController(); + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + + if(con.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(targetInput); + else if(list.size() != 0) + { + Card target = CardFactoryUtil.AI_getBestCreature(list); + ability.setTargetCard(target); + AllZone.Stack.add(ability); + } + }//execute() + }; + card.addDestroyCommand(destroy); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Elvish Piper")) + { + final SpellAbility ability = new Ability_Tap(card, "G") + { + private static final long serialVersionUID = 8788555124182810249L; + + public boolean canPlayAI() {return getCreature().size() != 0;} + public void chooseTargetAI() + { + card.tap(); + Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); + setTargetCard(target); + } + CardList getCreature() + { + CardList list = new CardList(AllZone.Computer_Hand.getCards()); + list = list.getType("Creature"); + return list; + } + + public void resolve() + { + Card c = getTargetCard(); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + if(AllZone.GameAction.isCardInZone(c, hand)) + { + hand.remove(c); + play.add(c); + } + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("G, tap: Put a creature card from your hand into play."); + + final Command paid = new Command() + { + private static final long serialVersionUID = 6859737530872573139L; + public void execute() + { + AllZone.InputControl.resetInput(); + AllZone.Stack.add(ability); + } + }; + final Command unpaid = new Command() + { + private static final long serialVersionUID = -257927480355704167L; + + public void execute() + { + card.untap(); + } + }; + final Input target = new Input() + { + private static final long serialVersionUID = -1041198540673942649L; + + public void showMessage() + { + ButtonUtil.enableOnlyCancel(); + AllZone.Display.showMessage("Select creature from your hand to put into play"); + } + public void selectCard(Card c, PlayerZone zone) + { + if(c.isCreature() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) + { + card.tap(); + + ability.setTargetCard(c);//since setTargetCard() changes stack description + ability.setStackDescription("Put into play " +c); + + AllZone.InputControl.setInput(new Input_PayManaCost_Ability(ability.getManaCost(), paid, unpaid)); + } + } + public void selectButtonCancel() + { + card.untap(); + stop(); + } + };//Input target + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Weathered Wayfarer")) + { + final SpellAbility ability = new Ability_Tap(card, "W") + { + private static final long serialVersionUID = 2902408879239353813L; + + public void resolve() + { + //getTargetCard() will NEVER be null + + //checks to see if card is still in the library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), library)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + } + }//resolve() + public boolean canPlay() + { + String oppPlayer = AllZone.GameAction.getOpponent(card.getController()); + + PlayerZone selfZone = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone oppZone = AllZone.getZone(Constant.Zone.Play, oppPlayer); + + CardList self = new CardList(selfZone.getCards()); + CardList opp = new CardList(oppZone.getCards()); + + self = self.getType("Land"); + opp = opp.getType("Land"); + + //checks to see if any land in library + PlayerZone selfLibrary = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList library = new CardList(selfLibrary.getCards()); + library = library.getType("Land"); + + return (self.size() < opp.size()) && (library.size() != 0) && super.canPlay(); + } + public void chooseTargetAI() + { + PlayerZone selfLibrary = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList library = new CardList(selfLibrary.getCards()); + library = library.getType("Land"); + + setTargetCard(library.get(0)); + } + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = 3492362297282622857L; + + public void showMessage() + { + CardList land = new CardList(AllZone.Human_Library.getCards()); + land = land.getType("Land"); + Object o = AllZone.Display.getChoiceOptional("Select a Land", land.toArray()); + + //techincally not correct, but correct enough + //this allows players to look at their decks without paying anything + if(o == null) + stop(); + else + { + AllZone.GameAction.shuffle("Human"); + ability.setTargetCard((Card)o); + stopSetNext(new Input_PayManaCost(ability)); + } + }//showMessage() + };//Input - target + + card.addSpellAbility(ability); + ability.setDescription("W, tap: Search your library for a land card, reveal it, and put it into your hand. Then shuffle your library. Play this ability only if an opponent controls more lands than you."); + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Disciple of Kangee")) + { + final SpellAbility ability = new Ability_Tap(card, "U") + { + private static final long serialVersionUID = -5169389637917649036L; + public boolean canPlayAI() + { + if(CardFactoryUtil.AI_doesCreatureAttack(card)) + return false; + + return CardFactoryUtil.AI_getHumanCreature("Flying", card, false).isEmpty() && + (getCreature().size() != 0); + } + public void chooseTargetAI() + { + card.tap(); + Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); + setTargetCard(target); + } + CardList getCreature() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && (!CardFactoryUtil.AI_doesCreatureAttack(c)) && + (! c.getKeyword().contains("Flying")) && CardFactoryUtil.canTarget(card, c); + } + }); + list.remove(card); + return list; + }//getCreature() + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + final Card[] creature = new Card[1]; + final Command EOT = new Command() + { + private static final long serialVersionUID = -1899153704584793548L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(creature[0])) + creature[0].removeExtrinsicKeyword("Flying"); + } + }; + creature[0] = getTargetCard(); + creature[0].addExtrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(EOT); + }//if (card is in play) + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("U, tap: Target creature gains flying."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Puppeteer")) + { + //tap - target creature + final SpellAbility ability = new Ability_Tap(card, "U") + { + private static final long serialVersionUID = 7698358771800336470L; + public boolean canPlayAI() {return getTapped().size() != 0;} + public void chooseTargetAI() + { + card.tap(); + Card target = CardFactoryUtil.AI_getBestCreature(getTapped()); + setTargetCard(target); + } + CardList getTapped() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && c.isTapped(); + } + }); + return list; + }//getTapped() + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + Card c = getTargetCard(); + if(c.isTapped()) + c.untap(); + else + c.tap(); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("U, tap: Tap or untap target creature."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sorceress Queen")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -6853184726011448677L; + public boolean canPlayAI() + { + Card c = getCreature(); + if(c == null) + return false; + else + { + setTargetCard(c); + return true; + } + }//canPlayAI() + //may return null + public Card getCreature() + { + CardList untapped = CardFactoryUtil.AI_getHumanCreature(card, true); + untapped = untapped.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isUntapped() && 2 < c.getNetDefense() && c != card; + } + }); + if(untapped.isEmpty()) + return null; + + Card big = CardFactoryUtil.AI_getBestCreature(untapped); + return big; + } + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + final Card[] creature = new Card[1]; + + creature[0] = getTargetCard(); + final int[] originalAttack = {creature[0].getBaseAttack()}; + final int[] originalDefense = {creature[0].getBaseDefense()}; + + creature[0].setBaseAttack(0); + creature[0].setBaseDefense(2); + + final Command EOT = new Command() + { + private static final long serialVersionUID = 6437463765161964445L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(creature[0])) + { + creature[0].setBaseAttack(originalAttack[0]); + creature[0].setBaseDefense(originalDefense[0]); + } + } + }; + AllZone.EndOfTurn.addUntil(EOT); + }//is card in play? + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Target creature other than Sorceress Queen becomes 0/2 until end of turn."); + //this ability can target "this card" when it shouldn't be able to + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility_NoTargetSelf(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Immaculate Magistrate")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 8976980151320100343L; + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + PlayerZone zone = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList list = new CardList(zone.getCards()); + int nElf = list.getType("Elf").size(); + + Card c = getTargetCard(); + c.addCounter(Counters.P1P1, nElf); + + }//is card in play? + }//resolve() + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isUntapped() && !c.equals(card) && c.isCreature(); + } + }); + + if(list.isEmpty()) + return false; + + list.shuffle(); + + setTargetCard(list.get(0)); + return true; + }//canPlayAI() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Put a +1/+1 counter on target creature for each Elf you control."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Mawcor")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 6238678956434079L; + public boolean canPlayAI() + { + return AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + + public void chooseTargetAI() + { + setTargetPlayer(Constant.Player.Human); + } + public void resolve() + { + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + getTargetCard().addDamage(1); + } + else + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(1); + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Mawcor deals 1 damage to target creature or player."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Orcish Artillery") || cardName.equals("Goblin Artillery") + || cardName.equals("Orcish Cannoneers")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -305363091630642003L; + public boolean canPlayAI() + { + return AllZone.Computer_Life.getLife() > 6; + } + + public void chooseTargetAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(2, card, true); + list.shuffle(); + + if(list.isEmpty() || AllZone.Human_Life.getLife() < 5) + setTargetPlayer(Constant.Player.Human); + else + setTargetCard(list.get(0)); + } + public void resolve() + { + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + getTargetCard().addDamage(2); + //3 damage to self + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); + + if (card.getKeyword().contains("Lifelink")) + GameActionUtil.executeLifeLinkEffects(card, 5); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(card, 5); + + } + } + else + { + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); + //3 damage to self + AllZone.GameAction.getPlayerLife(card.getController()).subtractLife(3); + + if (card.getKeyword().contains("Lifelink")) + GameActionUtil.executeLifeLinkEffects(card, 5); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(card, 5); + } + + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: " +cardName + " deals 2 damage to target creature or player and 3 damage to you."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability,true)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sparksmith")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 681102636956052363L; + public boolean canPlayAI() + { + int n = countGoblins(); + return (AllZone.Computer_Life.getLife() > n) && + (CardFactoryUtil.AI_getHumanCreature(n, card, true).size() != 0); + } + public void chooseTargetAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(countGoblins(), card, true); + list.shuffle(); + setTargetCard(list.get(0)); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.subtractLife(countGoblins()); + + getTargetCard().addDamage(countGoblins()); + + if (card.getKeyword().contains("Lifelink")) + GameActionUtil.executeLifeLinkEffects(card, 2*countGoblins()); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(card, 2*countGoblins()); + } + }//resolve() + int countGoblins() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Goblin"); + return list.size(); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Sparksmith deals X damage to target creature and X damage to you, where X is the number of Goblins in play."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Rathi Assassin")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 B B") + { + private static final long serialVersionUID = 1117792059002738977L; + public boolean canPlay() + { + return AllZone.GameAction.isCardInPlay(card) && !card.isTapped() && !card.hasSickness(); + } + public boolean canPlayAI() + { + CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); + human = human.filter(new CardListFilter() + { + public boolean addCard(Card c) {return c.isTapped() && !CardUtil.getColor(c).equals(Constant.Color.Black);} + }); + + CardListUtil.sortAttack(human); + CardListUtil.sortFlying(human); + + if(0 < human.size()) + setTargetCard(human.get(0)); + + return 0 < human.size(); + } + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c) && !CardUtil.getColor(c).equals(Constant.Color.Black) ) + { + AllZone.GameAction.destroy(c); + } + }//resolve() + };//SpellAbility + + ability.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -7903295056497483023L; + + public void showMessage() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + CardList slivers = new CardList(AllZone.getZone(Constant.Zone.Play, opponent).getCards()); + slivers = slivers.filter(new CardListFilter() + { + + public boolean addCard(Card c) + { + PlayerZone zone = AllZone.getZone(c); + return c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped() && ! CardUtil.getColor(c).equals(Constant.Color.Black); + } + + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, slivers, "Select a tapped non-black creature", true)); + } + }); + + card.addSpellAbility(ability); + ability.setDescription("1 B B, tap: Destroy target tapped nonblack creature."); + //ability.setBeforePayMana(target); + //ability.setAfterPayMana(target); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Royal Assassin")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 1974437552336643722L; + public boolean canPlayAI() + { + CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); + human = human.filter(new CardListFilter() + { + public boolean addCard(Card c) {return c.isTapped();} + }); + + CardListUtil.sortAttack(human); + CardListUtil.sortFlying(human); + + if(0 < human.size()) + setTargetCard(human.get(0)); + + return 0 < human.size(); + } + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && c.isTapped() && CardFactoryUtil.canTarget(card, c) ) + { + AllZone.GameAction.destroy(c); + } + }//resolve() + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = -5894703805950364923L; + public void showMessage() + { + AllZone.Display.showMessage("Select target tapped creature to destroy"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(card, c)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(c.isCreature() && zone.is(Constant.Zone.Play) && c.isTapped()) + { + //tap ability + card.tap(); + + ability.setTargetCard(c); + AllZone.Stack.add(ability); + stop(); + } + }//selectCard() + };//Input + + card.addSpellAbility(ability); + ability.setDescription("tap: Destroy target tapped creature."); + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Giltspire Avenger")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -1117719063688165635L; + + public boolean canPlayAI() + { + return false; + } + + public boolean canPlay() + { + System.out.println("phase =" + AllZone.Phase.getPhase()); + if ((AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || + AllZone.Phase.getPhase().equals(Constant.Phase.End_Of_Turn)) && + !card.hasSickness() && card.isUntapped()) + return true; + else + return false; + + } + + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && (c.getDealtCombatDmgToOppThisTurn() || c.getDealtDmgToOppThisTurn()) + && CardFactoryUtil.canTarget(card, c) ) + { + AllZone.GameAction.destroy(c); + } + }//resolve() + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = -4946540988877576202L; + public void showMessage() + { + AllZone.Display.showMessage("Select target creature to destroy"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(card, c)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(c.isCreature() && zone.is(Constant.Zone.Play) && (c.getDealtCombatDmgToOppThisTurn() || + c.getDealtDmgToOppThisTurn()) ) + { + //tap ability + card.tap(); + + ability.setTargetCard(c); + AllZone.Stack.add(ability); + stop(); + } + }//selectCard() + };//Input + + card.addSpellAbility(ability); + ability.setDescription("tap: Destroy target creature that dealt damage to you this turn."); + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Vedalken Plotter")) + { + final Card[] target = new Card[2]; + final int[] index = new int[1]; + + final Ability ability = new Ability(card, "") + { + + private static final long serialVersionUID = -3075569295823682336L; + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + + Card crd0 = target[0]; + Card crd1 = target[1]; + + if (crd0 != null && crd1 != null) + { + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + PlayerZone from0 = AllZone.getZone(crd0); + from0.remove(crd0); + PlayerZone from1 = AllZone.getZone(crd1); + from1.remove(crd1); + + crd0.setController(AllZone.GameAction.getOpponent(card.getController())); + crd1.setController(card.getController()); + + PlayerZone to0 = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(card.getController())); + to0.add(crd0); + PlayerZone to1 = AllZone.getZone(Constant.Zone.Play, card.getController()); + to1.add(crd1); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + } + + }//resolve() + };//SpellAbility + + + final Input input = new Input() + { + + private static final long serialVersionUID = -7143706716256752987L; + public void showMessage() + { + if(index[0] == 0) + AllZone.Display.showMessage("Select target land you control."); + else + AllZone.Display.showMessage("Select target land opponent controls."); + + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + //must target creature you control + if(index[0] == 0 && !c.getController().equals(card.getController())) + return; + + //must target creature you don't control + if(index[0] == 1 && c.getController().equals(card.getController())) + return; + + + if(c.isLand() && zone.is(Constant.Zone.Play) && CardFactoryUtil.canTarget(card, c)) + { + //System.out.println("c is: " +c); + target[index[0]] = c; + index[0]++; + showMessage(); + + if(index[0] == target.length) { + AllZone.Stack.add(ability); + stop(); + } + } + }//selectCard() + };//Input + + Command comesIntoPlay = new Command() + { + private static final long serialVersionUID = 6513203926272187582L; + + public void execute() { + index[0] = 0; + if(card.getController().equals(Constant.Player.Human)) + AllZone.InputControl.setInput(input); + } + }; + + //card.clearSpellAbility(); + ability.setStackDescription(cardName + " - Exchange control of target land you control and target land an opponent controls."); + card.addComesIntoPlayCommand(comesIntoPlay); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Ramses Overdark")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = 3560953910041049722L; + + public boolean canPlayAI() + { + if(CardFactoryUtil.AI_doesCreatureAttack(card)) + return false; + + return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0; + } + public void chooseTargetAI() + { + CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true); + Card target = CardFactoryUtil.AI_getBestCreature(creature); + setTargetCard(target); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && getTargetCard().isEnchanted() ) + { + AllZone.GameAction.destroy(getTargetCard()); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Destroy target enchanted creature."); + + Input runtime = new Input() + { + + private static final long serialVersionUID = 7538894357147291895L; + + public void showMessage() + { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + all = all.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return AllZone.GameAction.isCardInPlay(c) && c.isCreature() && CardFactoryUtil.canTarget(card, c) && c.isEnchanted(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all, "Destroy target enchanted creature.", true)); + } + }; + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Visara the Dreadful")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 6371765024236754171L; + + public boolean canPlayAI() + { + if(CardFactoryUtil.AI_doesCreatureAttack(card)) + return false; + + return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0; + } + public void chooseTargetAI() + { + CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true); + Card target = CardFactoryUtil.AI_getBestCreature(creature); + setTargetCard(target); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + AllZone.GameAction.destroyNoRegeneration(getTargetCard()); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Destroy target creature. It can't be regenerated"); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ethersworn Adjudicator")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 W B") + { + private static final long serialVersionUID = 4160943954590944389L; + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0){ + Card target = CardFactoryUtil.AI_getBestCreature(creature); + setTargetCard(target); + } + else + { + CardList enchantment = CardFactoryUtil.AI_getHumanEnchantment(card, true); + if (enchantment.size() > 0) + { + Card target = CardFactoryUtil.AI_getBestEnchantment(enchantment, card, true); + setTargetCard(target); + } + } + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + AllZone.GameAction.destroy(getTargetCard()); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap, 1 W B: Destroy target creature or enchantment."); + + //ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + + Input runtime = new Input() + { + private static final long serialVersionUID = -8099713981623158814L; + + public void showMessage() + { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + all = all.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return (c.isEnchantment() || c.isCreature() ) && CardFactoryUtil.canTarget(card, c); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, all, "Destroy target creature or enchantment.", true)); + } + }; + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Wojek Embermage")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -1208482961653326721L; + public boolean canPlayAI() + { + return (CardFactoryUtil.AI_getHumanCreature(1, card, true).size() != 0) && + (AllZone.Phase.getPhase().equals(Constant.Phase.Main2)); + } + + public void chooseTargetAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); + list.shuffle(); + setTargetCard(list.get(0)); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + CardList list = getRadiance(getTargetCard()); + for(int i = 0; i < list.size(); i++) + list.get(i).addDamage(1); + } + }//resolve() + //parameter Card c, is included in CardList + //no multi-colored cards + CardList getRadiance(Card c) + { + String color = CardUtil.getColor(c); + if(color.equals(Constant.Color.Colorless)) + { + CardList list = new CardList(); + list.add(c); + return list; + } + + CardList sameColor = new CardList(); + + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + for(int i = 0; i < list.size(); i++) + if(CardUtil.getColor(list.get(i)).equals(color)) + sameColor.add(list.get(i)); + + return sameColor; + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("Radiance - tap: Wojek Embermage deals 1 damage to target creature and each other creature that shares a color with it."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Timberwatch Elf")) + { + final Card[] creature = new Card[1]; + final int[] pump = new int[1]; + final Command EOT = new Command() + { + private static final long serialVersionUID = -2764970883655205904L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(creature[0])) + { + creature[0].addTempAttackBoost(-pump[0]); + creature[0].addTempDefenseBoost(-pump[0]); + } + } + }; + + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -7536296719726210357L; + public boolean canPlayAI() + { + CardList c = getAttackers(); + if(c.isEmpty()) + return false; + else + { + setTargetCard(c.get(0)); + return true; + } + }//canPlayAI() + CardList getAttackers() + { + Card[] c = ComputerUtil.getAttackers().getAttackers(); + CardList list = new CardList(c); + list = list.filter(new CardListFilter(){ + + public boolean addCard(Card c) { + return CardFactoryUtil.canTarget(card, c); + } + + }); + + //remove "this card" from attackers, if it is there + list.remove(card); + list.shuffle(); + return list; + }//getAttackers() + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + creature[0] = getTargetCard(); + pump[0] = countElves(); + + creature[0].addTempAttackBoost(pump[0]); + creature[0].addTempDefenseBoost(pump[0]); + + AllZone.EndOfTurn.addUntil(EOT); + } + }//resolve() + int countElves() + { + CardList elf = new CardList(); + elf.addAll(AllZone.Human_Play.getCards()); + elf.addAll(AllZone.Computer_Play.getCards()); + + elf = elf.getType("Elf"); + return elf.size(); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Target creature gets +X/+X until end of turn, where X is the number of Elves in play."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Mad Auntie")) + { + final Card[] creature = new Card[1]; + final Command EOT = new Command() + { + private static final long serialVersionUID = -5143708900761432510L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(creature[0])) + { + creature[0].setShield(0); + } + } + }; + + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -1280855188535819509L; + public boolean canPlayAI() + { + return false; + }//canPlayAI() + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + getTargetCard().addShield(); + AllZone.EndOfTurn.addUntil(EOT); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Regenerate another target Goblin."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Intrepid Hero")) + { + //tap ability - no cost - target creature + + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -7825416464364928117L; + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && + getTargetCard().getNetAttack() >= 4) + { + AllZone.GameAction.destroy(getTargetCard()); + } + }//resolve() + public boolean canPlayAI() + { + return getHumanCreatures().size() != 0; + } + public void chooseTargetAI() + { + CardList human = getHumanCreatures(); + human.shuffle(); + setTargetCard(human.get(0)); + } + CardList getHumanCreatures() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && 3 < c.getNetAttack(); + } + }); + return list; + } + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = -7024383930124942288L; + public void showMessage() + { + AllZone.Display.showMessage("Select target creature with power 4 or greater"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + if(card.isCreature() && zone.is(Constant.Zone.Play) && 3 < card.getNetAttack()) + { + ability.setTargetCard(card); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("tap: Destroy target creature with power 4 or greater."); + + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Tetsuo Umezawa")) + { + //tap ability - no cost - target creature + + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -8034678094689484203L; + public void resolve() + { + CardList blockers = AllZone.Combat.getAllBlockers(); + + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && + (blockers.contains(getTargetCard()) || getTargetCard().isTapped()) ) + { + AllZone.GameAction.destroy(getTargetCard()); + } + }//resolve() + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input target = new Input() + { + + private static final long serialVersionUID = -1939019440028116051L; + public void showMessage() + { + AllZone.Display.showMessage("Select target tapped or blocking creature."); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + CardList blockers = AllZone.Combat.getAllBlockers(); + if(card.isCreature() && zone.is(Constant.Zone.Play) && + (blockers.contains(card) || card.isTapped()) ) + { + ability.setTargetCard(card); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("U B B R, Tap: Destroy target tapped or blocking creature."); + + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Tor Wauki")) + { + //tap ability - no cost - target creature + + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -8034678094689484203L; + public void resolve() + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + CardList blockers = AllZone.Combat.getAllBlockers(); + + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && + (attackers.contains(getTargetCard()) || blockers.contains(getTargetCard()) ) ) + { + getTargetCard().addDamage(2); + } + }//resolve() + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input target = new Input() + { + + private static final long serialVersionUID = -1939019440028116051L; + public void showMessage() + { + AllZone.Display.showMessage("Select target attacking or blocking creature."); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + CardList blockers = AllZone.Combat.getAllBlockers(); + if(card.isCreature() && zone.is(Constant.Zone.Play) && + (attackers.contains(card) || blockers.contains(card) ) ) + { + ability.setTargetCard(card); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("tap: Tor Wauki deals 2 damage to target attacking or blocking creature."); + + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Lady Caleria")) + { + //tap ability - no cost - target creature + + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -8034678094689484203L; + public void resolve() + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + CardList blockers = AllZone.Combat.getAllBlockers(); + + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && + (attackers.contains(getTargetCard()) || blockers.contains(getTargetCard()) ) ) + { + getTargetCard().addDamage(3); + } + }//resolve() + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input target = new Input() + { + + private static final long serialVersionUID = -1939019440028116051L; + public void showMessage() + { + AllZone.Display.showMessage("Select target attacking or blocking creature."); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + CardList blockers = AllZone.Combat.getAllBlockers(); + if(card.isCreature() && zone.is(Constant.Zone.Play) && + (attackers.contains(card) || blockers.contains(card) ) ) + { + ability.setTargetCard(card); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("tap: Lady Caleria deals 3 damage to target attacking or blocking creature."); + + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Femeref Archers")) + { + //tap ability - no cost - target creature + + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -4369831076920644547L; + public void resolve() + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) && + attackers.contains(getTargetCard()) && getTargetCard().getKeyword().contains("Flying")) + { + getTargetCard().addDamage(4); + } + }//resolve() + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input target = new Input() + { + + private static final long serialVersionUID = 3455890565752527632L; + public void showMessage() + { + AllZone.Display.showMessage("Select target attacking creature with flying."); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card card, PlayerZone zone) + { + CardList attackers = new CardList(AllZone.Combat.getAttackers()); + if(card.isCreature() && zone.is(Constant.Zone.Play) && card.getKeyword().contains("Flying") && + attackers.contains(card)) + { + ability.setTargetCard(card); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("tap: Femeref Archers deals 4 damage to target attacking creature with flying."); + + ability.setBeforePayMana(target); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Adarkar Valkyrie")) + { + //tap ability - no cost - target creature - EOT + + final Card[] target = new Card[1]; + + final Command destroy = new Command() + { + private static final long serialVersionUID = -2433442359225521472L; + + public void execute() + { + AllZone.Stack.add(new Ability(card, "0", "Return " +target[0] +" from graveyard to play") + { + public void resolve() + { + PlayerZone grave = AllZone.getZone(target[0]); + //checks to see if card is still in the graveyard + if(AllZone.GameAction.isCardInZone(target[0], grave)) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + AllZone.GameAction.moveTo(play, target[0]); + target[0].setController(card.getController()); + } + } + }); + }//execute() + }; + + final Command untilEOT = new Command() + { + private static final long serialVersionUID = 2777978927867867610L; + + public void execute() + { + //resets the Card destroy Command + //target[0].addDestroy(Command.Blank); + target[0].removeDestroyCommand(destroy); + + } + }; + + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = -8454685126878522607L; + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard())) + { + target[0] = getTargetCard(); + AllZone.EndOfTurn.addUntil(untilEOT); + + //when destroyed, return to play + //add triggered ability to target card + target[0].addDestroyCommand(destroy); + }//if + }//resolve() + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input targetInput = new Input() + { + private static final long serialVersionUID = 913860087744941946L; + public void showMessage() + { + AllZone.Display.showMessage("Select target non-token creature other than this card"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + //must target non-token creature, and cannot target itself + if(c.isCreature() && (!c.isToken()) && (!c.equals(card))) + { + ability.setTargetCard(c); + stopSetNext(new Input_NoCost_TapAbility(ability)); + } + } + }; + + card.addSpellAbility(ability); + ability.setDescription("tap: When target creature other than Adarkar Valkyrie is put into a graveyard this turn, return that card to play under your control."); + + ability.setBeforePayMana(targetInput); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Imperious Perfect")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "G") + { + private static final long serialVersionUID = -3266607637871879336L; + + public boolean canPlayAI() + { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + public void chooseTargetAI() {card.tap();} + + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Elf Warrior"); + c.setImageName("G 1 1 Elf Warrior"); + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Elf"); + c.addType("Warrior"); + + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability); + + ability.setDescription("G, tap: Put a 1/1 green Elf Warrior creature token into play."); + ability.setStackDescription("Imperious Perfect - Put a 1/1 green Elf Warrior creature token into play."); + ability.setBeforePayMana(new Input_PayManaCost(ability)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Wall of Kelp")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "U U") + { + private static final long serialVersionUID = 2893813929304858905L; + + public boolean canPlayAI() + { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + public void chooseTargetAI() {card.tap();} + + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Kelp"); + c.setManaCost("U"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Plant"); + c.addType("Wall"); + c.addIntrinsicKeyword("Defender"); + + c.setBaseAttack(0); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability); + + ability.setDescription("UU, tap: Put a 0/1 blue Kelp Wall creature token with defender into play."); + ability.setStackDescription("Wall of Kelp - Put a 0/1 blue Kelp Wall creature token with defender into play"); + ability.setBeforePayMana(new Input_PayManaCost(ability)); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Vedalken Mastermind")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "U") + { + private static final long serialVersionUID = -6131368241135911606L; + + public boolean canPlayAI() {return false;} + + public void resolve() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetCard().getOwner()); + AllZone.GameAction.moveTo(hand, getTargetCard()); + + if (getTargetCard().isToken()) + hand.remove(getTargetCard()); + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = -5218098811060156481L; + + public void showMessage() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList choice = new CardList(play.getCards()); + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, choice, "Select a permanent you control.", true)); + } + }; + card.addSpellAbility(ability); + ability.setDescription("U, tap: Return target permanent you control to its owner's hand."); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Helldozer")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "B B B") + { + private static final long serialVersionUID = 6426884086364885861L; + + public boolean canPlayAI() + { + if(CardFactoryUtil.AI_doesCreatureAttack(card)) + return false; + + CardList land = new CardList(AllZone.Human_Play.getCards()); + land = land.getType("Land"); + return land.size() != 0; + } + + public void chooseTargetAI() + { + card.tap(); + + //target basic land that Human only has 1 or 2 in play + CardList land = new CardList(AllZone.Human_Play.getCards()); + land = land.getType("Land"); + + Card target = null; + + String[] name = {"Forest", "Swamp", "Plains", "Mountain", "Island"}; + for(int i = 0; i < name.length; i++) + if(land.getName(name[i]).size() == 1) + { + target = land.getName(name[i]).get(0); + break; + } + + //see if there are only 2 lands of the same type + if(target == null) + { + for(int i = 0; i < name.length; i++) + if(land.getName(name[i]).size() == 2) + { + target = land.getName(name[i]).get(0); + break; + } + }//if + if(target == null) + { + land.shuffle(); + target = land.get(0); + } + setTargetCard(target); + }//chooseTargetAI() + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + AllZone.GameAction.destroy(getTargetCard()); + + //if non-basic, untap Helldozer + if(! getTargetCard().getType().contains("Basic")) + card.untap(); + } + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("BBB, tap: Destroy target land. If that land is nonbasic, untap Helldozer."); + ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Land")); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Cao Cao, Lord of Wei")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "0") + { + private static final long serialVersionUID = 6760838700101179614L; + public void chooseTargetAI() {card.tap();} + public boolean canPlayAI() + { + int hand = AllZone.Human_Hand.getCards().length; + if((! CardFactoryUtil.AI_doesCreatureAttack(card)) && hand != 0) + return true; + + return 2 <= hand; + } + + public void resolve() + { + String player = AllZone.GameAction.getOpponent(card.getController()); + + if(player.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(CardFactoryUtil.input_discard(2)); + else + { + AllZone.GameAction.discardRandom(player); + AllZone.GameAction.discardRandom(player); + } + }//resolve() + public boolean canPlay() + { + String opp = AllZone.GameAction.getOpponent(card.getController()); + setStackDescription(card.getName() +" - " +opp +" discards 2 cards"); + + String phase = AllZone.Phase.getPhase(); + String activePlayer = AllZone.Phase.getActivePlayer(); + + return super.canPlay() && + phase.equals(Constant.Phase.Main1) && + card.getController().equals(activePlayer); + } + };//SpellAbility + + ability.setChooseTargetAI(CardFactoryUtil.AI_targetHuman()); + ability.setDescription("tap: Target opponent discards two cards. Play this ability only during your turn, before the combat phase."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Gwendlyn Di Corci")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "0") + { + + private static final long serialVersionUID = -4211234606012596777L; + public void chooseTargetAI() {setTargetPlayer(Constant.Player.Human); } + public boolean canPlayAI() + { + int hand = AllZone.Human_Hand.getCards().length; + return hand > 0; + } + + public void resolve() + { + String player = getTargetPlayer(); + + AllZone.GameAction.discardRandom(player); + + }//resolve() + public boolean canPlay() + { + setStackDescription(card.getName() +" - " +getTargetPlayer() +" discards a card at random."); + + String activePlayer = AllZone.Phase.getActivePlayer(); + + return super.canPlay() && + card.getController().equals(activePlayer); + } + };//SpellAbility + + Input input = new Input() + { + private static final long serialVersionUID = 3312693459353844120L; + + public void showMessage() + { + //prevents this from running multiple times, which it is for some reason + if(ability.getSourceCard().isUntapped()) + { + ability.getSourceCard().tap(); + stopSetNext(CardFactoryUtil.input_targetPlayer(ability)); + } + } + }; + + ability.setDescription("Tap: Target player discards a card at random. Activate this ability only during your turn."); + ability.setBeforePayMana(input); + //ability.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability)); + + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Xira Arien")) + { + //mana tap ability + final Ability_Tap ability = new Ability_Tap(card, "G R B") + { + + private static final long serialVersionUID = 5373361883064666451L; + public void chooseTargetAI() {setTargetPlayer(Constant.Player.Computer);} + public boolean canPlayAI() + { + int hand = AllZone.Computer_Hand.getCards().length; + int lib = AllZone.Computer_Library.getCards().length; + return hand < 6 && lib > 0; + } + + public void resolve() + { + String player = getTargetPlayer(); + + AllZone.GameAction.drawCard(player); + + }//resolve() + public boolean canPlay() + { + + setStackDescription(card.getName() +" - " +getTargetPlayer() +" discards a card at random."); + + return super.canPlay(); + } + };//SpellAbility + + ability.setDescription("Tap: Target player draws a card."); + //ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + ability.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability)); + + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Wayward Soul")) + { + //mana ability + final Ability ability = new Ability(card, "U") + { + public boolean canPlayAI() {return false;} + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card) ) + { + card.setBaseAttack(3); + card.setBaseDefense(2); + card.setIntrinsicKeyword(new ArrayList()); + card.addIntrinsicKeyword("Flying"); + + card.setAssignedDamage(0); + card.setDamage(0); + card.untap(); + AllZone.getZone(card).remove(card); + + //put card on top of library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); + library.add(card, 0); + } + }//resolve() + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 1469011418219527227L; + + public void showMessage() + { + ability.setStackDescription("Put " +card +" on top of its owner's library"); + + stopSetNext(new Input_PayManaCost(ability)); + } + }; + ability.setDescription("U: Put Wayward Soul on top of its owner's library."); + ability.setStackDescription("Put Wayward Soul on top of its owner's library."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Coastal Hornclaw")) + { + //sacrifice ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = 7538741250040204529L; + + public void execute() + { + card.removeIntrinsicKeyword("Flying"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + CardList land = new CardList(AllZone.Computer_Play.getCards()); + land = land.getType("Land"); + + CardList canBlock = CardFactoryUtil.AI_getHumanCreature(card, true); + canBlock = canBlock.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isUntapped(); + } + }); + + return (land.size() != 0) && + (! card.getKeyword().contains("Flying")) && + CardFactoryUtil.AI_getHumanCreature("Flying", card, false).isEmpty() && + (! card.hasSickness()) && + (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); + } + + public void chooseTargetAI() + { + CardList land = new CardList(AllZone.Computer_Play.getCards()); + land = land.getType("Land"); + land.shuffle(); + AllZone.GameAction.sacrifice(land.get(0)); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = 4874019210748846864L; + + public void showMessage() + { + ability.setStackDescription(card +" gains flying until EOT."); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList choice = new CardList(play.getCards()); + choice = choice.getType("Land"); + stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a land to sacrifice.")); + } + }; + ability.setStackDescription(card +" gains flying until end of turn."); + ability.setDescription("Sacrifice a land: Coastal Hornclaw gains flying until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Spitting Spider")) + { + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && c.getKeyword().contains("Flying"); + } + }); + + for(int i = 0; i < list.size(); i++) + list.get(i).addDamage(1); + }//resolve() + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 2004031367305867525L; + + public void showMessage() + { + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList choice = new CardList(play.getCards()); + choice = choice.getType("Land"); + stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a land to sacrifice.")); + } + }; + ability.setStackDescription(card +" deals 1 damage to each creature with flying."); + ability.setDescription("Sacrifice a land: Spitting Spider deals 1 damage to each creature with flying."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Killer Whale")) + { + final Ability ability = new Ability(card, "U") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -8494294720368074013L; + + public void execute() + { + card.removeIntrinsicKeyword("Flying"); + } + }; + + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + ability.setStackDescription(card +" gains flying until end of turn."); + ability.setDescription("U: Killer Whale gains flying until end of turn."); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Obsidian Fireheart")) + { + final Ability ability = new Ability(card, "1 R R") + { + public void resolve() { + Card c = getTargetCard(); + + if (AllZone.GameAction.isCardInPlay(c) && c.isLand() && (c.getCounters(Counters.BLAZE)==0) ) + c.addCounter(Counters.BLAZE, 1); + + } + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList land = new CardList(play.getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isLand() && c.getCounters(Counters.BLAZE) < 1; + } + }); + + if (land.size() > 0) + setTargetCard(land.get(0)); + + return land.size() > 0; + } + + }; + + ability.setDescription("1 R R: Put a blaze counter on target land without a blaze counter on it. For as long as that land has a blaze counter on it, it has \"At the beginning of your upkeep, this land deals 1 damage to you.\" (The land continues to burn after Obsidian Fireheart has left the battlefield.)"); + ability.setBeforePayMana(CardFactoryUtil.input_targetType(ability, "Land")); + card.addSpellAbility(ability); + + }// *************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Glint-Eye Nephilim")) + { + final Command untilEOT = new Command() + { + private static final long serialVersionUID = 5790680475821014099L; + + public void execute() + { + card.addTempAttackBoost(-1); + card.addTempDefenseBoost(-1); + } + }; + + final Ability ability = new Ability(card, "1") + { + public boolean canPlayAI() + { + Card[] hand = AllZone.Computer_Hand.getCards(); + return CardFactoryUtil.AI_doesCreatureAttack(card) && (hand.length != 0); + } + public void chooseTargetAI() {AllZone.GameAction.discardRandom(Constant.Player.Computer);} + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card) ) + { + card.addTempAttackBoost(1); + card.addTempDefenseBoost(1); + + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = -4302110760957471033L; + + public void showMessage() + { + ability.setStackDescription(card +" gets +1/+1 until EOT."); + //stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a card to discard.")); + stopSetNext(CardFactoryUtil.input_discard(ability, 1)); + + } + }; + ability.setStackDescription(card +" gets +1/+1 until end of turn."); + ability.setDescription("1, Discard a card: Glint-Eye Nephilim gets +1/+1 until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Wild Mongrel")) + { + //sacrifice ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -5563743272875711445L; + + public void execute() + { + card.addTempAttackBoost(-1); + card.addTempDefenseBoost(-1); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + Card[] hand = AllZone.Computer_Hand.getCards(); + return CardFactoryUtil.AI_doesCreatureAttack(card) && (hand.length > 3); + } + public void chooseTargetAI() {AllZone.GameAction.discardRandom(Constant.Player.Computer);} + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addTempAttackBoost(1); + card.addTempDefenseBoost(1); + + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = -4209163355325441624L; + + public void showMessage() + { + ability.setStackDescription(card +" gets +1/+1 until EOT."); + //stopSetNext(CardFactoryUtil.input_sacrifice(ability, choice, "Select a card to discard.")); + stopSetNext(CardFactoryUtil.input_discard(ability, 1)); + //AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + } + }; + ability.setStackDescription(card +" gets +1/+1 until end of turn."); + ability.setDescription("Discard a card: Wild Mongrel gets +1/+1 until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Hell-Bent Raider")) + { + final Command untilEOT = new Command() + { + + private static final long serialVersionUID = -2693050198371979012L; + + public void execute() + { + card.removeIntrinsicKeyword("Protection from white"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + return false; + } + + public void resolve() + { + AllZone.GameAction.discardRandom(card.getController()); + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Protection from white"); + + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + ability.setStackDescription(card +" gets Protection from white until end of turn."); + ability.setDescription("Discard a card at random: Hell-Bent Raider gets protection from white until end of turn."); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Whiptongue Frog")) + { + //mana ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -2693050198371979012L; + + public void execute() + { + card.removeIntrinsicKeyword("Flying"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "U") + { + public boolean canPlayAI() + { + return (! card.hasSickness()) && + (! card.getKeyword().contains("Flying")) && + (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = 1268037036474796569L; + + public void showMessage() + { + ability.setStackDescription(card +" gains flying until EOT."); + stopSetNext(new Input_PayManaCost(ability)); + } + }; + ability.setStackDescription("Whiptongue Frog gains flying until EOT."); + ability.setDescription("U: Whiptongue Frog gains flying until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sarcomite Myr")) + { + //mana ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -1726670429352834671L; + + public void execute() + { + card.removeIntrinsicKeyword("Flying"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "2") + { + public boolean canPlayAI() + { + return (! card.hasSickness()) && + (! card.getKeyword().contains("Flying")) && + (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)); + } + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = -685958984421033465L; + + public void showMessage() + { + ability.setStackDescription(card +" gains flying until EOT."); + stopSetNext(new Input_PayManaCost(ability)); + } + }; + ability.setStackDescription(card +" - gains flying until EOT."); + ability.setDescription("2: Sarcomite Myr gains flying until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + + //ability 2 + final Ability ability2 = new Ability(card, "2") + { + public boolean canPlayAI() + { + return false; + } + + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability2); + ability2.setDescription("2, Sacrifice Sarcomite Myr: Draw a card."); + ability2.setStackDescription("Sarcomite Myr - draw a card"); + ability2.setBeforePayMana(new Input_PayManaCost_Ability(ability2.getManaCost(), new Command() + { + private static final long serialVersionUID = -4357239016463815380L; + + public void execute() + { + AllZone.GameAction.sacrifice(card); + AllZone.Stack.add(ability2); + } + })); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Goblin Balloon Brigade")) + { + //mana ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = 3574792977266468264L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(card)) + card.removeIntrinsicKeyword("Flying"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "R") + { + public boolean canPlayAI() + { + CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, false); + return flying.isEmpty() && + (! card.hasSickness()) && + (! card.getKeyword().contains("Flying")) && + (! CardFactoryUtil.AI_getHumanCreature(card, true).isEmpty()); + } + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = 7757347395564372034L; + + public void showMessage() + { + ability.setStackDescription(card +" gains flying until EOT."); + stopSetNext(new Input_PayManaCost(ability)); + } + }; + ability.setStackDescription("Goblin Balloon Brigade gains flying until EOT."); + ability.setDescription("R: Goblin Balloon Brigade gains flying until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Manta Riders")) + { + //mana ability - targets itself - until EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -8732007889935536106L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(card)) + card.removeIntrinsicKeyword("Flying"); + } + }; + + //mana tap ability + final Ability ability = new Ability(card, "U") + { + public boolean canPlayAI() + { + CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, false); + return flying.isEmpty() && + (! card.hasSickness()) && + (! card.getKeyword().contains("Flying")) && + (! CardFactoryUtil.AI_getHumanCreature(card, true).isEmpty()); + } + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card)) + { + card.addIntrinsicKeyword("Flying"); + AllZone.EndOfTurn.addUntil(untilEOT); + } + }//resolve() + };//SpellAbility + + + Input runtime = new Input() + { + private static final long serialVersionUID = -3889041123558196949L; + + public void showMessage() + { + ability.setStackDescription(card +" gains flying until EOT."); + stopSetNext(new Input_PayManaCost(ability)); + } + }; + ability.setStackDescription(card.getName() +" gains flying until EOT."); + ability.setDescription("U: Manta Riders gains flying until end of turn."); + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Turtleshell Changeling")) + { + //mana ability - targets itself - until EOT + //mana ability + final Ability ability = new Ability(card, "1 U") + { + public boolean canPlayAI() + { + return CardFactoryUtil.AI_doesCreatureAttack(card) && card.getNetAttack() == 1; + } + public void resolve() + { + //in case ability is played twice + final int[] oldAttack = new int[1]; + final int[] oldDefense = new int[1]; + + oldAttack[0] = card.getBaseAttack(); + oldDefense[0] = card.getBaseDefense(); + + card.setBaseAttack(oldDefense[0]); + card.setBaseDefense(oldAttack[0]); + + //EOT + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -5494886974452901728L; + + public void execute() + { + card.setBaseAttack(oldAttack[0]); + card.setBaseDefense(oldDefense[0]); + } + }; + + AllZone.EndOfTurn.addUntil(untilEOT); + }//resolve() + };//SpellAbility + + + ability.setStackDescription(card +" - switch power and toughness until EOT."); + ability.setDescription("1 U: Switch Turtleshell Changeling's power and toughness until end of turn."); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Jugan, the Rising Star")) + { + final SpellAbility ability = new Ability(card, "0") + { + //should the computer play this card? + public boolean canPlayAI() + { + return (getComputerCreatures().size() != 0); + } + //set the target for the computer AI + public void chooseTargetAI() + { + CardList list = getComputerCreatures(); + + if(0 < list.size()) + setTargetCard(list.get(0)); + else + //the computer doesn't have any other creatures + setTargetCard(null); + } + CardList getComputerCreatures() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + CardList out = list.getType("Creature"); + return out; + }//getCreatures + public void resolve() + { + Card c = getTargetCard(); + if(c != null && AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + c.addCounter(Counters.P1P1, 5); + } + }//resolve() + }; + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + + Command leavesPlay = new Command() + { + private static final long serialVersionUID = -2823505283781217181L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + else if(ability.canPlayAI()) + { + ability.chooseTargetAI(); + //need to add this to the stack + AllZone.Stack.push(ability); + } + + + }//execute() + };//Command + + card.addDestroyCommand(leavesPlay); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + //destroy doesn't work + else if(cardName.equals("Sower of Temptation")) + { + final Card moveCreature[] = new Card[1]; + + final SpellAbility spell = new Spell_Permanent(card) + { + private static final long serialVersionUID = -6432280175218503718L; + public boolean canPlayAI() + { + CardList c = CardFactoryUtil.AI_getHumanCreature(card, true); + CardListUtil.sortAttack(c); + CardListUtil.sortFlying(c); + + if(c.isEmpty()) + return false; + + if(2 <= c.get(0).getNetAttack() && c.get(0).getKeyword().contains("Flying")) + { + setTargetCard(c.get(0)); + return true; + } + + CardListUtil.sortAttack(c); + if(4 <= c.get(0).getNetAttack()) + { + setTargetCard(c.get(0)); + return true; + } + + return false; + }//canPlayAI() + public void resolve() + { + super.resolve(); + + Card c = getTargetCard(); + moveCreature[0] = c; + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + + //set summoning sickness + if(c.getKeyword().contains("Haste")){ + c.setSickness(false); + } + else{ + c.setSickness(true); + } + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + c.setSickness(true); + c.setController(card.getController()); + + PlayerZone from = AllZone.getZone(c); + from.remove(c); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); + to.add(c); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + } + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell)); + + card.addLeavesPlayCommand(new Command() + { + private static final long serialVersionUID = -8961588142846220965L; + + public void execute() + { + Card c = moveCreature[0]; + + if(AllZone.GameAction.isCardInPlay(c)) + { + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + c.setSickness(true); + c.setController(AllZone.GameAction.getOpponent(c.getController())); + + PlayerZone from = AllZone.getZone(c); + from.remove(c); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, c.getOwner()); + to.add(c); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + }//if + }//execute() + });//Command + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Frostling")) + { + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() {return getCreature().size() != 0;} + + public void chooseTargetAI() + { + CardList list = getCreature(); + list.shuffle(); + setTargetCard(list.get(0)); + + AllZone.GameAction.sacrifice(card); + } + CardList getCreature() + { + //toughness of 1 + CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + //only get 1/1 flyers or 2/1 creatures + return (2 <= c.getNetAttack()) || c.getKeyword().contains("Flying"); + } + }); + return list; + }//getCreature() + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + getTargetCard().addDamage(1); + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("Sacrifice Frostling: Frostling deals 1 damage to target creature."); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability, new Command() + { + private static final long serialVersionUID = 3482118508536148313L; + + public void execute() + { + AllZone.GameAction.sacrifice(card); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Bottle Gnomes")) + { + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + return AllZone.Computer_Life.getLife() < 3; + + } + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0 && super.canPlay(); + }//canPlay() + public void resolve() + { + if(card.getOwner().equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void computerResolve() + { + CardList play = new CardList(AllZone.Computer_Play.getCards()); + play = play.getType("Basic"); + + CardList library = new CardList(AllZone.Computer_Library.getCards()); + library = library.getType("Basic"); + + //this shouldn't happen, but it is defensive programming, haha + if(library.isEmpty()) + return; + + Card land = null; + + //try to find a basic land that isn't in play + for(int i = 0; i < library.size(); i++) + if(! play.containsName(library.get(i))) + { + land = library.get(i); + break; + } + + //if not found + //library will have at least 1 basic land because canPlay() checks that + if(land == null) + land = library.get(0); + + land.tap(); + AllZone.Computer_Library.remove(land); + AllZone.Computer_Play.add(land); + + AllZone.GameAction.shuffle(Constant.Player.Computer); + }//computerResolve() + public void humanResolve() + { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); + + CardList basicLand = new CardList(library.getCards()); + basicLand = basicLand.getType("Basic"); + if(basicLand.isEmpty()) + return; + + Object o = AllZone.Display.getChoiceOptional("Choose a basic land", basicLand.toArray()); + if(o != null) + { + Card land = (Card)o; + land.tap(); + + library.remove(land); + play.add(land); + } + + AllZone.GameAction.shuffle(card.getController()); + }//resolve() + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 1959709104655340395L; + boolean once = true; + public void showMessage() + { + //this is necessary in order not to have a StackOverflowException + //because this updates a card, it creates a circular loop of observers + if(once) + { + once = false; + AllZone.GameAction.sacrifice(card); + AllZone.Stack.add(ability); + + stop(); + } + }//showMessage() + }; + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + ability.setDescription("Sacrifice Sakura-Tribe Elder: Search your library for a basic land card, put that card into play tapped, then shuffle your library."); + ability.setStackDescription("Search your library for a basic land card, put that card into play tapped, then shuffle your library."); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Transluminant")) + { + final Command atEOT = new Command() + { + private static final long serialVersionUID = -5126793112740563180L; + + public void execute() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Spirit"); + c.setImageName("W 1 1 Spirit"); + c.setManaCost("W"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Spirit"); + c.setBaseAttack(1); + c.setBaseDefense(1); + c.addIntrinsicKeyword("Flying"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); + play.add(c); + }//execute() + };//Command + + final Ability ability = new Ability(card, "W") + { + public boolean canPlayAI() + { /* + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Creature"); + + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2) && list.size() != 0; + */ + return false; + } + public void chooseTargetAI() + { + AllZone.GameAction.sacrifice(card); + } + + public void resolve() + { + AllZone.EndOfTurn.addAt(atEOT); + }//resolve() + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("W, Sacrifice Transluminant: Put a 1/1 white Spirit creature token with flying into play at end of turn."); + ability.setStackDescription("Put a 1/1 white Spirit creature token with flying into play at end of turn."); + ability.setBeforePayMana(new Input_PayManaCost_Ability(ability.getManaCost(), new Command() + { + private static final long serialVersionUID = -6553009833190713980L; + + public void execute() + { + AllZone.GameAction.sacrifice(card); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Llanowar Behemoth")) + { + final Ability ability = new Ability(card, "0") + { + public boolean canPlayAI() + { + return (getUntapped().size() != 0) && CardFactoryUtil.AI_doesCreatureAttack(card); + } + public void chooseTargetAI() + { + Card c = getUntapped().get(0); + c.tap(); + setTargetCard(c); + } + CardList getUntapped() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && c.isUntapped() && (!CardFactoryUtil.AI_doesCreatureAttack(c)); + } + }); + return list; + }//getUntapped() + + public void resolve() + { + card.addTempAttackBoost(1); + card.addTempDefenseBoost(1); + + Command untilEOT = new Command() + { + private static final long serialVersionUID = 6445782721494547172L; + + public void execute() + { + card.addTempAttackBoost(-1); + card.addTempDefenseBoost(-1); + }//execute() + };//Command + + AllZone.EndOfTurn.addUntil(untilEOT); + }//resolve() + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = 7721637420366357272L; + public void showMessage() + { + AllZone.Display.showMessage("Select an untapped creature you control"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(c.isCreature() && zone.is(Constant.Zone.Play, card.getController()) && c.isUntapped()) + { + ability.setStackDescription(card +" gets +1/+1 until end of turn."); + c.tap(); + AllZone.Stack.add(ability); + stop(); + } + } + };//Input + ability.setBeforePayMana(target); + ability.setDescription("Tap an untapped creature you control: Llanowar Behemoth gets +1/+1 until end of turn."); + + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Memnarch")) + { + //has 2 non-tap abilities that effects itself + final SpellAbility ability1 = new Ability(card, "1 U U") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + getTargetCard().addType("Artifact"); + } + }//resolve() + public boolean canPlayAI() + { + CardList list = getCreature(); + return list.size() != 0; + } + public void chooseTargetAI() + { + Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); + setTargetCard(target); + }//chooseTargetAI() + CardList getCreature() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && (!c.isArtifact()); + } + }); + return list; + }//getCreature() + };//SpellAbility + + //**** start of ability2 + final SpellAbility ability2 = new Ability(card, "3 U") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + //gain control of target artifact + PlayerZone from = AllZone.getZone(Constant.Zone.Play, getTargetCard().getController()); + from.remove(getTargetCard()); + + + getTargetCard().setController(card.getController()); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(false); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(false); + + PlayerZone to = AllZone.getZone(Constant.Zone.Play, card.getController()); + to.add(getTargetCard()); + to.setUpdate(true); + + ((PlayerZone_ComesIntoPlay)AllZone.Human_Play).setTriggers(true); + ((PlayerZone_ComesIntoPlay)AllZone.Computer_Play).setTriggers(true); + + +// AllZone.GameAction.moveTo(play, getTargetCard()); + + //TODO: controller probably is not set correctly + //TODO: when you take control, the creature looses type "Artifact" since + // GameAction.moveTo() makes a new card object + } + }//resolve() + public boolean canPlayAI() + { + CardList list = getArtifactCreatures(); + return list.size() != 0; + } + public void chooseTargetAI() + { + CardList list = getArtifactCreatures(); + Card target = CardFactoryUtil.AI_getBestCreature(list); + if(target == null) + target = AllZone.Human_Play.get(0); + + setTargetCard(target); + } + CardList getArtifactCreatures() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Artifact"); + list = list.getType("Creature"); + return list; + } + };//SpellAbility + card.addSpellAbility(ability1); + card.addSpellAbility(ability2); + + ability1.setDescription("1UU: Target permanent becomes an artifact in addition to its other types.(This effect doesn't end at end of turn.)"); + ability2.setDescription("3U: Gain control of target artifact.(This effect doesn't end at end of turn.)"); + + ability1.setBeforePayMana(CardFactoryUtil.input_targetType(ability1, "All")); + ability2.setBeforePayMana(CardFactoryUtil.input_targetType(ability2, "Artifact")); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Meloku the Clouded Mirror")) + { + final SpellAbility ability = new Ability(card, "1") + { + public void resolve() + { + Card c = new Card(); + c.setToken(true); + c.setImageName("U 1 1 Illusion"); + c.setName("Illusion"); + + c.setManaCost("U"); + c.setBaseAttack(1); + c.setBaseDefense(1); + c.addIntrinsicKeyword("Flying"); + c.addType("Creature"); + c.addType("Illusion"); + c.setOwner(card.getController()); + c.setController(card.getController()); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + + //TODO: the "bounced" land should be chosen by the user + //instead of "automatically" done for him + CardList island = new CardList(play.getCards()); + island = island.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.getType().contains("Land") && c.isTapped(); + } + }); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + + if(! island.isEmpty()) + AllZone.GameAction.moveTo(hand, island.get(0)); + }//resolve() + + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("1, Return a land you control to its owner's hand: Put a 1/1 blue Illusion creature token with flying into play."); + ability.setStackDescription("Put 1/1 token with flying into play"); + ability.setBeforePayMana(new Input_PayManaCost(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Squall Drifter")) + { + final SpellAbility ability = new Ability_Tap(card, "W") + { + private static final long serialVersionUID = 3862705592994953819L; + public void resolve() + { + Card c = getTargetCard(); + c.tap(); + } + public boolean canPlayAI() {return false;} + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("W, tap: Tap target creature."); + + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Bonded Fetch")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 3959966663907905001L; + public boolean canPlayAI() {return false;} + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Draw a card, then discard a card."); + ability.setStackDescription("Bonded Fetch - draw a card, then discard a card."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Hammerfist Giant")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 1089840397064226840L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(4, card, true); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) {return ! c.getKeyword().contains("Flying");} + }); + + return list.size() > 3 && 6 < AllZone.Computer_Life.getLife(); + }//canPlayAI() + public void resolve() + { + //get all creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Play.getCards()); + list.addAll(AllZone.Computer_Play.getCards()); + list = list.getType("Creature"); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return ! c.getKeyword().contains("Flying") && CardFactoryUtil.canDamage(card, c); + } + }); + for(int i = 0; i < list.size(); i++) + list.get(i).addDamage(4); + + AllZone.Human_Life.subtractLife(4); + AllZone.Computer_Life.subtractLife(4); + }//resolve() + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Hammerfist Giant deals 4 damage to each creature without flying and each player."); + ability.setStackDescription("Hammerfist Giant - deals 4 damage to each creature without flying and each player."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Urborg Syphon-Mage")) + { + final Ability_Tap ability = new Ability_Tap(card, "2 B") + { + private static final long serialVersionUID = -1965170715774280112L; + + public void resolve() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + AllZone.GameAction.getPlayerLife(opponent).subtractLife(2); + + AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + public boolean canPlay() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + return super.canPlay() && hand.getCards().length != 0; + } + public boolean canPlayAI() + { + int life = AllZone.Human_Life.getLife(); + Card[] hand = AllZone.Computer_Hand.getCards(); + return ((life < 11) || (5 < AllZone.Phase.getTurn())) && + hand.length > 0; + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("2B, tap, Discard a card: Each other player loses 2 life. You gain life equal to the life lost this way."); + ability.setStackDescription("Urborg Syphon-Mage - Opponent loses 2 life, and you gain 2 life"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("2 B", new Command() + { + private static final long serialVersionUID = 1186455545951390853L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + if (cardName.equals("Stangg")){ + + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setName("Stangg Twin"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("R G"); + c.setToken(true); + + c.addType("Legendary"); + c.addType("Creature"); + c.addType("Human"); + c.addType("Warrior"); + c.setBaseAttack(3); + c.setBaseDefense(4); + + c.addLeavesPlayCommand(new Command() + { + private static final long serialVersionUID = 3367390368512271319L; + + public void execute() { + if (AllZone.GameAction.isCardInPlay(card)) + AllZone.GameAction.sacrifice(card); + } + + }); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + + } + }; + ability.setStackDescription("When Stangg enters the battlefield, if Stangg is on the battlefield, put a legendary 3/4 red and green Human Warrior creature token named Stangg Twin onto the battlefield."); + + card.addComesIntoPlayCommand(new Command() + { + private static final long serialVersionUID = 6667896040611028600L; + + public void execute() { + AllZone.Stack.add(ability); + } + }); + + card.addLeavesPlayCommand(new Command() + { + private static final long serialVersionUID = 1786900359843939456L; + + public void execute() { + CardList list = new CardList(); + list.addAll(AllZone.Computer_Play.getCards()); + list.addAll(AllZone.Human_Play.getCards()); + list = list.getName("Stangg Twin"); + + if (list.size() == 1) + AllZone.GameAction.removeFromGame(list.get(0)); + } + }); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Llanowar Mentor")) + { + final Ability_Tap ability = new Ability_Tap(card, "G") + { + private static final long serialVersionUID = 752280918226277729L; + + public void resolve() + { + makeToken(); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Elf"); + c.addType("Druid"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + + //custom settings + c.setName("Llanowar Elves"); + c.setImageName("G 1 1 Llanowar Elves"); + //c.addIntrinsicKeyword("tap: add G"); + c.addSpellAbility(new Ability_Mana(card, "tap: add G") + { + private static final long serialVersionUID = 7871036527184588884L; + }); + + + play.add(c); + }//makeToken() + + public boolean canPlay() + { + Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); + + return super.canPlay() && (0 < c.length); + } + + public boolean canPlayAI() + { + boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; + return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("G, tap, Discard a card: Put a 1/1 green Elf Druid creature token named Llanowar Elves into play with \"tap: add G\" "); + ability.setStackDescription("Llanowar Mentor - Put a 1/1 token into play"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("G", new Command() + { + private static final long serialVersionUID = -8140640118045101485L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Sparkspitter")) + { + + + final Ability_Tap ability = new Ability_Tap(card, "R") + { + private static final long serialVersionUID = -6381252527344512333L; + + public void resolve() + { + makeToken(); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + void makeToken() + { + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + final Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Elemental"); + c.setBaseAttack(3); + c.setBaseDefense(1); + + //custom settings + c.setName("Spark Elemental"); + c.setImageName("R 3 1 Spark Elemental"); + + + final SpellAbility spell = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(c)) + AllZone.GameAction.sacrifice(c); + } + }; + spell.setStackDescription("Sacrifice " +c); + + final Command destroy = new Command() + { + + private static final long serialVersionUID = -8633713067929006933L; + + public void execute() + { + if(AllZone.GameAction.isCardInPlay(c)) + AllZone.Stack.add(spell); + } + }; + + Command intoPlay = new Command() + { + + private static final long serialVersionUID = -7174114937547707480L; + + public void execute() + { + if(!c.isFaceDown()) + AllZone.EndOfTurn.addAt(destroy); + } + }; + c.addComesIntoPlayCommand(intoPlay); + c.setSacrificeAtEOT(true); + + play.add(c); + + }//makeToken() + + public boolean canPlay() + { + Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); + + return super.canPlay() && (0 < c.length); + } + + public boolean canPlayAI() + { + boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; + return canPlay() && canDiscard; + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("R, tap, Discard a card: Put a 3/1 red Elemental creature token named Spark Elemental into play with trample, haste, and \"At end of turn, sacrifice Spark Elemental.\" "); + ability.setStackDescription("Sparkspitter - Put a 3/1 token into play"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("R", new Command() + { + private static final long serialVersionUID = 4717424466422508064L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Sliversmith")) + { + final Ability_Tap ability = new Ability_Tap(card, "1") + { + private static final long serialVersionUID = -901356795848120643L; + + public void resolve() + { + makeToken(); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("1"); + c.setToken(true); + + c.addType("Artifact"); + c.addType("Creature"); + c.addType("Sliver"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + + //custom settings + c.setName("Metallic Sliver"); + c.setImageName("C 1 1 Metallic Sliver"); + + play.add(c); + }//makeToken() + + public boolean canPlay() + { + Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); + + return super.canPlay() && (0 < c.length); + } + + public boolean canPlayAI() + { + boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; + return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("1, tap, Discard a card: Put a 1/1 Sliver artifact creature token named Metallic Sliver into play."); + ability.setStackDescription(card +" - Put a 1/1 token into play"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("1", new Command() + { + private static final long serialVersionUID = 7980998398222481323L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Cloudseeder")) + { + final Ability_Tap ability = new Ability_Tap(card, "U") + { + private static final long serialVersionUID = -4685908556244137496L; + + public void resolve() + { + makeToken(); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("U"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Faerie"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + + //custom settings + c.setName("Cloud Sprite"); + c.setImageName("U 1 1 Cloud Sprite"); + c.addIntrinsicKeyword("Flying"); + c.addIntrinsicKeyword("This creature can block only creatures with flying"); + + play.add(c); + }//makeToken() + + public boolean canPlay() + { + Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); + + return super.canPlay() && (0 < c.length); + } + + public boolean canPlayAI() + { + boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; + return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("U, tap, Discard a card: Put a 1/1 blue Sprite creature token named Cloud Sprite into play with flying and \"this creature can block only creatures with flying\"."); + ability.setStackDescription("Cloudseeker - Put a 1/1 token into play"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("U", new Command() + { + private static final long serialVersionUID = 7707504858274558816L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Goldmeadow Lookout")) + { + final Ability_Tap ability = new Ability_Tap(card, "G") + { + private static final long serialVersionUID = -8413409735529340094L; + + public void resolve() + { + makeToken(); + + //computer discards here, todo: should discard when ability put on stack + if(card.getController().equals(Constant.Player.Computer)) + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + void makeToken() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("W"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Kithkin"); + c.addType("Soldier"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + + //custom settings + c.setName("Goldmeadow Harrier"); + c.setImageName("W 1 1 Goldmeadow Harrier"); + final SpellAbility ability = new Ability_Tap(c, "W") + { + private static final long serialVersionUID = -7327585136675896817L; + + public void resolve() + { + Card c = getTargetCard(); + c.tap(); + } + public boolean canPlayAI() {return false;} + };//SpellAbility + c.addSpellAbility(new Spell_Permanent(c)); + c.addSpellAbility(ability); + ability.setDescription("W, tap: Tap target creature."); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + + + play.add(c); + }//makeToken() + + public boolean canPlay() + { + Card c[] = AllZone.getZone(Constant.Zone.Hand, card.getController()).getCards(); + + return super.canPlay() && (0 < c.length); + } + + public boolean canPlayAI() + { + boolean canDiscard = 0 < AllZone.Computer_Hand.getCards().length; + return canPlay() && canDiscard && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + };//SpellAbility + + card.addSpellAbility(ability); + ability.setDescription("W, tap, Discard a card: Put a 1/1 white Kithkin Soldier creature token named Goldmeadow Harrier into play with \"W, tap target creature.\""); + ability.setStackDescription("Goldmeadow Lookout - Put a 1/1 token into play"); + ability.setBeforePayMana(new Input_PayManaCost_Ability("W", new Command() + { + private static final long serialVersionUID = 8621733943286161557L; + + public void execute() + { + card.tap(); + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + AllZone.Stack.add(ability); + } + })); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Goldmeadow Harrier") || cardName.equals("Loxodon Mystic") + || cardName.equals("Master Decoy") || cardName.equals("Benalish Hero")) + { + final SpellAbility ability = new Ability_Tap(card, "W") + { + + private static final long serialVersionUID = 4424848120984319655L; + public void resolve() + { + Card c = getTargetCard(); + c.tap(); + } + public boolean canPlayAI() {return false;} + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("W, tap: Tap target creature."); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability)); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Silent Attendant")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -2602340080268657851L; + public void resolve() + { + + AllZone.GameAction.getPlayerLife(card.getController()).addLife(1); + } + public boolean canPlayAI() + { + //computer should play ability if this creature doesn't attack + Combat c = ComputerUtil.getAttackers(); + CardList list = new CardList(c.getAttackers()); + + //could this creature attack?, if attacks, do not use ability + return (! list.contains(card)); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: You gain 1 life."); + ability.setStackDescription(card.getName() + " - you gain 1 life."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ghost-Lit Redeemer")) + { + final SpellAbility ability = new Ability_Tap(card, "W") + { + private static final long serialVersionUID = -7119153679100849498L; + + public boolean canPlayAI() {return AllZone.Phase.getPhase().equals(Constant.Phase.Main2);} + + public void resolve() + { + Card c = card; + PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); + life.addLife(2); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("W, tap: You gain 2 life"); + ability.setStackDescription("Computer gains 2 life"); + + final Command paid = new Command() + { + private static final long serialVersionUID = 3649597692883194760L; + + public void execute() + { + Card c = card; + c.tap(); + AllZone.Human_Play.updateObservers();//so the card will tap at the correct time + + ability.setStackDescription(c.getController()+" gains 2 life"); + AllZone.Stack.add(ability); + AllZone.InputControl.resetInput(); + } + }; + ability.setBeforePayMana(new Input_PayManaCost_Ability(ability.getManaCost(), paid, Command.Blank)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ramosian Revivalist")) + { + @SuppressWarnings("unused") // costMinusOne + String costMinusOne = ""; + int a = Integer.parseInt("6"); + a--; + costMinusOne = Integer.toString(a); + final int converted = a; + final String player = card.getController(); + + final SpellAbility ability = new Ability_Tap(card, "6") + { + private static final long serialVersionUID = 2675327938055139432L; + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i0) + return true; + else + return false; + + } + + public void resolve() + { + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList rebels = new CardList(); + CardList list = new CardList(grave.getCards()); + list = list.getType("Rebel"); + + if (list.size()>0) + { + for (int i=0;i < list.size(); i++) + { + if (CardUtil.getConvertedManaCost(list.get(i).getManaCost()) <= converted) + { + rebels.add(list.get(i)); + } + + } + + if (rebels.size() > 0) + { + if (player.equals(Constant.Player.Computer)) + { + Card rebel = CardFactoryUtil.AI_getBestCreature(rebels); + grave.remove(rebel); + play.add(rebel); + } + else //human + { + Object o = AllZone.Display.getChoiceOptional("Select target Rebel", rebels.toArray()); + Card rebel = (Card)o; + grave.remove(rebel); + play.add(rebel); + } + }//rebels.size() >0 + }//list.size() > 0 + }//resolve + }; + ability.setDescription("6: Return target Rebel permanent card with converted mana cost 5 or less from your graveyard to play."); + ability.setStackDescription(card.getName() +" - return Rebel from graveyard to play."); + card.addSpellAbility(ability); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Marrow-Gnawer")) + { + final String player = card.getController(); + + final SpellAbility ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 447190529377334168L; + + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(play.getCards()); + + Card c = getTargetCard(); + if (c != null) + { + AllZone.GameAction.sacrifice(c); + + CardList rats = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + if (cards.get(i).getType().contains("Rat") || cards.get(i).getKeyword().contains("Changeling")){ + Card k = cards.get(i); + rats.add(k); + } + } + + if (!c.getName().equals("Marrow-Gnawer")) + { + for (int j=0; j < rats.size()-1; j++) + { + makeToken(); + } + } + else //some weird thing when targeting marrow himself, number of rats is different... so here's a hack: + { + for (int k=0; k < rats.size(); k++) + { + makeToken(); + } + } + } + }//resolve() + + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Computer_Play.getCards()); + list = list.getType("Rat"); + + for (int i=0;i < list.size(); i++) + { + String name = list.get(i).getName(); + if (!name.equals("Marrow-Gnawer") && !name.equals("Relentless Rats")) + setTargetCard(list.get(i)); + if (name.equals("B 1 1 Rat")) + { + setTargetCard(list.get(i)); + break; + } + + } + + if (getTargetCard() == null) + System.out.println("getTargetCard null"); + if(getTargetCard() != null && list.size() > 3) + return true; + else + return false; + } + + + public void makeToken() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Rat"); + c.setImageName("B 1 1 Rat"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Rat"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + } + + + };//ability + + Input runtime = new Input() + { + private static final long serialVersionUID = 8552290582665041908L; + + public void showMessage() + { + CardList rats = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + rats = rats.getType("Rat"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, rats, "Select a Rat to sacrifice.", false)); + } + }; + + card.addSpellAbility(ability); + ability.setDescription("Tap, Sacrifice a rat: Put X 1/1 black Rat creature tokens into play, where X is the number of Rats you control."); + ability.setStackDescription(card.getName() + " - Put X 1/1 black Rat creature tokens into play, where X is the number of Rats you control."); + ability.setBeforePayMana(runtime); + + + }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Arcanis the Omnipotent")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 4743686230518855738L; + + public boolean canPlayAI() + { + return true; + } + + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + AllZone.GameAction.drawCard(card.getController()); + AllZone.GameAction.drawCard(card.getController()); + } + };//SpellAbility + + final SpellAbility ability2 = new Ability(card,"2 U U") + { + public void resolve() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); + + card.untap(); + AllZone.getZone(card).remove(card); + if (!card.isToken()) + hand.add(card); + + } + public boolean canPlayAI() + { + return false; + } + }; //ability2 + + card.addSpellAbility(ability); + ability.setDescription("tap: Draw three cards."); + ability.setStackDescription("Arcanis - " + card.getController() + " draws three cards."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + + card.addSpellAbility(ability2); + ability2.setStackDescription(card.getController() + " returns Arcanis back to owner's hand."); + ability2.setDescription("2 U U: Return Arcanis the Omnipotent to its owner's hand."); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Horde of Notions")) + { + final Ability ability = new Ability(card, "W U B R G") + { + public void resolve() + { + Card c = null; + if (card.getController().equals("Human")) + { + Object o = AllZone.Display.getChoiceOptional("Select Elemental", getCreatures()); + c = (Card)o; + + } + else + { + c = getAIElemental(); + } + + PlayerZone grave = AllZone.getZone(c); + + if(AllZone.GameAction.isCardInZone(c, grave)) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); + AllZone.GameAction.moveTo(play, c); + } + }//resolve() + public boolean canPlay() + { + return getCreatures().length != 0 && AllZone.GameAction.isCardInPlay(card); + } + public Card[] getCreatures() + { + CardList creature = new CardList(); + PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + creature.addAll(zone.getCards()); + creature = creature.getType("Elemental"); + return creature.toArray(); + } + public Card getAIElemental() + { + Card c[] = getCreatures(); + Card biggest = c[0]; + for(int i = 0; i < c.length; i++) + if(biggest.getNetAttack() < c[i].getNetAttack()) + biggest = c[i]; + + return biggest; + } + };//SpellAbility + card.addSpellAbility(ability); + + ability.setDescription("W U B R G: You may play target Elemental card from your graveyard without paying its mana cost."); + //ability.setBeforePayMana(new Input_); + ability.setStackDescription("Horde of Notions - play Elemental card from graveyard without paying its mana cost."); + ability.setBeforePayMana(new Input_PayManaCost(ability)); + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Ravenous Rats") || cardName.equals("Corrupt Court Official")) + { + final Ability ability = new Ability(card,"0") + { + public boolean canPlayAI() + { + return true; + } + public void resolve() + { + if(Constant.Player.Computer.equals(getTargetPlayer())) + AllZone.GameAction.discardRandom(getTargetPlayer()); + else + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + }//resolve() + };//SpellAbility + + Command intoPlay = new Command() + { + private static final long serialVersionUID = -2028008593708491452L; + + public void execute() + { + if(card.getController().equals(Constant.Player.Human)) + { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); + ButtonUtil.disableAll(); + } + else//computer + { + ability.setTargetPlayer(Constant.Player.Human); + AllZone.Stack.add(ability); + }//else + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Boris Devilboon")) + { + final Ability_Tap tokenAbility1 = new Ability_Tap(card, "2 B R") + { + private static final long serialVersionUID = -6343382804503119405L; + + public boolean canPlayAI() + { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + public void chooseTargetAI() {card.tap();} + + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Minor Demon"); + c.setImageName("BR 1 1 Demon"); + c.setManaCost("B R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Demon"); + + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//SpellAbility + + card.addSpellAbility(tokenAbility1); + + tokenAbility1.setDescription("2 B R, tap: Put a 1/1 black and red Demon creature token named Minor Demon onto the battlefield."); + tokenAbility1.setStackDescription(card.getName() + " - Put a 1/1 black and red Demon creature token named Minor Demon onto the battlefield."); + tokenAbility1.setBeforePayMana(new Input_PayManaCost(tokenAbility1)); + } + + //*************** START *********** START ************************** + else if(cardName.equals("Rhys the Redeemed")) + { + final Ability_Tap tokenAbility1 = new Ability_Tap(card, "2 GW") + { + private static final long serialVersionUID = 411298860775527337L; + + public boolean canPlayAI() + { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + public void chooseTargetAI() {card.tap();} + + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Elf Warrior"); + c.setImageName("GW 1 1 Elf Warrior"); + c.setManaCost("GW"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Elf"); + c.addType("Warrior"); + + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//resolve() + };//SpellAbility + + card.addSpellAbility(tokenAbility1); + + tokenAbility1.setDescription("2 GW, tap: Put a 1/1 green and white Elf Warrior creature token into play."); + tokenAbility1.setStackDescription(card.getName() + " - Put a 1/1 green and white Elf Warrior creature token into play."); + tokenAbility1.setBeforePayMana(new Input_PayManaCost(tokenAbility1)); + + ///////////////////////////////////////////////////////////////////// + + final Ability_Tap copyTokens1 = new Ability_Tap(card, "4 GW GW") + { + private static final long serialVersionUID = 6297992502069547478L; + + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList allTokens = new CardList(); + allTokens.addAll(play.getCards()); + allTokens = allTokens.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.isCreature() && c.isToken(); + } + }); + + for (int i=0;i= 2; + } + }; + + card.addSpellAbility(copyTokens1); + + copyTokens1.setDescription("4 GW GW, tap: For each creature token you control, put a token into play that's a copy of that creature."); + copyTokens1.setStackDescription(card.getName() + " - For each creature token you control, put a token into play that's a copy of that creature."); + copyTokens1.setBeforePayMana(new Input_PayManaCost(copyTokens1)); + + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Bringer of the Green Dawn") || cardName.equals("Bringer of the Blue Dawn") || + cardName.equals("Bringer of the White Dawn")) + { + final SpellAbility diffCost = new Spell(card) + { + private static final long serialVersionUID = -1598664186463358630L; + public void resolve() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand ,card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play ,card.getController()); + + + hand.remove(card); + play.add(card); + card.comesIntoPlay(); //do i need this? + } + public boolean canPlay() + { + return AllZone.Phase.getActivePlayer().equals(card.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn") && !AllZone.GameAction.isCardInPlay(card); + } + + }; + diffCost.setManaCost("W U B R G"); + diffCost.setDescription("You may pay W U B R G rather than pay "+card.getName() +"'s mana cost. "); + diffCost.setStackDescription(card.getName() + " - Creature 5/5"); + card.addSpellAbility(diffCost); + + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Thelonite Hermit")) + { + + Command turnsFaceUp = new Command() + { + private static final long serialVersionUID = -3882798504865405413L; + + public void execute() + { + makeToken(); + makeToken(); + makeToken(); + makeToken(); + + }//execute() + + public void makeToken() + { + Card c = new Card(); + + + c.setName("Saproling"); + c.setImageName("G 1 1 Saproling"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Saproling"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + } + };//Command + + + card.addTurnFaceUpCommand(turnsFaceUp); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Imperial Hellkite")) + { + final String player = card.getController(); + Command turnsFaceUp = new Command() + { + private static final long serialVersionUID = -1407485989096862288L; + + public void execute() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + + CardList list = new CardList(lib.getCards()); + list = list.getType("Dragon"); + + if (list.size()==0) + return; + + + if (player.equals(Constant.Player.Computer)) + { + Card dragon = CardFactoryUtil.AI_getBestCreature(list); + lib.remove(dragon); + hand.add(dragon); + } + else //human + { + Object o = AllZone.Display.getChoiceOptional("Select Dragon", list.toArray()); + Card dragon = (Card)o; + lib.remove(dragon); + hand.add(dragon); + } + AllZone.GameAction.shuffle(card.getController()); + }//execute() + };//Command + + card.addTurnFaceUpCommand(turnsFaceUp); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Corrupt")) + { + + final SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = 335838994716307031L; + + Card check; + public boolean canPlayAI() + { + if(AllZone.Human_Life.getLife() <= countSwamps(card)) + return true; + + check = getFlying(); + return check != null; + } + + public int countSwamps(Card c) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, c.getController()); + CardList swamps = new CardList(play.getCards()); + swamps = swamps.getType("Swamp"); + return swamps.size(); + } + + public void chooseTargetAI() + { + if(AllZone.Human_Life.getLife() <= 12) //12? mebbe 15? + { + setTargetPlayer(Constant.Player.Human); + return; + } + + Card c = getFlying(); + if((c == null) || (! check.equals(c))) + throw new RuntimeException(card +" error in chooseTargetAI() - Card c is " +c +", Card check is " +check); + + setTargetCard(c); + }//chooseTargetAI() + + //uses "damage" variable + Card getFlying() + { + CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true); + for(int i = 0; i < flying.size(); i++) + if(flying.get(i).getNetDefense() <= countSwamps(card)) + return flying.get(i); + + return null; + } + + public void resolve() + { + int damage = countSwamps(card); + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + Card c = getTargetCard(); + c.addDamage(damage); + AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage); + } + } + else { + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(damage); + AllZone.GameAction.getPlayerLife(card.getController()).addLife(damage); + } + }//resolve() + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + + spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell,true)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Serra Avatar")) + { + Command leavesPlay = new Command() + { + private static final long serialVersionUID = -2274397219668820020L; + + public void execute() + { + //moveto library + PlayerZone libraryZone = AllZone.getZone(Constant.Zone.Library, card.getOwner()); + AllZone.GameAction.moveTo(libraryZone, card); + //shuffle library + AllZone.GameAction.shuffle(card.getOwner()); + }//execute() + };//Command + card.addDestroyCommand(leavesPlay); + }//*************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Pestermite")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) + { + if(c.isTapped()) + c.untap(); + else + c.tap(); + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 5202575895575352408L; + + public void execute() + { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + + CardList hum = new CardList(); + hum.addAll(AllZone.Human_Play.getCards()); + + if (all.size() != 0) { + + if(card.getController().equals(Constant.Player.Human)) { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target permanent to tap/untap.", true)); + ButtonUtil.enableAll(); + } + else if (card.getController().equals(Constant.Player.Computer)) { + Card human = CardFactoryUtil.AI_getBestCreature(hum); + ability.setTargetCard(human); + AllZone.Stack.add(ability); + } + } + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -3055232264358172133L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + list = list.filter(new CardListFilter(){ + public boolean addCard(Card c) { + return c.isUntapped(); + } + }); + + return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Angel of Despair")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c)) + { + if(c.isToken()) + AllZone.getZone(c).remove(c); + + else + AllZone.GameAction.destroy(c); + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -3583483691705438214L; + + public void execute() + { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + + CardList hum = new CardList(); + hum.addAll(AllZone.Human_Play.getCards()); + + if (all.size() != 0) { + + if(card.getController().equals(Constant.Player.Human)) { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target permanent.", true)); + ButtonUtil.disableAll(); + } + else if (card.getController().equals(Constant.Player.Computer)) { + Card human = CardFactoryUtil.AI_getBestCreature(hum); + ability.setTargetCard(human); + AllZone.Stack.add(ability); + } + } + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -173202865726476053L; + + public boolean canPlayAI() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + + return (list.size() > 0) && AllZone.getZone(getSourceCard()).is(Constant.Zone.Hand); + } + }); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Mystic Snake")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + if(AllZone.Stack.size() > 0) { + SpellAbility sa = AllZone.Stack.peek(); + if (sa.isSpell() && CardFactoryUtil.isCounterable(sa.getSourceCard()) ) { + sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + } + }//resolve() + };//SpellAbility + Command intoPlay = new Command() + { + private static final long serialVersionUID = -6564365394043612388L; + + public void execute() + { + if(AllZone.Stack.size() > 0) { + ability.setStackDescription("Mystic Snake counters " +AllZone.Stack.peek().getSourceCard().getName()); + AllZone.Stack.add(ability); + } + } + }; + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 6440845807532409545L; + + public boolean canPlayAI() + { + return false; + } + }); + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Captain Sisay")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 7978812786945030021L; + public void resolve() + { + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + }//resolve() + public void humanResolve() + { + CardList cards = new CardList(AllZone.Human_Library.getCards()); + //legends = legends.getType().contains("Legendary"); + CardList legends = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + //System.out.println("type: " +cards.get(i).getType()); + if (cards.get(i).getType().contains("Legendary")){ + //System.out.println(cards.get(i).getName()); + Card c = cards.get(i); + legends.add(c); + + } + } + + if (legends.size() != 0) { + Object check = AllZone.Display.getChoiceOptional("Select Legend", legends.toArray()); + if(check != null) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, (Card)check); + } + AllZone.GameAction.shuffle(Constant.Player.Human); + } + } + public void computerResolve() + { + Card[] library = AllZone.Computer_Library.getCards(); + CardList list = new CardList(library); + CardList legends = new CardList(); + //list = list.getType("Creature"); + + for (int i=0;i < list.size(); i++) + { + if (list.get(i).getType().contains("Legendary")){ + Card k = list.get(i); + legends.add(k); + } + + } + + //pick best creature + if (legends.size() != 0){ + Card c = CardFactoryUtil.AI_getBestCreature(legends); + if(c == null) + c = library[0]; + System.out.println("computer picked - " +c); + AllZone.Computer_Library.remove(c); + AllZone.Computer_Hand.add(c); + } + } + + + };//SpellAbility + //card.addSpellAbility(ability); + ability.setDescription("tap: Search your library for a Legend or legendary card, reveal that card, and put it into your hand. Then shuffle your library."); + ability.setBeforePayMana(new Input_NoCost_TapAbility((Ability_Tap) ability)); + ability.setStackDescription("Captain Sisay searches for a Legend or Legendary card..."); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Siege-Gang Commander")) + { + + final SpellAbility comesIntoPlayAbility = new Ability(card, "0") + { + public void resolve() + { + makeToken(); + makeToken(); + makeToken(); + }//resolve() + + public void makeToken() + { + Card c = new Card(); + + c.setName("Goblin"); + c.setImageName("R 1 1 Goblin"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Goblin"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + } + + }; //comesIntoPlayAbility + + Command intoPlay = new Command() + { + private static final long serialVersionUID = 8778828278589063477L; + + public void execute() + { + comesIntoPlayAbility.setStackDescription(card.getName() + " - put three 1/1 red Goblin creature tokens into play."); + AllZone.Stack.add(comesIntoPlayAbility); + } + }; + + card.addComesIntoPlayCommand(intoPlay); + + + final SpellAbility ability = new Ability(card, "1 R") + { + + private static final long serialVersionUID = -6653781740344703908L; + + public void resolve() + { + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + }//resolve() + + public void humanResolve() { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(play.getCards()); + + CardList creatures = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + if (cards.get(i).getType().contains("Goblin") || cards.get(i).getKeyword().contains("Changeling")){ + Card k = cards.get(i); + creatures.add(k); + } + } + + if (creatures.size() != 0) { + Object check = AllZone.Display.getChoiceOptional("Select Goblin to Sacrifice", creatures.toArray()); + if(check != null) + { + Card c = (Card)check; + if(AllZone.GameAction.isCardInPlay(c)) + { + AllZone.GameAction.sacrifice(c); + + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) + { + Card crd = getTargetCard(); + //c.addDamage(damage); + AllZone.GameAction.addDamage(crd, 2); + } + } + else + AllZone.GameAction.getPlayerLife(getTargetPlayer()).subtractLife(2); + + } + } + } + }//humanResolve + + public void computerResolve() { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(play.getCards()); + + CardList creatures = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + if (cards.get(i).getType().contains("Goblin") || cards.get(i).getType().contains("Changeling")){ + Card k = cards.get(i); + creatures.add(k); + } + } + //.... TODO + + }//compResolve + + public boolean canPlayAI() + { + return false; + } + + };//ability + + card.addSpellAbility(ability); + ability.setDescription("1 R, Sacrifice a goblin: Siege-Gang Commander deals 2 damage to target creature or player ."); + ability.setStackDescription("Siege-Gang Commander deals 2 damage to target creature or player"); + ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, true)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Brion Stoutarm")) + { + + final SpellAbility ability = new Ability_Tap(card, "R") + { + private static final long serialVersionUID = -7755879134314608010L; + + public void resolve() + { + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + }//resolve() + + public void humanResolve() { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(play.getCards()); + + CardList creatures = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + if (cards.get(i).getType().contains("Creature") && !cards.get(i).getName().equals("Brion Stoutarm")){ + Card k = cards.get(i); + creatures.add(k); + } + } + + if (creatures.size() != 0) { + Object check = AllZone.Display.getChoiceOptional("Select Creature to Sacrifice", creatures.toArray()); + if(check != null) + { + Card c = (Card)check; + if(AllZone.GameAction.isCardInPlay(c)) + { + int power = c.getNetAttack(); + AllZone.GameAction.sacrifice(c); + String opponent = AllZone.GameAction.getOpponent(player); + + PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); + life.subtractLife(power); + + GameActionUtil.executeLifeLinkEffects(card, power); + for(int i=0; i < CardFactoryUtil.hasNumberEnchantments(card, "Guilty Conscience"); i++) + GameActionUtil.executeGuiltyConscienceEffects(card, power); + + card.setDealtDmgToOppThisTurn(true); + } + } + } + }//humanResolve + + public void computerResolve() { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + CardList cards = new CardList(play.getCards()); + + CardList creatures = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + if (cards.get(i).getType().contains("Creature") && !cards.get(i).getName().equals("Brion Stoutarm")){ + Card k = cards.get(i); + creatures.add(k); + } + } + //.... TODO + + }//compResolve + + public boolean canPlayAI() + { + return false; + } + + };//ability + + card.addSpellAbility(ability); + ability.setDescription("R, tap, Sacrifice a creature other than Brion Stoutarm: Brion Stoutarm deals damage equal to the sacrificed creature's power to target player ."); + ability.setStackDescription("Brion Stoutarm deals damage equal to sacrificed creature's power"); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Trinket Mage")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) + { + Card c = getTargetCard(); + AllZone.GameAction.shuffle(card.getController()); + lib.remove(c); + hand.add(c); + + } + }//resolve() + }; + Command intoPlay = new Command() + { + + private static final long serialVersionUID = 4022442363194287539L; + + public void execute() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList cards = new CardList(lib.getCards()); + CardList arts = new CardList(); + + for (int i=0;i 0) + { + if (card.getController().equals(Constant.Player.Computer)) + { + lib.remove(landInLib.get(0)); + play.add(landInLib.get(0)); + } + else + { + Object o = AllZone.Display.getChoiceOptional("Select land card to put into play: ", landInLib.toArray()); + if (o != null) + { + Card crd = (Card)o; + lib.remove(crd); + play.add(crd); + } + } + AllZone.GameAction.shuffle(card.getController()); + } + }//if(isCardInPlay) + } + + public boolean canPlayAI() + { + CardList landInLib = new CardList(AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer).getCards()); + CardList landInPlay = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer).getCards()); + + landInLib = landInLib.getType("Land"); + landInPlay = landInPlay.getType("Land"); + + if (landInLib.size() > 0 && landInPlay.size() > 0) + return true; + else + return false; + + } + public void chooseTargetAI() + { + CardList land = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + if(c.getType().contains("Plains") || c.getType().contains("Forest")) + return true; + else + return false; + } + }); + if(land.size()>0) + setTargetCard(land.get(0)); + } + }; + + Input runtime = new Input() + { + private static final long serialVersionUID = -4320917612145305541L; + + public void showMessage() + { + CardList land = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + land = land.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + if(c.getType().contains("Plains") || c.getType().contains("Forest")) + return true; + else + return false; + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, land, "Select a Plains or Forest to sacrifice.", false)); + } + }; + ability.setBeforePayMana(runtime); + ability.setDescription("T, Sacrifice a Forest or Plains: Search your library for a land card, put it into play, then shuffle your library."); + ability.setStackDescription(card.getName() + " - Search your library for a card and put it into play, then shuffle your library"); + card.addSpellAbility(ability); + + } + + //*************** START *********** START ************************** + else if(cardName.equals("Knight of the White Orchid")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + + + CardList basic = new CardList(lib.getCards()); + basic = basic.getType("Plains"); + + + + if (card.getController().equals(Constant.Player.Computer)) + { + if (basic.size() > 0) + { + Card c = basic.get(0); + lib.remove(c); + play.add(c); + + } + } + else // human + { + if (basic.size() > 0) + { + Object o = AllZone.Display.getChoiceOptional("Select Plains card to put into play: ", basic.toArray()); + if (o != null) + { + Card c = (Card)o; + lib.remove(c); + play.add(c); + } + } + } + AllZone.GameAction.shuffle(card.getController()); + }//resolve() + + };//Ability + + Command fetchBasicLand = new Command() + { + + private static final long serialVersionUID = -1086551054597721988L; + + public void execute() + { + String player = card.getController(); + PlayerZone oppPlay = AllZone.getZone(Constant.Zone.Play, AllZone.GameAction.getOpponent(player)); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList self = new CardList(play.getCards()); + CardList opp = new CardList(oppPlay.getCards()); + + self = self.getType("Land"); + opp = opp.getType("Land"); + + if (self.size() < opp.size()) + { + ability.setStackDescription(card.getName()+ " - search library for a plains and put it into play"); + AllZone.Stack.add(ability); + } + } + }; + + card.addComesIntoPlayCommand(fetchBasicLand); + + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Niv-Mizzet, the Firemind")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 8670005059055071206L; + public boolean canPlayAI() {return false;} + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Draw a card."); + ability.setStackDescription(card.getName() + " - draw a card."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Elvish Farmer") || cardName.equals("Mycologist")) + { + Command intoPlay = new Command() + { + private static final long serialVersionUID = 882942955555047018L; + public boolean firstTime = true; + public void execute() + { + + if(firstTime){ + card.setCounter(Counters.SPORE, 0); + } + firstTime = false; + } + }; + + card.addComesIntoPlayCommand(intoPlay); + + final SpellAbility a2 = new Ability(card, "0") + { + public void chooseTargetAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList saps = new CardList(play.getCards()); + saps = saps.filter(new CardListFilter() + { + + public boolean addCard(Card c) { + if((c.getType().contains("Saproling") || c.getKeyword().contains("Changeling")) && + AllZone.GameAction.isCardInPlay(c) ) + return true; + return false; + } + + }); + + if (saps.size() != 0) + setTargetCard(saps.getCard(0)); + } + public void resolve() + { + //get all saprolings: + Card c = getTargetCard(); + if(c == null ) + return; + + if (!AllZone.GameAction.isCardInPlay(c)) + return; + + if(AllZone.GameAction.isCardInPlay(c)) + { + //AllZone.getZone(c).remove(c); + AllZone.GameAction.sacrifice(c); + + PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); + life.addLife(2); + } + }//resolve + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList saps = new CardList(play.getCards()); + saps = saps.filter(new CardListFilter() + { + + public boolean addCard(Card c) { + if(c.getType().contains("Saproling") || c.getKeyword().contains("Changeling") && + AllZone.GameAction.isCardInPlay(c)) + return true; + return false; + } + + }); + if(AllZone.Computer_Life.getLife() < 6 && saps.size() > 0) + return true; + else + return false; + } + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = -4803541385354247499L; + + public void showMessage() + { + CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + saps = saps.getType("Saproling"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); + } + }; + + card.addSpellAbility(a2); + a2.setDescription("Sacrifice a Saproling: You gain 2 life."); + a2.setStackDescription(card.getController() + " gains 2 life."); + a2.setBeforePayMana(runtime); + + + }//*************** END ************ END ************************** + + else if (cardName.equals("Pallid Mycoderm")) + { + + Command intoPlay = new Command() + { + private static final long serialVersionUID = 3400057700040211691L; + public boolean firstTime = true; + public void execute() + { + + if(firstTime){ + card.setCounter(Counters.SPORE, 0); + } + firstTime = false; + } + }; + + card.addComesIntoPlayCommand(intoPlay); + + final SpellAbility a2 = new Ability(card, "0") + { + final Command eot1 = new Command() + { + private static final long serialVersionUID = -4485431571276851181L; + + public void execute() + { + String player = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList creats = new CardList(play.getCards()); + creats = creats.getType("Creature"); + + for (int i=0; i < creats.size(); i++) + { + Card creat = creats.get(i); + + if (creat.getType().contains("Fungus") || creat.getType().contains("Saproling") || creat.getKeyword().contains("Changeling")) + { + creat.addTempAttackBoost(-1); + creat.addTempDefenseBoost(-1); + } + } + + } + }; + public void resolve() + { + //get all player controls saprolings: + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + CardList creats = new CardList(play.getCards()); + creats = creats.getType("Creature"); + + @SuppressWarnings("unused") // saps + CardList saps = new CardList(); + + Card c = getTargetCard(); + @SuppressWarnings("unused") // hand + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); + + if(AllZone.GameAction.isCardInPlay(c)) + { + //AllZone.getZone(c).remove(c); + AllZone.GameAction.sacrifice(c); + + + for (int i=0; i < creats.size(); i++) + { + Card creat = creats.get(i); + + if (creat.getType().contains("Fungus") || creat.getType().contains("Saproling")) + { + creat.addTempAttackBoost(1); + creat.addTempDefenseBoost(1); + } + } + + } + AllZone.EndOfTurn.addUntil(eot1); + } + public boolean canPlayAI() + { + return false; + } + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = 6754180514935882692L; + + public void showMessage() + { + CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + saps = saps.getType("Saproling"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); + } + }; + + card.addSpellAbility(a2); + a2.setDescription("Sacrifice a Saproling: Each Fungus and each Saproling you control gets +1/+1 until end of turn"); + a2.setStackDescription("Saprolings and Fungi you control get +1/+1 until end of turn."); + + a2.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Psychotrope Thallid")) + { + Command intoPlay = new Command() + { + private static final long serialVersionUID = 8020106056714209199L; + public boolean firstTime = true; + public void execute() + { + + if(firstTime){ + card.setCounter(Counters.SPORE, 0); + } + firstTime = false; + } + }; + + card.addComesIntoPlayCommand(intoPlay); + + final SpellAbility a2 = new Ability(card, "1") + { + public void resolve() + { + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c)) + { + //AllZone.getZone(c).remove(c); + AllZone.GameAction.sacrifice(c); + + AllZone.GameAction.drawCard(c.getController()); + } + }//resolve + public boolean canPlayAI() + { + //TODO: make AI able to use this + return false; + } + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = -6388866343458002392L; + + public void showMessage() + { + CardList saps = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + saps = saps.getType("Saproling"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, saps, "Select a Saproling to sacrifice.", false)); + } + }; + + card.addSpellAbility(a2); + a2.setDescription("1, Sacrifice a Saproling: You draw a card."); + a2.setStackDescription(card.getController() + " draws a card."); + a2.setBeforePayMana(runtime); + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Wall of Mulch")) + { + + final SpellAbility a2 = new Ability(card, "G") + { + public void resolve() + { + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c)) + { + //AllZone.getZone(c).remove(c); + AllZone.GameAction.sacrifice(c); + AllZone.GameAction.drawCard(c.getController()); + } + }//resolve + public boolean canPlayAI() + { + //TODO: make AI able to use this + return false; + } + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = -4390488827563977718L; + + public void showMessage() + { + CardList walls = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + walls = walls.getType("Wall"); + + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, walls, "Select a Wall to sacrifice.", false)); + } + }; + + card.addSpellAbility(a2); + a2.setDescription("G, Sacrifice a Wall: You draw a card."); + a2.setStackDescription(card.getController() + " draws a card."); + a2.setBeforePayMana(runtime); + + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if (cardName.equals("Rootwater Thief")) + { + //final String player = card.getController(); + //final String opponent = AllZone.GameAction.getOpponent(player); + + final Ability ability2 = new Ability(card, "2") + { + public void resolve() + { + String opponent = AllZone.GameAction.getOpponent(card.getController()); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, opponent); + CardList cards = new CardList(lib.getCards()); + + if (cards.size() > 0 ) + { + if (card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select card to remove: ", cards.toArray()); + Card c = (Card)o; + AllZone.GameAction.removeFromGame(c); + AllZone.GameAction.shuffle(opponent); + } + else + { + Card c = lib.get(0); + AllZone.GameAction.removeFromGame(c); + AllZone.GameAction.shuffle(opponent); + } + } + + } + public boolean canPlay() + { + //this is set to false, since it should only TRIGGER + return false; + } + };// ability2 + //card.clearSpellAbility(); + card.addSpellAbility(ability2); + ability2.setStackDescription(card.getName() + " - search opponent's library and remove a card from game."); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if (cardName.equals("Oros, the Avenger")) + { + final String player = card.getController(); + + final Ability ability2 = new Ability(card, "2 W") + { + public void resolve() + { + if (player.equals("Human")) + { + CardList cards = new CardList(); + PlayerZone hum = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone comp = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + cards.addAll(hum.getCards()); + cards.addAll(comp.getCards()); + cards = cards.getType("Creature"); + + for (int i=0;i 0) + { + Card c = basic.get(0); + lib.remove(c); + play.add(c); + c.tap(); + + } + } + else // human + { + if (basic.size() > 0) + { + Object o = AllZone.Display.getChoiceOptional("Select Basic Land card to put into play tapped: ", basic.toArray()); + if (o != null) + { + Card c = (Card)o; + lib.remove(c); + play.add(c); + c.tap(); + } + } + } + AllZone.GameAction.shuffle(card.getController()); + }//resolve() + };//Ability + + Command fetchBasicLand = new Command() + { + private static final long serialVersionUID = -7912757481694029348L; + + public void execute() + { + ability.setStackDescription(card.getName()+ " - search library for a basic land card and put it into play tapped."); + AllZone.Stack.add(ability); + } + }; + + final Ability ability2 = new Ability(card, "0") + { + public void resolve() + { + + AllZone.GameAction.drawCard(card.getController()); + }//resolve() + };//Ability + + Command draw = new Command() + { + private static final long serialVersionUID = -549395102229088642L; + + public void execute() + { + ability2.setStackDescription(card.getName()+ " - Draw a card."); + AllZone.Stack.add(ability2); + } + }; + + card.addDestroyCommand(draw); + card.addComesIntoPlayCommand(fetchBasicLand); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + if (cardName.equals("Master Transmuter")) + { + final Ability_Tap ability = new Ability_Tap(card, "U") + { + + private static final long serialVersionUID = -9076784333448226913L; + + public void resolve() { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + CardList artifacts = new CardList(hand.getCards()); + artifacts = artifacts.getType("Artifact"); + if (card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Select artifact to put onto the battlefield: ", artifacts.toArray()); + if(o!=null) + { + Card c = (Card)o; + hand.remove(c); + play.add(c); + } + } + else + { + //CardList arts = new CardList(play.getCards()); + //arts = arts.getType("Artifact"); + + Card c = getTargetCard(); + AllZone.GameAction.moveTo(hand, c); + + Card crd = CardFactoryUtil.AI_getMostExpensivePermanent(artifacts, card, false); + hand.remove(crd); + play.add(crd); + + } + } + + public boolean canPlayAI() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Computer); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + + CardList handArts = new CardList(hand.getCards()); + handArts = handArts.getType("Artifact"); + + CardList playArts = new CardList(play.getCards()); + playArts = playArts.getType("Artifact"); + + if (handArts.size() > 0 && playArts.size() > 0){ + + if (CardUtil.getConvertedManaCost(CardFactoryUtil.AI_getCheapestPermanent(playArts, card, false).getManaCost()) < + CardUtil.getConvertedManaCost(CardFactoryUtil.AI_getMostExpensivePermanent(handArts, card, false).getManaCost())) + { + setTargetCard(CardFactoryUtil.AI_getCheapestPermanent(playArts, card, false)); + return true; + } + + } + return false; + } + }; + + Input target = new Input() + { + + private static final long serialVersionUID = 4246650335595231655L; + public void showMessage() + { + AllZone.Display.showMessage("Select artifact to return to hand"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play,card.getController()); + if(c.isArtifact() && AllZone.GameAction.isCardInZone(c, play)) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand,card.getController()); + + AllZone.GameAction.moveTo(hand, c); + AllZone.Stack.add(ability); + stopSetNext(new ComputerAI_StackNotEmpty()); + } + }//selectCard() + };//Input + + card.addSpellAbility(ability); + ability.setDescription("U, tap, Return an artifact you control to its owner's hand: You may put an artifact card from your hand onto the battlefield."); + ability.setStackDescription(card + "You may put an artifact card from your hand onto the battlefield"); + ability.setAfterPayMana(target); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Hanna, Ship's Navigator")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 U W") + { + private static final long serialVersionUID = 7959233413572648987L; + + public void resolve() + { + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + }//resolve() + public void humanResolve() + { + CardList cards = new CardList(AllZone.Human_Graveyard.getCards()); + //legends = legends.getType().contains("Legendary"); + CardList list = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + //System.out.println("type: " +cards.get(i).getType()); + if (cards.get(i).getType().contains("Artifact") || cards.get(i).getType().contains("Enchantment")){ + //System.out.println(cards.get(i).getName()); + Card c = cards.get(i); + list.add(c); + + } + } + + if (list.size() != 0) { + Object check = AllZone.Display.getChoiceOptional("Select Artifact or Enchantment", list.toArray()); + if(check != null) + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, (Card)check); + } + } + } + public void computerResolve() + { + Card[] grave = AllZone.Computer_Graveyard.getCards(); + CardList list = new CardList(grave); + CardList artenchants = new CardList(); + //list = list.getType("Creature"); + + for (int i=0;i < list.size(); i++) + { + if (list.get(i).getType().contains("Artifact") || list.get(i).getType().contains("Enchantment")){ + Card k = list.get(i); + artenchants.add(k); + } + + } + + //pick best artifact / enchantment + if (artenchants.size() != 0){ + Card c = CardFactoryUtil.AI_getBestArtifact(list); + if(c == null) + c = CardFactoryUtil.AI_getBestEnchantment(list,card, true); + if(c == null) + c = grave[0]; + System.out.println("computer picked - " +c); + AllZone.Computer_Graveyard.remove(c); + AllZone.Computer_Hand.add(c); + } + }//computerResolve + + public boolean canPlay(){ + String controller = card.getController(); + + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, controller); + CardList list = new CardList(grave.getCards()); + CardList cards = new CardList(); + + for (int i=0;i 0 && AllZone.GameAction.isCardInPlay(card) && !card.hasSickness() && card.isUntapped()) + return true; + else + return false; + } + + + };//SpellAbility + //card.addSpellAbility(ability); + ability.setDescription("1 U W, tap: Return target artifact or enchantment card from your graveyard to your hand."); + ability.setBeforePayMana(new Input_PayManaCost(ability)); + ability.setStackDescription("Hanna, Ship's Navigator - Returns an artifact or enchantment card from graveyard to hand."); + card.addSpellAbility(ability); + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Cromat")){ + + //LibBounce Ability + final Ability a1 = new Ability(card, "G U") + { + public boolean canPlayAI() {return false;} + + public void resolve() + { + if(AllZone.GameAction.isCardInPlay(card) ) + { + card.setBaseAttack(5); + card.setBaseDefense(5); + + card.setAssignedDamage(0); + card.setDamage(0); + card.untap(); + AllZone.getZone(card).remove(card); + + //put card on top of library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getOwner()); + library.add(card, 0); + } + }//resolve() + };//SpellAbility + + Input runtime1 = new Input() + { + private static final long serialVersionUID = 1469011418219527227L; + + public void showMessage() + { + a1.setStackDescription("Put " +card +" on top of its owner's library"); + + stopSetNext(new Input_PayManaCost(a1)); + } + }; + a1.setDescription("G U: Put Cromat on top of its owner's library."); + a1.setStackDescription("Put Cromat on top of its owner's library."); + card.addSpellAbility(a1); + a1.setBeforePayMana(runtime1); + //Kill ability + + final Ability a2 = new Ability(card, "W B"){ + public boolean canPlay() + { + return (AllZone.GameAction.isCardInPlay(card) && (AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card))); + } + public boolean canPlayAI() + { + return false; + //TODO + } + public void resolve() + { + AllZone.GameAction.destroy(getTargetCard()); + }//resolve() + }; + Input runtime2 = new Input() + { + private static final long serialVersionUID = 1L; + + public void showMessage() + { + CardList targets = new CardList(); + if(AllZone.Combat.isBlocked(card) || AllZone.Combat.getAllBlockers().contains(card)){ + if (AllZone.Combat.isBlocked(card)){ targets = AllZone.Combat.getBlockers(card); } + else { + targets = new CardList(); + for (Card c : AllZone.Combat.getAttackers()){ + if (AllZone.Combat.isBlocked(c)) + if (AllZone.Combat.getBlockers(c).contains(card)) targets.add(c); + } + } + } + stopSetNext(CardFactoryUtil.input_targetSpecific(a2, targets, "Select target blocking or blocked by Cromat.", true)); + } + }; + card.addSpellAbility(a2); + a2.setBeforePayMana(runtime2); + a2.setDescription("W B: Destroy target creature blocking or blocked by Cromat."); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Energizer")) + { + Ability_Tap ability = new Ability_Tap(card, "2") + { + private static final long serialVersionUID = 6444406158364728638L; + public void resolve() + { + card.addCounter(Counters.P1P1,1); + } + public boolean canPlayAI() + { + return(true); + } + }; + ability.setDescription("2, T: Put a +1/+1 counter on Energizer."); + ability.setStackDescription("Put a +1/+1 counter on target Energizer."); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Sphinx of Jwar Isle")) + { + final SpellAbility ability1 = new Ability(card, "0") + { + public void resolve() + { + String player = card.getController(); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); + + if (lib.size() < 1) + return; + + CardList cl = new CardList(); + cl.add(lib.get(0)); + + AllZone.Display.getChoiceOptional("Top card", cl.toArray()); + } + public boolean canPlayAI() + { + return false; + } + }; + + ability1.setStackDescription(card.getName() + " - look at top card of library."); + ability1.setDescription("You may look at the top card of your library."); + card.addSpellAbility(ability1); + } + //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Imperial Recruiter")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + + if(AllZone.GameAction.isCardInZone(getTargetCard(), lib)) + { + Card c = getTargetCard(); + AllZone.GameAction.shuffle(card.getController()); + lib.remove(c); + hand.add(c, 0); + + } + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -8887306085997352723L; + + public void execute() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList cards = new CardList(lib.getCards()); + CardList powerTwoCreatures = new CardList(); + + for (int i=0;i 0) + { + if (card.getController().equals("Human")) + { + Object o = AllZone.Display.getChoiceOptional("Select a card in opponent's graveyard to remove", gravecards.toArray()); + if (o!=null) + { + Card removedCard = (Card)o; + AllZone.GameAction.removeFromGame(removedCard); + } + } + else + { + AllZone.GameAction.removeFromGame(gravecards.get(0)); + } + } + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + CardList creatures = new CardList(play.getCards()); + creatures = creatures.getType("Creature"); + + //Object o = AllZone.Display.getChoiceOptional("Select a creature card to bounce", blackBlue.toArray()); + + + AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, creatures, "Select a creature you control.", false)); + ButtonUtil.disableAll(); + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = 3089921616375272120L; + + public boolean canPlayAI() + { + return false; + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Cavern Harpy")) + { + final SpellAbility a1 = new Ability(card,"0") + { + public void resolve() + { + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.subtractLife(1); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); + + if (card.isToken()) + AllZone.getZone(card).remove(card); + else + AllZone.GameAction.moveTo(hand, card); + + + } + public boolean canPlayAI() + { + return false; + } + }; + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, c.getOwner()); + + if(AllZone.GameAction.isCardInPlay(c)) + { + AllZone.getZone(c).remove(c); + + if(! c.isToken()) + { + Card newCard = AllZone.CardFactory.getCard(c.getName(), c.getOwner()); + hand.add(newCard); + } + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -7855081477395863590L; + + public void execute() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + CardList creatures = new CardList(play.getCards()); + creatures = creatures.getType("Creature"); + + CardList blackBlue = new CardList(); + + + for(int i=0;i 0) + return true; + else + return false; + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Aven Cloudchaser") || cardName.equals("Cloudchaser Eagle") || cardName.equals("Monk Realist")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + { + if(c.isToken()) + AllZone.getZone(c).remove(c); + + else + AllZone.GameAction.destroy(c); + } + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 8586704292133752803L; + + public void execute() + { + CardList all = new CardList(); + all.addAll(AllZone.Human_Play.getCards()); + all.addAll(AllZone.Computer_Play.getCards()); + all = all.getType("Enchantment"); + + + if (all.size() != 0) { + + if(card.getController().equals(Constant.Player.Human)) { + AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(ability, all, "Select target enchantment.", true)); + ButtonUtil.disableAll(); + } + else if (card.getController().equals(Constant.Player.Computer)) { + Card human = CardFactoryUtil.AI_getBestEnchantment(all, card, true); + ability.setTargetCard(human); + AllZone.Stack.add(ability); + } + } + + }//execute() + };//Command + card.addComesIntoPlayCommand(intoPlay); + + card.clearSpellAbility(); + + card.addSpellAbility(new Spell_Permanent(card) + { + private static final long serialVersionUID = -8467111038318551304L; + + public boolean canPlayAI() + { + CardList ench = new CardList(); + ench.addAll(AllZone.Human_Play.getCards()); + ench = ench.getType("Enchantment"); + + if (ench.size() > 0) + return true; + else + return false; + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Rakka Mar")) + { + final SpellAbility a1 = new Ability_Tap(card, "R") + { + private static final long serialVersionUID = -3868544882464692305L; + + public boolean canPlayAI() + { + return true; + + } + public void resolve() + { + makeToken(); + } + void makeToken() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Elemental"); + c.setImageName("R 3 1 Elemental"); + c.setManaCost("R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Elemental"); + c.setBaseAttack(3); + c.setBaseDefense(1); + c.addIntrinsicKeyword("Haste"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + };//SpellAbility + card.addSpellAbility(a1); + a1.setDescription("R, T: Put a 3/1 red Elemental creature token with haste into play."); + a1.setStackDescription("Put a 3/1 red Elemental creature token with haste into play."); + + a1.setBeforePayMana(new Input_PayManaCost(a1)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Tolsimir Wolfblood")) + { + final SpellAbility a1 = new Ability_Tap(card) + { + private static final long serialVersionUID = -1900858280382389010L; + + public boolean canPlayAI() + { + String controller = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + CardList voja = new CardList(play.getCards()); + voja = voja.getName("Voja"); + + if (voja.size() == 0) + return true; + else + return false; + + } + public void resolve() + { + makeToken(); + } + void makeToken() + { + Card c = new Card(); + + c.setName("Voja"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("W G"); + c.setToken(true); + + c.addType("Legendary"); + c.addType("Creature"); + c.addType("Wolf"); + c.setBaseAttack(2); + c.setBaseDefense(2); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + };//SpellAbility + card.addSpellAbility(a1); + a1.setDescription("T: Put a legendary 2/2 green and white Wolf creature token named Voja into play."); + a1.setStackDescription("Put a 2/2 white green Legendary Wolf creature token named Voja into play."); + + a1.setBeforePayMana(new Input_PayManaCost(a1)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Ranger of Eos")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + + + CardList cards = new CardList(lib.getCards()); + CardList oneCostCreatures = new CardList(); + + for (int i=0;i= 1) + { + Card c1 = oneCostCreatures.getCard(0); + lib.remove(c1); + hand.add(c1); + oneCostCreatures.remove(c1); + + if (oneCostCreatures.size() >= 1) + { + Card c2 = oneCostCreatures.getCard(0); + lib.remove(c2); + hand.add(c2); + oneCostCreatures.remove(c2); + + } + + } + //ability.setTargetCard(powerTwoCreatures.get(0)); + //AllZone.Stack.add(ability); + AllZone.GameAction.shuffle(controller); + } + + + //... + + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -5697680711324878027L; + + public void execute() + { + ability.setStackDescription("Ranger of Eos - Grab 2 creatures"); + AllZone.Stack.add(ability); + }//execute() + };//Command + //ability.setStackDescription("Ranger of Eos - Grab 2 creatures"); + //AllZone.Stack.add(ability); + card.addComesIntoPlayCommand(intoPlay); + + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Scarblade Elite")) + { + final Ability_Tap ability = new Ability_Tap(card) + { + private static final long serialVersionUID = 3505019464802566898L; + + public boolean canPlay() + { + String controller = card.getController(); + PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard ,controller); + + CardList sins = new CardList(graveyard.getCards()); + sins = sins.getType("Assassin"); + + if (sins.size() > 0 && AllZone.GameAction.isCardInPlay(card) && CardFactoryUtil.canTarget(card, getTargetCard()) ) + return true; + else + return false; + + } + public boolean canPlayAI() + { + CardList human = CardFactoryUtil.AI_getHumanCreature(card, true); + human = human.filter(new CardListFilter() + { + public boolean addCard(Card c) {return AllZone.GameAction.isCardInPlay(c);} + }); + + CardListUtil.sortAttack(human); + CardListUtil.sortFlying(human); + + //if(0 < human.size()) + // setTargetCard(human.get(0)); + + PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard, Constant.Player.Computer); + + CardList grave = new CardList(graveyard.getCards()); + grave = grave.getType("Assassin"); + + if (human.size() > 0 && grave.size() > 0) + setTargetCard(human.get(0)); + + return 0 < human.size() && 0 < grave.size(); + } + + public void resolve() + { + String controller = card.getController(); + PlayerZone graveyard = AllZone.getZone(Constant.Zone.Graveyard ,controller); + + CardList sins = new CardList(graveyard.getCards()); + sins = sins.getType("Assassin"); + + if (card.getController().equals(Constant.Player.Human)) + { + Object o = AllZone.Display.getChoiceOptional("Pick an Assassin to remove", sins.toArray()); + + if(o != null) + { + Card crd = (Card)o; + graveyard.remove(crd); + + + Card c = getTargetCard(); + + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + AllZone.GameAction.destroy(c); + } + } //if o!= null + }//player.equals("human") + else + { + Card crd = sins.get(0); + graveyard.remove(crd); + + Card c = getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card, c) ) + { + AllZone.GameAction.destroy(c); + } + } + }//resolve() + };//SpellAbility + + Input target = new Input() + { + private static final long serialVersionUID = -4853162388286494888L; + + public void showMessage() + { + AllZone.Display.showMessage("Select target creature to destroy"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectCard(Card c, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(ability, card)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + if(c.isCreature() && zone.is(Constant.Zone.Play)) + { + //tap ability + card.tap(); + + ability.setTargetCard(c); + AllZone.Stack.add(ability); + stop(); + } + }//selectCard() + };//Input + + card.addSpellAbility(ability); + ability.setDescription("tap: Remove an Assassin card in your graveyard from the game: Destroy target creature."); + ability.setBeforePayMana(target); + + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Broodmate Dragon")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Dragon"); + c.setImageName("R 4 4 Dragon"); + c.setManaCost("R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Dragon"); + + c.addIntrinsicKeyword("Flying"); + + c.setBaseAttack(4); + c.setBaseDefense(4); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + + }//resolve() + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 2848700532090223394L; + + public void execute() + { + ability.setStackDescription("Broodmate Dragon - put a 4/4 red Dragon creature token into play."); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Aven Riftwatcher")) + { + Command gain2Life = new Command() + { + private static final long serialVersionUID = 5588978023269625349L; + + public boolean firstTime = true; + public void execute() + { + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.addLife(2); + + //testAndSet - only needed when comes into play. + if(firstTime){ + card.setCounter(Counters.AGE, 3); //vanishing + } + firstTime = false; + } + }; + + card.addLeavesPlayCommand(gain2Life); + card.addComesIntoPlayCommand(gain2Life); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Calciderm")) + { + Command ageCounters = new Command() + { + private static final long serialVersionUID = 431920157968451817L; + public boolean firstTime = true; + public void execute() + { + + //testAndSet - only needed when comes into play. + if(firstTime){ + card.setCounter(Counters.AGE, 4); + } + firstTime = false; + } + }; + card.addComesIntoPlayCommand(ageCounters); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Blastoderm")) + { + Command fadeCounters = new Command() + { + private static final long serialVersionUID = -580691660706977218L; + public boolean firstTime = true; + public void execute() + { + + //testAndSet - only needed when comes into play. + if(firstTime){ + card.setCounter(Counters.FADE, 3); + } + firstTime = false; + } + }; + + card.addComesIntoPlayCommand(fadeCounters); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Godsire")) + { + final SpellAbility a1 = new Ability_Tap(card) + { + private static final long serialVersionUID = -1160527561099142816L; + + public void resolve() + { + makeToken(); + } + void makeToken() + { + Card c = new Card(); + + c.setName("Beast"); + c.setImageName("RGW 8 8 Beast"); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("R G W"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Beast"); + c.setBaseAttack(8); + c.setBaseDefense(8); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + play.add(c); + }//makeToken() + + public boolean canPlayAI() + { + return AllZone.Phase.getPhase().equals("Main2"); + } + + };//SpellAbility + card.addSpellAbility(a1); + a1.setDescription("T: Put an 8/8 Beast creature token into play that's red, green, and white."); + a1.setStackDescription("Put an 8/8 Beast creature token into play that's red, green, and white."); + + //a1.setBeforePayMana(new Input_PayManaCost(a1)); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Wydwen, the Biting Gale")) + { + final SpellAbility a1 = new Ability(card,"U B") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + life.subtractLife(1); + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getOwner()); + /* + AllZone.getZone(card).remove(card); + hand.add(card); + */ + if (card.isToken()) + AllZone.getZone(card).remove(card); + else + AllZone.GameAction.moveTo(hand, card); + + + } + };//a1 + + //card.clearSpellAbility(); + card.addSpellAbility(a1); + a1.setStackDescription(card.getController() + " pays 1 life and returns Wydwen back to owner's hand."); + a1.setDescription("U B, Pay 1 life: Return Wydwen, the Biting Gale to its owner's hand."); + + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Tradewind Rider")) + { + final SpellAbility a1 = new Ability_Tap(card,"0") + { + private static final long serialVersionUID = 3438865371487994984L; + + public void chooseTargetAI() + { + if(getCreature().size() != 0) + { + Card bestCreature = CardFactoryUtil.AI_getBestCreature(getCreature()); + if(getEnchantment().size() != 0){ + Card bestEnchantment = CardFactoryUtil.AI_getBestEnchantment(getEnchantment(), card, true); + if(CardUtil.getConvertedManaCost(bestCreature.getManaCost()) > CardUtil.getConvertedManaCost(bestEnchantment.getManaCost())){ + setTargetCard(bestCreature); + } + else{ + setTargetCard(bestEnchantment); + } + } + else{ + setTargetCard(bestCreature); + } + } + else if(getArtifact().size() != 0){ + Card bestArtifact = CardFactoryUtil.AI_getBestArtifact(getArtifact()); + setTargetCard(bestArtifact); + } + + }//ChooseTargetAI() + CardList getCreature() + { + CardList list = CardFactoryUtil.AI_getHumanCreature(card, true); + return list; + }//getEnchantment() + CardList getArtifact() + { + CardList list = CardFactoryUtil.AI_getHumanArtifact(card, true); + return list; + }//getArtifact() + CardList getEnchantment() + { + CardList list = CardFactoryUtil.AI_getHumanEnchantment(card, true); + return list; + } + + + + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList cards = new CardList(); + + cards.addAll(play.getCards()); + cards = cards.filter(new CardListFilter(){ + + public boolean addCard(Card c) { + return (c.isArtifact() || c.isEnchantment() || c.isCreature() ) && CardFactoryUtil.canTarget(card, c); + } + + }); + + return cards.size() > 0; + + } + public boolean canPlay() + { + String controller = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + + CardList creats = new CardList(); + + creats.addAll(play.getCards()); + creats = creats.getType("Creature"); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isUntapped() && !c.equals(card); + } + }); + + if (creats.size() > 1 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped() && !card.hasSickness()) + return true; + else + return false; + } + public void resolve() + { + + if (getTargetCard()== null) + return; + + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void humanResolve() + { + String controller = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + CardList creats = new CardList(); + + creats.addAll(play.getCards()); + creats = creats.getType("Creature"); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isUntapped() && !c.equals(card); + } + }); + + CardList tappedCreats = new CardList(); + + Object o = AllZone.Display.getChoice("Pick first creature to tap", creats.toArray()); + + if (o!= null) + { + Card c1 = (Card)o; + creats.remove(c1); + tappedCreats.add(c1); + } + else + return; + + o = AllZone.Display.getChoice("Pick second creature to tap", creats.toArray()); + if (o!= null) + { + Card c2 = (Card)o; + creats.remove(c2); + tappedCreats.add(c2); + } + else + return; + + for(int i = 0; i CardUtil.getConvertedManaCost(bestEnchantment.getManaCost())){ + setTargetCard(bestArtifact); + } + else{ + setTargetCard(bestEnchantment); + } + } + else{ + setTargetCard(bestEnchantment); + } + } + else if(getArtifact().size() != 0){ + Card bestArtifact = CardFactoryUtil.AI_getBestArtifact(getArtifact()); + setTargetCard(bestArtifact); + } + + } + CardList getEnchantment() + { + CardList list = CardFactoryUtil.AI_getHumanEnchantment(card, true); + return list; + }//getEnchantment() + CardList getArtifact() + { + CardList list = CardFactoryUtil.AI_getHumanArtifact(card, true); + return list; + }//getArtifact() + + + public boolean canPlayAI() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + CardList cards = new CardList(); + + cards.addAll(play.getCards()); + cards = cards.filter(new CardListFilter(){ + + public boolean addCard(Card c) { + return (c.isArtifact() || c.isEnchantment() ) && CardFactoryUtil.canTarget(card, c); + } + + }); + + return cards.size() > 0; + + } + public boolean canPlay() + { + String controller = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + + CardList creats = new CardList(); + + creats.addAll(play.getCards()); + creats = creats.getType("Creature"); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isUntapped(); + } + }); + + if (creats.size() > 3 && AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + } + public void resolve() + { + + if (getTargetCard()== null) + return; + + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void humanResolve() + { + String controller = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + CardList creats = new CardList(); + + creats.addAll(play.getCards()); + creats = creats.getType("Creature"); + creats = creats.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isUntapped(); + } + }); + + CardList tappedCreats = new CardList(); + + Object o = AllZone.Display.getChoice("Pick first creature to tap", creats.toArray()); + + if (o!= null) + { + Card c1 = (Card)o; + creats.remove(c1); + tappedCreats.add(c1); + } + else + return; + + o = AllZone.Display.getChoice("Pick second creature to tap", creats.toArray()); + if (o!= null) + { + Card c2 = (Card)o; + creats.remove(c2); + tappedCreats.add(c2); + } + else + return; + + o = AllZone.Display.getChoice("Pick third creature to tap", creats.toArray()); + if (o!= null) + { + Card c3 = (Card) o; + creats.remove(c3); + tappedCreats.add(c3); + } + else + return; + + o = AllZone.Display.getChoice("Pick fourth creature to tap", creats.toArray()); + if (o!= null) + { + Card c4 = (Card) o; + creats.remove(c4); + tappedCreats.add(c4); + } + else + return; + + + for(int i = 0; i 6 && druidsUntapped > 6 && AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + } + public void resolve() + { + + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void humanResolve() + { + String controller = card.getController(); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, controller); + CardList druids = new CardList(); + + druids.addAll(play.getCards()); + druids = druids.getType("Druid"); + + CardList tappedDruids = new CardList(); + + Object o = AllZone.Display.getChoice("Pick first druid to tap", druids.toArray()); + + if (o!= null) + { + Card c1 = (Card)o; + druids.remove(c1); + tappedDruids.add(c1); + } + else + return; + + o = AllZone.Display.getChoice("Pick second druid to tap", druids.toArray()); + if (o!= null) + { + Card c2 = (Card)o; + druids.remove(c2); + tappedDruids.add(c2); + } + else + return; + + o = AllZone.Display.getChoice("Pick third druid to tap", druids.toArray()); + if (o!= null) + { + Card c3 = (Card) o; + druids.remove(c3); + tappedDruids.add(c3); + } + else + return; + + o = AllZone.Display.getChoice("Pick fourth druid to tap", druids.toArray()); + if (o!= null) + { + Card c4 = (Card) o; + druids.remove(c4); + tappedDruids.add(c4); + } + else + return; + o = AllZone.Display.getChoice("Pick fifth druid to tap", druids.toArray()); + if (o!= null) + { + Card c5 = (Card) o; + druids.remove(c5); + tappedDruids.add(c5); + } + else + return; + + o = AllZone.Display.getChoice("Pick sixth druid to tap", druids.toArray()); + if (o!= null) + { + Card c6 = (Card) o; + druids.remove(c6); + tappedDruids.add(c6); + } + else + return; + + o = AllZone.Display.getChoice("Pick seventh druid to tap", druids.toArray()); + if (o!=null) + { + Card c7 = (Card) o; + druids.remove(c7); + tappedDruids.add(c7); + } + else + return; + + for(int i = 0; i()); + if (artifact) + card.addType("Artifact"); + card.addType("Creature"); + card.addType("Kithkin"); + card.addType("Spirit"); + } + + public boolean canPlayAI() + { + return !card.getType().contains("Spirit"); + } + + };// ability1 + + ability1.setDescription("RW: Figure of Destiny becomes a 2/2 Kithkin Spirit."); + ability1.setStackDescription("Figure of Destiny becomes a 2/2 Kithkin Spirit."); + card.addSpellAbility(ability1); + + + Ability ability2 = new Ability(card, "RW RW RW") + { + public void resolve() + { + boolean artifact = false; + card.setBaseAttack(4); + card.setBaseDefense(4); + + card.removeIntrinsicKeyword("Flying"); + card.removeIntrinsicKeyword("First Strike"); + + if (card.isArtifact()) + artifact = true; + + card.setType(new ArrayList()); + if (artifact) + card.addType("Artifact"); + card.addType("Creature"); + card.addType("Kithkin"); + card.addType("Spirit"); + card.addType("Warrior"); + } + + public boolean canPlay() + { + return card.getType().contains("Spirit"); + } + + public boolean canPlayAI() + { + return !card.getType().contains("Warrior"); + } + + };// ability2 + + ability2.setDescription("RW RW RW: If Figure of Destiny is a Spirit, it becomes a 4/4 Kithkin Spirit Warrior."); + ability2.setStackDescription("Figure of Destiny becomes a 4/4 Kithkin Spirit Warrior."); + card.addSpellAbility(ability2); + + + Ability ability3 = new Ability(card, "RW RW RW RW RW RW") + { + public void resolve() + { + boolean artifact = false; + card.setBaseAttack(8); + card.setBaseDefense(8); + + card.addIntrinsicKeyword("Flying"); + card.addIntrinsicKeyword("First Strike"); + + if (card.isArtifact()) + artifact = true; + + card.setType(new ArrayList()); + if (artifact) + card.addType("Artifact"); + card.addType("Creature"); + card.addType("Kithkin"); + card.addType("Spirit"); + card.addType("Warrior"); + card.addType("Avatar"); + } + public boolean canPlay() + { + return card.getType().contains("Warrior"); + } + public boolean canPlayAI() + { + return !card.getType().contains("Avatar"); + } + };// ability3 + + ability3.setDescription("RW RW RW RW RW RW: If Figure of Destiny is a Warrior, it becomes an 8/8 Kithkin Spirit Warrior Avatar with flying and first strike. "); + ability3.setStackDescription("Figure of Destiny becomes an 8/8 Kithkin Spirit Warrior Avatar with flying and first strike."); + card.addSpellAbility(ability3); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Jenara, Asura of War")) + { + + Ability ability2 = new Ability(card, "1 W") + { + public void resolve() + { + card.addCounter(Counters.P1P1, 1); + } + };// ability2 + + ability2.setStackDescription(card.getName() + " - gets a +1/+1 counter."); + card.addSpellAbility(ability2); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + if (cardName.equals("Composite Golem")) + { + final Ability ability = new Ability(card, "0") + { + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 9) + pay = MyRandom.random.nextBoolean(); + + if(pay) + AllZone.Computer_Life.subtractLife(2); + else + card.tap(); + } + public void humanExecute() + { + PlayerLife life = AllZone.GameAction.getPlayerLife(card.getController()); + if(2 < life.getLife()) + { + String[] choices = {"Yes", "No"}; + Object o = AllZone.Display.getChoice("Pay 2 life?", choices); + if(o.equals("Yes")) + life.subtractLife(2); + else + tapCard(); + }//if + else + tapCard(); + }//execute() + private void tapCard() + { + card.tap(); + } + }); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Kabira Crossroads")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = card; + PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); + life.addLife(2); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = -4550013855602477643L; + + public void execute() + { + card.tap(); + ability.setStackDescription(card.getName() + " - " +card.getController() +" gains 2 life"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Graypelt Refuge")|| cardName.equals("Sejiri Refuge")|| cardName.equals("Jwar Isle Refuge") || + cardName.equals("Akoum Refuge")|| cardName.equals("Kazandu Refuge")) + { + final SpellAbility ability = new Ability(card, "0") + { + public void resolve() + { + Card c = card; + c.tap(); + PlayerLife life = AllZone.GameAction.getPlayerLife(c.getController()); + life.addLife(1); + } + }; + Command intoPlay = new Command() + { + private static final long serialVersionUID = 5055232386220487221L; + + public void execute() + { + card.tap(); + ability.setStackDescription(card.getName() + " - " +card.getController() +" gains 1 life"); + AllZone.Stack.add(ability); + } + }; + card.addComesIntoPlayCommand(intoPlay); + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Faerie Conclave")) + { + card.addComesIntoPlayCommand(new Command() + { + private static final long serialVersionUID = 2792041290726604698L; + + public void execute() + { + card.tap(); + } + }); + + final Command eot1 = new Command() + { + private static final long serialVersionUID = 5106629534549783845L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeIntrinsicKeyword("Flying"); + c.removeType("Creature"); + c.removeType("Faerie"); + } + }; + + final SpellAbility a1 = new Ability(card, "1 U") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(2); + c.setBaseDefense(1); + + //to prevent like duplication like "Flying Flying Creature Creature" + if(! c.getIntrinsicKeyword().contains("Flying")) + { + c.addIntrinsicKeyword("Flying"); + c.addType("Creature"); + c.addType("Faerie"); + } + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + card.setManaCost("U"); + + card.clearSpellKeepManaAbility(); + card.addSpellAbility(a1); + a1.setDescription("1U: Faerie Conclave becomes a 2/1 blue Faerie creature with flying until end of turn. It's still a land."); + a1.setStackDescription(card +" becomes a 2/1 creature with flying until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -601119544294387668L; + public void execute() {AllZone.Stack.add(a1);} + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Forbidding Watchtower")) + { + card.addComesIntoPlayCommand(new Command() + { + private static final long serialVersionUID = 5212793782060828409L; + + public void execute() + { + card.tap(); + } + }); + + final Command eot1 = new Command() + { + private static final long serialVersionUID = 8806880921707550181L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeType("Creature"); + c.removeType("Soldier"); + } + }; + + final SpellAbility a1 = new Ability(card, "1 W") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(1); + c.setBaseDefense(5); + + //to prevent like duplication like "Creature Creature" + if(! c.getType().contains("Creature")) + { + c.addType("Creature"); + c.addType("Soldier"); + } + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + + card.clearSpellKeepManaAbility(); + card.addSpellAbility(a1); + a1.setStackDescription(card +" becomes a 1/5 creature until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -7211256926392695778L; + public void execute() {AllZone.Stack.add(a1);} + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + + }//*************** END ************ END ************************** + + + + //*************** START *********** START ************************** + else if(cardName.equals("Treetop Village")) + { + card.addComesIntoPlayCommand(new Command() + { + private static final long serialVersionUID = -2246560994818997231L; + + public void execute() + { + card.tap(); + } + }); + + final Command eot1 = new Command() + { + private static final long serialVersionUID = -8535770979347971863L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeType("Creature"); + c.removeType("Ape"); + c.removeIntrinsicKeyword("Trample"); + } + }; + + final SpellAbility a1 = new Ability(card, "1 G") + { + public boolean canPlayAI() + { + return ! card.getType().contains("Creature"); + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(3); + c.setBaseDefense(3); + + //to prevent like duplication like "Creature Creature" + if(! c.getIntrinsicKeyword().contains("Trample")) + { + c.addType("Creature"); + c.addType("Ape"); + c.addIntrinsicKeyword("Trample"); + } + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + + card.clearSpellKeepManaAbility(); + card.addSpellAbility(a1); + a1.setStackDescription(card +" becomes a 3/3 creature with trample until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -6800983290478844750L; + + public void execute() {AllZone.Stack.add(a1);} + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Blinkmoth Nexus")) + { + final SpellAbility a1 = new Ability(card, "1") + { + final Command eot1 = new Command() + { + private static final long serialVersionUID = 3564161001279001235L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeIntrinsicKeyword("Flying"); + c.removeType("Artifact"); + c.removeType("Creature"); + c.removeType("Blinkmoth"); + } + }; + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(1); + c.setBaseDefense(1); + //to prevent like duplication like "Flying Flying Creature Creature" + if(! c.getIntrinsicKeyword().contains("Flying")) + { + c.addIntrinsicKeyword("Flying"); + } + c.addType("Artifact"); + c.addType("Creature"); + c.addType("Blinkmoth"); + + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + card.addSpellAbility(a1); + a1.setDescription("1: Blinkmoth Nexus becomes a 1/1 Blinkmoth artifact creature with flying until end of turn. It's still a land."); + a1.setStackDescription(card +" becomes a 1/1 creature with flying until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -5122292582368202498L; + public void execute() {AllZone.Stack.add(a1);} + }; + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + + final SpellAbility[] a2 = new SpellAbility[1]; + final Command eot2 = new Command() + { + private static final long serialVersionUID = 6180724472470740160L; + + public void execute() + { + Card c = a2[0].getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c)) + { + c.addTempAttackBoost(-1); + c.addTempDefenseBoost(-1); + } + } + }; + + a2[0] = new Ability_Tap(card,"1") + { + private static final long serialVersionUID = 3561450520225198222L; + + public boolean canPlayAI() + { + return getAttacker() != null; + } + public void chooseTargetAI() + { + setTargetCard(getAttacker()); + } + public Card getAttacker() + { + //target creature that is going to attack + Combat c = ComputerUtil.getAttackers(); + CardList att = new CardList(c.getAttackers()); + att.remove(card); + att.shuffle(); + + if(att.size() != 0) + return att.get(0); + else + return null; + }//getAttacker() + + public void resolve() + { + Card c = a2[0].getTargetCard(); + if(AllZone.GameAction.isCardInPlay(c) && CardFactoryUtil.canTarget(card,c) ) + { + c.addTempAttackBoost(1); + c.addTempDefenseBoost(1); + + AllZone.EndOfTurn.addUntil(eot2); + } + }//resolve() + };//SpellAbility + card.addSpellAbility(a2[0]); + a2[0].setDescription("1, tap: Target Blinkmoth gets +1/+1 until end of turn."); + + + @SuppressWarnings("unused") // target unused + final Input target = new Input() + { + private static final long serialVersionUID = 8913477363141356082L; + + public void showMessage() + { + ButtonUtil.enableOnlyCancel(); + AllZone.Display.showMessage("Select Blinkmoth to get +1/+1"); + } + public void selectCard(Card c, PlayerZone zone) + { + if(!CardFactoryUtil.canTarget(card, c)){ + AllZone.Display.showMessage("Cannot target this card (Shroud? Protection?)."); + } + else if(c.isCreature() && c.getType().contains("Blinkmoth")) + { + card.tap(); + AllZone.Human_Play.updateObservers(); + + a2[0].setTargetCard(c);//since setTargetCard() changes stack description + a2[0].setStackDescription(c +" gets +1/+1 until EOT"); + + AllZone.InputControl.resetInput(); + AllZone.Stack.add(a2[0]); + } + }//selectCard() + public void selectButtonCancel() + { + card.untap(); + stop(); + } + };//Input target + a2[0].setBeforePayMana(CardFactoryUtil.input_targetType(a2[0], "Blinkmoth")); + }//*************** END ************ END ************************** + + + + + //*************** START *********** START ************************** + else if(cardName.equals("Mishra's Factory")) + { + final Command eot1 = new Command() + { + private static final long serialVersionUID = -956566640027406078L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeType("Artifact"); + c.removeType("Creature"); + c.removeType("Assembly-Worker"); + } + }; + + final SpellAbility a1 = new Ability(card, "1") + { + public boolean canPlayAI() + { + return false; + //it turns into a creature, but doesn't attack +// return (! card.getKeyword().contains("Flying") && +// (CardFactoryUtil.AI_getHumanCreature("Flying").isEmpty())); + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(2); + c.setBaseDefense(2); + //to prevent like duplication like "Creature Creature" + if(! c.getKeyword().contains("Creature")) + { + c.addType("Artifact"); + c.addType("Creature"); + c.addType("Assembly-Worker"); + } + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + card.addSpellAbility(a1); + a1.setStackDescription(card +" - becomes a 2/2 creature until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -6767109002136516590L; + + public void execute() {AllZone.Stack.add(a1);} + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Terramorphic Expanse")) + { + //tap sacrifice + final Ability_Tap ability = new Ability_Tap(card, "0") + { + private static final long serialVersionUID = 5441740362881917927L; + + public boolean canPlayAI() + { + return false; + /* + //sacrifice Sakura-Tribe Elder if Human has any creatures + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.getType("Creature"); + return list.size() != 0 && card.isUntapped(); + */ + } + public void chooseTargetAI() + { + AllZone.GameAction.sacrifice(card); + } + public boolean canPlay() + { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList list = new CardList(library.getCards()); + list = list.getType("Basic"); + if (list.size() > 0 && AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + + }//canPlay() + public void resolve() + { + if(card.getOwner().equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void computerResolve() + { + CardList play = new CardList(AllZone.Computer_Play.getCards()); + play = play.getType("Basic"); + + CardList library = new CardList(AllZone.Computer_Library.getCards()); + library = library.getType("Basic"); + + //this shouldn't happen, but it is defensive programming, haha + if(library.isEmpty()) + return; + + Card land = null; + + //try to find a basic land that isn't in play + for(int i = 0; i < library.size(); i++) + if(! play.containsName(library.get(i))) + { + land = library.get(i); + break; + } + + //if not found + //library will have at least 1 basic land because canPlay() checks that + if(land == null) + land = library.get(0); + + land.tap(); + AllZone.Computer_Library.remove(land); + AllZone.Computer_Play.add(land); + + AllZone.GameAction.shuffle(Constant.Player.Computer); + }//computerResolve() + + public void humanResolve() + { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play , card.getController()); + + CardList basicLand = new CardList(library.getCards()); + basicLand = basicLand.getType("Basic"); + + Object o = AllZone.Display.getChoiceOptional("Choose a basic land", basicLand.toArray()); + if(o != null) + { + Card land = (Card)o; + land.tap(); + + library.remove(land); + play.add(land); + } + AllZone.GameAction.shuffle(card.getController()); + }//resolve() + };//SpellAbility + + Input runtime = new Input() + { + private static final long serialVersionUID = -4379321114820908030L; + boolean once = true; + public void showMessage() + { + //this is necessary in order not to have a StackOverflowException + //because this updates a card, it creates a circular loop of observers + if(once) + { + once = false; + AllZone.GameAction.sacrifice(card); + + ability.setStackDescription(card.getController() +" - Search your library for a basic land card and put it into play tapped. Then shuffle your library."); + AllZone.Stack.add(ability); + + stop(); + } + }//showMessage() + }; + card.addSpellAbility(ability); + ability.setDescription("tap, Sacrifice Terramorphic Expanse: Search your library for a basic land card and put it into play tapped. Then shuffle your library."); + ability.setBeforePayMana(runtime); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Tortuga")) + { + final Input discardThenDraw = new Input() + { + private static final long serialVersionUID = -7119292573232058526L; + int nCards = 1; + int n = 0; + + public void showMessage() + { + AllZone.Display.showMessage("Select a card to discard"); + ButtonUtil.disableAll(); + + //in case no more cards in hand + if(n == nCards || AllZone.Human_Hand.getCards().length == 0) + { + stop(); + AllZone.GameAction.drawCard(card.getController()); + n = 0; //very important, otherwise the 2nd time you play this ability, you + //don't have to discard + } + } + public void selectCard(Card card, PlayerZone zone) + { + if(zone.is(Constant.Zone.Hand)) + { + AllZone.GameAction.discard(card); + n++; + showMessage(); + } + } + };//SpellAbility + + final Ability_Tap ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -2946606436670861559L; + public boolean canPlayAI() {return false;} + public void resolve() + { + AllZone.InputControl.setInput(discardThenDraw); + } + };//SpellAbility + card.addSpellAbility(ability); + ability.setDescription("tap: Discard a card, then draw a card."); + ability.setStackDescription("Tortuga - Discard a card, then draw a card."); + ability.setBeforePayMana(new Input_NoCost_TapAbility(ability)); + + + final Ability_Tap ability2 = new Ability_Tap(card) + { + private static final long serialVersionUID = 8961266883009597786L; + public boolean canPlay() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + return hand.getCards().length == 7; + } + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + } + };//SpellAbility + card.addSpellAbility(ability2); + ability2.setDescription("tap: Draw a card. Play this ability only if you have exactly 7 cards in your hand."); + ability2.setStackDescription("Tortuga - draw a card."); + ability2.setBeforePayMana(new Input_NoCost_TapAbility(ability2)); + + }//*************** END ************ END ************************** + + + //*************** START *********** START ************************** + else if(cardName.equals("Library of Alexandria")) + { + final Ability_Tap ability2 = new Ability_Tap(card) + { + private static final long serialVersionUID = -3405763871882165537L; + public boolean canPlay() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + return hand.getCards().length == 7 && super.canPlay(); + } + public void resolve() + { + AllZone.GameAction.drawCard(card.getController()); + } + };//SpellAbility + card.addSpellAbility(ability2); + ability2.setDescription("tap: Draw a card. Play this ability only if you have exactly 7 cards in your hand."); + ability2.setStackDescription("Library of Alexandria - draw a card."); + ability2.setBeforePayMana(new Input_NoCost_TapAbility(ability2)); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if (cardName.equals("Dark Depths")) + { + Command intoPlay = new Command() + { + private static final long serialVersionUID = 6805304924956145866L; + + public boolean firstTime = true; + public void execute() + { + + if(firstTime){ + card.setCounter(Counters.ICE, 10); + } + firstTime = false; + } + }; + + card.addComesIntoPlayCommand(intoPlay); + + final SpellAbility ability = new Ability(card, "3") + { + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i 0 && AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + } + public boolean canPlayAI() { + String phase = AllZone.Phase.getPhase(); + return phase.equals(Constant.Phase.Main2); + } + + public void resolve() + { + card.subtractCounter(Counters.ICE, 1); + + if (card.getCounters(Counters.ICE) == 0) + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + //make token + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Marit Lage"); + c.setManaCost("B"); + c.setToken(true); + + c.addType("Legendary"); + c.addType("Creature"); + c.addType("Avatar"); + c.addIntrinsicKeyword("Flying"); + c.addExtrinsicKeyword("Indestructible"); + c.setBaseAttack(20); + c.setBaseDefense(20); + + play.add(c); + AllZone.GameAction.sacrifice(card); + }// if counters == 0 + } + }; + ability.setDescription("3: Remove an ice counter from Dark Depths."); + ability.setStackDescription(card.getName() +" - remove an ice counter."); + + card.addSpellAbility(ability); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Karakas")) + { + final Ability_Tap ability = new Ability_Tap(card, "0") + { + + private static final long serialVersionUID = -6589125907956046586L; + + public boolean canPlayAI() + { + CardList list = new CardList(AllZone.Human_Play.getCards()); + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isCreature() && c.getKeyword().contains("Legendary"); + } + }); + + setTargetCard(CardFactoryUtil.AI_getBestCreature(list, card)); + + return list.size() > 0; + } + + public void resolve() + { + Card c = getTargetCard(); + + if (c!=null) + { + if ( CardFactoryUtil.canTarget(card, c) && c.isCreature() && c.getType().contains("Legendary") ) + AllZone.GameAction.moveTo(AllZone.getZone(Constant.Zone.Hand, card.getOwner()), c); + } + } + }; + + Input runtime = new Input() + { + + private static final long serialVersionUID = -7649200192384343204L; + + public void showMessage() + { + CardList choice = new CardList(); + choice.addAll(AllZone.Human_Play.getCards()); + choice.addAll(AllZone.Computer_Play.getCards()); + + choice = choice.getType("Creature"); + choice = choice.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return (c.isCreature() && c.getType().contains("Legendary")); + } + }); + + //System.out.println("size of choice: " + choice.size()); + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, choice, "Select target Legendary creature:", true)); + } + }; + + ability.setDescription("tap: Return target legendary creature to its owner's hand."); + //ability.setStackDescription(card.getName() + " - gives target creature +1/+2 until end of turn."); + + card.addSpellAbility(ability); + ability.setBeforePayMana(runtime); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add G"); + card.setText(card.getSpellText() + "\r\ntap: Return target legendary creature to its owner's hand."); + //card.addIntrinsicKeyword("tap: add G"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Pendelhaven")) + { + final Ability_Tap ability = new Ability_Tap(card, "0") + { + private static final long serialVersionUID = 8154776336533992188L; + + public boolean canPlayAI() + { + return getAttacker() != null; + } + + public void chooseTargetAI() + { + setTargetCard(getAttacker()); + } + public Card getAttacker() + { + //target creature that is going to attack + Combat c = ComputerUtil.getAttackers(); + CardList att = new CardList(); + att.addAll(c.getAttackers()); + + for (int i=0; i 0 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) + return true; + else + return false; + } + + }; + + ability.setDescription("1 U, tap: Put target artifact card in your graveyard on top of your library."); + ability.setStackDescription(card.getName() + " - put artifact card in your graveyard on top of your library."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n1 U, tap: Put target artifact card in your graveyard on top of your library."); + //card.addExtrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Volrath's Stronghold")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 B") + { + private static final long serialVersionUID = 2821525387844776907L; + + public void resolve() + { + String player = card.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + + public void humanResolve() + { + CardList cards = new CardList(AllZone.Human_Graveyard.getCards()); + + CardList list = new CardList(); + + for (int i=0;i < cards.size(); i++) + { + //System.out.println("type: " +cards.get(i).getType()); + if (cards.get(i).getType().contains("Creature")){ + //System.out.println(cards.get(i).getName()); + Card c = cards.get(i); + list.add(c); + + } + } + + if (list.size() != 0) { + Object check = AllZone.Display.getChoiceOptional("Select Creature", list.toArray()); + if(check != null) + { + //PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + //library.add((Card)check, 0); + AllZone.GameAction.moveToTopOfLibrary((Card)check); + } + } + } + public void computerResolve() + { + Card[] grave = AllZone.Computer_Graveyard.getCards(); + CardList list = new CardList(grave); + CardList creats = new CardList(); + + for (int i=0;i < list.size(); i++) + { + if (list.get(i).getType().contains("Creature")){ + Card k = list.get(i); + creats.add(k); + } + + } + + //pick best artifact + if (creats.size() != 0){ + Card c = CardFactoryUtil.AI_getBestCreature(list); + if(c == null) + c = grave[0]; + //System.out.println("computer picked - " +c); + AllZone.Computer_Graveyard.remove(c); + //AllZone.Computer_Library.add(c, 0); + AllZone.GameAction.moveToTopOfLibrary(c); + } + }//computerResolve + + public boolean canPlay(){ + String controller = card.getController(); + + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, controller); + CardList list = new CardList(grave.getCards()); + CardList cards = new CardList(); + + for (int i=0;i 0 && AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) + return true; + else + return false; + } + + }; + + ability.setDescription("1 B, tap: Put target creature card in your graveyard on top of your library."); + ability.setStackDescription(card.getName() + " - put creature card in your graveyard on top of your library."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n1 U, tap: Put target creature card in your graveyard on top of your library."); + //card.addExtrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Oboro, Palace in the Clouds")) + { + final Ability ability = new Ability(card, "1") + { + + public boolean canPlayAI() + { + return false; + } + + public void resolve() + { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + AllZone.GameAction.moveTo(hand, card); + } + }; + + ability.setDescription("1: Return Oboro, Palace in the Clouds to your hand."); + ability.setStackDescription("Return " + card.getName() + " to your hand."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n1: Return Oboro, Palace in the Clouds to your hand."); + //card.addExtrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Mikokoro, Center of the Sea")) + { + final Ability_Tap ability = new Ability_Tap(card, "2") + { + private static final long serialVersionUID = -199960897120235012L; + + public void resolve() + { + AllZone.GameAction.drawCard(Constant.Player.Computer); + AllZone.GameAction.drawCard(Constant.Player.Human); + } + }; + + ability.setDescription("2, tap: Each player draws a card."); + ability.setStackDescription(card.getName() + " - Each player draws a card."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n2, tap: Each player draws a card."); + //card.addExtrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Gargoyle Castle")) + { + final Ability_Tap ability = new Ability_Tap(card, "5") + { + + private static final long serialVersionUID = 8524185208900629992L; + + public boolean canPlay() + { + if (AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) + return true; + else + return false; + } + + public void resolve() + { + String player = card.getController(); + AllZone.GameAction.sacrifice(card); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + //make token + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Gargoyle"); + c.setImageName("C 3 4 Gargoyle"); + c.setManaCost("1"); + c.setToken(true); + + c.addType("Artifact"); + c.addType("Creature"); + c.addType("Gargoyle"); + c.setBaseAttack(3); + c.setBaseDefense(4); + c.addIntrinsicKeyword("Flying"); + + play.add(c); + } + }; + + ability.setDescription("5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); + ability.setStackDescription(card.getName() + " - Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n5, tap, sacrifice Gargoyle Castle: Put a 3/4 colorless Gargoyle artifact creature token with flying onto the battlefield."); + //card.addIntrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Kher Keep")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 R") + { + private static final long serialVersionUID = 4037838521451709399L; + + public boolean canPlay() + { + if (AllZone.GameAction.isCardInPlay(card) && card.isUntapped()) + return true; + else + return false; + } + + public void resolve() + { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + //make token + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Kobolds of Kher Keep"); + c.setManaCost("R"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Kobold"); + c.setBaseAttack(0); + c.setBaseDefense(1); + + play.add(c); + } + }; + + ability.setDescription("1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); + ability.setStackDescription(card.getName() + " - Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n1 R, tap: Put a 0/1 red Kobold creature token named Kobolds of Kher Keep into play."); + //card.addIntrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Vitu-Ghazi, the City-Tree")) + { + final Ability_Tap ability = new Ability_Tap(card, "2 G W") + { + private static final long serialVersionUID = 1781653158406511188L; + + public boolean canPlay() + { + if (AllZone.GameAction.isCardInPlay(card)) + return true; + else + return false; + } + + public void resolve() + { + String player = card.getController(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); + + //make token + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setName("Saproling"); + c.setImageName("G 1 1 Saproling"); + c.setManaCost("G"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Saproling"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + play.add(c); + } + }; + + ability.setDescription("2 G W, tap: Put a 1/1 green Saproling creature token into play."); + ability.setStackDescription(card.getName() + " - Put a 1/1 green Saproling creature token named into play."); + + card.addSpellAbility(ability); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + //card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getSpellText() + "\r\n 2 G W, tap: Put a 1/1 green Saproling creature token into play."); + //card.addIntrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Gods' Eye, Gate to the Reikai")) + { + + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setManaCost("1"); + c.setToken(true); + + c.setName("Spirit"); + c.setImageName("C 1 1 Spirit"); + + c.addType("Creature"); + c.addType("Spirit"); + c.setBaseAttack(1); + c.setBaseDefense(1); + + play.add(c); + + }//resolve() + };//Ability + + Command makeToken = new Command() + { + private static final long serialVersionUID = 2339209292936869322L; + + public void execute() + { + ability.setStackDescription(card.getName()+ " - put a 1/1 Spirit creature token into play"); + AllZone.Stack.add(ability); + } + }; + + card.addDestroyCommand(makeToken); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Flagstones of Trokair")) + { + + final Ability ability = new Ability(card, "0") + { + public void resolve() + { + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController()); + + CardList plains = new CardList(lib.getCards()); + plains = plains.getType("Plains"); + + if (card.getController().equals(Constant.Player.Computer)) + { + if (plains.size() > 0) + { + Card c = plains.get(0); + lib.remove(c); + play.add(c); + c.tap(); + + } + } + else // human + { + if (plains.size() > 0) + { + Object o = AllZone.Display.getChoiceOptional("Select plains card to put into play tapped: ", plains.toArray()); + if (o != null) + { + Card c = (Card)o; + lib.remove(c); + play.add(c); + c.tap(); + } + } + } + AllZone.GameAction.shuffle(card.getController()); + }//resolve() + };//Ability + + Command fetchPlains = new Command() + { + + private static final long serialVersionUID = 5991465998493672076L; + + public void execute() + { + ability.setStackDescription(card.getName()+ " - search library for a plains card and put it into play tapped."); + AllZone.Stack.add(ability); + } + }; + + card.addDestroyCommand(fetchPlains); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Mutavault")) + { + final Command eot1 = new Command() + { + private static final long serialVersionUID = 5106629534549783845L; + + public void execute() + { + Card c = card; + + c.setBaseAttack(0); + c.setBaseDefense(0); + c.removeIntrinsicKeyword("Changeling"); + c.removeType("Creature"); + } + }; + + final SpellAbility a1 = new Ability(card, "1") + { + public boolean canPlayAI() + { + return false; + } + public void resolve() + { + Card c = card; + + c.setBaseAttack(2); + c.setBaseDefense(2); + + //to prevent like duplication like "Changeling Changeling Creature Creature" + if(! c.getIntrinsicKeyword().contains("Changeling")) + { + c.addIntrinsicKeyword("Changeling"); + c.addType("Creature"); + } + AllZone.EndOfTurn.addUntil(eot1); + } + };//SpellAbility + + card.clearSpellAbility(); + card.addSpellAbility(a1); + a1.setDescription("1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land."); + a1.setStackDescription(card +" becomes a 2/2 creature with changeling until EOT"); + + Command paid1 = new Command() { + private static final long serialVersionUID = -601119544294387668L; + public void execute() {AllZone.Stack.add(a1);} + }; + + a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1)); + + //not sure what's going on here, maybe because it's a land it doesn't add the ability to the text? + //anyway, this does the trick: + card.removeIntrinsicKeyword("tap: add 1"); + card.setText(card.getText() + "\r\n1: Mutavault becomes a 2/2 creature with all creature types until end of turn. It's still a land."); + card.addIntrinsicKeyword("tap: add 1"); + + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + if (cardName.equals("Gaea's Cradle")) + { + final SpellAbility ability = new Ability_Tap(card) + { + + private static final long serialVersionUID = -1631970749273122485L; + public void resolve() + { + CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards()); + list = list.getName("Mana Pool"); + Card mp = list.getCard(0); + + CardList creats = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards()); + creats = creats.getType("Creature"); + + for(int i=0;i 0) + return false; + + return true; + } + + public boolean canPlay() + { + @SuppressWarnings("unused") // library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); + + return 0 < card2.getCounters(Counters.LOYALTY) && + AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + + }//canPlay() + };//SpellAbility ability2 + + ability2.setBeforePayMana(new Input() + { + + + private static final long serialVersionUID = 2828718386226165026L; + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + + + AllZone.Stack.push(ability2); + } + stop(); + }//showMessage() + }); + + + //ability3 + final SpellAbility ability3 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 7); + turn[0] = AllZone.Phase.getTurn(); + + //make all permanents in play/hand/library and graveyard + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController()); + + CardList list = new CardList();; + list.addAll(library.getCards()); + list = list.getType("Elf"); + + //currently, just adds all elves into play. + for (int i=0;i < list.size(); i++) + { + Card c = list.get(i); + if (c.isCreature() ) + { + library.remove(c); + play.add(c); + } + } + } + public boolean canPlay() + { + return 7 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + public boolean canPlayAI() + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, Constant.Player.Computer); + + CardList elves = new CardList(lib.getCards()); + elves = elves.getType("Elf"); + + return elves.size() > 3; + } + }; + ability3.setBeforePayMana(new Input() + { + + private static final long serialVersionUID = -7189927522150479572L; + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability3); + } + stop(); + }//showMessage() + }); + + //ability 1: search for Nessa's Chosen + final SpellAbility ability1 = new Ability(card2, "0") + { + public void resolve() + { + card2.addCounter(Counters.LOYALTY, 1); + turn[0] = AllZone.Phase.getTurn(); + + if (card2.getController().equals(Constant.Player.Human)){ + Object check = AllZone.Display.getChoiceOptional("Search for Nissa's Chosen", AllZone.Human_Library.getCards()); + if(check != null) + { + Card c = (Card)check; + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card2.getController()); + + if (c.getName().equals("Nissa's Chosen")) + { + lib.remove(c); + play.add(c); + } + } + AllZone.GameAction.shuffle(Constant.Player.Human); + }//human + else + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card2.getController()); + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); + CardList nissas = new CardList(lib.getCards()); + nissas = nissas.getName("Nissa's Chosen"); + + if (nissas.size() > 0) + { + Card nissa = nissas.get(0); + lib.remove(nissa); + play.add(nissa); + } + AllZone.GameAction.shuffle(Constant.Player.Computer); + } + + } + public boolean canPlayAI() + { + if(ability3.canPlay() && ability3.canPlayAI()) { + return false; + } else + { + return true; + } + } + public boolean canPlay() + { + return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + };//SpellAbility ability1 + + ability1.setBeforePayMana(new Input() + { + + private static final long serialVersionUID = 7668642820407492396L; + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability1); + } + stop(); + }//showMessage() + }); + + ability1.setDescription("+1: Search your library for a card named Nissa's Chosen and put it onto the battlefield. Then shuffle your library."); + ability1.setStackDescription("Nissa Revane - Search for a card named Nissa's Chosen and put it onto the battlefield."); + card2.addSpellAbility(ability1); + + ability2.setDescription("+1: You gain 2 life for each Elf you control."); + ability2.setStackDescription("Nissa Revane - You gain 2 life for each Elf you control."); + + card2.addSpellAbility(ability2); + + ability3.setDescription("-7: Search your library for any number of Elf creature cards and put them onto the battlefield. Then shuffle your library."); + ability3.setStackDescription("Nissa Revane - Search your library for any number of Elf creature cards and put them onto the battlefield. Then shuffle your library."); + card2.addSpellAbility(ability3); + + return card2; + } + //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Nicol Bolas, Planeswalker")) + { + + final int turn[] = new int[1]; + turn[0] = -1; + + final Card card2 = new Card() + { + public void addDamage(int n) + { + subtractCounter(Counters.LOYALTY, n); + AllZone.GameAction.checkStateEffects(); + } + }; + card2.addCounter(Counters.LOYALTY, 5); + + card2.setOwner(owner); + card2.setController(owner); + + card2.setName(card.getName()); + card2.setType(card.getType()); + card2.setManaCost(card.getManaCost()); + card2.addSpellAbility(new Spell_Permanent(card2)); + + //ability3 + final SpellAbility ability3 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 9); + turn[0] = AllZone.Phase.getTurn(); + + String player = card2.getController(); + String opponent = AllZone.GameAction.getOpponent(player); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, opponent); + CardList oppPerms = new CardList(play.getCards()); + + PlayerLife life = AllZone.GameAction.getPlayerLife(opponent); + life.subtractLife(7); + + for (int j=0; j<7; j++) + { + //will not actually let human choose which cards to discard + AllZone.GameAction.discardRandom(opponent); + } + + CardList permsToSac = new CardList(); + CardList oppPermTempList = new CardList(play.getCards()); + + if (player.equals("Human")) + { + for(int k=0; k < oppPerms.size(); k++) + { + Card c = oppPerms.get(k); + + permsToSac.add(c); + + if (k == 6) + break; + } + } + + else //computer + { + Object o = null; + for(int k=0; k < oppPerms.size(); k++) + { + o = AllZone.Display.getChoiceOptional("Select Card to sacrifice", oppPermTempList.toArray()); + Card c = (Card)o; + //AllZone.GameAction.sacrifice(c); + permsToSac.add(c); + oppPermTempList.remove(c); + + + if (k == 6) + break; + } + } + for(int m=0;m highestCost) + { + highestCost = CardUtil.getConvertedManaCost(nonCreaturePermanents.get(i).getManaCost()); + bestCard = nonCreaturePermanents.get(i); + } + } + if (bestCard == null && nonCreaturePermanents.size() > 0) + { + bestCard = nonCreaturePermanents.get(0); + return bestCard; + } + + return null; + } + };//SpellAbility ability1 + + ability1.setBeforePayMana(new Input() + { + private static final long serialVersionUID = 9167121234861249451L; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability1); + } + stop(); + }//showMessage() + }); + + ability1.setDescription("+3: Destroy target noncreature permanent."); + ability1.setStackDescription("Nicol Bolas - Destroy target noncreature permanent."); + ability1.setBeforePayMana(CardFactoryUtil.input_targetNonCreaturePermanent(ability1, Command.Blank)); + + card2.addSpellAbility(ability1); + + ability2.setDescription("-2: Gain control of target creature."); + ability2.setStackDescription("Nicol Bolas - Gain control of target creature."); + ability2.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability2)); + + card2.addSpellAbility(ability2); + + ability3.setDescription("-9: Nicol Bolas deals 7 damage to target player. That player discards 7 cards, then sacrifices 7 permanents."); + ability3.setStackDescription("Nicol Bolas - deals 7 damage to target player. That player discards 7 cards, then sacrifices 7 permanents."); + card2.addSpellAbility(ability3); + + return card2; + } + //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Ajani Goldmane")) + { + //computer only plays ability 1 and 3, gain life and put X\X token into play + final int turn[] = new int[1]; + turn[0] = -1; + + final Card card2 = new Card() + { + public void addDamage(int n) + { + subtractCounter(Counters.LOYALTY,n); + AllZone.GameAction.checkStateEffects(); + } + }; + card2.addCounter(Counters.LOYALTY, 4); + + card2.setOwner(owner); + card2.setController(owner); + + card2.setName(card.getName()); + card2.setType(card.getType()); + card2.setManaCost(card.getManaCost()); + card2.addSpellAbility(new Spell_Permanent(card2)); + + //ability2: all controller's creatures get +1\+1 and vigilance until EOT + final SpellAbility ability2 = new Ability(card2, "0") + { + final Command untilEOT = new Command() + { + private static final long serialVersionUID = -5436621445704076988L; + + public void execute() + { + String player = card2.getController(); + CardList creatures; + if(player.equals(Constant.Player.Human)) { + creatures = new CardList(AllZone.Human_Play.getCards()); + } else { + creatures = new CardList(AllZone.Computer_Play.getCards()); + } + + creatures = creatures.getType("Creature"); + + for (int i = 0; i < creatures.size(); i++) { + Card card = creatures.get(i); + //card.setAttack(card.getAttack() - 1); + //card.setDefense(card.getDefense() - 1); + card.removeExtrinsicKeyword("Vigilance"); + } + } + }; + + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY,1); + turn[0] = AllZone.Phase.getTurn(); + + String player = card2.getController(); + CardList creatures; + if(player.equals(Constant.Player.Human)) { + creatures = new CardList(AllZone.Human_Play.getCards()); + } else { + creatures = new CardList(AllZone.Computer_Play.getCards()); + } + + creatures = creatures.getType("Creature"); + + for (int i = 0; i < creatures.size(); i++) { + Card card = creatures.get(i); + card.addCounter(Counters.P1P1,1); + card.addExtrinsicKeyword("Vigilance"); + } + + AllZone.EndOfTurn.addUntil(untilEOT); + } + + public boolean canPlayAI() + { + return false; + } + + public boolean canPlay() + { + @SuppressWarnings("unused") // library + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); + + return 0 < card2.getCounters(Counters.LOYALTY) && + AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + + }//canPlay() + };//SpellAbility ability2 + + ability2.setBeforePayMana(new Input() + { + private static final long serialVersionUID = 6373573398967821630L; + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability2); + } + stop(); + }//showMessage() + }); + + //ability3 + final SpellAbility ability3 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 6); + turn[0] = AllZone.Phase.getTurn(); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController()); + + //Create token + Card c = new Card(); + + c.setOwner(card.getController()); + c.setController(card.getController()); + + c.setImageName("W N N Avatar"); + c.setName("Avatar"); + c.setManaCost("W"); + c.setToken(true); + + c.addType("Creature"); + c.addType("Avatar"); + c.setBaseAttack(AllZone.GameAction.getPlayerLife(card.getController()).getLife()); + c.setBaseDefense(AllZone.GameAction.getPlayerLife(card.getController()).getLife()); + + c.addIntrinsicKeyword("This creature's power and toughness are each equal to your life total."); + + play.add(c); + } + public boolean canPlay() + { + return 6 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + 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; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability3); + } + stop(); + }//showMessage() + }); + + //ability 1: gain 2 life + final SpellAbility ability1 = new Ability(card2, "0") + { + public void resolve() + { + card2.addCounter(Counters.LOYALTY, 1); + turn[0] = AllZone.Phase.getTurn(); + + + AllZone.GameAction.getPlayerLife(card.getController()).addLife(2); + System.out.println("current phase: " +AllZone.Phase.getPhase()); + } + public boolean canPlayAI() + { + if(ability3.canPlay() && ability3.canPlayAI()) { + return false; + } else + { + return true; + } + } + public boolean canPlay() + { + return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + };//SpellAbility ability1 + + ability1.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -7969603493514210825L; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability1); + } + stop(); + }//showMessage() + }); + + ability1.setDescription("+1: You gain 2 life."); + ability1.setStackDescription("Ajani Goldmane - " + card2.getController() + " gains 2 life"); + card2.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."); + card2.addSpellAbility(ability2); + + ability3.setDescription("-6: Put a white Avatar creature token into play with \"This creature's power and toughness are each equal to your life total.\""); + ability3.setStackDescription("Ajani Goldmane - Put X\\X white Avatar creature token into play."); + card2.addSpellAbility(ability3); + + return card2; + } + //*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Liliana Vess")) + { + //computer only plays ability 1 and 3, discard and return creature from graveyard to play + final int turn[] = new int[1]; + turn[0] = -1; + + final Card card2 = new Card() + { + public void addDamage(int n) + { + subtractCounter(Counters.LOYALTY,n); + AllZone.GameAction.checkStateEffects(); + } + }; + card2.addCounter(Counters.LOYALTY, 5); + + card2.setOwner(owner); + card2.setController(owner); + + card2.setName(card.getName()); + card2.setType(card.getType()); + card2.setManaCost(card.getManaCost()); + card2.addSpellAbility(new Spell_Permanent(card2)); + + //ability2 + final SpellAbility ability2 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 2); + turn[0] = AllZone.Phase.getTurn(); + + String player = card2.getController(); + if(player.equals(Constant.Player.Human)) + humanResolve(); + else + computerResolve(); + } + public void computerResolve() + { + CardList creature = new CardList(AllZone.Computer_Library.getCards()); + creature = creature.getType("Creature"); + if(creature.size() != 0) + { + Card c = creature.get(0); + AllZone.GameAction.shuffle(card2.getController()); + + //move to top of library + AllZone.Computer_Library.remove(c); + AllZone.Computer_Library.add(c, 0); + } + }//computerResolve() + public void humanResolve() + { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); + + CardList list = new CardList(library.getCards()); + + if(list.size() != 0) + { + Object o = AllZone.Display.getChoiceOptional("Select any card", list.toArray()); + + AllZone.GameAction.shuffle(card2.getController()); + if(o != null) + { + //put creature on top of library + library.remove(o); + library.add((Card)o, 0); + } + }//if + }//resolve() + public boolean canPlayAI() + { + return false; + } + + public boolean canPlay() + { + PlayerZone library = AllZone.getZone(Constant.Zone.Library, card2.getController()); + + return 2 <= card2.getCounters(Counters.LOYALTY) && + AllZone.getZone(card2).is(Constant.Zone.Play) && + 1 < library.size() && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + };//SpellAbility ability2 + + ability2.setBeforePayMana(new Input() + { + private static final long serialVersionUID = 5726590384281714755L; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability2); + } + stop(); + }//showMessage() + }); + + //ability3 + final SpellAbility ability3 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 8); + turn[0] = AllZone.Phase.getTurn(); + + //get all graveyard creatures + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + list = list.getType("Creature"); + + PlayerZone play = AllZone.getZone(Constant.Zone.Play, card2.getController()); + PlayerZone grave = null; + Card c = null; + for(int i = 0; i < list.size(); i++) + { + //this is a rough hack, but no one will ever see this code anyways, lol ;+) + c = list.get(i); + c.setController(card.getController()); + + grave = AllZone.getZone(c); + if(grave != null) + grave.remove(c); + + play.add(c); + } + } + public boolean canPlay() + { + return 8 <= card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + public boolean canPlayAI() + { + CardList list = new CardList(); + list.addAll(AllZone.Human_Graveyard.getCards()); + list.addAll(AllZone.Computer_Graveyard.getCards()); + list = list.getType("Creature"); + + return 3 < list.size(); + } + }; + ability3.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -3297439284172874241L; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + AllZone.Stack.push(ability3); + } + stop(); + }//showMessage() + }); + + //ability 1 + final SpellAbility ability1 = new Ability(card2, "0") + { + public void resolve() + { + card2.addCounter(Counters.LOYALTY,1); + turn[0] = AllZone.Phase.getTurn(); + + String s = getTargetPlayer(); + setStackDescription("Liliana Vess - " +s +" discards a card"); + + if(s.equals(Constant.Player.Human)) + AllZone.InputControl.setInput(CardFactoryUtil.input_discard()); + else + AllZone.GameAction.discardRandom(Constant.Player.Computer); + } + public boolean canPlayAI() + { + if(ability3.canPlay() && ability3.canPlayAI()) + return false; + else + { + setTargetPlayer(Constant.Player.Human); + return true; + } + } + public boolean canPlay() + { + return 0 < card2.getCounters(Counters.LOYALTY) && AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn"); + }//canPlay() + };//SpellAbility ability1 + + Input target = new Input() + { + private static final long serialVersionUID = 4997055112713151705L; + + public void showMessage() + { + AllZone.Display.showMessage("Select target player"); + ButtonUtil.enableOnlyCancel(); + } + public void selectButtonCancel() {stop();} + public void selectPlayer(String player) + { + turn[0] = AllZone.Phase.getTurn(); + ability1.setTargetPlayer(player); + AllZone.Stack.add(ability1); + stop(); + } + };//Input target + ability1.setBeforePayMana(target); + ability1.setDescription("+1: Target player discards a card."); + card2.addSpellAbility(ability1); + + ability2.setDescription("-2: Search your library for a card, then shuffle your library and put that card on top of it."); + ability2.setStackDescription("Liliana Vess - Search your library for a card, then shuffle your library and put that card on top of it."); + card2.addSpellAbility(ability2); + + ability3.setDescription("-8: Put all creature cards in all graveyards into play under your control."); + ability3.setStackDescription("Liliana Vess - Put all creature cards in all graveyards into play under your control."); + card2.addSpellAbility(ability3); + + return card2; + } + //*************** 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; + + final Card card2 = new Card() + { + public void addDamage(int n) + { + subtractCounter(Counters.LOYALTY, n); + AllZone.GameAction.checkStateEffects(); + } + }; + card2.addCounter(Counters.LOYALTY, 6); + + card2.setOwner(owner); + card2.setController(owner); + + card2.setName(card.getName()); + card2.setType(card.getType()); + card2.setManaCost(card.getManaCost()); + card2.addSpellAbility(new Spell_Permanent(card2)); + + //ability 1 + final SpellAbility ability1 = new Ability(card2, "0") + { + public void resolve() + { + card2.addCounter(Counters.LOYALTY, 1); + turn[0] = AllZone.Phase.getTurn(); + + if(getTargetCard() != null) + { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card2,getTargetCard())) + { + Card c = getTargetCard(); + if (CardFactoryUtil.canDamage(card2, c)) + c.addDamage(1); + } + } + + else + { + PlayerLife life = AllZone.GameAction.getPlayerLife(getTargetPlayer()); + life.subtractLife(1); + } + } + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i= 4 && AllZone.Phase.getPhase().equals(Constant.Phase.Main1) && + AllZone.Phase.getActivePlayer().equals(card2.getController()); + } + };//SpellAbility ability3 + Input runtime3 = new Input() + { + private static final long serialVersionUID = 7697504647440222302L; + + int check = -1; + public void showMessage() + { + if(check != AllZone.Phase.getTurn()) + { + check = AllZone.Phase.getTurn(); + turn[0] = AllZone.Phase.getTurn(); + + AllZone.Stack.push(ability3); + stop(); + } + } + };//Input + ability3.setStackDescription(card2.getName() +" - Creatures you control get +3/+3 and trample until end of turn."); + ability3.setDescription("-4: Creatures you control get +3/+3 and trample until end of turn."); + ability3.setBeforePayMana(runtime3); + card2.addSpellAbility(ability3); + //end ability 3 + + return card2; + }//*************** END ************ END ************************** + + return card; + } +} \ No newline at end of file diff --git a/src/Computer.java b/src/Computer.java index 15bb224841d..d50743b402d 100644 --- a/src/Computer.java +++ b/src/Computer.java @@ -11,5 +11,7 @@ public interface Computer public void main2(); public void end_of_turn();//end of Human's turn + public void addNumberPlayLands(int n); + public void stack_not_empty(); } diff --git a/src/ComputerAI_Burn.java b/src/ComputerAI_Burn.java index d360abeb2d9..d28e7ac78a1 100644 --- a/src/ComputerAI_Burn.java +++ b/src/ComputerAI_Burn.java @@ -1,3 +1,5 @@ + + //import java.util.*; import javax.swing.SwingUtilities; @@ -5,11 +7,11 @@ import forge.error.ErrorViewer; public class ComputerAI_Burn implements Computer { - private volatile boolean playLand = true; + private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); public void main1() { - if(playLand) { - playLand = false; + if(numberPlayLand > 0) { + numberPlayLand--; ComputerUtil.playLand(); } Runnable run = new Runnable() { @@ -53,17 +55,16 @@ public class ComputerAI_Burn implements Computer { }//main1() public void main2() { - playLand = true; + numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?"); AllZone.Phase.setNeedToNextPhase(true); } - - public void declare_attackers_before() { - AllZone.Phase.setNeedToNextPhase(true); + public void declare_attackers_before() + { + AllZone.Phase.setNeedToNextPhase(true); } - public void declare_attackers() { //AllZone.Phase.nextPhase(); @@ -119,12 +120,17 @@ public class ComputerAI_Burn implements Computer { for(int i = 0; i < 14; i++) library.add(cf.getCard("Mountain", Constant.Player.Computer)); - if(library.size() != 40) throw new RuntimeException( - "ComputerAI_Burn : getLibrary() error, library size is " + library.size()); + if(library.size() != 40) + throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size()); return library.toArray(); } + public void addNumberPlayLands(int n) + { + numberPlayLand += n; + } + public void stack_not_empty() { //same as Input.stop() method //ends the method diff --git a/src/ComputerAI_Burn2.java b/src/ComputerAI_Burn2.java index 559a45ab34b..8c3a094c4ed 100644 --- a/src/ComputerAI_Burn2.java +++ b/src/ComputerAI_Burn2.java @@ -5,11 +5,11 @@ import forge.error.ErrorViewer; public class ComputerAI_Burn2 implements Computer { - private volatile boolean playLand = true; + private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); public void main1() { - if(playLand) { - playLand = false; + if(numberPlayLand > 0 ) { + numberPlayLand--; ComputerUtil.playLand(); Card c[] = AllZone.Computer_Hand.getCards(); @@ -73,15 +73,16 @@ public class ComputerAI_Burn2 implements Computer { }//main1() public void main2() { - playLand = true; + numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?"); AllZone.Phase.setNeedToNextPhase(true); } - public void declare_attackers_before() { - AllZone.Phase.setNeedToNextPhase(true); + public void declare_attackers_before() + { + AllZone.Phase.setNeedToNextPhase(true); } public void declare_attackers() { @@ -161,12 +162,17 @@ public class ComputerAI_Burn2 implements Computer { for(int i = 0; i < 17; i++) library.add(cf.getCard("Mountain", Constant.Player.Computer)); - if(library.size() != 40) throw new RuntimeException( - "ComputerAI_Burn : getLibrary() error, library size is " + library.size()); + if(library.size() != 40) + throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size()); return library.toArray(); } + public void addNumberPlayLands(int n) + { + numberPlayLand += n; + } + public void stack_not_empty() { //same as Input.stop() method //ends the method @@ -174,4 +180,4 @@ public class ComputerAI_Burn2 implements Computer { AllZone.InputControl.resetInput(); AllZone.InputControl.updateObservers(); } -} +} \ No newline at end of file diff --git a/src/ComputerAI_General.java b/src/ComputerAI_General.java index c93666d33e0..297dcbb7eb8 100644 --- a/src/ComputerAI_General.java +++ b/src/ComputerAI_General.java @@ -6,7 +6,8 @@ import java.util.TreeSet; public class ComputerAI_General implements Computer { - private boolean playLand = true; + //private boolean playLand = true; + private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); private Collection playMain1Cards; @SuppressWarnings("unchecked") @@ -17,23 +18,36 @@ public class ComputerAI_General implements Computer { } public void main1() { - if(playLand) { - playLand = false; + if(numberPlayLand > 0) { + numberPlayLand--; ComputerUtil.playLand(); for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) { Command com = GameActionUtil.commands.get(effect); com.execute(); } - GameActionUtil.executeCardStateEffects(); + GameActionUtil.executeCardStateEffects(); } -// AllZone.Phase.nextPhase(); + // AllZone.Phase.nextPhase(); playCards(Constant.Phase.Main1); + + //for cards like Exploration, Fastbond, Azusa, ... + while(numberPlayLand > 0) + { + numberPlayLand--; + ComputerUtil.playLand(); + + for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) { + Command com = GameActionUtil.commands.get(effect); + com.execute(); + } + GameActionUtil.executeCardStateEffects(); + } }//main1() public void main2() { - playLand = true; + numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); playCards(Constant.Phase.Main2); } @@ -292,6 +306,11 @@ public class ComputerAI_General implements Computer { return library.toArray(); } + public void addNumberPlayLands(int n) + { + numberPlayLand += n; + } + public void stack_not_empty() { //same as Input.stop() method //ends the method diff --git a/src/ComputerAI_Input.java b/src/ComputerAI_Input.java index 8758964e594..97d3498006f 100644 --- a/src/ComputerAI_Input.java +++ b/src/ComputerAI_Input.java @@ -21,6 +21,12 @@ public class ComputerAI_Input extends Input think(); }//getMessage(); + + public Computer getComputer() + { + return computer; + } + private void think() { final String phase = AllZone.Phase.getPhase(); diff --git a/src/ComputerAI_Rats2.java b/src/ComputerAI_Rats2.java index f8ed2779e9a..cb2dee9b1e3 100644 --- a/src/ComputerAI_Rats2.java +++ b/src/ComputerAI_Rats2.java @@ -2,15 +2,15 @@ import java.util.*; public class ComputerAI_Rats2 implements Computer { - private boolean playLand = true; + private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); private static Random random = new Random(); public void main1() { - if(playLand) + if(numberPlayLand > 0) { - playLand = false; + numberPlayLand--; ComputerUtil.playLand(); } @@ -25,7 +25,7 @@ public class ComputerAI_Rats2 implements Computer } public void main2() { - playLand = true; + numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main2) = true"); @@ -132,6 +132,12 @@ public class ComputerAI_Rats2 implements Computer //for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.playInstantAndAbilities) = true"); AllZone.Phase.setNeedToNextPhase(true); } + + public void addNumberPlayLands(int n) + { + numberPlayLand += n; + } + public void stack_not_empty() { AllZone.InputControl.resetInput(); diff --git a/src/ComputerAI_Testing.java b/src/ComputerAI_Testing.java index af968bff633..568400f00b7 100644 --- a/src/ComputerAI_Testing.java +++ b/src/ComputerAI_Testing.java @@ -1,6 +1,8 @@ public class ComputerAI_Testing implements Computer { + private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer); + //must shuffle this public Card[] getLibrary() {return new Card[] {};} @@ -56,4 +58,9 @@ public class ComputerAI_Testing implements Computer //for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.end_of_turn) = true"); AllZone.Phase.setNeedToNextPhase(true); } + + public void addNumberPlayLands(int n) + { + numberPlayLand += n; + } } \ No newline at end of file diff --git a/src/Input_Draw.java b/src/Input_Draw.java index 2cc1708d702..b2a2c7f5586 100644 --- a/src/Input_Draw.java +++ b/src/Input_Draw.java @@ -22,7 +22,9 @@ boolean humanSkipsDrawPhase = humanCards.containsName("Necropotence") || humanCards.containsName("Yawgmoth's Bargain"); if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase){ - Input_Main.canPlayLand = true; + //Input_Main.canPlayLand = true; + Input_Main.canPlayNumberOfLands = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human); + Input_Main.firstLandHasBeenPlayed = false; AllZone.Phase.setNeedToNextPhase(true); } @@ -56,7 +58,9 @@ if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) { - Input_Main.canPlayLand = true; + //Input_Main.canPlayLand = true; + Input_Main.canPlayNumberOfLands = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human); + Input_Main.firstLandHasBeenPlayed = false; //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true"); diff --git a/src/Input_Main.java b/src/Input_Main.java index 4ae52f6fa58..8b1dd691616 100644 --- a/src/Input_Main.java +++ b/src/Input_Main.java @@ -5,7 +5,9 @@ public class Input_Main extends Input { private static final long serialVersionUID = -2162856359060870957L; //Input_Draw changes this - public static boolean canPlayLand; + //public static boolean canPlayLand; + public static boolean firstLandHasBeenPlayed; + public static int canPlayNumberOfLands; public void showMessage() { @@ -18,7 +20,6 @@ public class Input_Main extends Input } public void selectButtonOK() { - //AllZone.Phase.nextPhase(); //for debugging: System.out.println("need to nextPhase(Input_Main.selectButtonOK) = true"); AllZone.Phase.setNeedToNextPhase(true); @@ -28,14 +29,26 @@ public class Input_Main extends Input //these if statements cannot be combined if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) { - if(canPlayLand) + if(canPlayNumberOfLands > 0 ) { - InputUtil.playAnyCard(card, zone); - canPlayLand = false; - AllZone.GameAction.checkStateEffects(); + CardList fastbonds = CardFactoryUtil.getFastbonds(Constant.Player.Human); + if (fastbonds.size() > 0){ + if (firstLandHasBeenPlayed) + { + for ( Card vard : fastbonds) + { + AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife(1); + } + } + } + InputUtil.playAnyCard(card, zone); + canPlayNumberOfLands--; + firstLandHasBeenPlayed = true; + AllZone.GameAction.checkStateEffects(); } //TODO: add code for exploration / fastbond here + } else { diff --git a/src/PlayerZone_ComesIntoPlay.java b/src/PlayerZone_ComesIntoPlay.java index d7244b378b1..0b486a4831e 100644 --- a/src/PlayerZone_ComesIntoPlay.java +++ b/src/PlayerZone_ComesIntoPlay.java @@ -21,6 +21,21 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone super.add(o); Card c = (Card) o; + + //cannot use addComesIntoPlayCommand - trigger might be set to false; + if (c.getName().equals("Exploration")) { + Input_Main.canPlayNumberOfLands++; + AllZone.Computer.getComputer().addNumberPlayLands(1); + } + else if (c.getName().equals("Azusa, Lost but Seeking")) { + Input_Main.canPlayNumberOfLands+=2; + AllZone.Computer.getComputer().addNumberPlayLands(2); + } + else if( c.getName().equals("Fastbond")) { + Input_Main.canPlayNumberOfLands+=100; + AllZone.Computer.getComputer().addNumberPlayLands(100); + } + if (trigger) { c.setSickness(true);// summoning sickness @@ -108,7 +123,23 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone super.remove(o); - Card c = (Card) o; + Card c = (Card) o; + + //cannot use addLeavesPlayCommand - trigger might be set to false + if (c.getName().equals("Exploration")) { + Input_Main.canPlayNumberOfLands--; + AllZone.Computer.getComputer().addNumberPlayLands(-1); + } + else if (c.getName().equals("Azusa, Lost but Seeking")) { + Input_Main.canPlayNumberOfLands-=2; + AllZone.Computer.getComputer().addNumberPlayLands(-2); + } + else if( c.getName().equals("Fastbond")) { + Input_Main.canPlayNumberOfLands-=100; + AllZone.Computer.getComputer().addNumberPlayLands(-100); + } + + if (leavesTrigger) c.leavesPlay();