Skip to content

Commit

Permalink
fix: Avoid penalizing Improved Heavy Lasers in weapon bays
Browse files Browse the repository at this point in the history
While heavy lasers incur an accuracy penalty, this obviously isn't meant
to apply to improved heavy lasers, which are improved specifically by
avoiding that.

The check has also been made a bit more efficient.
  • Loading branch information
Saklad5 committed Aug 18, 2024
1 parent 0e7ec4b commit 364759a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions megamek/src/megamek/common/actions/WeaponAttackAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3835,15 +3835,10 @@ private static ToHitData compileAeroAttackerToHitMods(Game game, Entity ae, Targ
if (ae.usesWeaponBays() && wtype != null && weapon != null) {

// any heavy lasers
if (wtype.getAtClass() == WeaponType.CLASS_LASER) {
for (WeaponMounted bweap : weapon.getBayWeapons()) {
WeaponType bwtype = bweap.getType();
if ((bwtype.getInternalName().contains("Heavy"))
&& (bwtype.getInternalName().contains("Laser"))) {
toHit.addModifier(+1, Messages.getString("WeaponAttackAction.HeavyLaserInBay"));
break;
}
}
if (wtype.getAtClass() == WeaponType.CLASS_LASER &&
weapon.getBayWeapons().stream().anyMatch(bweap ->
bweap.getType().getInternalName().startsWith("CLHeavyLaser"))) {
toHit.addModifier(+1, Messages.getString("WeaponAttackAction.HeavyLaserInBay"));
}
// barracuda missiles
else if (wtype.getAtClass() == WeaponType.CLASS_CAPITAL_MISSILE) {
Expand Down

0 comments on commit 364759a

Please sign in to comment.