spGainLife[Tgt] keyword
Hot on the heels of spLoseLife, it's closest cousin makes its debut performance!
spGainLife for you, spGainLifeTgt for a friend!
spGainLife:1 gets you one, spGainLife:2 gets you twice as much.
Most of the usual permutations apply.
New for this update, a math operation for Count$ - "Times.#" - While "Twice" is nice, "Times.2" is effectively the same, but "Times.3" is better, and who knows, "Times.4" might show up. (just don't try "Times.1.5")
Cards.txt to be added or modified (don't forget to comment them from CardFactory)
			spGainLife for you, spGainLifeTgt for a friend!
spGainLife:1 gets you one, spGainLife:2 gets you twice as much.
Most of the usual permutations apply.
New for this update, a math operation for Count$ - "Times.#" - While "Twice" is nice, "Times.2" is effectively the same, but "Times.3" is better, and who knows, "Times.4" might show up. (just don't try "Times.1.5")
Cards.txt to be added or modified (don't forget to comment them from CardFactory)
- Code: Select all
 An-Havva Inn
1 G G
Sorcery
no text
spGainLife:X:You gain X plus 1 life, where X is the number of green creatures on the battlefield.:An-Havva Inn - player gains X life
SVar:X:Count$GreenTypeOnBattlefield.Creature/Plus.1
Ancestral Tribute
5 W W
Sorcery
no text
spGainLife:X:You gain 2 life for each card in your graveyard.:Ancestral Tribute - player gains X life
SVar:X:Count$CardsInYourYard/Times.2
Flashback:9 W W W
Angel's Mercy
2 W W
Instant
no text
spGainLife:7
Bargain
2 W
Sorcery
no text
spGainLife:7:Drawback$OppDrawCard/1:Target opponent draws a card. You gain 7 life.:Bargain - opponent draws a card and you gain 7 life
Blossoming Wreath
G
Instant
no text
spGainLife:X:You gain life equal to the number of creature cards in your graveyard.:Blossoming Wreath - player gains X life
SVar:X:Count$TypeInYourYard.Creature
Bountiful Harvest
4 G
Sorcery
no text
spGainLife:X:You gain 1 life for each land you control.:Bountiful Harvest - player gains X life
SVar:X:Count$TypeYouControl.Land
Congregate
3 W
Instant
no text
spGainLifeTgt:X:Target player gains 2 life for each creature on the battlefield.:Congregate - target player gains X life
SVar:X:Count$TypeOnBattlefield.Creature/Times.2
Dosan's Oldest Chant
4 G
Sorcery
no text
spGainLife:6
Draw a card.
Festival of Trokin
W
Sorcery
no text
spGainLife:X:You gain 2 life for each creature you control.:Festival of Trokin - player gains X life
SVar:X:Count$TypeYouCtrl.Creature/Times.2
Folk Medicine
2 G
Instant
no text
spGainLife:X:You gain 1 life for each creature you control.:Folk Medicine - player gains X life
SVar:X:Count$TypeYouCtrl.Creature
Flashback:1 W
Fruition
G
Sorcery
no text
spGainLife:X:You gain 1 life for each Forest on the battlefield.:Fruition - player gains X life
SVar:X:Count$TypeOnBattlefield.Forest
Gerrard's Wisdom
2 W W
Sorcery
no text
spGainLife:X:You gain 2 life for each card in your hand.:Gerrard's Wisdom - player gains X life
SVar:X:Count$CardsInYourHand/Times.2
Heroe's Reunion
W G
Instant
no text
spGainLifeTgt:7
Invigorating Falls
2 G G
Sorcery
no text
spGainLife:X:You gain life equal to the number of creature cards in all graveyards.:Invigorating Falls - player gains X life
SVar:X:Count$TypeInAllYards.Creature
Joyous Respite
3 G
Sorcery Arcane
no text
spGainLife:X:You gain 1 life for each land you control.:Joyous Respite - player gains X life
SVar:X:Count$TypeYouCtrl.Land
Kiss of the Amesha
4 W U
Sorcery
no text
spGainLifeTgt:7:Drawback$TgtDrawCards/2:Target player gains 7 life and draws two cards.:Kiss of the Amesha - target player gains 7 life and draws 2 cards
Landbind Ritual
3 W W
Sorcery
no text
spGainLife:X:You gain 2 life for each Plains you control.:Landbind Ritual - player gains X life
SVar:X:Count$TypeYouCtrl.Plains
Natural Spring
3 G G
Sorcery
no text
spGainLifeTgt:8
Nourish
G G
Instant
no text
spGainLife:6
Peach Garden Oath
W
Sorcery
no text
spGainLife:X:You gain 2 life for each creature you control.:Peach Garden Oath - player gains X life
SVar:X:Count$TypeYouCtrl.Creature/Times.2
Presence of the Wise
2 W W
Sorcery
no text
spGainLife:X:You gain 2 life for each card in your hand.:Presence of the Wise - player gains X life
SVar:X:Count$CardsInYourHand/Times.2
Rejuvinate
3 G
Sorcery
no text
spGainLife:6
Cycling:2
Renewing Dawn
1 W
Sorcery
no text
spGainLife:X:You gain 2 life for each Mountain target opponent controls.:Renewing Dawn - player gains X life
SVar:X:Count$TypeOppCtrl.Mountain/Times.2
Reviving Dose
2 W
Instant
no text
spGainLife:3
Draw a card.
Sacred Nectar
1 W
Sorcery
no text
spGainLife:4
Soothing Balm
1 W
Instant
no text
spGainLifeTgt:5
Spring of Eternal Peace
3 G G
Sorcery
no text
spGainLife:8
Starlight
1 W
Sorcery
no text
spGainLife:X:You gain life for each black creature target opponent controls.:Starlight - player gains X life
SVar:X:Count$BlackTypeOppCtrl.Creature/Times.3
Sylvan Bounty
5 G
Instant
no text
spGainLifeTgt:8
TypeCycling:Basic:1 G
Vital Surge
1 G
Instant Arcane
no text
spGainLife:3
Wandering Stream
2 G
Sorcery
no text
spGainLife:X:Domain - You gain 2 life for each basic land type among lands you control.:Wandering Stream - player gains X life
SVar:X:Count$Domain/Times.2
- Code: Select all
 if (hasKeyword(card, "spGainLife") != -1)
{
int n = hasKeyword(card, "spGainLife");
if (n != -1)
{
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String k[] = parse.split(":");
final boolean Tgt[] = {false};
Tgt[0] = k[0].contains("Tgt");
final int NumLife[] = {-1};
final String NumLifeX[] = {"none"};
if (k[1].matches("X"))
{
String x = card.getSVar(k[1]);
if (x.startsWith("Count$"))
{
String kk[] = x.split("\\$");
NumLifeX[0] = kk[1];
}
}
else if (k[1].matches("[0-9][0-9]?"))
NumLife[0] = Integer.parseInt(k[1]);
// drawbacks and descriptions
final String DrawBack[] = {"none"};
final String spDesc[] = {"none"};
final String stDesc[] = {"none"};
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 (Tgt[0] == true)
{
spDesc[0] = "Target player gains " + NumLife[0] + " life.";
stDesc[0] = cardName + " - target player gains life";
}
else
{
spDesc[0] = "You gain " + NumLife[0] + " life.";
stDesc[0] = cardName + " - you gain life";
}
}
final SpellAbility spGainLife = new Spell(card)
{
private static final long serialVersionUID = -8361697584661592092L;
public int getNumLife()
{
if (NumLife[0] != -1)
return NumLife[0];
if (! NumLifeX[0].equals("none"))
return CardFactoryUtil.xCount(card, NumLifeX[0]);
return 0;
}
public boolean canPlayAI()
{
if (Tgt[0] == true)
setTargetPlayer(Constant.Player.Computer);
if (AllZone.Computer_Life.getLife() < 10)
return true;
else
{
Random r = new Random();
return (r.nextFloat() < .6667);
}
}
public void resolve()
{
int nlife = getNumLife();
String TgtPlayer;
if (Tgt[0] == true)
TgtPlayer = getTargetPlayer();
else
TgtPlayer = card.getController();
AllZone.GameAction.addLife(TgtPlayer, nlife);
if (!DrawBack[0].equals("none"))
CardFactoryUtil.doDrawBack(DrawBack[0], nlife, card.getController(), AllZone.GameAction.getOpponent(card.getController()), TgtPlayer, card, null);
}//resolve()
};//SpellAbility
if (Tgt[0] == true)
spGainLife.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spGainLife));
spGainLife.setDescription(spDesc[0]);
spGainLife.setStackDescription(stDesc[0]);
card.clearSpellAbility();
card.addSpellAbility(spGainLife);
String bbCost = card.getSVar("Buyback");
if (!bbCost.equals(""))
{
SpellAbility bbGainLife = spGainLife.copy();
bbGainLife.setManaCost(CardUtil.addManaCosts(card.getManaCost(), bbCost));
bbGainLife.setDescription("Buyback " + bbCost + "(You may pay an additional " + bbCost + " as you cast this spell. If you do, put this card into your hand as it resolves.)");
bbGainLife.setIsBuyBackAbility(true);
if (Tgt[0] == true)
bbGainLife.setBeforePayMana(CardFactoryUtil.input_targetPlayer(bbGainLife));
card.addSpellAbility(bbGainLife);
}
}
}//spGainLife
- Code: Select all
 else if(s[0].contains("Negative")) return num * -1;
else if(s[0].contains("Times")) return num * Integer.parseInt(s[1]); // added with spGainLife
else return num;