spPumpTgt Revision
 Posted: 28 Jan 2010, 02:00
Posted: 28 Jan 2010, 02:00Updated spPumpTgt to enable new technology for Count$ and Drawback$.
Nothing amazingly new with the syntax:
New Drawback$ method - DamageTgtC/NumDamage
The following cards can be modified in cards.txt (might be a tad out-of date, as the list was compiled before the Draw a card Cantrip conversion was done) (this includes cards which were previously hard-coded without the spPumpTgt in cards.txt, they can be commented):
			Nothing amazingly new with the syntax:
- Code: Select all
- spPumpTgt:p/t{:Drawback$}{:spDescription}{:stDescription}
 spPumpTgt:k{:Drawback$}{:spDescription}{:stDescription}
 spPumpTgt:p/t/k{:Drawback$}{:spDescription}{:stDescription}
New Drawback$ method - DamageTgtC/NumDamage
The following cards can be modified in cards.txt (might be a tad out-of date, as the list was compiled before the Draw a card Cantrip conversion was done) (this includes cards which were previously hard-coded without the spPumpTgt in cards.txt, they can be commented):
- Code: Select all
- Wildsize
 2 G
 Instant
 no text
 spPumpTgt:+2/+2/Trample
 Draw a card.
 Infiltrate
 U
 Instant
 no text
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Infiltrate - Target creature is unblockable this turn.
 Giant Growth
 G
 Instant
 no text
 spPumpTgt:+3/+3
 Accelerate
 1 R
 Instant
 no text
 spPumpTgt:Haste
 Draw a card.
 Cloak of Feathers
 U
 Sorcery
 no text
 spPumpTgt:Flying
 Draw a card.
 Unnatural Speed
 R
 Instant
 no text
 spPumpTgt:Haste
 Shriek of Dread
 1 B
 Instant
 no text
 spPumpTgt:Fear
 Shadow Rift
 U
 Instant
 no text
 spPumpTgt:Shadow
 Draw a card.
 Leap
 U
 Instant
 no text
 spPumpTgt:Flying
 Draw a card.
 Lace with Moonglove
 2 G
 Instant
 no text
 spPumpTgt:Deathtouch
 Draw a card.
 Jump
 U
 Instant
 no text
 spPumpTgt:Flying
 Double Cleave
 1 RW
 Instant
 no text
 spPumpTgt:Double Strike
 Breach
 2 B
 Instant
 no text
 spPumpTgt:+2/+0/Fear
 Wielding the Green Dragon
 1 G
 Sorcery
 no text
 spPumpTgt:+4/+4
 Screaming Fury
 2 R
 Sorcery
 no text
 spPumpTgt:+5/+0/Haste
 Sangrite Surge
 4 R G
 Sorcery
 no text
 spPumpTgt:+3/+3/Double Strike
 Monstrous Growth
 1 G
 Sorcery
 no text
 spPumpTgt:+4/+4
 Howling Fury
 2 B
 Sorcery
 no text
 spPumpTgt:+4/+0
 Fit of Rage
 1 R
 Sorcery
 no text
 spPumpTgt:+3/+3/First Strike
 Sudden Strength
 3 G
 Instant
 no text
 spPumpTgt:+3/+3
 Draw a card.
 Silk Net
 G
 Instant
 no text
 spPumpTgt:+1/+1/Reach
 Predator's Strike
 1 G
 Instant
 no text
 spPumpTgt:+3/+3/Trample
 Kindled Fury
 R
 Instant
 no text
 spPumpTgt:+1/+0/First Strike
 Fists of the Anvil
 1 R
 Instant
 no text
 spPumpTgt:+4/+0
 Fanatical Fever
 2 G G
 Instant
 no text
 spPumpTgt:+3/+0/Trample
 Colossal Might
 R G
 Instant
 no text
 spPumpTgt:+4/+2/Trample
 Aggressive Urge
 1 G
 Instant
 no text
 spPumpTgt:+1/+1
 Draw a card.
 Angelic Blessing
 2 W
 Sorcery
 no text
 spPumpTgt:+3/+3/Flying
 Riding Red Hare
 2 W
 Sorcery
 no text
 spPumpTgt:+3/+3/Horsemanship
 Slaughter Cry
 2 R
 Instant
 no text
 spPumpTgt:+3/+0/First Strike
 Touch of Invisibility
 3 U
 Sorcery
 no text
 Draw a card.
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Touch of Invisibility - Target creature is unblockable this turn.
 Trailblazer
 2 G G
 Instant
 no text
 spPumpTgt:Unblockable:Target creature is unblockable this turn.:Trailblazer - Target creature is unblockable this turn.
 Gerrard's Command
 W G
 Instant
 no text
 spPumpTgt:+3/+3:Drawback$UntapTgt:Untap target creature. It gets +3/+3 until end of turn.:Untap target creature. It gets +3/+3 until end of turn.
 Brute Force
 R
 Instant
 no text
 spPumpTgt:+3/+3
 Guided Strike
 1 W
 Instant
 no text
 spPumpTgt:+1/+0/First strike
 Draw a card.
 Might of Oaks
 3 G
 Instant
 no text
 spPumpTgt:+7/+7
 Inspirit
 2 W
 Instant
 no text
 spPumpTgt:+2/+4:Drawback$UntapTgt:Untap target creature. It gets +2/+4 until end of turn.:Insprit - Untap target creature. It gets +2/+4 until end of turn.
- Code: Select all
- Accelerated Mutation
 3 G G
 Instant
 no text
 spPumpTgt:Count$MaxCMCYouCtrl/Count$MaxCMCYouCtrl:Target creature gets +X/+X until end of turn, where X is the highest converted mana cost among permanents you control.:Target creature gets +X/+X until end of turn.
 Burning Cloak
 R
 Sorcery
 no text
 spPumpTgt:+2/+0:Drawback$DamageTgtC/2:Target creature gets +2/+0 until end of turn. Burning Cloak deals 2 damage to that creature.
 Flowstone Strike
 1 R
 Instant
 no text
 spPumpTgt:+1/-1/Haste
 Gaea's Might
 G
 Instant
 no text
 spPumpTgt:Count$Domain/Count$Domain:Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.:Target creature gets +Domain/+Domain until end of turn.
 Ghoul's Feast
 1 B
 Instant
 no text
 spPumpTgt:Count$TypeInYourYard.Creature/+0:Target creature gets +X/+0 until end of turn, where X is the number of creature cards in your graveyard.
 ==
 Hunger of the Nim
 1 B
 Sorcery
 no text
 spPumpTgt:Count$TypeYouCtrl.Artifact/+0:Target creature gets +1/+0 for each artifact you control.:Hunger of the Nim - Target creature gets +X/+0
- Code: Select all
- Inner Calm, Outer Strength
 2 G
 Instant Arcane
 no text
 spPumpTgt:Count$CardsInYourHand/Count$CardsInYourHand:Target creature gets +X/+X until end of turn, where X is the number of cards in your hand.:Inner Calm, Outer Strength - Target creature gets +X/+X
- Code: Select all
- Iron Will
 W
 Instant
 no text
 spPumpTgt:+0/+4
 Cycling:2
 Might of Alara
 G
 Instant
 no text
 spPumpTgt:Count$Domain/Count$Domain:Domain - Target creature gets +1/+1 until end of turn for each basic land type among lands you control.
 Muscle Burst
 1 G
 Instant
 no text
 spPumpTgt:Count$NamedInAllYards.Muscle Burst\Plus.3/Count$NamedInAllYards.Muscle Burst\Plus.3:Target creature gets +X/+X until end of turn, where X is 3 plus the number of cards named Muscle Burst in all graveyards.:Muscle Burst - Target creature gets +X/+X until end of turn.
 Primal Bellow
 G
 Instant
 no text
 spPumpTgt:Count$TypeYouCtrl.Forest/Count$TypeYouCtrl.Forest:Target creature gets +1/+1 until end of turn for each Forest you control:Primal Bellow - Target creature gets +X/+X until end of turn
 Stand Firm
 W
 Instant
 no text
 spPumpTgt:+1/+1:
 Scry 2
 Strength of Cedars
 4 G
 Instant Arcane
 no text
 spPumpTgt:Count$TypeYouCtrl.Land/Count$TypeYouCtrl.Land:Target creature gets +X/+X until end of turn, where X is the number of lands you control.:Strength of Cedars - Target creature gets +X/+X until end of turn.
 Wirewood Pride
 G
 Instant
 no text
 spPumpTgt:Count$TypeOnBattlefield.Elf/Count$TypeOnBattlefield.Elf:Target creature gets +X/+X until end of turn, where X is the number of Elves on the battlefield.:Wirewood Pride - Target creature get +X/+X until end of turn.
- Code: Select all
- // Generic target creature pump
 if (hasKeyword(card, "spPumpTgt") != -1)
 {
 int n = hasKeyword(card, "spPumpTgt");
 
 String parse = card.getKeyword().get(n).toString();
 card.removeIntrinsicKeyword(parse);
 
 String k[] = parse.split(":");
 
 final int NumAttack[] = {-1138};
 final String AttackX[] = {"none"};
 final int NumDefense[] = {-1138};
 final String DefenseX[] = {"none"};
 final String Keyword[] = {"none"};
 
 String ptk[] = k[1].split("/");
 
 if (ptk.length == 1)
 Keyword[0] = ptk[0];
 
 if (ptk.length >= 2)
 {
 if (ptk[0].length() <= 3)
 NumAttack[0] = Integer.parseInt(ptk[0].replace("+", ""));
 else
 if (ptk[0].startsWith("Count$"))
 {
 String kk[] = ptk[0].split("\\$");
 AttackX[0] = kk[1].replace("\\", "/");
 }
 
 if (ptk[1].length() <= 3)
 NumDefense[0] = Integer.parseInt(ptk[1].replace("+", ""));
 else
 if (ptk[1].startsWith("Count$"))
 {
 String kk[] = ptk[1].split("\\$");
 DefenseX[0] = kk[1].replace("\\", "/");
 }
 }
 
 if (ptk.length == 3)
 Keyword[0] = ptk[2];
 
 final String DrawBack[] = {"none"};
 final String spDesc[] = {"none"};
 final String stDesc[] = {"none"};
 //String d = new String("none");
 StringBuilder sb = new StringBuilder();
 
 if ((AttackX[0].equals("none") && !(NumAttack[0] == -1138)) && (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && Keyword[0].equals("none"))
 {
 // pt boost
 sb.append("Target creature gets ");
 
 if (NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
 sb.append("+");
 else if (NumAttack[0] < 0 || (NumAttack[0] == 0 && NumDefense[0] < 0)) // -0/-1
 sb.append("-");
 
 sb.append(Math.abs(NumAttack[0]) + "/");
 
 if (NumDefense[0] > 0 || (NumDefense[0] == 0 && NumAttack[0] > 0)) // +1/+0
 sb.append("+");
 else if (NumDefense[0] < 0 || (NumDefense[0] == 0 && NumAttack[0] < 0)) // -1/-0
 sb.append("-");
 
 sb.append(Math.abs(NumDefense[0]) + " until end of turn.");
 }
 if ((AttackX[0].equals("none") && NumAttack[0] == -1138) && (DefenseX[0].equals("none") && NumDefense[0] == -1138) && !Keyword[0].equals("none"))
 {
 // k boost
 sb.append("Target creature gains " + Keyword[0] + " until end of turn.");
 }
 if ((AttackX[0].equals("none") && !(NumAttack[0] == -1138)) && (DefenseX[0].equals("none") && !(NumDefense[0] == -1138)) && !Keyword[0].equals("none"))
 {
 // ptk boost
 sb.append("Target creature gets ");
 
 if (NumAttack[0] > 0 || (NumAttack[0] == 0 && NumDefense[0] > 0)) // +0/+1
 sb.append("+");
 else if (NumAttack[0] < 0 || (NumAttack[0] == 0 && NumDefense[0] < 0)) // -0/-1
 sb.append("-");
 
 sb.append(Math.abs(NumAttack[0]) + "/");
 
 if (NumDefense[0] > 0 || (NumDefense[0] == 0 && NumAttack[0] > 0)) // +1/+0
 sb.append("+");
 else if (NumDefense[0] < 0 || (NumDefense[0] == 0 && NumAttack[0] < 0)) // -1/-0
 sb.append("-");
 
 sb.append(Math.abs(NumDefense[0]));
 
 sb.append(" and gains " + Keyword[0] + " until end of turn.");
 }
 if (k.length > 2)
 {
 if (k[2].contains("Drawback$"))
 {
 String kk[] = k[2].split("\\$");
 DrawBack[0] = kk[1];
 if (k.length > 3)
 spDesc[0] = k[3];
 if (k.length > 4)
 stDesc[0] = k[4];
 }
 else
 {
 if (k.length > 2)
 spDesc[0] = k[2];
 if (k.length > 3)
 stDesc[0] = k[3];
 }
 }
 else
 if (!sb.toString().equals("none"))
 {
 spDesc[0] = sb.toString();
 stDesc[0] = sb.toString();
 }
 SpellAbility spPump = new Spell(card)
 {
 private static final long serialVersionUID = 42244224L;
 
 private int getNumAttack()
 {
 if (NumAttack[0] != -1138)
 return NumAttack[0];
 
 if (! AttackX[0].equals("none"))
 return CardFactoryUtil.xCount(card, AttackX[0]);
 
 return 0;
 }
 private int getNumDefense()
 {
 if (NumDefense[0] != -1138)
 return NumDefense[0];
 
 if (! DefenseX[0].equals("none"))
 return CardFactoryUtil.xCount(card, DefenseX[0]);
 
 return 0;
 }
 public boolean canPlayAI()
 {
 int defense = getNumDefense();
 
 if (AllZone.Phase.getPhase().equals(Constant.Phase.Main2))
 return false;
 
 CardList list = getCreatures();
 if (!list.isEmpty())
 {
 boolean goodt = false;
 Card t = new Card();
 while (goodt == false && !list.isEmpty())
 {
 t = CardFactoryUtil.AI_getBestCreature(list);
 if ((t.getNetDefense() + defense) > 0)
 goodt = true;
 else
 list.remove(t);
 }
 if (goodt == true)
 {
 setTargetCard(t);
 return true;
 }
 }
 
 return false;
 }
 
 CardList getCreatures()
 {
 CardList list = new CardList(AllZone.Computer_Play.getCards());
 list = list.filter(new CardListFilter()
 {
 public boolean addCard(Card c)
 {
 if (c.isCreature())
 {
 if (c.hasSickness() && Keyword[0].equals("Haste"))
 return CardFactoryUtil.canTarget(card, c);
 
 return (CardFactoryUtil.AI_doesCreatureAttack(c)) &&
 (CardFactoryUtil.canTarget(card, c)) &&
 (!Keyword[0].equals("none") && !c.getKeyword().contains(Keyword[0])) &&
 (! (! c.hasSickness()) && Keyword[0].equals("Haste"));
 }
 return false;
 }
 });
 return list;
 }
 
 public void resolve()
 {
 if (AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard()))
 {
 final Card[] creature = new Card[1];
 creature[0] = getTargetCard();
 
 final int a = getNumAttack();
 final int d = getNumDefense();
 
 final Command untilEOT = new Command()
 {
 private static final long serialVersionUID = -42244224L;
 
 public void execute()
 {
 if (AllZone.GameAction.isCardInPlay(creature[0]))
 {
 creature[0].addTempAttackBoost(-1 * a);
 creature[0].addTempDefenseBoost(-1 * d);
 
 if (!Keyword[0].equals("none"))
 creature[0].removeExtrinsicKeyword(Keyword[0]);
 }
 }
 };
 
 creature[0].addTempAttackBoost(a);
 creature[0].addTempDefenseBoost(d);
 if (! Keyword[0].equals("none"))
 creature[0].addExtrinsicKeyword(Keyword[0]);
 
 AllZone.EndOfTurn.addUntil(untilEOT);
 
 if (! DrawBack[0].equals("none"))
 CardFactoryUtil.doDrawBack(DrawBack[0], 0, card.getController(), AllZone.GameAction.getOpponent(card.getController()), creature[0].getController(), card, creature[0]);
 }
 }//resolve
 };//SpellAbility
 
 spPump.setBeforePayMana(CardFactoryUtil.input_targetCreature(spPump));
 spPump.setDescription(spDesc[0]);
 spPump.setStackDescription(stDesc[0]);
 
 card.clearSpellAbility();
 card.addSpellAbility(spPump);
 }
 .
.