mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-07-23 16:30:29 +02:00
Fikser noen bugs rundt flagg og diverse Closes #75
Fikser noen tiles i Dizzy Dash som var feil vei Fikser resetting av hasTouchedFlagThisTurn Fikser at RoboRallyGame sin setProgram ikke godtar et tomt program Utvider flaggtesten til å inkludere alle flagg
This commit is contained in:
@@ -890,7 +890,13 @@ public class Board {
|
||||
* @param hasTouched If the robot has touched a flag this turn
|
||||
*/
|
||||
public void setHasTouchedFlagThisTurn(RobotID robotID, boolean hasTouched) {
|
||||
robots.get(robotID).setHasTouchedFlagThisTurn(hasTouched);
|
||||
Robot aliveRobot = robots.get(robotID);
|
||||
Robot deadRobot = getRobotFromDeadRobots(robotID);
|
||||
if (aliveRobot != null) {
|
||||
aliveRobot.setHasTouchedFlagThisTurn(hasTouched);
|
||||
} else if (deadRobot != null) {
|
||||
deadRobot.setHasTouchedFlagThisTurn(hasTouched);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -131,7 +131,7 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
|
||||
@Override
|
||||
public void setProgram(List<ProgrammingCard> program) {
|
||||
if (program.size() != 5) {
|
||||
if (program.size() != 5 && program.size() != 0) {
|
||||
throw new IllegalArgumentException("Invalid program chosen.");
|
||||
}
|
||||
this.program = program;
|
||||
@@ -307,8 +307,8 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
|
||||
* Resets the boolean for if the robot has touched a flag this turn, to set up the next turn.
|
||||
*/
|
||||
private void resetHasTouchedFlagThisTurnForAllRobots() {
|
||||
for (Robot robot : gameBoard.getAliveRobots()) {
|
||||
robot.setHasTouchedFlagThisTurn(false);
|
||||
for (RobotID robotID : RobotID.values()) {
|
||||
gameBoard.setHasTouchedFlagThisTurn(robotID, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user