Skip to content

Conversation

@IllianiBird
Copy link
Collaborator

@IllianiBird IllianiBird commented Nov 20, 2025

Fix #8260

In this episode of "Illiani Fixes Morale, No For Real This Time" we fix an issue where we were comparing equipment quality against Dragoon Ratings, despite quality being the wrong metric and Dragoon Ratings not being used in OpFor calculations.

That issue, at least, is an artifact from the original morale system our new one was built on. I do feel rather stupid that I didn't spot it before, though.

While I was at it I also updated the glossary and added a bunch more tests.

@IllianiBird IllianiBird self-assigned this Nov 20, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner November 20, 2025 18:15
@IllianiBird IllianiBird added Bug StratCon Bugs relating strictly to StratCon Tests Issues or Pull Requests related to the project tests Severity: High Issues described as high severity as per the new issue form labels Nov 20, 2025
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 62.06897% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.74%. Comparing base (f130d04) to head (1a752aa).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/campaign/mission/MHQMorale.java 62.06% 10 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8262      +/-   ##
============================================
+ Coverage     11.72%   11.74%   +0.02%     
- Complexity     7532     7548      +16     
============================================
  Files          1271     1271              
  Lines        162724   162754      +30     
  Branches      24515    24525      +10     
============================================
+ Hits          19082    19121      +39     
+ Misses       141644   141632      -12     
- Partials       1998     2001       +3     

☔ 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.

@IllianiBird IllianiBird changed the title Fix: Fixed Morale Yet Again; Updated Glossary; Added Even More Tests Fix #8260: Fixed Morale Yet Again; Updated Glossary; Added Even More Tests Nov 20, 2025
@HammerGS HammerGS requested a review from Copilot November 20, 2025 21:44
Copilot finished reviewing on behalf of HammerGS November 20, 2025 21:47
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

This PR fixes issue #8260 where the morale system was incorrectly comparing equipment quality against Dragoon Ratings instead of using skill levels for OpFor calculations. The fix updates the morale reliability calculation to use getEnemySkill().getAdjustedValue() instead of getEnemyQuality(), properly aligning the system with skill-based metrics rather than outdated Dragoon rating constants.

Key Changes

  • Replaced Dragoon rating-based reliability calculations with skill level-based calculations (GREEN, ELITE, LEGENDARY)
  • Enhanced morale check reporting to show both raw roll and modifiers separately for clarity
  • Added comprehensive test coverage for morale state transitions and edge cases

Reviewed Changes

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

Show a summary per file
File Description
MHQMoraleTest.java Updated tests to use SkillLevel enums instead of ForceDescriptor ratings; added 90+ lines of new test cases for morale transitions and null date handling
MHQMorale.java Fixed getReliability() to use skill levels; improved documentation; separated roll display from modifiers; added constant definitions for target numbers
Mission.properties Updated tooltip text for morale levels to use more consistent voice ("allied forces" instead of "your forces")
MHQMorale.properties Enhanced report format to display roll breakdown: "Rolled X (Y + Z)" showing base roll and modifiers
GlossaryEntry.properties Expanded morale documentation with skill-based calculations, HTML formatting, and contract type clarifications

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Severity: High Issues described as high severity as per the new issue form StratCon Bugs relating strictly to StratCon Tests Issues or Pull Requests related to the project tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] [NIGHTLY 2025-11-19] More Morale Roll Nonsense

1 participant