Fix #8385: ACAR always reporting 100% loss odds in StratCon scenarios#8809
Fix #8385: ACAR always reporting 100% loss odds in StratCon scenarios#8809VicenteCartas wants to merge 7 commits intoMegaMek:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes StratCon ACAR simulations incorrectly reporting 100% loss odds by ensuring player/allied entities are actually added to the simulation even when their forceString is missing or begins with an empty root-force segment.
Changes:
- Assigns a default
forceStringto entities that would otherwise have no force assignment (preventing them from being silently skipped). - Normalizes
forceStringby stripping leading empty-named force segments that break MegaMek force parsing/validation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8809 +/- ##
============================================
+ Coverage 13.22% 13.39% +0.16%
- Complexity 7874 7993 +119
============================================
Files 1306 1306
Lines 169191 169203 +12
Branches 25458 25464 +6
============================================
+ Hits 22383 22668 +285
+ Misses 144632 144321 -311
- Partials 2176 2214 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
psikomonkie
left a comment
There was a problem hiding this comment.
Code looks fine but the copyright on the new file is incorrect.
MekHQ/unittests/mekhq/campaign/autoResolve/ScenarioSetupForcesTest.java
Outdated
Show resolved
Hide resolved
…8094) ## Description Fixes a deployment timing bug in the ACAR auto-resolve simulation where formations with deployRound=0 were never deployed. The ACAR game loop increments the round counter to 1 before the first deployment check. Both shouldDeployForRound() and DeploymentPhase used exact equality (==) to match the current round against a formation's deploy round. Since all formations default to deployRound=0 and the first round is 1, the deployment phase was always skipped — no formations from either side ever deployed, and every simulation ended as a draw. ## Changes SimulationContext.shouldDeployForRound(): Changed from containsKey(round) to check for any pending deployment at or before the current round (<= round). DeploymentPhase.executePhase(): Changed deployment filter from == currentRound to <= currentRound so formations whose deploy round has already passed are still deployed. ##Related [MekHQ companion PR](MegaMek/mekhq#8809)
Description
Fixes #8385 — ACAR always reports 100% chance of loss in all StratCon scenarios. Player units were never added to the simulation, so the enemy won instantly every time.
After change, with the campaign from the bug report:

Root Cause
Two issues in ScenarioSetupForces.sendEntities():
Changes
In ScenarioSetupForces.sendEntities():
Related
MegaMek companion PR
Fixes #8385