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

Fix: Show consistent healing quality #77699

Merged

Conversation

inogenous
Copy link
Contributor

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:

  • For example, applying an adhesive bandage with "wound care" proficiency should give bandaging intensity 2, as returned from get_bandaged_level - this is correct.
  • The bandaged effect as defined in effects.json specifies int_dur_factor=6h, so the intensity of this effect should be defined by setting its duration as multiples of int_dur_factor.
  • When calculating the duration for the created effect, the code previously added 0.5f to the desired intensity, likely to prevent it from getting 0. <- This was one part of the previous problem.
  • In effect::set_duration, the intensity is calculated from how many multiples of int_dur_factor that the desired duration is. That calulation added 1 to the desired intensity, likely to also prevent it from being 0. <- This was the second problem before.
  • In effect, instead of applying intensity 2 for an adhesive bandage, the code previously applied intensity 3.5 .

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

  • Applied adhesive bandage. Now shows the same bandage quality when choosing body part as the applied quality. ✓
  • Applied bandage. Now shows the same bandage quality when choosing body part as the applied quality. ✓
  • Applied antiseptic. Now shows the same disinfection quality when choosing body part as the applied quality. ✓
  • Debug-spawned some flaming eyes. Had a staring contest. Threw up. Effect "touched mind" and "badly touched mind" is still applied as expected (to verify that other effects still work). ✓

consistent-healing-quality

Additional context

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 9, 2024
@inogenous inogenous force-pushed the consistent-healing-quality branch from d97ff38 to 30f6e61 Compare November 11, 2024 19:52
@github-actions github-actions bot added the Code: Tests Measurement, self-control, statistics, balancing. label Nov 11, 2024
Fixes an issue where healing qualities shown when applying a bandage was
different than the applied quality.

The problem before was:
* For example, applying an adhesive bandage with "wound care"
  proficiency should give bandaging intensity 2, as returned from
  `get_bandaged_level` - this is correct.
* The `bandaged` effect as defined in `effects.json` specifies
  `int_dur_factor=6h`, so the intensity of this effect should be defined
  by setting its duration as multiples of `int_dur_factor`.
* When calculating the duration for the created effect, the code
  previously added `0.5f` to the desired intensity, likely to prevent it
  from getting 0. <- This was one part of the previous problem.
* In `effect::set_duration`, the intensity is calculated from how many
  multiples of `int_dur_factor` that the desired `duration` is. That
  calulation added 1 to the desired intensity, likely to also prevent it
  from being 0. <- This was the second problem before.
* In effect, instead of applying intensity 2 for an adhesive bandage,
  the code previously applied intensity 3.5 .

With this commit, we instead use `std::max(1, intensity)` to prevent
intensity from being 0.
@inogenous inogenous force-pushed the consistent-healing-quality branch from 30f6e61 to 831f14a Compare November 11, 2024 22:32
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 12, 2024
@Night-Pryanik Night-Pryanik merged commit b860ef2 into CleverRaven:master Nov 13, 2024
20 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disinfection and bandaging not acting as it should
2 participants