Fixed player leaving/conceding handling.

This commit is contained in:
LevelX2 2017-10-21 16:13:45 +02:00
parent 79d4c07d20
commit 58d3fc2328
21 changed files with 553 additions and 463 deletions

View file

@ -95,7 +95,7 @@ public abstract class Phase implements Serializable {
}
public boolean play(Game game, UUID activePlayerId) {
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
@ -104,7 +104,7 @@ public abstract class Phase implements Serializable {
if (beginPhase(game, activePlayerId)) {
for (Step step : steps) {
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
if (game.getTurn().isEndTurnRequested() && step.getType()!=PhaseStep.CLEANUP) {
@ -122,7 +122,7 @@ public abstract class Phase implements Serializable {
}
}
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
count++;
@ -143,7 +143,7 @@ public abstract class Phase implements Serializable {
}
public boolean resumePlay(Game game, PhaseStep stepType, boolean wasPaused) {
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
@ -157,7 +157,7 @@ public abstract class Phase implements Serializable {
resumeStep(game, wasPaused);
while (it.hasNext()) {
step = it.next();
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
currentStep = step;
@ -169,7 +169,7 @@ public abstract class Phase implements Serializable {
}
}
if (game.isPaused() || game.gameOver(null)) {
if (game.isPaused() || game.checkIfGameIsOver()) {
return false;
}
count++;
@ -206,13 +206,13 @@ public abstract class Phase implements Serializable {
if (!currentStep.skipStep(game, activePlayerId)) {
game.getState().increaseStepNum();
prePriority(game, activePlayerId);
if (!game.isPaused() && !game.gameOver(null) && !game.executingRollback()) {
if (!game.isPaused() && !game.checkIfGameIsOver() && !game.executingRollback()) {
currentStep.priority(game, activePlayerId, false);
if (game.executingRollback()) {
return;
}
}
if (!game.isPaused() && !game.gameOver(null) && !game.executingRollback()) {
if (!game.isPaused() && !game.checkIfGameIsOver() && !game.executingRollback()) {
postPriority(game, activePlayerId);
}
}
@ -233,11 +233,11 @@ public abstract class Phase implements Serializable {
prePriority(game, activePlayerId);
}
case PRIORITY:
if (!game.isPaused() && !game.gameOver(null)) {
if (!game.isPaused() && !game.checkIfGameIsOver()) {
currentStep.priority(game, activePlayerId, resuming);
}
case POST:
if (!game.isPaused() && !game.gameOver(null)) {
if (!game.isPaused() && !game.checkIfGameIsOver()) {
postPriority(game, activePlayerId);
}
}