game: Squashed various bugs

This commit is contained in:
Nathan Woodburn 2023-05-11 12:36:08 +10:00
parent a19f6e371c
commit 7c8dac2aff
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -169,6 +169,9 @@ public class Game extends Application {
sendMessage("You have placed all your villages");
return;
}
} else if (currentGame.getCurrentPlayer().getSettlers().length >= (40-(currentGame.getNumPlayers()*5))){
sendMessage("You have placed all your settlers");
return;
}
// If the move is valid, do it
@ -232,7 +235,7 @@ public class Game extends Application {
String message = "";
if (!currentGame.isPhaseOver()){
Player player = currentGame.getCurrentPlayer();
player.doAIMove(currentGame);
if (player.doAIMove(currentGame)) {
if (currentGame.isPhaseOver()) {
message = "Starting next phase";
@ -245,11 +248,14 @@ public class Game extends Application {
message = "AI " + player.getPlayerID() + " picked up " + resource.getTypeString().toLowerCase();
}
}
}
else {
} else {
message = "AI " + player.getPlayerID() + " placed at " + lastMove.toString();
}
}
} else {
message += "AI " + player.getPlayerID() + " passed";
currentGame.nextPlayer();
}
}
if (currentGame.isPhaseOver()){
currentGame.scorePhase();
@ -607,6 +613,7 @@ public class Game extends Application {
hb.setSpacing(10);
hb.setLayoutX(50);
hb.setLayoutY(WINDOW_HEIGHT - 50);
controls.getChildren().clear();
controls.getChildren().add(hb);
}