mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
fix NPE in Evendo Brushrazer (PermanentsSacrificedWatcher)
This commit is contained in:
parent
acc180d1d4
commit
0967f05721
2 changed files with 4 additions and 7 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue