From 7d3169d2cf72834bf8bd4207274c4a57eace2ec2 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 15:48:18 +0000 Subject: [PATCH] - Convert Memory Erosion, Mindwrack Liege, Xiahou Dun, the One-Eyed, Loyal Retainers, Order of Whiteclay to AFs - moveTo Tweaks --- res/cardsfolder/loyal_retainers.txt | 1 + res/cardsfolder/memory_erosion.txt | 4 +- res/cardsfolder/mindwrack_liege.txt | 3 +- res/cardsfolder/order_of_whiteclay.txt | 1 + res/cardsfolder/xiahou_dun_the_one_eyed.txt | 1 + src/forge/CardFactory_Creatures.java | 332 -------------------- src/forge/GameActionUtil.java | 37 +-- 7 files changed, 16 insertions(+), 363 deletions(-) diff --git a/res/cardsfolder/loyal_retainers.txt b/res/cardsfolder/loyal_retainers.txt index a524587af68..f634002ff77 100644 --- a/res/cardsfolder/loyal_retainers.txt +++ b/res/cardsfolder/loyal_retainers.txt @@ -3,6 +3,7 @@ ManaCost:2 W Types:Creature Human Advisor Text:no text PT:1/1 +A:AB$ChangeZone | Cost$ Sac<1/CARDNAME> | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.Legendary+YouCtrl | TgtPrompt$ Select a target legendary creature card from your graveyard | ChangeNum$ 1 | PlayerTurn$ True | ActivatingPhases$ Upkeep->BeginCombat | SpellDescription$ Return target legendary creature card from your graveyard to the battlefield. Activate this ability only during your turn, before attackers are declared. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/loyal_retainers.jpg SetInfo:PTK|Uncommon|http://magiccards.info/scans/en/p3k/12.jpg diff --git a/res/cardsfolder/memory_erosion.txt b/res/cardsfolder/memory_erosion.txt index 0e711d788de..e056ba77042 100644 --- a/res/cardsfolder/memory_erosion.txt +++ b/res/cardsfolder/memory_erosion.txt @@ -1,7 +1,9 @@ Name:Memory Erosion ManaCost:1 U U Types:Enchantment -Text:Whenever an opponent casts a spell, that player puts the top two cards of his or her library into his or her graveyard. +Text:no text +T:Mode$ SpellCast | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigMill | TriggerDescription$ Whenever an opponent casts a spell, that player puts the top two cards of his or her library into his or her graveyard. +SVar:TrigMill:AB$Mill | Cost$ 0 | Defined$ Opponent | NumCards$ 2 SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/memory_erosion.jpg SetInfo:ALA|Rare|http://magiccards.info/scans/en/ala/50.jpg diff --git a/res/cardsfolder/mindwrack_liege.txt b/res/cardsfolder/mindwrack_liege.txt index 63809ba9921..8dbdb41573a 100644 --- a/res/cardsfolder/mindwrack_liege.txt +++ b/res/cardsfolder/mindwrack_liege.txt @@ -1,10 +1,11 @@ Name:Mindwrack Liege ManaCost:3 UR UR UR Types:Creature Horror -Text:UR UR UR UR: You may put a blue or red creature card from your hand onto the battlefield. +Text:no text PT:4/4 K:stPumpAll:Creature.Blue+Other+YouCtrl:1/1:No Condition:Other blue creatures you control get +1/+1. K:stPumpAll:Creature.Red+Other+YouCtrl:1/1:No Condition:Other red creatures you control get +1/+1. +A:AB$ChangeZone | Cost$ UR UR UR UR | Origin$ Hand | Destination$ Battlefield | ChangeType$ Creature.Blue,Creature.Red | ChangeNum$ 1 | SpellDescription$ You may put a blue or red creature card from your hand onto the battlefield. SVar:PlayMain1:TRUE SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/mindwrack_liege.jpg diff --git a/res/cardsfolder/order_of_whiteclay.txt b/res/cardsfolder/order_of_whiteclay.txt index 339aa68ccb9..81a95525b2b 100644 --- a/res/cardsfolder/order_of_whiteclay.txt +++ b/res/cardsfolder/order_of_whiteclay.txt @@ -3,6 +3,7 @@ ManaCost:1 W W Types:Creature Kithkin Cleric Text:no text PT:1/4 +A:AB$ChangeZone | Cost$ 1 W W Untap | Origin$ Graveyard | Destination$ Battlefield | ValidTgts$ Creature.cmcLE3+YouCtrl | TgtPrompt$ Select a creature card with converted mana cost 3 or less from your graveyard | ChangeNum$ 1 | SpellDescription$ Return target creature card with converted mana cost 3 or less from your graveyard to the battlefield. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/order_of_whiteclay.jpg SetInfo:SHM|Rare|http://magiccards.info/scans/en/shm/16.jpg diff --git a/res/cardsfolder/xiahou_dun_the_one_eyed.txt b/res/cardsfolder/xiahou_dun_the_one_eyed.txt index 4a1e43aca35..28c942f8529 100644 --- a/res/cardsfolder/xiahou_dun_the_one_eyed.txt +++ b/res/cardsfolder/xiahou_dun_the_one_eyed.txt @@ -4,6 +4,7 @@ Types:Legendary Creature Human Soldier Text:no text PT:3/2 K:Horsemanship +A:AB$ChangeZone | Cost$ Sac<1/CARDNAME> | Origin$ Graveyard | Destination$ Hand | ValidTgts$ Card.Black+YouCtrl | TgtPrompt$ Select a target black card from your graveyard | ChangeNum$ 1 | PlayerTurn$ True | ActivatingPhases$ Upkeep->BeginCombat | SpellDescription$ Return target black card from your graveyard to your hand. Activate this ability only during your turn, before attackers are declared. SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/xiahou_dun_the_one_eyed.jpg SetInfo:PTK|Rare|http://magiccards.info/scans/en/p3k/92.jpg diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index e0de3b035f8..aa468211bed 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -427,71 +427,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Order of Whiteclay")) { - final SpellAbility a1 = new Ability(card, "1 W W") { - @Override - public void resolve() { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, 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(AllZone.HumanPlayer)) { - Object o = GuiUtils.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(); - } - - } - - @Override - 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 && super.canPlay()) return true; - else return false; - } - - @Override - public boolean canPlayAI() { - return true; - } - };//SpellAbility - a1.makeUntapAbility(); - card.addSpellAbility(a1); - a1.setDescription("1 W W, Untap: Return target creature card with converted mana cost 3 or less from your graveyard to the battlefield."); - - StringBuilder sb = new StringBuilder(); - sb.append(card.getName()).append(" - return target creature card with converted mana cost 3 or less from your graveyard to the battlefield."); - a1.setStackDescription(sb.toString()); - - a1.setBeforePayMana(new Input_PayManaCost(a1)); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if(cardName.equals("Mudbutton Torchrunner")) { final SpellAbility ability = new Ability(card, "0") { @@ -3413,62 +3348,6 @@ public class CardFactory_Creatures { }//*************** END ************ END ************************** - //*************** START *********** START ************************** - else if(cardName.equals("Mindwrack Liege")) { - final SpellAbility ability = new Ability(card, "UR UR UR UR") { - private static final long serialVersionUID = 3978560192382921056L; - - @Override - public boolean canPlayAI() { - return getCreature().size() != 0; - } - - @Override - 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"); - CardList list2 = list.getColor("Blue"); - list2.add(list.getColor("Red")); - return list2; - } - - @Override - public void resolve() { - Card c = getTargetCard(); - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); - - if(AllZone.GameAction.isCardInZone(c, hand)) { - hand.remove(c); - play.add(c); - } - } - }; - - ability.setBeforePayMana(new Input() { - private static final long serialVersionUID = -1038409328463518290L; - - @Override - public void showMessage() { - Player controller = card.getController(); - CardList creats = new CardList(AllZone.getZone(Constant.Zone.Hand, controller).getCards()); - creats = creats.getType("Creature"); - CardList creats2 = creats.getColor("U"); - creats2.add(creats.getColor("R")); - stopSetNext(CardFactoryUtil.input_targetSpecific(ability, creats2, "Select a creature", false, - false)); - } - }); - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if (cardName.equals("Disciple of Kangee")) { Ability_Cost abCost = new Ability_Cost("U T", cardName, true); @@ -7548,218 +7427,7 @@ public class CardFactory_Creatures { };//Command card.addComesIntoPlayCommand(intoPlay); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Loyal Retainers")) { - final Ability ability = new Ability(card, "0") { - - @Override - public void resolve() { - if(AllZone.GameAction.isCardInPlay(card)) { - AllZone.GameAction.sacrifice(card); - - PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController()); - 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.getType().contains("Legendary"); - } - }); - - if(list.size() > 0) { - if(card.getController().equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select Legendary creature", - list.toArray()); - if(o != null) { - Card c = (Card) o; - grave.remove(c); - play.add(c); - } - - } else //computer - { - Card c = CardFactoryUtil.AI_getBestCreature(list); - grave.remove(c); - play.add(c); - } - } - } - } - - @Override - public boolean canPlay() { - 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.getType().contains("Legendary"); - } - }); - - SpellAbility sa; - for(int i = 0; i < AllZone.Stack.size(); i++) { - sa = AllZone.Stack.peek(i); - if(sa.getSourceCard().equals(card)) return false; - } - - return super.canPlay() && list.size() > 0 - && AllZone.Phase.getPhase().equals(Constant.Phase.Main1) - && AllZone.Phase.getPlayerTurn().equals(card.getController()); - } - - @Override - public boolean canPlayAI() { - 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.getType().contains("Legendary") - && CardUtil.getConvertedManaCost(c.getManaCost()) > 4; - } - }); - return list.size() > 0; - } - };//Ability - - StringBuilder sbDesc = new StringBuilder(); - sbDesc.append("Sacrifice Loyal Retainers: Return target legendary creature card from your graveyard to the battlefield. "); - sbDesc.append("Activate this ability only during your turn, before attackers are declared."); - ability.setDescription(sbDesc.toString()); - - StringBuilder sbStack = new StringBuilder(); - sbStack.append(cardName).append(" - Return target legendary creature card from your graveyard to the battlefield."); - ability.setStackDescription(sbStack.toString()); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if(cardName.equals("Xiahou Dun, the One-Eyed")) { - final Ability ability = new Ability(card, "0") { - - @Override - public void resolve() { - if(AllZone.GameAction.isCardInPlay(card)) { - AllZone.GameAction.sacrifice(card); - - PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.filter(AllZoneUtil.black); - - if(list.size() > 0) { - if(card.getController().equals(AllZone.HumanPlayer)) { - Object o = GuiUtils.getChoiceOptional("Select black card", list.toArray()); - if(o != null) { - Card c = (Card) o; - grave.remove(c); - hand.add(c); - } - - } else //computer - { - //TODO - } - } - } - } - - @Override - public boolean canPlay() { - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); - CardList list = new CardList(grave.getCards()); - list = list.filter(AllZoneUtil.black); - - SpellAbility sa; - for(int i = 0; i < AllZone.Stack.size(); i++) { - sa = AllZone.Stack.peek(i); - if(sa.getSourceCard().equals(card)) return false; - } - - return super.canPlay() && list.size() > 0 - && AllZone.Phase.getPhase().equals(Constant.Phase.Main1) - && AllZone.Phase.getPlayerTurn().equals(card.getController()); - } - - @Override - public boolean canPlayAI() { - return false; - } - }; - - StringBuilder sbDesc = new StringBuilder(); - sbDesc.append("Sacrifice Xiahou Dun, the One-Eyed: Return target black card from your graveyard to your hand. "); - sbDesc.append("Activate this ability only during your turn, before attackers are declared."); - ability.setDescription(sbDesc.toString()); - - StringBuilder sbStack = new StringBuilder(); - sbStack.append(cardName).append(" - Return target black card from your graveyard to your hand."); - ability.setStackDescription(sbStack.toString()); - - card.addSpellAbility(ability); - }//*************** END ************ END ************************** - - /* - //*************** START *********** START ************************** - else if(cardName.equals("Fire Bowman")) { - final Ability ability = new Ability(card, "0") { - @Override - public boolean canPlayAI() { - return getCreature().size() != 0; - } - - @Override - public void chooseTargetAI() { - if(AllZone.HumanPlayer.getLife() < 3) setTargetPlayer(AllZone.HumanPlayer); - else { - CardList list = getCreature(); - list.shuffle(); - setTargetCard(list.get(0)); - } - AllZone.GameAction.sacrifice(card); - }//chooseTargetAI() - - 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() - - @Override - public void resolve() { - if(getTargetCard() != null) { - if(AllZone.GameAction.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) getTargetCard().addDamage(1, - card); - } else getTargetPlayer().addDamage(1, card); - }//resolve() - };//SpellAbility - - card.addSpellAbility(ability); - - StringBuilder sb = new StringBuilder(); - sb.append("Sacrifice Fire Bowman: Fire Bowman deals 1 damage to target creature or player. "); - sb.append("Activate this ability only during your turn, before attackers are declared."); - ability.setDescription(sb.toString()); - - ability.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(ability, new Command() { - - private static final long serialVersionUID = -3283051501556347775L; - - public void execute() { - AllZone.GameAction.sacrifice(card); - } - }, true, false)); - }//*************** END ************ END ************************** - */ //*************** START *********** START ************************** else if(cardName.equals("Sygg, River Guide")) { diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index cc40757c82b..91c89f7dd81 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -1516,25 +1516,16 @@ public class GameActionUtil { }//Thistledown Duo - public static void playCard_Demigod_of_Revenge(Card c) { - + public static void playCard_Demigod_of_Revenge(final Card c) { + // not enough boom stick references in this block of code if(c.getName().equals("Demigod of Revenge")) { Ability ability2 = new Ability(c, "0") { @Override public void resolve() { - PlayerZone Grave = AllZone.getZone(Constant.Zone.Graveyard, AllZone.Phase.getPlayerTurn()); - PlayerZone Play = AllZone.getZone(Constant.Zone.Battlefield, AllZone.Phase.getPlayerTurn()); - CardList evildead = new CardList(); - evildead.addAll(Grave.getCards()); - evildead = evildead.filter(new CardListFilter() { - public boolean addCard(Card card) { - return (card.getName().contains("Demigod of Revenge")); - } - }); - for(int i = 0; i < evildead.size(); i++) { - Card c = evildead.get(i); - Grave.remove(c); - Play.add(c); + CardList evildead = AllZoneUtil.getPlayerGraveyard(c.getController(), "Demigod of Revenge"); + + for(Card c : evildead){ + AllZone.GameAction.moveToPlay(c); } } }; // ability2 @@ -1737,20 +1728,8 @@ public class GameActionUtil { else if(!choice.equals("None")) target = AllZone.HumanPlayer; // check for target of spell/abilities should be here else target = null; } else target = AllZone.HumanPlayer; // check for target of spell/abilities should be here - if(!(null == target)) { - PlayerZone lib = AllZone.getZone(Constant.Zone.Library, target); - PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, target); - CardList libList = new CardList(lib.getCards()); - - int max = converted; - - if(libList.size() < max) max = libList.size(); - - for(int i = 0; i < max; i++) { - Card c = libList.get(i); - lib.remove(c); - grave.add(c); - } + if(null != target) { + target.mill(converted); } //if } //resolve }; //ability