mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
fixed bug #3834
This commit is contained in:
parent
5457907b9b
commit
255b81f143
2 changed files with 11 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue