* Game timer - Fixed that the timer count down was not shown while selecting the starting player and deciding for mulligan.

This commit is contained in:
LevelX2 2015-05-20 23:27:00 +02:00
parent a3065b703a
commit f5245ade01
3 changed files with 19 additions and 6 deletions

View file

@ -90,7 +90,8 @@ public class PlayerView implements Serializable {
this.hasPriority = player.getId().equals(state.getPriorityPlayerId());
this.priorityTimeLeft = player.getPriorityTimeLeft();
this.timerActive = (this.hasPriority && player.isGameUnderControl()) ||
(player.getPlayersUnderYourControl().contains(state.getPriorityPlayerId()));
(player.getPlayersUnderYourControl().contains(state.getPriorityPlayerId())) ||
player.getId().equals(game.getState().getChoosingPlayerId());
this.hasLeft = player.hasLeft();
for (Card card: player.getGraveyard().getCards(game)) {

View file

@ -811,9 +811,10 @@ public abstract class GameImpl implements Game, Serializable {
choosingPlayer = this.getPlayer(choosingPlayerId);
}
if (choosingPlayer == null) {
choosingPlayer = getPlayer(pickChoosingPlayer());
choosingPlayerId = pickChoosingPlayer();
choosingPlayer = getPlayer(choosingPlayerId);
}
getState().setChoosingPlayerId(choosingPlayerId); // needed to start/stop the timer if active
if (choosingPlayer != null && choosingPlayer.choose(Outcome.Benefit, targetPlayer, null, this)) {
startingPlayerId = targetPlayer.getTargets().get(0);
Player startingPlayer = state.getPlayer(startingPlayerId);
@ -859,6 +860,7 @@ public abstract class GameImpl implements Game, Serializable {
GameEvent event = new GameEvent(GameEvent.EventType.CAN_TAKE_MULLIGAN, null, null, playerId);
if (!replaceEvent(event)) {
fireEvent(event);
getState().setChoosingPlayerId(playerId);
if (player.chooseMulligan(this)) {
keep = false;
}
@ -880,7 +882,7 @@ public abstract class GameImpl implements Game, Serializable {
}
saveState(false);
} while (!mulliganPlayers.isEmpty());
getState().setChoosingPlayerId(null);
// add watchers
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
state.getWatchers().add(new PlayerDamagedBySourceWatcher(playerId));

View file

@ -87,8 +87,9 @@ public class GameState implements Serializable, Copyable<GameState> {
private final Watchers watchers;
private UUID activePlayerId;
private UUID priorityPlayerId;
private UUID activePlayerId; // playerId which turn it is
private UUID priorityPlayerId; // player that has currently priority
private UUID choosingPlayerId; // player that makes a choice at game start
private SpellStack stack;
private Command command;
private Exile exile;
@ -134,6 +135,7 @@ public class GameState implements Serializable, Copyable<GameState> {
this.playerList = state.playerList.copy();
this.activePlayerId = state.activePlayerId;
this.priorityPlayerId = state.priorityPlayerId;
this.choosingPlayerId = state.choosingPlayerId;
this.turn = state.turn.copy();
this.stack = state.stack.copy();
this.command = state.command.copy();
@ -360,6 +362,14 @@ public class GameState implements Serializable, Copyable<GameState> {
this.priorityPlayerId = priorityPlayerId;
}
public UUID getChoosingPlayerId() {
return choosingPlayerId;
}
public void setChoosingPlayerId(UUID choosingPlayerId) {
this.choosingPlayerId = choosingPlayerId;
}
public Battlefield getBattlefield() {
return this.battlefield;
}