This commit is contained in:
Tobydrama 2020-03-31 15:08:30 +02:00
commit 6bb6e4965c
2 changed files with 18 additions and 10 deletions

View File

@ -136,30 +136,38 @@ public class Board {
} }
/** /**
* sets the powerdown status of the robot * Sets the power down status of the robot
* @param robotID the robotid of the robot * @param robotID The robot id of the robot
* @param powerdown the status of the powerdown * @param powerdown The status of the powerdown
*/ */
public void setPowerDown(RobotID robotID,Boolean powerdown){ public void setPowerDown(RobotID robotID, Boolean powerdown) {
robots.get(robotID).setPowerDown(powerdown); robots.get(robotID).setPowerDown(powerdown);
} }
/**
* Gets the power down status of the robot
* @param robotID The robot id of the robot
*/
public boolean getPowerDown(RobotID robotID) {
return robots.get(robotID).isInPowerDown();
}
/** /**
* removes one damage for a given robot given that it has taken som damage before * removes one damage for a given robot given that it has taken som damage before
* @param robotID the ID of the robot * @param robotID the ID of the robot
*/ */
public void repairRobotOnTile(RobotID robotID){ public void repairRobotOnTile(RobotID robotID) {
Robot robot = robots.get(robotID); Robot robot = robots.get(robotID);
int newDamage = Math.max(robot.getDamageTaken()-1,0); int newDamage = Math.max(robot.getDamageTaken() - 1, 0);
robot.setDamageTaken(newDamage); robot.setDamageTaken(newDamage);
} }
/** /**
* sets the damage taken of robots in powerdown to 0 * sets the damage taken of robots in powerdown to 0
*/ */
public void executePowerdown(){ public void executePowerdown() {
for (Robot robot:robots.values()) { for (Robot robot:robots.values()) {
if(robot.isInPowerDown()){ if (robot.isInPowerDown()) {
robot.setDamageTaken(0); robot.setDamageTaken(0);
} }
} }

View File

@ -414,9 +414,9 @@ public class RoboRallyGame implements IDrawableGame {
} }
/** /**
* repair all robots standing on a reparer tile * repair all robots standing on a repair tile
*/ */
private void repairAllRobotsOnReparerTiles(){ private void repairAllRobotsOnRepairTiles(){
List<BoardElementContainer<Tile>> listOfRepareTiles = gameBoard.getPositionsOfTileOnBoard(TileType.FLAG_1, List<BoardElementContainer<Tile>> listOfRepareTiles = gameBoard.getPositionsOfTileOnBoard(TileType.FLAG_1,
TileType.FLAG_2, TileType.FLAG_3, TileType.FLAG_4, TileType.WRENCH, TileType.WRENCH_AND_HAMMER); TileType.FLAG_2, TileType.FLAG_3, TileType.FLAG_4, TileType.WRENCH, TileType.WRENCH_AND_HAMMER);
for (BoardElementContainer<Tile> repareTile:listOfRepareTiles) { for (BoardElementContainer<Tile> repareTile:listOfRepareTiles) {