-
Notifications
You must be signed in to change notification settings - Fork 177
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
Refactored Leadership Unit Selection Logic #5281
Conversation
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.
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 ReportAll modified and coverable lines are covered by tests ✅
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. |
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.
*These changes were suggested by our user base |
|
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.
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.
Co-Pilot sees no issues.
@IllianiCBT Merge Conflicts |
# Conflicts: # MekHQ/resources/mekhq/resources/AtBStratCon.properties # MekHQ/src/mekhq/campaign/stratcon/StratconRulesManager.java # MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java
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.