diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CounterspellTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CounterspellTest.java index 44e5635c177..130ba3b9a36 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CounterspellTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/oneshot/counterspell/CounterspellTest.java @@ -65,7 +65,6 @@ public class CounterspellTest extends CardTestPlayerBase { * the same card ID (6b5), which seems likely to cause issues. */ @Test - @Ignore public void testCopyCounterToCounter() { // Lightning Bolt deals 3 damage to any target. addCard(Zone.HAND, playerA, "Lightning Bolt"); @@ -78,7 +77,7 @@ public class CounterspellTest extends CardTestPlayerBase { // Counter target spell. If that spell is countered this way, put it on top of its owner's library instead of into that player's graveyard. addCard(Zone.HAND, playerB, "Memory Lapse"); // Instant {1}{U} - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Memory Lapse", "Lightning Bolt"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Twincast", "Memory Lapse"); diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 568646726e9..be910504108 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1066,6 +1066,15 @@ public abstract class PlayerImpl implements Player, Serializable { private boolean moveObjectToLibrary(UUID objectId, UUID sourceId, Game game, boolean toTop, boolean withName) { MageObject mageObject = game.getObject(objectId); + if (mageObject instanceof Spell && mageObject.isCopy()) { + // Spell copies are not moved as cards, so here the no copy spell has to be selected to move + // (but because copy and original have the same objectId the wrong sepell can be selected from stack). + // So let's check if the original spell is on the stack and has to be selected. // TODO: Better handling so each spell could be selected by a unique id + Spell spellNoCopy = game.getStack().getSpell(sourceId, false); + if (spellNoCopy != null) { + mageObject = spellNoCopy; + } + } if (mageObject != null) { Zone fromZone = game.getState().getZone(objectId); if ((mageObject instanceof Permanent)) {