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

Implemented Incremental Loyalty Changes #4441

Merged
merged 13 commits into from
Jul 23, 2024

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Jul 19, 2024

This PR attempts to make Loyalty more dynamic by introducing event-based Loyalty changes. Now, as personnel 'live' their lives events may occur which result in Loyalty being tested. Sometimes it will improve, other times it will be reduced.

Triggering events include...

  • The death of a spouse (especially if the spouse was pregnant)
  • The death of a parent (if individual is a child)
  • The death of both parents
  • The death of a child
  • Marriage (affects both parents)
  • The birth of a child (affects both parents)
  • Graduating from an academy
  • The campaign misses a paycheck
  • The execution or jettisoning of prisoners

Both Turnover & Retention and Education documentation have been updated to reflect these changes.

Important
This PR merges in changes made in #4439 and #4440 and must be merged last to avoid conflicts.

New service logger messages were added for statuses 'SACKED' and 'LEFT'. In addition, turnover retirement information is now temporarily stored across new day events, allowing its retrieval on a new day.
In the `Person` class, when a person's status was updated to 'Dead', checks were added to determine if the person has living children. If the person had children and no living parents remain, the children are logged as orphans.
Enhanced the way the game handles the death of a character within a relationship. Introduced comprehensive checks and notifications for the status of family members upon a character's death, including living spouses, children, and parents. Logs were also updated to differentiate between 'divorced' and 'widowed'.
Added new functionality to manage character loyalty changes in various scenarios including childbirth, death of family members, or financial matters. Refactored multiple notification messages related to finance handling to be more descriptive and provide more accurate information.
The 'useLeadershipChangeRefresh' variable was removed from CampaignOptions and all related settings, methods and bindings. This included the GUI components associated with this option, its XML handlers and its references in the properties file.
The loyalty refreshing logic has been refactored and improved. Removed multiple calls to 'refreshLoyalty()' method across different personnel status conditions. Instead, a new 'massChangeLoyalty()' method is introduced which triggers a loyalty change for the entire unit when the current character is a campaign commander who hasn't resigned or retired.
The condition in the 'Person.java' file for triggering a loyalty change has been modified. Previously, the loyalty change would occur if the character had living parents. The way it works now, the loyalty change is only triggered if the character still qualifies as a child.
@IllianiCBT IllianiCBT added the Personnel Personnel-related Issues label Jul 19, 2024
@IllianiCBT IllianiCBT self-assigned this Jul 19, 2024
The default loyalty value for the Person class in MekHQ was changed from 0 to 9.
@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.23%. Comparing base (c6c6c02) to head (6fff6f8).
Report is 19 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4441      +/-   ##
============================================
- Coverage     10.24%   10.23%   -0.02%     
+ Complexity     5809     5807       -2     
============================================
  Files           924      925       +1     
  Lines        126436   126569     +133     
  Branches      18766    18807      +41     
============================================
- Hits          12953    12949       -4     
- Misses       112208   112343     +135     
- Partials       1275     1277       +2     

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

The update includes modifications in PersonnelTableMouseAdapter file. It now processes loyalty changes whenever prisoners are executed or jettisoned.
The logic for executing and jettisoning prisoners has been consolidated into a single method to avoid code duplication. This simplification provides clearer path and less maintenance, improving overall code health. The prompt messages have also been updated to include information about the potential loyalty changes that could occur as a result.
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.

Tested and I think it works.

@IllianiCBT IllianiCBT merged commit 7172ff1 into MegaMek:master Jul 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Personnel Personnel-related Issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants