- Convert Leeches to Script

This commit is contained in:
Sol
2013-02-02 02:50:53 +00:00
parent 9796a3220f
commit 17a15fc12e
3 changed files with 10 additions and 43 deletions

View File

@@ -1,7 +1,10 @@
Name:Leeches Name:Leeches
ManaCost:1 W W ManaCost:1 W W
Types:Sorcery Types:Sorcery
Text:Target player loses all poison counters. Leeches deals that much damage to that player. Text:no text
A:SP$ DealDamage | Cost$ 1 W W | ValidTgts$ Player | NumDmg$ X | SubAbility$ Unpoison | SpellDescription$ Target player loses all poison counters. Leeches deals that much damage to that player.
SVar:Unpoison:DB$ Poison | Num$ -X
SVar:X:TargetedPlayer$PoisonCounters
SVar:RemAIDeck:True SVar:RemAIDeck:True
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leeches.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/leeches.jpg

View File

@@ -610,47 +610,6 @@ public class CardFactorySorceries {
return spell; return spell;
} }
private static final SpellAbility getLeeches(final Card card) {
/*
* Target player loses all poison counters. Leeches deals that much
* damage to that player.
*/
final Target tgt = new Target(card, "Select target player", "Player");
final Cost cost = new Cost(card, "1 W W", false);
return new Spell(card, cost, tgt) {
private static final long serialVersionUID = 8555498267738686288L;
@Override
public void resolve() {
final Player p = tgt.getTargetPlayers().get(0);
final int counters = p.getPoisonCounters();
p.addDamage(counters, card);
p.subtractPoisonCounters(counters);
} // resolve()
@Override
public boolean canPlayAI() {
final Player ai = getActivatingPlayer();
final Player opp = ai.getOpponent();
final int humanPoison = opp.getPoisonCounters();
final int compPoison = ai.getPoisonCounters();
if (opp.getLife() <= humanPoison) {
tgt.addTarget(opp);
return true;
}
if ((((2 * (11 - compPoison)) < ai.getLife()) || (compPoison > 7))
&& (compPoison < (ai.getLife() - 2))) {
tgt.addTarget(ai);
return true;
}
return false;
}
};
}
private static final SpellAbility getSanityGrinding(final Card card) { private static final SpellAbility getSanityGrinding(final Card card) {
/* /*
* Chroma - Reveal the top ten cards of your library. For each blue * Chroma - Reveal the top ten cards of your library. For each blue
@@ -1212,7 +1171,6 @@ public class CardFactorySorceries {
} else if (cardName.equals("Global Ruin")) { card.addSpellAbility(getGlobalRuin(card)); } else if (cardName.equals("Global Ruin")) { card.addSpellAbility(getGlobalRuin(card));
} else if (cardName.equals("Balance")) { card.addSpellAbility(getBalance(card)); } else if (cardName.equals("Balance")) { card.addSpellAbility(getBalance(card));
} else if (cardName.equals("Patriarch's Bidding")) { card.addSpellAbility(getPatriarchsBidding(card)); } else if (cardName.equals("Patriarch's Bidding")) { card.addSpellAbility(getPatriarchsBidding(card));
} else if (cardName.equals("Leeches")) { card.addSpellAbility(getLeeches(card));
} else if (cardName.equals("Sanity Grinding")) { card.addSpellAbility(getSanityGrinding(card)); } else if (cardName.equals("Sanity Grinding")) { card.addSpellAbility(getSanityGrinding(card));
} else if (cardName.equals("Profane Command")) { card.addSpellAbility(getProfaneCommand(card)); } else if (cardName.equals("Profane Command")) { card.addSpellAbility(getProfaneCommand(card));
} else if (cardName.equals("Transmute Artifact")) { card.addSpellAbility(getTransmuteArtifact(card)); } else if (cardName.equals("Transmute Artifact")) { card.addSpellAbility(getTransmuteArtifact(card));

View File

@@ -1886,6 +1886,12 @@ public class CardFactoryUtil {
return CardFactoryUtil.doXMath(players.get(0).getLifeLostThisTurn(), m, source); return CardFactoryUtil.doXMath(players.get(0).getLifeLostThisTurn(), m, source);
} }
} }
if (sq[0].contains("PoisonCounters")) {
if (players.size() > 0) {
return CardFactoryUtil.doXMath(players.get(0).getPoisonCounters(), m, source);
}
}
if (sq[0].contains("TopOfLibraryCMC")) { if (sq[0].contains("TopOfLibraryCMC")) {
if (players.size() > 0) { if (players.size() > 0) {