create token copy checks for copyfrom

* Esoteric Duplicator test demonstrates fix. Sculpting steel token was not coming back as an Esoteric Duplicator
This commit is contained in:
jmlundeen 2025-08-29 15:54:31 -05:00
parent 71cd3ce3fc
commit d13a0e6e6b
2 changed files with 10 additions and 4 deletions

View file

@ -2,7 +2,6 @@ package org.mage.test.cards.single.big;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -21,7 +20,6 @@ public class EsotericDuplicatorTest extends CardTestPlayerBase {
private static final String esotericDuplicator = "Esoteric Duplicator"; private static final String esotericDuplicator = "Esoteric Duplicator";
@Test @Test
@Ignore("Sculpting steel doesn't retain copy on entering battlefield")
public void testEsotericDuplicator() { public void testEsotericDuplicator() {
setStrictChooseMode(true); setStrictChooseMode(true);

View file

@ -176,8 +176,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
} }
// can target card or permanent // can target card or permanent
Card copyFrom; Card copyFrom = null;
CopyApplier applier = new EmptyCopyApplier(); CopyApplier applier = null;
if (permanent != null) { if (permanent != null) {
// handle copies of copies // handle copies of copies
Permanent copyFromPermanent = permanent; Permanent copyFromPermanent = permanent;
@ -196,9 +196,17 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
} }
} }
} }
// check if permanent was copying, but copy effect is no longer active
if (applier == null) {
if (permanent.isCopy() && permanent.getCopyFrom() instanceof Permanent) {
copyFromPermanent = (Permanent) permanent.getCopyFrom();
}
applier = new EmptyCopyApplier();
}
copyFrom = copyFromPermanent; copyFrom = copyFromPermanent;
} else { } else {
copyFrom = game.getCard(getTargetPointer().getFirst(game, source)); copyFrom = game.getCard(getTargetPointer().getFirst(game, source));
applier = new EmptyCopyApplier();
} }
if (copyFrom == null) { if (copyFrom == null) {