mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Add TurnId to GameState (for Final Fortune card)
This commit is contained in:
parent
3417be4a78
commit
d7489789d9
3 changed files with 18 additions and 4 deletions
|
@ -597,11 +597,16 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
state.setTurnNum(state.getTurnNum() + 1);
|
||||
|
||||
//20091005 - 500.7
|
||||
while (getState().getTurnMods().extraTurn(player.getId())) {
|
||||
UUID extraTurnId = getState().getTurnMods().getExtraTurn(player.getId());
|
||||
while (extraTurnId != null) {
|
||||
state.setExtraTurn(true);
|
||||
state.setTurnId(extraTurnId);
|
||||
playTurn(player);
|
||||
state.setTurnNum(state.getTurnNum() + 1);
|
||||
|
||||
extraTurnId = getState().getTurnMods().getExtraTurn(player.getId());
|
||||
}
|
||||
state.setTurnId(null);
|
||||
state.setExtraTurn(false);
|
||||
player = players.getNext(this);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private Exile exile;
|
||||
private Battlefield battlefield;
|
||||
private int turnNum = 1;
|
||||
private UUID turnId = null;
|
||||
private boolean extraTurn = false;
|
||||
private boolean legendaryRuleActive = true;
|
||||
private boolean gameOver;
|
||||
|
@ -358,6 +359,14 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.turnNum = turnNum;
|
||||
}
|
||||
|
||||
public UUID getTurnId() {
|
||||
return this.turnId;
|
||||
}
|
||||
|
||||
public void setTurnId(UUID turnId) {
|
||||
this.turnId = turnId;
|
||||
}
|
||||
|
||||
public boolean isExtraTurn() {
|
||||
return extraTurn;
|
||||
}
|
||||
|
|
|
@ -49,16 +49,16 @@ public class TurnMods extends ArrayList<TurnMod> {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean extraTurn(UUID playerId) {
|
||||
public UUID getExtraTurn(UUID playerId) {
|
||||
ListIterator<TurnMod> it = this.listIterator(this.size());
|
||||
while (it.hasPrevious()) {
|
||||
TurnMod turnMod = it.previous();
|
||||
if (turnMod.isExtraTurn() == true && turnMod.getPlayerId().equals(playerId)) {
|
||||
it.remove();
|
||||
return true;
|
||||
return turnMod.getId();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean skipTurn(UUID playerId) {
|
||||
|
|
Loading…
Reference in a new issue