From 7c49dab11f8e3f5353c2a91d878a236d7566a63e Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 17:09:22 +0000 Subject: [PATCH] add Burn the Impure (form MBS) --- .gitattributes | 1 + res/cardsfolder/burn_the_impure.txt | 7 +++ src/forge/CardFactory_Instants.java | 70 ++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/burn_the_impure.txt diff --git a/.gitattributes b/.gitattributes index 1b9728ed623..94336be6614 100644 --- a/.gitattributes +++ b/.gitattributes @@ -781,6 +781,7 @@ res/cardsfolder/bull_hippo.txt -text svneol=native#text/plain res/cardsfolder/bull_rush.txt -text svneol=native#text/plain res/cardsfolder/buoyancy.txt -text svneol=native#text/plain res/cardsfolder/buried_alive.txt -text svneol=native#text/plain +res/cardsfolder/burn_the_impure.txt -text svneol=native#text/plain res/cardsfolder/burning_cloak.txt -text svneol=native#text/plain res/cardsfolder/burning_fields.txt -text svneol=native#text/plain res/cardsfolder/burning_inquiry.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/burn_the_impure.txt b/res/cardsfolder/burn_the_impure.txt new file mode 100644 index 00000000000..7b03784a1a9 --- /dev/null +++ b/res/cardsfolder/burn_the_impure.txt @@ -0,0 +1,7 @@ +Name:Burn the Impure +ManaCost:1 R +Types:Instant +Text:no text +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/burn_the_impure.jpg +End \ No newline at end of file diff --git a/src/forge/CardFactory_Instants.java b/src/forge/CardFactory_Instants.java index 005bd41d90f..090f3e978dc 100644 --- a/src/forge/CardFactory_Instants.java +++ b/src/forge/CardFactory_Instants.java @@ -2051,7 +2051,8 @@ public class CardFactory_Instants { };//SpellAbility StringBuilder sb = new StringBuilder(); - sb.append(cardName).append(" - deal 2 damage to target creature or player. If Burst Lightning was kicked, it deals 4 damage to that creature or player instead."); + sb.append(cardName).append(" deals 2 damage to target creature or player. If "); + sb.append(cardName).append(" was kicked, it deals 4 damage to that creature or player instead."); spell.setDescription(sb.toString()); final SpellAbility kicker = new Spell(card) { @@ -3064,8 +3065,73 @@ public class CardFactory_Instants { card.clearSpellAbility(); card.addSpellAbility(spell); }//*************** END ************ END ************************** - + + //*************** START *********** START ************************** + else if(cardName.equals("Burn the Impure")) { + /* + * Burn the Impure deals 3 damage to target creature. If that + * creature has infect, Burn the Impure deals 3 damage to that + * creature's controller. + */ + Ability_Cost abCost = new Ability_Cost("1 R", cardName, false); + final SpellAbility spell = new Spell(card, abCost, new Target(card, "TgtC")) { + private static final long serialVersionUID = -3069135027502686218L; + int damage = 3; + + @Override + public void chooseTargetAI() { + + CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + creatures = creatures.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.getNetAttack() <= damage && !c.getKeyword().contains("Indestructible"); + } + }); + CardList infect = creatures.filter(AllZoneUtil.getKeywordFilter("Infect")); + if(infect.size() > 0) { + Card c = CardFactoryUtil.AI_getBestCreature(infect); + setTargetCard(c); + } + else { + Card c = CardFactoryUtil.AI_getBestCreature(creatures); + setTargetCard(c); + } + + }//chooseTargetAI() + + @Override + public boolean canPlayAI() { + CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + creatures = creatures.filter(new CardListFilter() { + public boolean addCard(Card c) { + return c.getNetAttack() <= damage && !c.getKeyword().contains("Indestructible"); + } + }); + return creatures.size() > 0; + } + + @Override + public void resolve() { + if(AllZone.GameAction.isCardInPlay(getTargetCard()) + && CardFactoryUtil.canTarget(card, getTargetCard())) { + Card c = getTargetCard(); + c.addDamage(damage, card); + if(c.hasKeyword("Infect")) c.getController().addDamage(3, card); + } + } + };//SpellAbility + + StringBuilder sb = new StringBuilder(); + sb.append(cardName); + sb.append(" deals 3 damage to target creature. If that creature has infect, "); + sb.append(cardName); + sb.append(" deals 3 damage to that creature's controller."); + spell.setDescription(sb.toString()); + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + return card; }//getCard }