From 29f7555ac3d70776750f603a8e225a666b1202f8 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 15 Apr 2021 09:45:12 -0400 Subject: [PATCH] [STX] fixed Star Pupil not adding counters (fixes #7744) --- Mage.Sets/src/mage/cards/s/SpitefulSquad.java | 2 +- Mage.Sets/src/mage/cards/s/StarPupil.java | 2 +- .../test/cards/single/stx/StarPupilTest.java | 34 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/stx/StarPupilTest.java diff --git a/Mage.Sets/src/mage/cards/s/SpitefulSquad.java b/Mage.Sets/src/mage/cards/s/SpitefulSquad.java index 5cfc6cbfe0..f7b642060a 100644 --- a/Mage.Sets/src/mage/cards/s/SpitefulSquad.java +++ b/Mage.Sets/src/mage/cards/s/SpitefulSquad.java @@ -75,7 +75,7 @@ class SpitefulSquadEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = source.getSourcePermanentOrLKI(game); + Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield"); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (sourcePermanent == null || permanent == null) { return false; diff --git a/Mage.Sets/src/mage/cards/s/StarPupil.java b/Mage.Sets/src/mage/cards/s/StarPupil.java index 9715d91c7c..544edcb677 100644 --- a/Mage.Sets/src/mage/cards/s/StarPupil.java +++ b/Mage.Sets/src/mage/cards/s/StarPupil.java @@ -71,7 +71,7 @@ class StarPupilEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = source.getSourcePermanentOrLKI(game); + Permanent sourcePermanent = (Permanent) getValue("permanentLeftBattlefield"); Permanent permanent = game.getPermanent(source.getFirstTarget()); if (sourcePermanent == null || permanent == null) { return false; diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/StarPupilTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/StarPupilTest.java new file mode 100644 index 0000000000..807e93782c --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/StarPupilTest.java @@ -0,0 +1,34 @@ +package org.mage.test.cards.single.stx; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * @author TheElk801 + */ +public class StarPupilTest extends CardTestPlayerBase { + + private static final String pupil = "Star Pupil"; + private static final String murder = "Murder"; + private static final String lion = "Silvercoat Lion"; + + @Test + public void testPupil() { + addCard(Zone.BATTLEFIELD, playerA, "Scrubland", 4); + addCard(Zone.BATTLEFIELD, playerA, lion); + addCard(Zone.HAND, playerA, pupil); + addCard(Zone.HAND, playerA, murder); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, pupil); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, murder, pupil); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertCounterCount(lion, CounterType.P1P1, 1); + } +}