[ZNR] fixed an error with Nimble Trapfinder rules text (#7046)

This commit is contained in:
Evan Kranzler 2020-09-17 20:03:57 -04:00
parent dcc6ce9752
commit 3af2d11992

View file

@ -85,7 +85,7 @@ enum NimbleTrapfinderCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
NimbleTrapfinderWatcher watcher = game.getState().getWatcher(NimbleTrapfinderWatcher.class);
return watcher != null && watcher.checkPlayer(game.getPermanent(source.getSourceId()), game);
return watcher != null && watcher.checkPlayer(source.getSourceId(), game);
}
@Override
@ -133,7 +133,11 @@ class NimbleTrapfinderWatcher extends Watcher {
playerMap.clear();
}
boolean checkPlayer(Permanent permanent, Game game) {
boolean checkPlayer(UUID sourceId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent == null) {
return !playerMap.computeIfAbsent(game.getOwnerId(sourceId), u -> new HashSet<>()).isEmpty();
}
return playerMap
.computeIfAbsent(permanent.getControllerId(), u -> new HashSet<>())
.stream()