Fikser en bug vedrørende skade fra trippel laser

This commit is contained in:
Kristian Knarvik 2020-05-03 14:22:39 +02:00
parent 1060fb70b6
commit d23bfed055

View File

@ -854,7 +854,21 @@ public class Board {
* @param robot The robot getting hit by the robot
*/
private void applyLaserDamage(WallType laserType, Robot robot) {
robot.setDamageTaken(robot.getDamageTaken() + laserType.getWallTypeID() - 2);
int laserDamage;
switch (laserType) {
case WALL_LASER_SINGLE:
laserDamage = 1;
break;
case WALL_LASER_DOUBLE:
laserDamage = 2;
break;
case WALL_LASER_TRIPLE:
laserDamage = 3;
break;
default:
throw new IllegalArgumentException("Invalid laser type encountered.");
}
robot.setDamageTaken(robot.getDamageTaken() + laserDamage - 2);
}
/**