Skip to content
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

Refactored Leadership Unit Selection Logic #5281

Merged
merged 7 commits into from
Dec 4, 2024

Conversation

IllianiCBT
Copy link
Collaborator

This PR revises Leadership Unit selection to no longer use the lowest BV in the previously assigned forces. Furthermore, players are not granted x number of auxiliary units per level of Leadership.

Instead, players are granted a 500 BV2 budget, multiplied by the number of levels of Leadership obtained by the force commander. A character with 3 Leadership, for example, can supplement their deployment with 1,500 BV2 of supplemental units. There is no limit on the number of units the player can deploy in this way, so long as the total BV2 does not exceed the budget. Leadership units are still required to be a different type to the primary unit for the parent force.

Only units that are present in the TO&E are eligible to be chosen as Leadership Units. This allows the player to better control what units are listed.

Revised the leadership unit selection algorithm to use a base leadership budget, improving efficiency and clarity. Removed redundant code and streamlined the process to determine eligible units based on the force commander's leadership capabilities. Updated UI elements to reflect changes in how available units are calculated and displayed.
@IllianiCBT IllianiCBT added the StratCon Bugs relating strictly to StratCon label Dec 3, 2024
@IllianiCBT IllianiCBT self-assigned this Dec 3, 2024
Included force name in unit rendering for clarity and addressed budget calculation by allowing units with BattleValue equal to the total budget. These changes improve the visibility and usability of units within the Scenario Wizard and ensure that budget allocation is handled more accurately.
@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.47%. Comparing base (91fcbc5) to head (107b960).
Report is 42 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5281      +/-   ##
============================================
- Coverage     10.47%   10.47%   -0.01%     
- Complexity     6049     6060      +11     
============================================
  Files           959      959              
  Lines        135211   135463     +252     
  Branches      19680    19733      +53     
============================================
+ Hits          14166    14187      +21     
- Misses       119697   119921     +224     
- Partials       1348     1355       +7     

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

Replaced `useLeadershipPoint` method with direct adjustment of `leadershipPointsUsed` using calculated base battle values, improving clarity and precision. Updated methods and parameters to align with the new approach, including renaming for clarity. Adjusted UI labels and validation rules to support displaying calculated unit battle value details consistently, enhancing user experience and code maintainability.
Updated the leadership budget calculation to ensure it is capped at five levels for both UI and logic processing. This change prevents budgets from exceeding the maximum allowed and ensures consistent gameplay mechanics. The update utilized the `min` function to enforce the cap effectively.
@IllianiCBT
Copy link
Collaborator Author

  • Increased the leadership unit budget from 500/level to 1000/level (capped at 5,000). This may need further adjustments, but should be a good starting point*
  • Leadership Unit costs are based on crewless BV2*
  • Leadership Units are no longer restricted to types other than the primary force's primary type. This means 'Meks can reinforcement 'Mek forces, and Vees can reinforce Vee forces*
  • Updated the Leadership unit picker GUI to include more information

*These changes were suggested by our user base

@IllianiCBT
Copy link
Collaborator Author

  • Leadership unit picker now sorts entries based on formation names, not unit names. This is done using a reversed force hierarchy. So we sort at battalion level, then company level, then lance level (and so on). This ensures units are grouped intuitively, which should make finding the right units easier for players with large campaigns.

Replaced unit name sorting with sorting based on a reversed force hierarchy to better organize leadership units. Implemented `getForceNameReversed` method to compute force names in reverse order, aiding in the sort process. This change enhances the clarity of the force structure presented to the user.
Copy link
Member

@HammerGS HammerGS left a comment

Choose a reason for hiding this comment

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

Co-Pilot sees no issues.

@HammerGS
Copy link
Member

HammerGS commented Dec 4, 2024

@IllianiCBT Merge Conflicts

# Conflicts:
#	MekHQ/resources/mekhq/resources/AtBStratCon.properties
#	MekHQ/src/mekhq/campaign/stratcon/StratconRulesManager.java
#	MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java
@IllianiCBT IllianiCBT merged commit 6635153 into MegaMek:master Dec 4, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
StratCon Bugs relating strictly to StratCon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants