Improve character heal_rate and heal_rate_medicine tests #39935
Merged
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: Infrastructure "Improve character heal_rate and heal_rate_medicine tests"
Purpose of change
To describe plainly how healing works, in terms of the Character functions that calculate healing rate per turn, and enforce the current behavior with simple test cases.
The
healing_rate
andhealing_rate_medicine
functions have the following behavior, as tested:Baseline healing is 8.64 HP per day while sleeping, 0 while awake. This base rate comes from
data/json/game_balance.json : PLAYER_HEALING_RATE
.Traits like "Poor healer", "Regeneration", and "Rapid Metabolism" affect healing rate, with different multipliers for awake and asleep rates.
Hidden health stat
[-200, +200]
influences healing rate, with +200 doubling healing, and -200 giving no healing at all, even while asleep.Bandages and/or disinfectant each add 1-3 HP/day to healing rate while awake, doubled to 2-6 HP/day while sleeping. The head gets less benefit while the torso gets the most benefit from these treatments; the limbs all get the same moderate benefit.
When bandages and disinfectant are used together, not only do their effects combine, they are again doubled, giving +4-12 HP/day while awake (head 4, limbs 8, torso 12), and +8-24 HP/day while asleep.
Describe the solution
Describe alternatives you've considered
There are still deeper layers to explore here, and combinations of effects. One step at a time.
Testing
tests/cata_test [heal]
Additional context
Possibly the longest time I've ever spent creating a single commit.