From ac2eb9056d01c4982bd91f69f11fd4dd02b5a5f9 Mon Sep 17 00:00:00 2001 From: Grath <1895280+Grath@users.noreply.github.com> Date: Fri, 13 May 2022 16:56:47 -0400 Subject: [PATCH] Reflection of Kiki-Jiki token being sacrificed incorrectly for #8742 (#8743) Reflection of Kiki-Jiki tokens were being sacrificed even if not under the control of Reflection of Kiki-Jiki controller. --- .../cards/copy/ReflectionOfKikiJikiTest.java | 51 +++++++++++++++++++ .../common/CreateTokenCopyTargetEffect.java | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/copy/ReflectionOfKikiJikiTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/copy/ReflectionOfKikiJikiTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/copy/ReflectionOfKikiJikiTest.java new file mode 100644 index 0000000000..122524612f --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/copy/ReflectionOfKikiJikiTest.java @@ -0,0 +1,51 @@ + +package org.mage.test.cards.copy; + +import mage.abilities.keyword.HasteAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; +import org.junit.Assert; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +public class ReflectionOfKikiJikiTest extends CardTestPlayerBase { + + /** + * Reflection of Kiki-Jiki creates a copy of Humble Defector, activate + * Humble defector, token gets sacrificed while under opponents control. + */ + @Test + public void testTokenNotSacrificedIfNotControlled() { + addCard(Zone.BATTLEFIELD, playerA, "Island", 1); + // Tap target creature you don't control. + // Overload {3}{U} + addCard(Zone.HAND, playerA, "Blustersquall", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1); + addCard(Zone.BATTLEFIELD, playerB, "Reflection of Kiki-Jiki", 1); + // {T}: Draw two cards. Target opponent gains control of Humble Defector. Activate this ability only during your turn. + addCard(Zone.BATTLEFIELD, playerB, "Humble Defector", 1); + + castSpell(2, PhaseStep.UPKEEP, playerA, "Blustersquall", "Humble Defector"); // Tap nontoken Defector so only the Token can be used later + + activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{1}, {T}: Create a token that's a copy of another target nonlegendary creature you control", "Humble Defector"); + + activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: Draw two cards. Target opponent gains control"); + + setStopAt(3, PhaseStep.UPKEEP); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + + assertHandCount(playerB, 3); // normal 3 draw from turn two + 2 from Defector + + assertGraveyardCount(playerA, "Blustersquall", 1); + assertPermanentCount(playerB, "Humble Defector", 1); + assertPermanentCount(playerA, "Humble Defector", 1); + + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java index 3fd986660f..767b9acc84 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java @@ -375,7 +375,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { if (exile) { effect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD).setText("exile the token copies"); } else { - effect = new SacrificeTargetEffect("sacrifice the token copies"); + effect = new SacrificeTargetEffect("sacrifice the token copies", source.getControllerId()); } effect.setTargetPointer(new FixedTargets(addedTokenPermanents, game));