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

Fix 6395: Add knowledge of smoke zero damage to princess #6397

Merged

Conversation

Sleet01
Copy link
Collaborator

@Sleet01 Sleet01 commented Jan 11, 2025

Have the WeaponFireInfo.computeExpectedDamage() method return 0 if the associated munition is Smoke, Flare, or FASCAM/Thunder type.
This should give Princess a better idea of the utility of some munitions when planning turns and attacks, so she chooses them less often.
Similarly, explicitly set the damage value of Smoke, Flare, or FASCAM/Thunder artillery munitions to 0 for Artillery fire control computations.

We can either replace this with a generalized Smoke or Utility Munition planner, or implement that at a higher level, but for now we don't want Princess to treat zero-damage rounds as if they do damage to targets.

This also fixes an NPE path in minefield handling, when artillery-deployed minefields are used in counter-battery attacks.
Unfortunately it looks like all counter-battery attacks currently compute an expected damage of 0.0, possibly due to the targets being off-board, so Princess still chooses munitions for these attacks randomly.

Additionally, add trailing spaces to the Glancing Blow and Direct Blow messages so that they produce lines like:

- Glancing Blow - 6 missile(s) hit

rather than

- Glancing Blow -6 missile(s) hit

which can be confusing.

Testing:

  • Ran several Princess-on-Princess battles with Smoke (and other) munitions equipped.
  • Ran all 3 projects' unit tests.

Close #6395

Copy link

codecov bot commented Jan 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.57%. Comparing base (c640d47) to head (e20bf40).
Report is 86 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6397      +/-   ##
============================================
+ Coverage     28.56%   28.57%   +0.01%     
+ Complexity    14090    14088       -2     
============================================
  Files          2788     2785       -3     
  Lines        273454   273302     -152     
  Branches      48432    48414      -18     
============================================
  Hits          78104    78104              
+ Misses       191367   191217     -150     
+ Partials       3983     3981       -2     

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

@Sleet01 Sleet01 marked this pull request as draft January 12, 2025 09:28
@Sleet01
Copy link
Collaborator Author

Sleet01 commented Jan 12, 2025

Converted to draft; I'm also adding Thunder, FASCAM, maybe a couple others as well

@Sleet01 Sleet01 force-pushed the Add_Knowledge_of_Smoke_Zero_Damage_To_Princess branch from 0109f41 to 3533e20 Compare January 13, 2025 07:48
@Sleet01 Sleet01 marked this pull request as ready for review January 13, 2025 08:19
@Sleet01 Sleet01 requested a review from NickAragua January 14, 2025 19:02
Copy link
Member

@HammerGS HammerGS left a comment

Choose a reason for hiding this comment

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

Checked with Co-Pilot and IDEA AI

@HammerGS HammerGS merged commit 61bf76b into MegaMek:master Jan 15, 2025
6 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.

Princess doesn't know that Smoke munitions do zero damage.
2 participants