convert Sword of Body and Mind to triggers

This commit is contained in:
jendave
2011-08-06 19:40:03 +00:00
parent f612cca9bd
commit 0acee8a5f6
3 changed files with 7 additions and 131 deletions

View File

@@ -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

View File

@@ -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"))
{

View File

@@ -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<String> 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