* Fixed a bug that by countering a copied spell (e.g. by copied Memory Lapse), the copy could be removed from stack instead the originally countered spell (fixes #6823).

This commit is contained in:
LevelX2 2020-07-13 11:23:36 +02:00
parent 983019251e
commit c6c1b0ed3a
2 changed files with 10 additions and 2 deletions

View file

@ -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)) {