mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-08-03 21:55:27 +02:00
Gjør det mulig å hente ut alle roboter fra spillet
This commit is contained in:
@@ -34,37 +34,6 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
private ProgrammingCardDeck playerHand;
|
||||
private Phase phase;
|
||||
|
||||
public Boolean getRobotPowerdown(){
|
||||
if(getPlayerFromName(this.playerName)!=null){
|
||||
return gameBoard.getPowerDown(Objects.requireNonNull(getPlayerFromName(this.playerName)).getRobotID());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Robo Rally game
|
||||
*
|
||||
* @param playerList A list of all the players participating in the game
|
||||
* @param boardName The playerName of the board to use
|
||||
* @param host Whether this player is the host
|
||||
* @param playerName The name of the player of this instance of the game
|
||||
* @param server The server if this player is host. Should be null otherwise
|
||||
* @param debug Whether this game is to use the debugging board
|
||||
*/
|
||||
public RoboRallyGame(List<Player> playerList, String boardName, boolean host, String playerName,
|
||||
RoboRallyServer server, boolean debug) {
|
||||
this.playerName = playerName;
|
||||
this.host = host;
|
||||
this.playerList = playerList;
|
||||
this.server = server;
|
||||
if (debug) {
|
||||
initializeDebugMode();
|
||||
} else {
|
||||
initializeGame(boardName);
|
||||
}
|
||||
this.phase = new Phase(gameBoard, playerList, 600, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Robo Rally game
|
||||
*
|
||||
@@ -84,6 +53,13 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
this.phase = new Phase(gameBoard, playerList, 600, this);
|
||||
}
|
||||
|
||||
public Boolean getRobotPowerdown() {
|
||||
if (getPlayerFromName(this.playerName) != null) {
|
||||
return gameBoard.getPowerDown(Objects.requireNonNull(getPlayerFromName(this.playerName)).getRobotID());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return gameBoard.getBoardWidth();
|
||||
@@ -114,6 +90,11 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
return gameBoard.getAliveRobots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Robot> getAllRobots() {
|
||||
return gameBoard.getAllRobots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getPlayers() {
|
||||
return new ArrayList<>(this.playerList);
|
||||
@@ -186,17 +167,17 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
removeNonLockedProgrammingCardsFromPlayers();
|
||||
}
|
||||
|
||||
if (getPlayerFromName(this.playerName)!=null&& 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);
|
||||
setGameState(GameState.SKIP_STAY_IN_POWER_DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveStayInPowerDown(PowerDownContainer powerDowns) {
|
||||
for (Player player : playerList) {
|
||||
if(gameBoard.getPowerDown(player.getRobotID())) {
|
||||
if (gameBoard.getPowerDown(player.getRobotID())) {
|
||||
player.setPowerDownNextRound(powerDowns.getPowerDown().get(player.getName()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user