8000 Fix: Fixed Reinforcements So That the Force Leader's Strategy is Used for Reinforcement Time and Not the Overall Drop Commander's Strategy by IllianiBird · Pull Request #7056 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Fixed Reinforcements So That the Force Leader's Strategy is Used for Reinforcement Time and Not the Overall Drop Commander's Strategy #7056

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IllianiBird
Copy link
Collaborator

Previously we were using the Strategy skill of the overall drop commander, meaning that Strategy on reinforcing units was worthless. While this does make some kind of sense, I definitely prefer players needing to invest in skills across more characters.

… for Reinforcement Time and Not the Overall Drop Commander's Strategy
@IllianiBird IllianiBird self-assigned this May 19, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner May 19, 2025 18:16
@IllianiBird IllianiBird added Bug AtB StratCon Bugs relating strictly to StratCon Severity: Low Issues described as low severity as per the new issue form For New Dev Cycle labels May 19, 2025
@IllianiBird IllianiBird marked this pull request as draft May 19, 2025 18:16
UUID commanderId = playerForce.getForceCommanderID();
Person commander = campaign.getPerson(commanderId);
if (commander != null && commander.hasSkill(S_STRATEGY)) {
strategy = commander.getSkill(S_STRATEGY).getTotalSkillLevel();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
Skill.getTotalSkillLevel
should be avoided because it has been deprecated.
Copy link
codecov bot commented May 19, 2025

Codecov Report

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

Project coverage is 12.03%. Comparing base (e72d548) to head (3053f45).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...hq/campaign/mission/AtBDynamicScenarioFactory.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #7056   +/-   ##
=========================================
  Coverage     12.03%   12.03%           
+ Complexity     6891     6889    -2     
=========================================
  Files          1103     1103           
  Lines        142282   142289    +7     
  Branches      21991    21992    +1     
=========================================
+ Hits          17123    17124    +1     
- Misses       123324   123328    +4     
- Partials       1835     1837    +2     

☔ 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 May 21, 2025 00:43
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 PR changes reinforcement timing logic to use each force leader’s Strategy skill rather than the drop commander’s skill.

  • Removed scenario.getLanceCommanderSkill(...) and instead fetch the specific force commander’s Strategy level.
  • Added static import for SkillType.S_STRATEGY and imported Person.
  • Initialize strategy to 0 and conditionally set it from the force commander, defaulting to 0 if absent.
Comments suppressed due to low confidence (1)

MekHQ/src/mekhq/campaign/mission/AtBDynamicScenarioFactory.java:4099

  • Consider adding a unit test to verify that the force commander’s Strategy skill correctly influences deployment turns and that the fallback to 0 is applied when no skill is present.
UUID commanderId = playerForce.getForceCommanderID();

@@ -4083,7 +4085,7 @@ public static void setPlayerDeploymentTurns(AtBDynamicScenario scenario, Campaig
}

// Make note of battle commander strategy
int strategy = scenario.getLanceCommanderSkill(SkillType.S_STRATEGY, campaign);
int strategy = 0;
Copy link
Preview
Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The initial assignment to 0 is redundant since both branches of the following conditional reassign strategy. Consider declaring it without an initializer and relying on the conditional to set its value.

Suggested change
int strategy = 0;
int strategy;

Copilot uses AI. Check for mistakes.

@@ -4094,6 +4096,13 @@ public static void setPlayerDeploymentTurns(AtBDynamicScenario scenario, Campaig

List<Entity> forceEntities = new ArrayList<>();
Force playerForce = campaign.getForce(forceID);
UUID commanderId = playerForce.getForceCommanderID();
Person commander = campaign.getPerson(commanderId);
Copy link
Preview
Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

[nitpick] It may be safer to guard against a null commanderId before passing it to campaign.getPerson(...) to avoid potential NPEs if no commander is assigned.

Suggested change
Person commander = campaign.getPerson(commanderId);
Person commander = null;
if (commanderId != null) {
commander = campaign.getPerson(commanderId);
}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AtB Bug For New Dev Cycle Severity: Low Issues described as low severity as per the new issue form StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0