game: fixed miss watchers from second side of transformable cards (closes #11329);

This commit is contained in:
Oleg Agafonov 2023-11-06 10:40:05 +04:00
parent 710b79b46d
commit dfbd6627e5
5 changed files with 99 additions and 11 deletions

View file

@ -634,16 +634,23 @@ public class GameState implements Serializable, Copyable<GameState> {
return this.turnMods;
}
/**
* Find game scope watcher
*/
public <T extends Watcher> T getWatcher(Class<T> watcherClass) {
return watcherClass.cast(watchers.get(watcherClass.getSimpleName()));
return getWatcher(watcherClass, null);
}
/**
* Find card/player scope watcher
*/
public <T extends Watcher> T getWatcher(Class<T> watcherClass, UUID uuid) {
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), uuid.toString()));
String watcherKey = (uuid == null ? "" : uuid.toString()) + watcherClass.getSimpleName();
return watcherClass.cast(getWatcher(watcherKey));
}
public <T extends Watcher> T getWatcher(Class<T> watcherClass, String prefix) {
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), prefix));
public Watcher getWatcher(String key) {
return watchers.get(key);
}
public SpecialActions getSpecialActions() {