Random Civilian Removal Fix#8990
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8990 +/- ##
============================================
- Coverage 14.00% 13.99% -0.02%
+ Complexity 8320 8317 -3
============================================
Files 1285 1285
Lines 167958 167972 +14
Branches 25418 25422 +4
============================================
- Hits 23530 23513 -17
- Misses 141950 141982 +32
+ Partials 2478 2477 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes the Random Civilian Removal (“Random Dependents”) flow so camp followers are included in the active personnel pool and can be considered for random removal, aligning behavior with campaign expectations around civilian retention.
Changes:
- Include camp followers when building the candidate pool by switching
Campaign.getActivePersonnel(..., includeCampFollowers)toincludeCampFollowers=true. - Narrow dependent collection to camp followers that are civilians (
!isEmployed() && isCivilian()), keeping the removal system focused on civilians. - Update the unit test mock to match the revised
getActivePersonnel(false, true)call.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| MekHQ/src/mekhq/campaign/personnel/RandomDependents.java | Includes camp followers in the active personnel iteration so they can be tracked and removed as dependents. |
| MekHQ/unittests/mekhq/campaign/personnel/RandomDependentsTest.java | Adjusts mocking to reflect the updated getActivePersonnel(false, true) usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
At some point in the distant past we introduced implicit filters to the method that fetches personnel. This was done to filter out unnecessary personnel, specifically Camp Followers. However, this was incorrectly propagated to the Random Civilian Removal system, so that all Camp Followers were filtered out and thus never considered eligible for random removal.
Addendum: we may see an uptick in player contract regarding civilians leaving their campaign. This will be working as intended, if players want to keep their civilians they should employ them. At which point they'll be covered by normal Retention systems.