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

Improve character heal_rate and heal_rate_medicine tests #39935

Merged
merged 1 commit into from
Apr 26, 2020

Conversation

wapcaplet
Copy link
Contributor

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 and healing_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

  • Add top-level documentation and coverage notes
  • Use constants for hp_per_day, tolerance, and effects
  • Include descriptions for all trait/mutation healing factors
  • Add heal_rate_medicine tests for bandages and/or disinfectant

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.

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` and `healing_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.

Changes in this commit:

- Add top-level documentation and coverage notes
- Use constants for hp_per_day, tolerance, and effects
- Include descriptions for all trait/mutation healing factors
- Add heal_rate_medicine tests for bandages and/or disinfectant
@ifreund ifreund added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Mechanics: Character / Player Character / Player mechanics labels Apr 26, 2020
Copy link
Contributor

@ifreund ifreund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ifreund ifreund merged commit 997cdcd into CleverRaven:master Apr 26, 2020
@wapcaplet wapcaplet deleted the heal-with-meds branch May 6, 2020 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Enhancement / Feature> New features, or enhancements on existing Mechanics: Character / Player Character / Player mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants