diff --git a/Mage.Sets/src/mage/sets/magicorigins/LilianaDefiantNecromancer.java b/Mage.Sets/src/mage/sets/magicorigins/LilianaDefiantNecromancer.java index 5bdc845b32..d286db8669 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/LilianaDefiantNecromancer.java +++ b/Mage.Sets/src/mage/sets/magicorigins/LilianaDefiantNecromancer.java @@ -109,7 +109,7 @@ public class LilianaDefiantNecromancer extends CardImpl { FilterCard newFilter = filter.copy(); newFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc)); ability.getTargets().clear(); - ability.addTarget(new TargetCardInYourGraveyard(filter)); + ability.addTarget(new TargetCardInYourGraveyard(newFilter)); } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java index 0a9d737ed3..80fd554a8e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/LilianaDefiantNecromancerTest.java @@ -16,7 +16,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { - + // Reported bug: -X allowing returning creatures with higher CMC than counters removed @Test public void testMinusAbilityShouldNotReturnHigherCmcCreature() { @@ -31,28 +31,25 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer"); - castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt"); - addTarget(playerB, "Hill Giant"); - + castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt", "Hill Giant"); + // 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. - activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:", "Hill Giant"); 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); execute(); - - assertGraveyardCount(playerB, "Lightning Bolt", 1); + + assertGraveyardCount(playerB, "Lightning Bolt", 1); assertPermanentCount(playerA, "Liliana, Heretical Healer", 0); assertPermanentCount(playerA, "Zombie", 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); assertGraveyardCount(playerA, "Hill Giant", 1); } - + @Test public void testMinusAbilityShouldNotReturnLegendaryCreature() { addCard(Zone.BATTLEFIELD, playerA, "Alesha, Who Smiles at Death", 1); // {2}{R} 3/2 Legendary first strike @@ -68,7 +65,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer"); castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt"); addTarget(playerB, "Alesha, Who Smiles at Death"); - + // 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. activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); @@ -78,8 +75,8 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.END_TURN); execute(); - - assertGraveyardCount(playerB, "Lightning Bolt", 1); + + assertGraveyardCount(playerB, "Lightning Bolt", 1); assertPermanentCount(playerA, "Liliana, Heretical Healer", 0); assertPermanentCount(playerA, "Zombie", 1); assertPermanentCount(playerA, "Alesha, Who Smiles at Death", 0); @@ -88,10 +85,10 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3); assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1); } - + @Test public void testMinusAbilityShouldReturnNonLegendaryCreature() { - addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable", 1); // {2} 2/1 + addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable", 1); // {2} 2/1 addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); // Lifelink @@ -104,7 +101,7 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Liliana, Heretical Healer"); castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt"); addTarget(playerB, "Bronze Sable"); - + // 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. activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "-X:"); @@ -114,8 +111,8 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { setStopAt(1, PhaseStep.END_TURN); execute(); - - assertGraveyardCount(playerB, "Lightning Bolt", 1); + + assertGraveyardCount(playerB, "Lightning Bolt", 1); assertPermanentCount(playerA, "Liliana, Heretical Healer", 0); assertPermanentCount(playerA, "Zombie", 1); assertPermanentCount(playerA, "Bronze Sable", 1); @@ -123,6 +120,5 @@ public class LilianaDefiantNecromancerTest extends CardTestPlayerBase { assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1); assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 1); } - - + } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index 29b94e9676..118a40b5f0 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -254,14 +254,15 @@ public abstract class AbilityImpl implements Ability { if (!getModes().choose(game, this)) { return false; } + + getSourceObject(game); + if (controller.isTestMode()) { if (!controller.addTargets(this, game)) { return false; } } - getSourceObject(game); - /* 20130201 - 601.2b * 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. @@ -269,7 +270,7 @@ public abstract class AbilityImpl implements Ability { if (this.abilityType.equals(AbilityType.SPELL)) { game.getContinuousEffects().applySpliceEffects(this, game); } - + // if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid. // For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability if (noMana) { diff --git a/Mage/src/main/java/mage/game/permanent/PermanentCard.java b/Mage/src/main/java/mage/game/permanent/PermanentCard.java index be56b4b2d3..35c9e779d1 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentCard.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentCard.java @@ -241,12 +241,20 @@ public class PermanentCard extends PermanentImpl { @Override 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 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