fixed some bugs with powerdown screens

This commit is contained in:
Tobydrama 2020-04-21 15:49:38 +02:00
parent cab21fb0fa
commit 507ec6ed4a
3 changed files with 6 additions and 4 deletions

View File

@ -43,13 +43,13 @@ class RoboRallyClientListener extends Listener {
wrapper.server != null, info.getPlayerName(), wrapper.server);
} else if (object instanceof ProgrammingCardDeck) {
if(((ProgrammingCardDeck) object).isEmpty()){
wrapper.roboRallyGame.setProgram(new ArrayList<>());
if (wrapper.roboRallyGame.getRobotPowerdown()){
wrapper.roboRallyGame.setGameState(GameState.SKIP_POWER_DOWN_SCREEN);
}
else {
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_POWER_DOWN);
}
wrapper.roboRallyGame.setProgram(new ArrayList<>());
}
else {wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);}
new Thread(() -> wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object)).start();

View File

@ -4,7 +4,7 @@ package inf112.fiasko.roborally.networking.containers;
* This class represents a response saying that something went wrong with the request
*/
public class ErrorResponse {
private final String errorMessage;
private String errorMessage;
private boolean critical;
/**
@ -16,6 +16,9 @@ public class ErrorResponse {
this.errorMessage = errorMessage;
this.critical = false;
}
public ErrorResponse(){
}
/**
* Constructs a new error response

View File

@ -181,11 +181,10 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
removeNonLockedProgrammingCardsFromPlayers();
}
if (gameBoard.getPowerDown(Objects.requireNonNull(getPlayerFromName(this.playerName)).getRobotID())) {
if (getPlayerFromName(this.playerName)!=null&& gameBoard.getPowerDown(Objects.requireNonNull(getPlayerFromName(this.playerName)).getRobotID())) {
setGameState(GameState.CHOOSING_STAY_IN_POWER_DOWN);
} else {
setGameState(GameState.LOADING);
}
}