Added the monarch concept to xmage and all related cards.

This commit is contained in:
LevelX2 2016-11-27 01:14:32 +01:00
parent 8bf299e342
commit 68d0e6b9fa
33 changed files with 2149 additions and 281 deletions

View file

@ -2348,7 +2348,18 @@ public abstract class GameImpl implements Game, Serializable {
it.remove();
}
}
// If the current monarch leaves the game. When that happens, the player whose turn it is becomes the monarch.
// If the monarch leaves the game on their turn, the next player in turn order becomes the monarch.
if (playerId.equals(getMonarchId())) {
if (!getActivePlayerId().equals(playerId)) {
setMonarchId(null, getActivePlayerId());
} else {
Player nextPlayer = getPlayerList().getNext(this);
if (nextPlayer != null) {
setMonarchId(null, nextPlayer.getId());
}
}
}
// 801.2c The particular players within each players range of influence are determined as each turn begins.
// So no update of range if influence yet
}
@ -2896,4 +2907,20 @@ public abstract class GameImpl implements Game, Serializable {
}
return options;
}
@Override
public UUID getMonarchId() {
return getState().getMonarchId();
}
@Override
public void setMonarchId(Ability source, UUID monarchId) {
Player newMonarch = getPlayer(monarchId);
if (newMonarch != null) {
getState().setMonarchId(monarchId);
informPlayers(newMonarch.getLogName() + " is the monarch");
fireEvent(new GameEvent(GameEvent.EventType.BECOMES_MONARCH, monarchId, source == null ? null : source.getSourceId(), monarchId));
}
}
}