From a9b8b3d5eabfe2b70db22f969a90bd217b93bfb3 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 12 Sep 2024 13:12:57 -0500 Subject: [PATCH] Fixed Hidden Loyalty Calculation in RetirementDefectionTracker Fixed the loyalty calculation (when loyalty is hidden) by adding a bonus for commanders and applying a loyalty modifier based on the adjusted loyalty score, instead of using raw loyalty score. --- .../RetirementDefectionTracker.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MekHQ/src/mekhq/campaign/personnel/turnoverAndRetention/RetirementDefectionTracker.java b/MekHQ/src/mekhq/campaign/personnel/turnoverAndRetention/RetirementDefectionTracker.java index e9034060a0..d05af0bae2 100644 --- a/MekHQ/src/mekhq/campaign/personnel/turnoverAndRetention/RetirementDefectionTracker.java +++ b/MekHQ/src/mekhq/campaign/personnel/turnoverAndRetention/RetirementDefectionTracker.java @@ -675,7 +675,15 @@ public static int getCombinedSkillValues(Campaign campaign, String skillType) { */ private int getBaseTargetNumber(Campaign campaign, Person person) { if ((campaign.getCampaignOptions().isUseLoyaltyModifiers()) && (campaign.getCampaignOptions().isUseHideLoyalty())) { - return campaign.getCampaignOptions().getTurnoverFixedTargetNumber() + person.getLoyalty(); + int loyaltyScore = person.getLoyalty(); + + if (person.isCommander()) { + loyaltyScore += 2; + } + + int loyaltyModifier = person.getLoyaltyModifier(loyaltyScore); + + return campaign.getCampaignOptions().getTurnoverFixedTargetNumber() + loyaltyModifier; } else { return campaign.getCampaignOptions().getTurnoverFixedTargetNumber(); }