-
Notifications
You must be signed in to change notification settings - Fork 334
Fix advanced armors handling PSRs, Piloting Rolls, damage reduction incorrectly #7108
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 advanced armors handling PSRs, Piloting Rolls, damage reduction incorrectly #7108
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7108 +/- ##
============================================
+ Coverage 30.75% 30.79% +0.03%
- Complexity 16826 17029 +203
============================================
Files 2936 2940 +4
Lines 285817 287606 +1789
Branches 49726 50210 +484
============================================
+ Hits 87901 88565 +664
- Misses 191624 192536 +912
- Partials 6292 6505 +213 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dd1285d to
aaab330
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issues with advanced armors preventing PSRs and piloting rolls and refactors damage application code by moving damageEntity into a dedicated damage manager module. It also updates several unit definition files and associated game options and localization files to support these changes.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| megamek/testresources/megamek/common/units/*.mtf/.blk | Added or updated unit definitions with new and revised unit attributes |
| megamek/src/megamek/server/IDamageManager.java | Introduced a new damage manager interface to encapsulate damageEntity logic |
| megamek/src/megamek/common/options/OptionsConstants.java & BasicGameOptions.java | Added new game option BASE_NEW_DAMAGE_MANAGER to toggle the new damage handling system |
| megamek/src/megamek/common/DamageInfo.java | Updated the DamageInfo record with multiple overloaded constructors for enhanced flexibility |
| megamek/i18n/megamek/common/options/messages.properties | Updated messages to include entries for the new damage manager option |
Comments suppressed due to low confidence (1)
megamek/testresources/megamek/common/units/Flashman FLS-10E.mtf:5
- [nitpick] Ensure that the casing of configuration keys (e.g., 'techbase' vs 'TechBase') is consistent across all unit definition files to improve readability and maintainability.
techbase:Mixed (IS Chassis)
4ffa5bc to
70094fb
Compare
|
Asked AI about the Java Doc failure. Says this.
Code Suggestions: Method: removeFirstTurnFor Add the missing @param, @return, and @throws tags. Method: setAllReports Add the missing @param tag.
|
4fe82a4 to
9a7289d
Compare
|
@HammerGS The Game.java stuff is outside my scope, but I can try fixing the tag error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only sticking point is the copyright headers.
The rest are just requests along with... please do something about the variable names.
49c96d7 to
c56cf2c
Compare
|
One of the recent changes has introduced an OOM at the end of the firing phase on very large matches; I've confirmed it's not in the old damage code so I'm taking this to Draft to find the issue. |
07431a9 to
ff84f65
Compare
|
Turns out early return escapes need to be replaced with something after they are removed. |
ff84f65 to
a15c4ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If TWDamageManager needs both GameManager and Game... can't it use the game reference from the GameManager itself? Also, since it is so vital for it, would be best if the TWDamageManager had to be be initialized on its constructor with a TWGameManager, solving all possible error states because of bad initialization.
|
Also, can you rename the "new" damage manager to something else? |
Are you familiar with the "Chicken and Egg" problem? 😸 Further, while we currently automatically create a Game instance when instantiating TWGameManager, we may not always - and decoupling the Game instance from the TWGameManager instance makes for easier testing. In the near future I plan to move more functionality out of TWGameManager into TWDamageManager, which should remove this mutual dependency, but for now I wanted to get the new damage handling code out and tested by players. |
Removed merge conflicts due to Mech/Mek updates; these changes will be reintroduced following the rebase. Removed additional merge conflicts from subsequent updates.
Removed already-moved section. Note: will need verification that changes have been persisted between 03/04 and 03/20 versions. Merge some updates, adapt/ignore some others. Now with deprecation pass included.
Remove extraneous blocks moved/duplicated in this patch. Redo some removal. Note: again, will need to reconcile 03/04 and 03/20 versions.
Note: currently broken; should be fixed in next patch.
Now with deprecation pass included
Now with deprecation pass
…hexes; can be removed
…lication functions
…20250521 Now with deprecation pass
Now with deprecation pass
…amage loop for destroyed Aerospace
I can do this, but the "Legacy" TWDamageManager is going away once we're comfortable with the new code, and the new code will replace its innards. So we'll only have TWDamageManagerModular for 1~2 releases. |
7efc44f to
2658385
Compare
…o stripped trailing space
This PR contains fixes for a number of advanced armors not preventing PSRs or piloting rolls as they should.
It also contains updates for some Aerospace and BA armor handling edge cases.
Finally, it implements a TWDamageManager class and moves the entirety of direct damage assignment function
damageEntityout of TWGameManager into a separate class that TWGameManager will configure through composition.The rationale behind splitting damageEntity() out of TWGameManager is three-fold:
A new game option has been added to allow disabling the new damage manager code if desired / needed while further fixes are implemented.
Going Forward
There are a few more edge-case bugs that may need to be added to this PR but I would like to get the initial work in for testing purposes.
There is also a good argument for pulling more damage-adjacent handling code out of TWGameManager into TWDamageManager, but that is outside my remit - the work so far was in service of simplifying
damageEntityso that specific issues around advanced armor could be fix, and no more.If it makes sense to move functions out of TWGameManager then another PR may be in order.
Testing:
Fix: #2032
Fix: #2209
Fix: #3396