mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-07-30 03:35:26 +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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
12 16
|
||||
01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1
|
||||
01;1 12;3 11;3 11;3 12;5 01;1 01;1 12;3 11;3 11;3 12;5 01;1
|
||||
01;1 11;1 03;1 01;1 11;1 04;7 01;1 11;1 03;1 01;1 11;5 01;1
|
||||
01;1 11;1 21;1 03;1 11;1 01;1 01;1 11;1 22;1 03;1 11;5 01;1
|
||||
01;1 11;1 03;1 01;1 11;5 04;7 01;1 11;1 03;1 01;1 11;5 01;1
|
||||
01;1 11;1 21;1 03;1 11;5 01;1 01;1 11;1 22;1 03;1 11;5 01;1
|
||||
01;1 12;1 11;7 11;7 12;7 17;1 04;7 12;1 11;7 11;7 12;7 01;1
|
||||
01;1 01;1 01;1 01;1 04;5 01;1 01;1 01;1 01;1 04;1 01;1 01;1
|
||||
01;1 19;1 04;5 01;1 01;1 01;1 01;1 04;1 01;1 01;1 01;1 01;1
|
||||
|
Reference in New Issue
Block a user