* Liliana, Defiant Necromancer - Fixed target bug of -X ability.

This commit is contained in:
LevelX2 2016-08-02 16:52:25 +02:00
parent acf5df7f94
commit 270ffcb88a
4 changed files with 32 additions and 27 deletions

View file

@ -109,7 +109,7 @@ public class LilianaDefiantNecromancer extends CardImpl {
FilterCard newFilter = filter.copy(); FilterCard newFilter = filter.copy();
newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc)); newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
ability.getTargets().clear(); ability.getTargets().clear();
ability.addTarget(new TargetCardInYourGraveyard(filter)); ability.addTarget(new TargetCardInYourGraveyard(newFilter));
} }
} }

View file

@ -31,15 +31,12 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer");
castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt"); castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt", "Hill Giant");
addTarget(playerB, "Hill Giant");
// Transformed into Liliana, Defiant Necromancer with (3) loyalty to start // Transformed into Liliana, Defiant Necromancer with (3) loyalty to start
// -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield. // -X: Return target nonlegendary creature with converted mana cost X from your graveyard to the battlefield.
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:", "Hill Giant");
setChoice(playerA, "X=1"); setChoice(playerA, "X=1");
addTarget(playerA, "Hill Giant"); // dunno which to use for returning from grave, both target/choice seem to work
setChoice(playerA, "Hill Giant");
setStopAt(1, PhaseStep.END_TURN); setStopAt(1, PhaseStep.END_TURN);
execute(); execute();
@ -48,7 +45,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0); assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
assertPermanentCount(playerA, "Zombie", 1); assertPermanentCount(playerA, "Zombie", 1);
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1); assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 2); assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3); // No balid target with X=1 so no counter is removed
assertPermanentCount(playerA, "Hill Giant", 0); assertPermanentCount(playerA, "Hill Giant", 0);
assertGraveyardCount(playerA, "Hill Giant", 1); assertGraveyardCount(playerA, "Hill Giant", 1);
} }
@ -124,5 +121,4 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase {
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 1); assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 1);
} }
} }

View file

@ -254,14 +254,15 @@ public abstract class AbilityImpl implements Ability {
if (!getModes().choose(game, this)) { if (!getModes().choose(game, this)) {
return false; return false;
} }
getSourceObject(game);
if (controller.isTestMode()) { if (controller.isTestMode()) {
if (!controller.addTargets(this, game)) { if (!controller.addTargets(this, game)) {
return false; return false;
} }
} }
getSourceObject(game);
/* 20130201 - 601.2b /* 20130201 - 601.2b
* If the player wishes to splice any cards onto the spell (see rule 702.45), he * If the player wishes to splice any cards onto the spell (see rule 702.45), he
* or she reveals those cards in his or her hand. * or she reveals those cards in his or her hand.

View file

@ -241,12 +241,20 @@ public class PermanentCard extends PermanentImpl {
@Override @Override
public void adjustTargets(Ability ability, Game game) { public void adjustTargets(Ability ability, Game game) {
card.adjustTargets(ability, game); if (this.isTransformed()) {
card.getSecondCardFace().adjustTargets(ability, game);
} else {
card.adjustTargets(ability, game);
}
} }
@Override @Override
public void adjustCosts(Ability ability, Game game) { public void adjustCosts(Ability ability, Game game) {
card.adjustCosts(ability, game); if (this.isTransformed()) {
card.getSecondCardFace().adjustCosts(ability, game);
} else {
card.adjustCosts(ability, game);
}
} }
@Override @Override