Skip to content

Commit

Permalink
check both old and new control roll rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Algebro7 committed Aug 6, 2024
1 parent 48b939e commit 7e1fc94
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions megamek/src/megamek/server/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19335,9 +19335,10 @@ void checkForPSRFromDamage() {
}
}
if (entity.isAero() && entity.isAirborne() && !game.getBoard().inSpace()) {
// if this aero has any damage, add another roll to the list.
// check if aero unit meets conditions for control rolls and add to the list
if (entity.damageThisPhase > 0) {
if (!getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)) {
if (!getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)
&& !getGame().getOptions().booleanOption(OptionsConstants.UNOFF_ADV_ATMOSPHERIC_CONTROL)) {
int damMod = entity.damageThisPhase / 20;
PilotingRollData damPRD = new PilotingRollData(entity.getId(), damMod,
entity.damageThisPhase + " damage +" + damMod);
Expand All @@ -19347,15 +19348,23 @@ void checkForPSRFromDamage() {
}
getGame().addControlRoll(damPRD);
} else {
// was the damage threshold exceeded this round?
// Note errata: https://bg.battletech.com/forums/index.php?topic=72983.msg2024516#msg2024516
if ((((IAero) entity).wasCritThresh())
|| entity.damageThisRound > ((IAero) entity).getHighestThresh()) {
// was the damage threshold in a single location exceeded this round?
if ((((IAero) entity).wasCritThresh())) {
PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0,
"damage threshold exceeded");
"damage threshold exceeded");
if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT)
&& (entity.getCrew().getPiloting() > 3)) {
damThresh.addModifier(-1, "easy to pilot");
&& (entity.getCrew().getPiloting() > 3)) {
damThresh.addModifier(-1, "easy to pilot");
}
getGame().addControlRoll(damThresh);
} else if (getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_ATMOSPHERIC_CONTROL)
&& entity.damageThisRound > ((IAero) entity).getHighestThresh()) {
// did the damage exceed the unit's highest threshold?
PilotingRollData damThresh = new PilotingRollData(entity.getId(), 0,
"highest damage threshold exceeded");
if (entity.hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT)
&& (entity.getCrew().getPiloting() > 3)) {
damThresh.addModifier(-1, "easy to pilot");
}
getGame().addControlRoll(damThresh);
}
Expand Down

0 comments on commit 7e1fc94

Please sign in to comment.