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

Decoupled Dependents from AtB, Reworked Dependents, Reworked New Personnel Ages, Added Documentation #4463

Merged
merged 35 commits into from
Sep 26, 2024

Conversation

IllianiCBT
Copy link
Collaborator

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

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.
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.
@IllianiCBT IllianiCBT added AtB Personnel Personnel-related Issues UX User experience Documentation labels Jul 22, 2024
@IllianiCBT IllianiCBT self-assigned this Jul 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.46%. Comparing base (c147ec9) to head (caef4d9).
Report is 52 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

# Conflicts:
#	MekHQ/docs/Personnel Modules/Prisoner & Defection System.pdf
#	MekHQ/src/mekhq/campaign/Campaign.java
@IllianiCBT
Copy link
Collaborator Author

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
@IllianiCBT IllianiCBT marked this pull request as draft August 9, 2024 00:13
@IllianiCBT
Copy link
Collaborator Author

Flipping this to draft so I can't merge it by accident

IllianiCBT and others added 9 commits August 19, 2024 14:08
# 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.
@IllianiCBT
Copy link
Collaborator Author

Flipping this to live. Assuming the tests pass, it should be good for review.

@IllianiCBT IllianiCBT marked this pull request as ready for review September 17, 2024 22:45
…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
@IllianiCBT IllianiCBT merged commit 7089ece into MegaMek:master Sep 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AtB Documentation For New Dev Cycle Personnel Personnel-related Issues UX User experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: cap additional adult dependents based on current admin levels
2 participants