-
Notifications
You must be signed in to change notification settings - Fork 188
Refactor StratCon Reinforcement Logic and Improve Skill Checks #6709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor StratCon Reinforcement Logic and Improve Skill Checks #6709
Conversation
- Refactored reinforcement logic to utilize the new Centralized Skill Check utility class when evading enemy interceptions.
- Updated reinforcement target number to better match the original intent. Now the skill of the Admin character will act as a modifier, rather than the primary target number. The base Target Number is currently 7, adjusted by the experience level of the admin character.
### Pull Request Summary - **Refactored reinforcement interception logic**: - Consolidated morale-based reinforcement success checks. - Removed redundant routed enemy success check. - **Implemented `SkillCheckUtility` for skill evaluations**: - Simplified and standardized the handling of Tactics skill checks. - Added success/failure reporting for reinforcement evasion. - **Updated morale and skill modifier calculations**: - Adjusted targeting logic using skill and morale modifiers. - Improved handling of default skill behavior for unskilled commanders. - **Refined user-facing reinforcement text resources**: - Removed redundant or obsolete text for routed enemy scenarios. - Simplified evasion success and failure messaging. - **General cleanup and optimizations**: - Standardized imports and removed unused variables. - Refined reinforcement target calculation method for better clarity. This refactor simplifies the reinforcement logic while maintaining functionality and improving usability, making skill-based outcomes more consistent and clear to users.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6709 +/- ##
============================================
+ Coverage 11.40% 11.45% +0.04%
- Complexity 6482 6483 +1
============================================
Files 1095 1094 -1
Lines 141048 140613 -435
Branches 21884 21799 -85
============================================
+ Hits 16082 16101 +19
+ Misses 123308 122859 -449
+ Partials 1658 1653 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 pull request refactors the StratCon reinforcement logic and modifies the skill check procedure for better alignment with the original intent. Key changes include:
- Integrating the new Centralized Skill Check utility for enemy evasion.
- Adjusting the reinforcement target number computation by applying the admin character’s skill as a modifier.
- Updating reporting logic to directly add campaign reports.
Files not reviewed (1)
- MekHQ/resources/mekhq/resources/AtBStratCon.properties: Language not supported
Comments suppressed due to low confidence (1)
MekHQ/src/mekhq/campaign/stratcon/StratconRulesManager.java:1855
- [nitpick] Consider extracting the literal '7' into a named constant to enhance clarity and facilitate future adjustments of the base target number.
TargetRoll reinforcementTargetNumber = new TargetRoll(7, "Base Target Number");
// Check passed | ||
if (interceptionRoll >= interceptionOdds) { | ||
if (interceptionRoll >= interceptionOdds || contract.getMoraleLevel().isRouted()) { | ||
reportStatus.append(' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify that combining the interception roll check with the enemy morale routed condition is intentional, as this change may bypass some reporting or handling scenarios previously managed separately.
Copilot uses AI. Check for mistakes.
campaign.addReport(skillCheckUtility.getResultsText()); | ||
|
||
if (roll >= targetNumber) { | ||
reportStatus.append(' '); | ||
if (skillCheckUtility.isSuccess()) { | ||
String reportString = tactics != null ? | ||
resources.getString("reinforcementEvasionSuccessful.text") : | ||
resources.getString("reinforcementEvasionSuccessful.noSkill"); | ||
reportStatus.append(String.format(reportString, | ||
campaign.addReport(String.format(reportString, | ||
spanOpeningWithCustomColor(MekHQ.getMHQOptions().getFontColorPositiveHexColor()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider standardizing the reporting approach by either accumulating messages in reportStatus or using campaign.addReport consistently, to ensure clarity in the report output.
Copilot uses AI. Check for mistakes.