Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Bugfixes "Fix Morale Calculations."
Purpose of change
Originally this PR was to fix a display oddity, as fatigue would display on the morale screen as a penalty when in reality it capped the focus equilibrium display and increased/decreased fatigue penalties accordingly. Leading to unintuitive situations where the more you tried to increase your morale the higher the penalty became.
While converting it to display as a cap. It was found that morale calculations were broken. Fatigue itself did not affect the focus equilibrium, but rather applied extra per tick decrements directly to focus change calculations. Furthermore, the caps for each tier of fatigue were different from the player side display.
Describe the solution
Created new function
calc_fatigue_cap()
to unify the calculations, so that only one calculation needs to be altered to affect both the display and the effect on focus.Removed direct effect on focus change calculations and applied the fatigue cap to effective morale when calculating focus equilibrium, as I assume was intended.
Changed the display to show the fatigue cap instead of fatigue penalties, and show regardless of whether morale is below or above cap to prevent player confusion.
Streamlined the pain_penalty display so it didn't call the entire focus equilibrium calculation.
Describe alternatives you've considered
calc_fatigue_cap()
to affect the focus equilibrium directly instead of theeff_morale
int.This could probably be done and would allow me to remove the
- 100
from the calculations, but I'm on the fence.Testing
Added pain to character, checked that it displayed properly. Added Fatigue to character, checked that cap was enforced but did not interfere with pain. (20 pain and tired level fatigue is still 80 morale, while increasing pain beyond the threshold decreases morale accordingly.) Check that fatigue cap was displayed so long as fatigue thresholds were reached.
Additional context