From 0acee8a5f6948a8a7adb000d6d6ffc074b5c8051 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 19:40:03 +0000 Subject: [PATCH] convert Sword of Body and Mind to triggers --- res/cardsfolder/sword_of_body_and_mind.txt | 8 +- src/forge/CardFactory_Equipment.java | 104 +-------------------- src/forge/GameActionUtil.java | 26 ------ 3 files changed, 7 insertions(+), 131 deletions(-) diff --git a/res/cardsfolder/sword_of_body_and_mind.txt b/res/cardsfolder/sword_of_body_and_mind.txt index ce604367637..057fc4fbb04 100644 --- a/res/cardsfolder/sword_of_body_and_mind.txt +++ b/res/cardsfolder/sword_of_body_and_mind.txt @@ -1,8 +1,12 @@ Name:Sword of Body and Mind ManaCost:3 Types:Artifact Equipment -Text:Equipped creature gets +2/+2 and has protection from green and from blue.\r\nWhenever equipped creature deals combat damage to a player, you put a 2/2 green Wolf creature token onto the battlefield and that player puts the top ten cards of his or her library into his or her graveyard. -SVar:Rarity:Rare +Text:Equipped creature gets +2/+2 and has protection from green and from blue. +K:eqPump 2:+2/+2/Protection from green & Protection from blue +T:Mode$ DamageDone | ValidSource$ Creature.AttachedBy | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever equipped creature deals combat damage to a player, you put a 2/2 green Wolf creature token onto the battlefield and that player puts the top ten cards of his or her library into his or her graveyard. +SVar:TrigToken:AB$Token | Cost$ 0 | TokenAmount$ 1 | TokenName$ Wolf | TokenTypes$ Creature,Wolf | TokenOwner$ Controller | TokenColors$ Green | TokenPower$ 2 | TokenToughness$ 2 | SubAbility$ SVar=DBMill +SVar:DBMill:DB$Mill | Defined$ TriggeredTarget | NumCards$ 10 +SVar:Rarity:Mythic SVar:Picture:http://www.wizards.com/global/images/magic/general/sword_of_body_and_mind.jpg SetInfo:SOM|Mythic|http://magiccards.info/scans/en/som/208.jpg End \ No newline at end of file diff --git a/src/forge/CardFactory_Equipment.java b/src/forge/CardFactory_Equipment.java index 373b8f32eb3..0f47ca72da3 100644 --- a/src/forge/CardFactory_Equipment.java +++ b/src/forge/CardFactory_Equipment.java @@ -591,110 +591,8 @@ class CardFactory_Equipment { card.addUnEquipCommand(onUnEquip); } //*************** END ************ END ************************** + - - //*************** START *********** START ************************** - else if (cardName.equals("Sword of Body and Mind")) { - final Ability equip = new Ability(card, "2") { - - @Override - public void resolve() { - if (AllZone.GameAction.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) { - - if (card.isEquipping()) { - Card crd = card.getEquipping().get(0); - if (crd.equals(getTargetCard())) return; - - card.unEquipCard(crd); - } - card.equipCard(getTargetCard()); - } - } - - @Override - public boolean canPlay() { - return AllZone.getZone(card).is(Constant.Zone.Battlefield) - && AllZone.Phase.getPlayerTurn().equals(card.getController()) - && (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2")) - && super.canPlay(); - } - - @Override - public boolean canPlayAI() { - return getCreature().size() != 0 - && !card.isEquipping() - && super.canPlayAI(); - } - - @Override - public void chooseTargetAI() { - Card target = CardFactoryUtil.AI_getBestCreature(getCreature()); - setTargetCard(target); - } - - CardList getCreature() { - CardList list = new CardList(AllZone.Computer_Battlefield.getCards()); - list = list.filter(new CardListFilter() { - public boolean addCard(Card c) { - return c.isCreature() - && CardFactoryUtil.AI_doesCreatureAttack(c) - && CardFactoryUtil.canTarget(card, c) - && (!c.getKeyword().contains("Defender")); - } - }); - - // Is there at least 1 Loxodon Punisher and/or Goblin Gaveleer to target - CardList equipMagnetList = list; - equipMagnetList = equipMagnetList.getEquipMagnets(); - - if (equipMagnetList.size() != 0) { - return equipMagnetList; - } - - return list; - }//getCreature() - };//equip ability - - Command onEquip = new Command() { - - private static final long serialVersionUID = 4792252563711300648L; - - public void execute() { - if(card.isEquipping()) { - Card crd = card.getEquipping().get(0); - crd.addSemiPermanentAttackBoost(2); - crd.addSemiPermanentDefenseBoost(2); - crd.addExtrinsicKeyword("Protection from green"); - crd.addExtrinsicKeyword("Protection from blue"); - } - }//execute() - };//Command - - Command onUnEquip = new Command() { - - private static final long serialVersionUID = 6204739827947031589L; - - public void execute() { - if(card.isEquipping()) { - Card crd = card.getEquipping().get(0); - crd.addSemiPermanentAttackBoost(-2); - crd.addSemiPermanentDefenseBoost(-2); - crd.removeExtrinsicKeyword("Protection from green"); - crd.removeExtrinsicKeyword("Protection from blue"); - } - }//execute() - };//Command - - equip.setBeforePayMana(CardFactoryUtil.input_equipCreature(equip)); - equip.setDescription("Equip: 2"); - card.addSpellAbility(equip); - - card.addEquipCommand(onEquip); - card.addUnEquipCommand(onUnEquip); - - } //*************** END ************ END ************************** - //*************** START *********** START ************************** else if(cardName.equals("Blade of the Bloodchief")) { diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 8f270dcf589..038e3d3b08e 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -2856,29 +2856,6 @@ public class GameActionUtil { res.execute(); } - public static void executeSwordOfBodyAndMindEffects(Card source) - { - final Card src = source; - final Ability ability = new Ability(src, "0") { - @Override - public void resolve() { - Player opponent = src.getController().getOpponent(); - - CardFactoryUtil.makeToken("Wolf", "G 2 2 Wolf", src.getController(), "G", - new String[] {"Creature", "Wolf"}, 2, 2, new String[] {""}); - - opponent.mill(10); - } - }; // ability - - StringBuilder sb = new StringBuilder(); - sb.append("Sword of Body and Mind - put a 2/2 green Wolf creature token onto the battlefield "); - sb.append("and opponent puts the top ten cards of his or her library into his or her graveyard."); - ability.setStackDescription(sb.toString()); - - AllZone.Stack.add(ability); - } - //this is for cards like Sengir Vampire public static void executeVampiricEffects(Card c) { ArrayList a = c.getKeyword(); @@ -3144,9 +3121,6 @@ public class GameActionUtil { if(equip.getName().equals("Sword of Light and Shadow")) { GameActionUtil.executeSwordOfLightAndShadowEffects(equip); } - if(equip.getName().equals("Sword of Body and Mind")) { - GameActionUtil.executeSwordOfBodyAndMindEffects(equip); - } } }//isEquipped