Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid penalizing Improved Heavy Lasers in weapon bays #5918

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

Saklad5
Copy link
Contributor

@Saklad5 Saklad5 commented Aug 18, 2024

This fixes a long-standing bug with Improved Heavy Lasers getting an accuracy penalty in weapon bays.

It also makes the check quite a bit more efficient, replacing two O(n) calls with one O(1) call. I might skim through the code later and see if I can make similar changes elsewhere.

@Saklad5 Saklad5 marked this pull request as draft August 18, 2024 12:58
@Saklad5 Saklad5 marked this pull request as ready for review August 18, 2024 13:06
Copy link

codecov bot commented Aug 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.90%. Comparing base (e2fa2c8) to head (f21c91c).
Report is 6 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5918      +/-   ##
============================================
- Coverage     28.90%   28.90%   -0.01%     
+ Complexity    13929    13926       -3     
============================================
  Files          2539     2539              
  Lines        268363   268361       -2     
  Branches      47933    47930       -3     
============================================
- Hits          77579    77576       -3     
+ Misses       186819   186817       -2     
- Partials       3965     3968       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Saklad5 Saklad5 marked this pull request as draft August 18, 2024 15:08
@Saklad5 Saklad5 marked this pull request as ready for review August 18, 2024 15:42
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.
@IllianiCBT IllianiCBT added the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Aug 18, 2024
weapon.getBayWeapons().stream()
.map(WeaponMounted::getType)
.map(WeaponType::getInternalName)
.anyMatch(i -> i.startsWith("CLHeavyLaser"))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "CLHeavyLaser" the "Improved Heavy Laser"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it’s the unimproved versions. If that matches, it applies the penalty.

@SJuliez SJuliez removed the For New Dev Cycle This PR should be merged at the beginning of a dev cycle label Sep 4, 2024
@NickAragua NickAragua merged commit b60dd3c into MegaMek:master Sep 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants