Fix: Show consistent healing quality #77699
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
Bugfixes "Show consistent healing quality"
Purpose of change
Fixes an issue where healing qualities shown when applying a bandage was different than the applied quality. Fixes #75736 .
Describe the solution
This is a continuation of the nice investigation that was done in #75857 .
The problem before was:
get_bandaged_level
- this is correct.bandaged
effect as defined ineffects.json
specifiesint_dur_factor=6h
, so the intensity of this effect should be defined by setting its duration as multiples ofint_dur_factor
.0.5f
to the desired intensity, likely to prevent it from getting 0. <- This was one part of the previous problem.effect::set_duration
, the intensity is calculated from how many multiples ofint_dur_factor
that the desiredduration
is. That calulation added 1 to the desired intensity, likely to also prevent it from being 0. <- This was the second problem before.With this commit, we instead use
std::max(1, intensity)
to prevent intensity from being 0. This commit also adds a debugmsg if the calculation of intensity based on the duration would start to differ from the expected values some time in the future.Describe alternatives you've considered
Testing
Additional context