PR: Fix crew killed buildings not counting as crew killed in after-action#8774
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8774 +/- ##
=========================================
Coverage 13.22% 13.22%
- Complexity 7873 7874 +1
=========================================
Files 1306 1306
Lines 169162 169191 +29
Branches 25452 25458 +6
=========================================
+ Hits 22378 22383 +5
- Misses 144606 144632 +26
+ Partials 2178 2176 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where crew-killed buildings were not being counted correctly in the after-action scenario resolution screen. Specifically, it updates the entityIsCaptured logic so that buildings with remaining CF (i.e., not collapsed) count as captured even if their entity state is "Destroyed", and updates entity capture/preserve evaluation to correctly use opponentHasBattlefieldControl rather than its inverse. It also re-enables the recheckObjectives() call in the tab-change handler.
Changes:
ScenarioObjectiveProcessor: FixedentityIsCapturedto checkopponentHasBattlefieldControl(instead of!opponentHasBattlefieldControl), and updated it to count non-collapsedAbstractBuildingEntityinstances as captured. AddedentityIsCapturedto thePreservecase inupdateObjectiveEntityState.ScenarioObjectiveProcessor: Updated theCapturecase inentityMeetsObjectiveto also useopponentHasBattlefieldControl(matching the fix above).ResolveScenarioWizardDialog: IntroducedrecheckObjectives()method and enabled it intabChanged(), replacing the previously commented-out stub.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
MekHQ/src/mekhq/campaign/mission/ScenarioObjectiveProcessor.java |
Fixes capture/preserve logic for buildings and corrects the opponentHasBattlefieldControl polarity for capture evaluation |
MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java |
Implements recheckObjectives() and enables it in tabChanged() to keep objective checkboxes in sync |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MekHQ/src/mekhq/campaign/mission/ScenarioObjectiveProcessor.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/ScenarioObjectiveProcessor.java
Outdated
Show resolved
Hide resolved
MekHQ/src/mekhq/campaign/mission/ScenarioObjectiveProcessor.java
Outdated
Show resolved
Hide resolved
…ves should remember manual player overrides - unless the player makes changes that change the "auto" value - going back and changing if a unit was killed, for example
Do not merge until MegaMek/megamek#8059 has been merged!
Updates to scenario resolution to better support capturing buildings: