Skip to content

Commit

Permalink
Condensed rubble and rough if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
pheonixstorm committed Feb 16, 2023
1 parent 0781768 commit 7ca5b59
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions megamek/src/megamek/common/Terrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,16 @@ public int movementCost(Entity e) {
}
return 0;
case Terrains.RUBBLE:
boolean allowRubbleHoverTracked = ((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED)) && (level == 6);

if (level == 6) {
mp = 2;
} else {
mp = 1;
}

if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
if (((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED))
&& (level == 6)) {
mp *= 2;
} else if ((moveMode == EntityMovementMode.WHEELED)) {
if (allowRubbleHoverTracked || (moveMode == EntityMovementMode.WHEELED)) {
mp *= 2;
}
}
Expand Down Expand Up @@ -521,17 +520,16 @@ public int movementCost(Entity e) {
}
return Math.max(0, mp);
case Terrains.ROUGH:
boolean allowRoughHoverTracked = ((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED)) && (level == 2);

if (level == 2) {
mp = 2;
} else {
mp = 1;
}

if (isCrossCountry && e.isGround() && e.isCombatVehicle()) {
if (((moveMode == EntityMovementMode.HOVER) || (moveMode == EntityMovementMode.TRACKED))
&& (level == 2)) {
mp *= 2;
} else if ((moveMode == EntityMovementMode.WHEELED)) {
if ( allowRoughHoverTracked || (moveMode == EntityMovementMode.WHEELED)) {
mp *= 2;
}
}
Expand Down

0 comments on commit 7ca5b59

Please sign in to comment.