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

@ -176,8 +176,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
}
// can target card or permanent
Card copyFrom;
CopyApplier applier = new EmptyCopyApplier();
Card copyFrom = null;
CopyApplier applier = null;
if (permanent != null) {
// handle copies of copies
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;
} else {
copyFrom = game.getCard(getTargetPointer().getFirst(game, source));
applier = new EmptyCopyApplier();
}
if (copyFrom == null) {