-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add fitness band and heartrate function for character #36233
Conversation
Can you provide a table or a data file, that shows what results you get for bpm with differnet numbers being put in , so that you can see the upper and lower ranges? |
I will prepare some sort of table. |
The contents of your two PRs should be in one PR. They depend on each other, merging just one of them is pretty much useless without merging the other. Even more so: we can't really test this PR as the function it adds is never called. We can't really test the other PR as the item it adds has no associated function or meaning. |
It was suggested by dev team member on Discord that I actually make separate function to calculate BPM. This is WIP PR so after it's refined enough this function can be used for many purposes related to heartbeat not just other mentioned PR. Thus, I made this PR separate. |
The fact that it can be used for other things does not change the fact that there are no uses currently. The only use so far lives in the other PR. As it stands, neither of the PRs would be merged simply because the item is useless and the function is not used. |
Now this PR has item part of code to be complete and testable. |
# Conflicts: # src/cata_string_consts.h
Must be ready for review. |
Summary
SUMMARY: Features "Adds fitness band and heartrate function to character for detetmining heart BPM"
Purpose of change
I am planning to add fitness band to family of watches. However it needs to find out BPM of player character, and this function can be useful for many purposes.
Describe the solution
This function uses average healthy BPM between 60 and 80 to define what it should be depending on fatigue, general health, stamina level, chems and anything else that should be there.
Describe alternatives you've considered
Adding simpler code for BPM calculation to fitness band. Not really reusable or complete this way.
Possible rework upon testing results to see if values are getting to high so every addition will be percentage of average BPM instead of calculated by the moment of modification.
Testing
WIP
Additional context
This function needs much more polishing and details, Any help and advices are very welcome.
Regarding what effects I am applying.
Initially average calm heartbeat is calculated as 70+-10.
Depending on level of stamina/max stamina it's increased non-lineraly up to triple value.
Depending on health value it's increased or decreased 5% for every 20 health points accordingly.
Depending on stimulators it's increased with a math formula I handpicked where it's doubles at 30 level of stims and decreseas up to tripling value.
Other effects are not there yet.
In the end value is clamped between average calm value and 250 BPM.
Spreadsheet is also avaliable (Open Office format):
heartrate.zip
Spreadsheets are below (more will be added)
Stamina effect
Stims have effect that slows down but still raises with accumulation. Formula is explained in comments (or ask me for more details)
Here's also plot for someone with 70 BPM in calm state. X axis is stimulant level, y is BPM.
Healthiness effect (based on get_max_healthy that already has bmi factored in). Applied in the end as health effect can do overall count better or worse by up to 50% but still between 60-250 limits.
Temperature effect for COLDBLOOD mutations of all tiers
Pain effect
TODO list