added another fix for Valiant Rescuer

This commit is contained in:
Evan Kranzler 2020-04-24 20:26:02 -04:00
parent c8fa5b8819
commit 505c434fb5

View file

@ -94,7 +94,7 @@ class ValiantRescuerTriggeredAbility extends TriggeredAbilityImpl {
class ValiantRescuerWatcher extends Watcher { class ValiantRescuerWatcher extends Watcher {
private final Map<UUID, Map<UUID, Integer>> playerMap = new HashMap(); private final Map<UUID, Map<UUID, Integer>> playerMap = new HashMap<>();
ValiantRescuerWatcher() { ValiantRescuerWatcher() {
super(WatcherScope.GAME); super(WatcherScope.GAME);
@ -109,8 +109,10 @@ class ValiantRescuerWatcher extends Watcher {
StackObject item = game.getState().getStack().getFirst(); StackObject item = game.getState().getStack().getFirst();
if (item instanceof StackAbility if (item instanceof StackAbility
&& item.getStackAbility() instanceof CyclingAbility) { && item.getStackAbility() instanceof CyclingAbility) {
playerMap.computeIfAbsent(event.getPlayerId(), u -> new HashMap()); playerMap.computeIfAbsent(event.getPlayerId(), u -> new HashMap<>());
playerMap.get(event.getPlayerId()).compute(event.getSourceId(), (u, i) -> i == null ? 1 : i + 1); playerMap.get(event.getPlayerId()).compute(
event.getSourceId(), (u, i) -> i == null ? 1 : Integer.sum(i, 1)
);
} }
} }