* Commander - Fixed that a player lost by commander damage was posted continuously to the game log while the multiplayer game was ongoing.

This commit is contained in:
LevelX2 2015-08-25 15:21:45 +02:00
parent c5718e3f19
commit 30e0f8b85a
2 changed files with 3 additions and 4 deletions

View file

@ -193,7 +193,7 @@ public abstract class GameCommanderImpl extends GameImpl {
for (Map.Entry<UUID, Integer> entrySet : damageWatcher.getDamageToPlayer().entrySet()) { for (Map.Entry<UUID, Integer> entrySet : damageWatcher.getDamageToPlayer().entrySet()) {
if (entrySet.getValue() > 20) { if (entrySet.getValue() > 20) {
Player opponent = getPlayer(entrySet.getKey()); Player opponent = getPlayer(entrySet.getKey());
if (opponent != null && player.isInGame()) { if (opponent != null && !opponent.hasLost() && player.isInGame()) {
opponent.lost(this); opponent.lost(this);
} }
} }

View file

@ -113,13 +113,12 @@ public class CommanderInfoWatcher extends Watcher {
sb.append(" ").append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone."); sb.append(" ").append(castCount).append(castCount == 1 ? " time" : " times").append(" casted from the command zone.");
} }
this.addInfo(object, "Commander", sb.toString(), game); this.addInfo(object, "Commander", sb.toString(), game);
if (checkCommanderDamage) { if (checkCommanderDamage) {
for (Map.Entry<UUID, Integer> entry : damageToPlayer.entrySet()) { for (Map.Entry<UUID, Integer> entry : damageToPlayer.entrySet()) {
Player damagedPlayer = game.getPlayer(entry.getKey()); Player damagedPlayer = game.getPlayer(entry.getKey());
sb.setLength(0);
sb.append("<b>Commander</b> did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append("."); sb.append("<b>Commander</b> did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append(".");
this.addInfo(object, new StringBuilder("Commander").append(entry.getKey()).toString(), sb.toString(), game); this.addInfo(object, "Commander" + entry.getKey(),
"<b>Commander</b> did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + ".", game);
} }
} }
} }