diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/KinnanBonderProdigyTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/KinnanBonderProdigyTest.java index 1a6dd26502..1034ea33a3 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/KinnanBonderProdigyTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/iko/KinnanBonderProdigyTest.java @@ -13,6 +13,7 @@ public class KinnanBonderProdigyTest extends CardTestPlayerBase { private static final String kinnan = "Kinnan, Bonder Prodigy"; private static final String egg = "Golden Egg"; private static final String hovermyr = "Hovermyr"; + private static final String strike = "Strike It Rich"; @Test public void testSacrificedPermanent() { @@ -32,4 +33,23 @@ public class KinnanBonderProdigyTest extends CardTestPlayerBase { assertPermanentCount(playerA, egg, 0); assertGraveyardCount(playerA, egg, 1); } + + @Test + public void testSacrificedToken() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain"); + addCard(Zone.BATTLEFIELD, playerA, kinnan); + addCard(Zone.HAND, playerA, strike); + addCard(Zone.HAND, playerA, hovermyr); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, strike); + activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, hovermyr); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertPermanentCount(playerA, hovermyr, 1); + assertPermanentCount(playerA, "Treasure", 0); + } } diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index a354670438..84840ecab5 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -22,6 +22,7 @@ import mage.game.command.Emblem; import mage.game.command.Plane; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; import mage.game.stack.Spell; import mage.game.stack.StackAbility; import mage.players.Player; @@ -1258,6 +1259,10 @@ public abstract class AbilityImpl implements Ability { @Override public Permanent getSourcePermanentOrLKI(Game game) { + Permanent permanent = game.getPermanentOrLKIBattlefield(getSourceId()); + if (permanent instanceof PermanentToken) { + return permanent; + } if (getSourceObjectZoneChangeCounter() == 0 || getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(getSourceId())) { return game.getPermanent(getSourceId());