Skip to content

Commit

Permalink
Updated fatigue display logic in PersonViewPanel
Browse files Browse the repository at this point in the history
The code for displaying and calculating the fatigue value in PersonViewPanel has been modified to display only effective fatigue.
  • Loading branch information
IllianiCBT committed Jul 5, 2024
1 parent 8ed1cb1 commit b730e5f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions MekHQ/src/mekhq/gui/view/PersonViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ private JPanel fillSkills() {
int loyaltyModifier = person.getLoyaltyModifier(person.getLoyalty());

if (person.isCommander()) {
loyaltyModifier = person.getLoyaltyModifier(person.getLoyalty() + 2);;
loyaltyModifier = person.getLoyaltyModifier(person.getLoyalty() + 2);
}

if ((campaign.getCampaignOptions().isUseLoyaltyModifiers())
Expand Down Expand Up @@ -1469,7 +1469,7 @@ private JPanel fillSkills() {
firsty++;
}

if ((campaign.getCampaignOptions().isUseFatigue()) && (person.getFatigue() > 0)) {
if ((campaign.getCampaignOptions().isUseFatigue()) && (person.getEffectiveFatigue(campaign) > 0)) {
lblFatigue1.setName("lblFatigue1");
lblFatigue1.setText(resourceMap.getString("lblFatigue1.text"));
gridBagConstraints = new GridBagConstraints();
Expand All @@ -1480,14 +1480,11 @@ private JPanel fillSkills() {
pnlSkills.add(lblFatigue1, gridBagConstraints);

StringBuilder fatigueDisplay = new StringBuilder();

int effectiveFatigue = person.getEffectiveFatigue(campaign);
int fatigueTurnoverModifier = MathUtility.clamp(((person.getEffectiveFatigue(campaign) - 1) / 4) - 1, 0, 3);

fatigueDisplay.append(person.getFatigue());

if (person.getFatigue() != effectiveFatigue) {
fatigueDisplay.append(" / ").append(effectiveFatigue);
}
fatigueDisplay.append(effectiveFatigue);

if (fatigueTurnoverModifier > 0) {
fatigueDisplay.append(" (-").append(fatigueTurnoverModifier).append(')');
Expand Down

0 comments on commit b730e5f

Please sign in to comment.