spPumpTgt - Targeted Pump Spells

Spells which follow the syntax "Target creature [gets | gains] [+p/+t | keyword] [and gains keyword] until end of turn.
In other words, it supports p/t pumps:
Giant Growth
G
Instant
Target creature gets +3/+3 until end of turn.
spPumpTgt:+3/+3
Or p/t/k pumps:
Wildsize
2 G
Instant
Target creature gets +2/+2 and gains trample until end of turn.
spPumpTgt:+2/+2/Trample
or just keyword pumps:
Accelerate
1 R
Instant
Target creature gains haste until end of turn.#Draw a card.
spPumpTgt:Haste
Cantrip
I've tested it a little bit with Giant Growth and Wildsize both human and AI.
In other words, it supports p/t pumps:
Giant Growth
G
Instant
Target creature gets +3/+3 until end of turn.
spPumpTgt:+3/+3
Or p/t/k pumps:
Wildsize
2 G
Instant
Target creature gets +2/+2 and gains trample until end of turn.
spPumpTgt:+2/+2/Trample
or just keyword pumps:
Accelerate
1 R
Instant
Target creature gains haste until end of turn.#Draw a card.
spPumpTgt:Haste
Cantrip
- Code: Select all
private final int shouldSpPumpTgt(Card c){
ArrayList<String> a = c.getKeyword();
for (int i = 0; i < a.size(); i++)
if (a.get(i).toString().startsWith("spPumpTgt"))
return i;
return -1;
}
- Code: Select all
// Generic target creature pump
if (shouldSpPumpTgt(card) != -1)
{
int n = shouldSpPumpTgt(card);
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
String ptk[] = k[1].split("/");
final int attack[] = {0};
final int defense[] = {0};
final String keyword[] = {"none"};
if (ptk.length == 1)
keyword[0] = ptk[0];
if (ptk.length >= 2)
{
attack[0] = Integer.parseInt(ptk[0].replace("+", ""));
defense[0] = Integer.parseInt(ptk[1].replace("+", ""));
}
if (ptk.length == 3)
keyword[0] = ptk[2];
/* String Desc = new String();
Desc = "Target creature ";
if (attack[0] != 0 || defense[0] != 0)
{
Desc = Desc + "gets ";
if (attack[0] > 0)
Desc = Desc + "+" + attack[0];
else
Desc = Desc + attack[0];
Desc = Desc + "/";
if (defense[0] > 0)
Desc = Desc + "+" + defense[0];
else
Desc = Desc + defense[0];
if (! keyword[0].equals("none"))
Desc = Desc + " and ";
}
if (! keyword[0].equals("none"))
Desc = Desc + "gains " + keyword;
Desc = Desc + " until end of turn.";
*/
SpellAbility spPump = new Spell(card)
{
private static final long serialVersionUID = 42244224L;
public boolean canPlayAI()
{
Card c = getAttacker();
if (c != null)
{
setTargetCard(c);
return true;
}
else
return false;
}
public Card getAttacker()
{
Combat c = ComputerUtil.getAttackers();
CardList list = new CardList(c.getAttackers());
CardListUtil.sortFlying(list);
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return (CardFactoryUtil.canTarget(card, c)) &&
(! c.getKeyword().contains(keyword[0])) &&
(! c.hasSickness() && keyword[0].equals("Haste"));
}
});
if (list.size() > 0)
return list.get(0);
else
return null;
}
public void resolve()
{
final Card[] target = new Card[1];
final Command untilEOT = new Command()
{
private static final long serialVersionUID = -42244224L;
public void execute()
{
if (AllZone.GameAction.isCardInPlay(target[0]))
{
target[0].addTempAttackBoost(-attack[0]);
target[0].addTempDefenseBoost(-defense[0]);
if (!keyword[0].equals("none"))
target[0].removeExtrinsicKeyword(keyword[0]);
}
}
};
target[0] = getTargetCard();
if (AllZone.GameAction.isCardInPlay(target[0]) && CardFactoryUtil.canTarget(card, target[0]))
{
target[0].addTempAttackBoost(attack[0]);
target[0].addTempDefenseBoost(defense[0]);
if (!keyword[0].equals("none"))
target[0].addExtrinsicKeyword(keyword[0]);
AllZone.EndOfTurn.addUntil(untilEOT);
}
}
};
spPump.setBeforePayMana(CardFactoryUtil.input_targetCreature(spPump));
//spPump.setDescription(Desc);
card.clearSpellAbility();
card.addSpellAbility(spPump);
}
I've tested it a little bit with Giant Growth and Wildsize both human and AI.