mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Improved watcher copy support of Cards fields (example: Abandoned Sarcophagus, see 43dbaf405b
);
This commit is contained in:
parent
df07ad4418
commit
790aef9c37
1 changed files with 9 additions and 0 deletions
|
@ -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<Object, Cards> source = (Map<Object, Cards>) field.get(this);
|
||||
Map<Object, Cards> target = (Map<Object, Cards>) field.get(watcher);
|
||||
target.clear();
|
||||
for (Map.Entry<Object, Cards> e : source.entrySet()) {
|
||||
Cards list = e.getValue().copy();
|
||||
target.put(e.getKey(), list);
|
||||
}
|
||||
} else if (valueType.getTypeName().contains("List")) {
|
||||
Map<Object, List<Object>> source = (Map<Object, List<Object>>) field.get(this);
|
||||
Map<Object, List<Object>> target = (Map<Object, List<Object>>) field.get(watcher);
|
||||
|
|
Loading…
Reference in a new issue