Skip to content

Commit

Permalink
Merge pull request #6016 from MegaMek/quadvee-damage-mp-reduction
Browse files Browse the repository at this point in the history
Quadvee damage mp reduction
  • Loading branch information
SJuliez authored Sep 21, 2024
2 parents 418a656 + 0eeace3 commit c6b71cf
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions megamek/src/megamek/common/QuadVee.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public String getMotiveTypeString() {
}

public static int getMotiveTypeForString(String inType) {
if ((inType == null) || (inType.length() < 1)) {
if ((inType == null) || (inType.isEmpty())) {
return MOTIVE_UNKNOWN;
}
for (int x = 0; x < MOTIVE_STRING.length; x++) {
Expand Down Expand Up @@ -161,9 +161,8 @@ public int getCruiseMP(MPCalculationSetting mpCalculationSetting) {
mp++;
}

// If a leg or its track/wheel is destroyed, it is treated as major motive system damage,
// which we are interpreting as a cumulative 1/2 MP.
// bg.battletech.com/forums/index.php?topic=55261.msg1271935#msg1271935
// If a leg or its track/wheel is destroyed, it reduces movement by a cumulative -1/4 mp per leg.
// https://bg.battletech.com/forums/index.php?topic=63281.msg1469243#msg1469243
int badTracks = 0;
for (int loc = 0; loc < locations(); loc++) {
if (locationIsLeg(loc) && (isLocationBad(loc) || getCritical(loc, 5).isHit())) {
Expand All @@ -173,8 +172,8 @@ public int getCruiseMP(MPCalculationSetting mpCalculationSetting) {

if (badTracks == 4) {
return 0;
} else if (badTracks > 1) {
mp = mp / (1 << badTracks);
} else if (badTracks > 0) {
mp -= mp * badTracks / 4;
}

if (!mpCalculationSetting.ignoreModularArmor && hasModularArmor()) {
Expand Down Expand Up @@ -276,14 +275,11 @@ public MPBoosters getArmedMPBoosters() {
return mpBoosters;
}

switch (mpBoosters) {
case MASC_AND_SUPERCHARGER:
return MPBoosters.SUPERCHARGER_ONLY;
case MASC_ONLY:
return MPBoosters.NONE;
default:
return mpBoosters;
}
return switch (mpBoosters) {
case MASC_AND_SUPERCHARGER -> MPBoosters.SUPERCHARGER_ONLY;
case MASC_ONLY -> MPBoosters.NONE;
default -> mpBoosters;
};
}

/**
Expand Down

0 comments on commit c6b71cf

Please sign in to comment.