8000 Refactor StratCon Reinforcement Logic and Improve Skill Checks by IllianiBird · Pull Request #6709 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 4 commits into from
Apr 26, 2025

Conversation

IllianiBird
Copy link
Collaborator
  • 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.
@IllianiBird IllianiBird added StratCon Bugs relating strictly to StratCon Refactoring For New Dev Cycle labels Apr 19, 2025
@IllianiBird IllianiBird self-assigned this Apr 19, 2025
Copy link
codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 11.45%. Comparing base (c77b064) to head (a747dd7).
Report is 59 commits behind head on master.

Files with missing lines Patch % Lines
.../mekhq/campaign/stratcon/StratconRulesManager.java 0.00% 15 Missing ⚠️
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.
📢 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.

@HammerGS HammerGS requested a review from Copilot April 23, 2025 02:37
Copy link
Contributor
@Copilot 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 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");

Comment on lines 1692 to 1694
// Check passed
if (interceptionRoll >= interceptionOdds) {
if (interceptionRoll >= interceptionOdds || contract.getMoraleLevel().isRouted()) {
reportStatus.append(' ');
Copy link
Preview
Copilot AI Apr 23, 2025

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.

Comment on lines +1742 to 1749
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()),
Copy link
Preview
Copilot AI Apr 23, 2025

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.

@HammerGS HammerGS merged commit 7b927f7 into MegaMek:master Apr 26, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0