Some additions to game log.

This commit is contained in:
LevelX2 2013-10-03 22:40:14 +02:00
parent 3fcb222201
commit 089fbf15b1

View file

@ -572,23 +572,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
} }
private boolean playTurn(Player player) { private boolean playTurn(Player player) {
StringBuilder sb = new StringBuilder("Turn "); this.logStartOfTurn(player);
sb.append(state.getTurnNum()).append(" (");
int delimiter = this.getPlayers().size() - 1;
for (Player gamePlayer : this.getPlayers().values()) {
sb.append(gamePlayer.getLife());
int poison = gamePlayer.getCounters().getCount(CounterType.POISON);
if (poison > 0) {
sb.append("[P:").append(poison).append("]");
}
if (delimiter > 0) {
sb.append(" - ");
delimiter--;
}
}
sb.append(")");
fireStatusEvent(sb.toString(), true);
if (checkStopOnTurnOption()) { if (checkStopOnTurnOption()) {
return false; return false;
} }
@ -604,6 +588,26 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
} }
private void logStartOfTurn(Player player) {
StringBuilder sb = new StringBuilder("Turn ").append(state.getTurnNum()).append(" ");
sb.append(player.getName());
sb.append(" (");
int delimiter = this.getPlayers().size() - 1;
for (Player gamePlayer : this.getPlayers().values()) {
sb.append(gamePlayer.getLife());
int poison = gamePlayer.getCounters().getCount(CounterType.POISON);
if (poison > 0) {
sb.append("[P:").append(poison).append("]");
}
if (delimiter > 0) {
sb.append(" - ");
delimiter--;
}
}
sb.append(")");
fireStatusEvent(sb.toString(), true);
}
private boolean checkStopOnTurnOption() { private boolean checkStopOnTurnOption() {
if (gameOptions.stopOnTurn != null && gameOptions.stopAtStep == PhaseStep.UNTAP) { if (gameOptions.stopOnTurn != null && gameOptions.stopAtStep == PhaseStep.UNTAP) {
if (gameOptions.stopOnTurn.equals(state.getTurnNum())) { if (gameOptions.stopOnTurn.equals(state.getTurnNum())) {