From 790aef9c378dae1ae89fda0b6db8cd9d4b6f4d8c Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sun, 1 Aug 2021 03:32:16 +0400 Subject: [PATCH] Improved watcher copy support of Cards fields (example: Abandoned Sarcophagus, see 43dbaf405b9bae3cc54772345db10d5c1aa79eec); --- Mage/src/main/java/mage/watchers/Watcher.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Mage/src/main/java/mage/watchers/Watcher.java b/Mage/src/main/java/mage/watchers/Watcher.java index d12f796f80..7b5db9859e 100644 --- a/Mage/src/main/java/mage/watchers/Watcher.java +++ b/Mage/src/main/java/mage/watchers/Watcher.java @@ -1,5 +1,6 @@ package mage.watchers; +import mage.cards.Cards; import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent; @@ -133,6 +134,14 @@ public abstract class Watcher implements Serializable { PlayerList list = e.getValue().copy(); target.put(e.getKey(), list); } + } else if (valueType.getTypeName().endsWith("Cards")) { + Map source = (Map) field.get(this); + Map target = (Map) field.get(watcher); + target.clear(); + for (Map.Entry e : source.entrySet()) { + Cards list = e.getValue().copy(); + target.put(e.getKey(), list); + } } else if (valueType.getTypeName().contains("List")) { Map> source = (Map>) field.get(this); Map> target = (Map>) field.get(watcher);