diff --git a/res/cards.txt b/res/cards.txt index 167d93b87b1..baa414d7e83 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,9 @@ +Sword of Body and Mind +3 +Artifact Equipment +Equipped creature gets +2/+2 and has protection from green and from blue. 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:Rarity:Rare + Desecrated Earth 4 B Sorcery diff --git a/src/forge/CardFactory_Equipment.java b/src/forge/CardFactory_Equipment.java index 2c6a4b64c7d..a936fa2504f 100644 --- a/src/forge/CardFactory_Equipment.java +++ b/src/forge/CardFactory_Equipment.java @@ -839,6 +839,108 @@ class CardFactory_Equipment { } //*************** 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.Play) + && AllZone.Phase.getActivePlayer().equals(card.getController()) + && (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals( + "Main2")); + } + + @Override + public boolean canPlayAI() { + return getCreature().size() != 0 && !card.isEquipping(); + } + + @Override + public void chooseTargetAI() { + 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)) + && CardFactoryUtil.canTarget(card, c) + && (!c.getKeyword().contains("Defender")); + } + }); + // list.remove(card); // if mana-only cost, allow self-target + + // is there at least 1 Loxodon Punisher to target + + CardList equipMagnetList = list.getName("Loxodon Punisher"); + 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 red"); + 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 ************************** + if (shouldEquip(card) != -1) { int n = shouldEquip(card); if (n != -1) { diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index e5af04d50b0..d1df23927a6 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -750,7 +750,10 @@ public class CombatUtil { GameActionUtil.executeSwordOfFireAndIceEffects(equip); } if(c.getDealtCombatDmgToOppThisTurn() && equip.getName().equals("Sword of Light and Shadow")) { - GameActionUtil.executeSwordOfLightandShadowEffects(equip); + GameActionUtil.executeSwordOfLightAndShadowEffects(equip); + } + if(c.getDealtCombatDmgToOppThisTurn() && equip.getName().equals("Sword of Body and Mind")) { + GameActionUtil.executeSwordOfBodyAndMindEffects(equip); } } }//isEquipped && getNetAttack > 0 diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index f5bb76cfd74..64044551114 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -4932,7 +4932,7 @@ public class GameActionUtil { } } - public static void executeSwordOfLightandShadowEffects(Card source) { + public static void executeSwordOfLightAndShadowEffects(Card source) { final Card src = source; final Ability ability = new Ability(src, "0") { @Override @@ -4989,6 +4989,34 @@ 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() { + String opponent = AllZone.GameAction.getOpponent(src.getController()); + + CardFactoryUtil.makeToken("Wolf", "G 2 2 Wolf", src, "G", + new String[] {"Creature", "Wolf"}, 2, 2, new String[] {""}); + + + CardList lib = AllZoneUtil.getPlayerCardsInLibrary(opponent); + int max = lib.size(); + if (max > 10) + max = 10; + + for (int i=0;i a = c.getKeyword();