diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java index eb3cf1762d..14e6c0db6a 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/TransformTest.java @@ -92,4 +92,36 @@ public class TransformTest extends CardTestPlayerBase { } + /** + * The creature-Liliana and another creature was out, Languish is cast + * killing both, Liliana comes back transformed and no zombie. I'm fairly + * certain she's not supposed to come back due to her exile trigger + * shouldn't be able to exile her cos she's dead. + */ + @Test + public void LilianaHereticalHealer2() { + addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); + + // Lifelink + // Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield. + addCard(Zone.BATTLEFIELD, playerA, "Liliana, Heretical Healer"); + + // All creatures get -4/-4 until end of turn. + addCard(Zone.HAND, playerB, "Languish"); + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 4); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Languish"); + + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + assertGraveyardCount(playerB, "Languish", 1); + assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 0); + assertPermanentCount(playerA, "Zombie", 0); + + assertGraveyardCount(playerA, "Silvercoat Lion", 1); + assertGraveyardCount(playerA, "Liliana, Heretical Healer", 1); + + } + } diff --git a/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java b/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java index 7e328a9b8b..6b57e657d3 100644 --- a/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/ExileAndReturnTransformedSourceEffect.java @@ -5,7 +5,6 @@ */ package mage.abilities.effects.common; -import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.Effect; @@ -15,6 +14,7 @@ import mage.cards.Card; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.players.Player; /** @@ -57,7 +57,8 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - MageObject sourceObject = source.getSourceObjectIfItStillExists(game); + // Creature has to be on the battlefield to get exiled and be able to return transformed + Permanent sourceObject = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (sourceObject != null && controller != null) { Card card = (Card) sourceObject;