This commit is contained in:
Evan Kranzler 2017-08-23 21:26:39 -04:00
parent 5457907b9b
commit 255b81f143
2 changed files with 11 additions and 6 deletions

View file

@ -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;
}

View file

@ -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);
}