From 255b81f1438f6deb629567433c9241730dfaa2d3 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 23 Aug 2017 21:26:39 -0400 Subject: [PATCH] fixed bug #3834 --- .../dynamicvalue/common/OpponentsLostLifeCount.java | 7 +------ .../mage/watchers/common/PlayerLostLifeWatcher.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java index b25f9c88ede..131609a7c21 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/OpponentsLostLifeCount.java @@ -32,7 +32,6 @@ import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.Effect; import mage.game.Game; -import mage.players.Player; import mage.watchers.common.PlayerLostLifeWatcher; /** @@ -49,11 +48,7 @@ public class OpponentsLostLifeCount implements DynamicValue { public int calculate(Game game, UUID controllerId) { PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName()); if (watcher != null) { - int amountLifeLost = 0; - for (UUID opponentId : game.getOpponents(controllerId)) { - amountLifeLost += watcher.getLiveLost(opponentId); - } - return amountLifeLost; + return watcher.getAllOppLifeLost(controllerId); } return 0; } diff --git a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java index c0fd33b991d..462f2db4083 100644 --- a/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PlayerLostLifeWatcher.java @@ -78,6 +78,16 @@ public class PlayerLostLifeWatcher extends Watcher { return amountOfLifeLostThisTurn.getOrDefault(playerId, 0); } + public int getAllOppLifeLost(UUID playerId) { + int amount = 0; + for (UUID player : this.amountOfLifeLostThisTurn.keySet()) { + if (!player.equals(playerId)) { + amount += this.amountOfLifeLostThisTurn.get(player); + } + } + return amount; + } + public int getLiveLostLastTurn(UUID playerId) { return amountOfLifeLostLastTurn.getOrDefault(playerId, 0); }