Skip to content

Fixes auto assigning forces to official challenge scenarios (#8612)#8811

Open
VicenteCartas wants to merge 2 commits intoMegaMek:mainfrom
VicenteCartas:vc/8612
Open

Fixes auto assigning forces to official challenge scenarios (#8612)#8811
VicenteCartas wants to merge 2 commits intoMegaMek:mainfrom
VicenteCartas:vc/8612

Conversation

@VicenteCartas
Copy link
Collaborator

This fixes #8612

I couldn't repro manually, but the test will check that a force is not auto-assigned to an official challenge scenario. Without this change, this is the test result, where stratcon tries to auto-assign the foce:

Screenshot 2026-03-14 220732

With the change, this test passes correctly.

@VicenteCartas VicenteCartas requested a review from a team as a code owner March 15, 2026 05:21
Copilot AI review requested due to automatic review settings March 15, 2026 05:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts StratCon force auto-assignment behavior so Official Challenge scenarios don’t forcibly pre-select/assign a player force, addressing #8612 in the StratCon scenario generation/deployment flow.

Changes:

  • Prevent auto-assignment for Official Challenge scenarios when generating scenarios for existing forces.
  • Prevent auto-assignment when deploying a force onto a hex that already contains an Official Challenge scenario.
  • Add unit tests covering deployForceToCoords() behavior for challenge vs non-challenge scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
MekHQ/src/mekhq/campaign/stratCon/StratConRulesManager.java Adds Official Challenge checks to bypass auto-assignment paths in scenario generation/deployment.
MekHQ/unittests/mekhq/campaign/stratCon/StratConRulesManagerTest.java Adds regression tests asserting forces are not auto-assigned to Official Challenge scenarios (and still are for normal scenarios).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 41.66667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.27%. Comparing base (6e9f6a0) to head (f23ffea).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../mekhq/campaign/stratCon/StratConRulesManager.java 50.00% 4 Missing and 1 partial ⚠️
.../src/mekhq/campaign/stratCon/StratConScenario.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8811      +/-   ##
============================================
+ Coverage     13.22%   13.27%   +0.04%     
- Complexity     7874     7893      +19     
============================================
  Files          1306     1306              
  Lines        169191   169193       +2     
  Branches      25458    25460       +2     
============================================
+ Hits          22383    22459      +76     
+ Misses       144632   144535      -97     
- Partials       2176     2199      +23     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Official Challenge Scenarios forces selection of deployed combat force.

2 participants