- Convert Leeches to Cost/Target

This commit is contained in:
jendave
2011-08-07 00:40:34 +00:00
parent 37f4e90c00
commit f1dc5c21f3
2 changed files with 13 additions and 8 deletions

View File

@@ -3121,14 +3121,17 @@ public class CardFactory_Sorceries {
* Target player loses all poison counters.
* Leeches deals that much damage to that player.
*/
SpellAbility spell = new Spell(card) {
final Target tgt = new Target(card, "Select a player", "Player");
Cost cost = new Cost("1 W W", cardName, false);
SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = 8555498267738686288L;
@Override
public void resolve() {
int counters = getTargetPlayer().getPoisonCounters();
getTargetPlayer().addDamage(counters, card);
getTargetPlayer().subtractPoisonCounters(counters);
Player p = tgt.getTargetPlayers().get(0);
int counters = p.getPoisonCounters();
p.addDamage(counters, card);
p.subtractPoisonCounters(counters);
}// resolve()
@Override
@@ -3137,12 +3140,12 @@ public class CardFactory_Sorceries {
int compPoison = AllZone.ComputerPlayer.getPoisonCounters();
if(AllZone.HumanPlayer.getLife() <= humanPoison ) {
setTargetPlayer(AllZone.HumanPlayer);
tgt.addTarget(AllZone.HumanPlayer);
return true;
}
if( (2*(11 - compPoison) < AllZone.ComputerPlayer.getLife() || compPoison > 7) && compPoison < AllZone.ComputerPlayer.getLife() - 2) {
setTargetPlayer(AllZone.ComputerPlayer);
tgt.addTarget(AllZone.ComputerPlayer);
return true;
}
@@ -3150,8 +3153,6 @@ public class CardFactory_Sorceries {
}
};// SpellAbility
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
card.clearFirstSpellAbility();
card.addSpellAbility(spell);

View File

@@ -170,6 +170,10 @@ public class Target {
this(src, select, valid, "1", "1");
}
public Target(Card src, String select, String valid){
this(src, select, valid.split(","), "1", "1");
}
public Target(Card src, String select, String[] valid, String min, String max){
srcCard = src;
tgtValid = true;