-
Notifications
You must be signed in to change notification settings - Fork 178
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
Decoupled Dependents from AtB, Reworked Dependents, Reworked New Personnel Ages, Added Documentation #4463
Conversation
The method getAgeByExpLevel in Utilities.java has been refactored to simplify logic and improve age calculation based on a character's experience level and clan status. This included modifying base values, incorporating an efficient switch case for experience levels, and updating condition checks for character age calculation.
Simplified the switch-case statement in the getSimpleTechLevel method and updated the syntax for string concatenation in Utilities.java.
Deleted the RandomDependentMethod.java file as it was no longer needed. Added a new functionality 'useAssignRecruitRank' which, when enabled, automatically assigns E0 rank to new adult recruits. Updated component fields and methods in CampaignOptions.java to reflect these changes, and adjusted related UI elements and properties accordingly.
The useAssignRecruitRank function and its associated elements in the Campaign Options GUI pane were removed. This was done in response to a realization that this mechanism was not realistically feasible.
The RandomDependentMethodTest.java file was deleted. This test file was no longer necessary following removal of the enum it was testing.
The process for adding and removing "dependents" in a campaign was revised. This involved creating a new method to handle both actions called `processRandomDependents`. An additional method `getActiveDependents` was also introduced to retrieve a list of active dependents. The goal was to improve code organization and readability. Focusing on the most critical part of the changes, the previously crowded block of code responsible for this process was now separated and made more modular.
Refined the dependent removal and addition process in the Campaign class. Specific restrictions were added to the removal of dependents, excluding those who have a spouse, non-adult children, or are children themselves. The addition process was also optimized to reflect a more accurate count of available capacity. Additional methods were added in the Genealogy class to assist in the implementation of these new conditions.
…& defection documentation
The original getLowerRandomInt() methods and other relevant computations were restructured for clarity and better flow. A new method, isRemovalEligible(), was introduced to check eligibility of a dependent. Also, improved random roll computation for dependent addition.
This update modifies the processRandomDependents method in the Campaign class, more specifically the way dependents are handled. Instead of considering the entire active personnel for the dependent capacity, the code now specifically excludes Dependents and children, making the removal process more accurate. Also, the isRemovalEligible method has been updated with an additional parameter (the current date) for better clarity.
Removed the feature that automatically assigns an E0 rank to new adult recruits. Also adjusted the calculation for the dependent capacity in the campaign to ensure a minimum value of 1 and reduced the capacity proportion from 20% to 5%. The dependent's title is now hyperlinked in reports.
Adjusted the calculation for the dependent capacity in the campaign to ensure a minimum value of 1 and reduced the capacity proportion from 20% to 5%. The dependent's title is now hyperlinked in reports.
The base age in the getAgeByExpLevel method was changed from 16 to 18. Additionally, the age calculations for the veteran and elite experience levels were modified to reflect these changes. The ultra-green level condition that previously adjusted the age was removed.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4463 +/- ##
=========================================
Coverage 10.46% 10.46%
- Complexity 6014 6017 +3
=========================================
Files 953 952 -1
Lines 132794 132755 -39
Branches 19318 19308 -10
=========================================
- Hits 13898 13894 -4
+ Misses 117544 117516 -28
+ Partials 1352 1345 -7 ☔ View full report in Codecov by Sentry. |
# Conflicts: # MekHQ/docs/Personnel Modules/Prisoner & Defection System.pdf # MekHQ/src/mekhq/campaign/Campaign.java
Updated to remove conflicts |
# Conflicts: # MekHQ/docs/Personnel Modules/Prisoner & Defection System.pdf # MekHQ/src/mekhq/campaign/Campaign.java
…sRework # Conflicts: # MekHQ/docs/Personnel Modules/Prisoner & Defection System.pdf
Flipping this to draft so I can't merge it by accident |
# Conflicts: # MekHQ/src/mekhq/Utilities.java # MekHQ/src/mekhq/campaign/Campaign.java # MekHQ/src/mekhq/campaign/CampaignOptions.java # MekHQ/src/mekhq/campaign/personnel/familyTree/Genealogy.java # MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java
Updated copyright years to 2024 across several files. Improved code readability by importing required classes explicitly and reformatting comments for better readability.
Updated copyright years to 2024 across several files. Improved code readability by importing required classes explicitly and reformatting comments for better readability.
Separated `processRandomDependents` into distinct methods for removing and adding dependents.
Flipping this to live. Assuming the tests pass, it should be good for review. |
5f51d06
to
2ad6e3c
Compare
…sRework # Conflicts: # MekHQ/src/mekhq/campaign/mission/AtBContract.java
# Conflicts: # MekHQ/resources/mekhq/resources/Campaign.properties # MekHQ/src/mekhq/campaign/Campaign.java # MekHQ/src/mekhq/campaign/CampaignOptions.java # MekHQ/src/mekhq/campaign/mission/AtBContract.java # MekHQ/src/mekhq/campaign/personnel/familyTree/Genealogy.java
This PR primarily reworks the random addition and removal of Dependents from a campaign. In doing so it decouples dependents from AtB and moves to a monthly addition/removal model, rather than annual. This creates a more dynamic feel to addition and removal.
The number of random Dependents is now soft-capped at 5% of the total active, adult, non-dependents in the campaign. This helps reduce the issue of larger campaigns ending up with small towns traveling with them.
While I was reworking dependents I also incorporated the information on how they work into the prisoners & defection documentation. Neither random dependents nor prisoners are sufficiently detailed to warrant their own documentation, so it made sense to merge them.
Finally, I slightly adjusted the ages new personnel spawn at. In particular, dependents now have much larger range of possible ages and Veteran and Elite personnel will spawn at higher ages.
Closes #3570