fix NPE in Evendo Brushrazer (PermanentsSacrificedWatcher)

This commit is contained in:
xenohedron 2025-12-18 00:44:48 -05:00
parent acc180d1d4
commit 0967f05721
2 changed files with 4 additions and 7 deletions

View file

@ -62,12 +62,9 @@ enum GoblinBlastRunnerCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
UUID player = source.getControllerId();
PermanentsSacrificedWatcher watcher = game.getState().getWatcher(PermanentsSacrificedWatcher.class); PermanentsSacrificedWatcher watcher = game.getState().getWatcher(PermanentsSacrificedWatcher.class);
if (watcher == null) { return watcher != null
return false; && !watcher.getThisTurnSacrificedPermanents(source.getControllerId()).isEmpty();
}
return watcher.getThisTurnSacrificedPermanents(player) != null;
} }
public static Hint getHint() { public static Hint getHint() {

View file

@ -44,10 +44,10 @@ public class PermanentsSacrificedWatcher extends Watcher {
} }
public List<Permanent> getThisTurnSacrificedPermanents(UUID playerId) { public List<Permanent> getThisTurnSacrificedPermanents(UUID playerId) {
return sacrificedPermanents.get(playerId); return sacrificedPermanents.getOrDefault(playerId, new ArrayList<>());
} }
public int getThisTurnSacrificedPermanents() { public int getThisTurnSacrificedPermanents() {
return sacrificedPermanents.values().stream().mapToInt(permanents -> permanents.size()).sum(); return sacrificedPermanents.values().stream().mapToInt(List::size).sum();
} }
} }