-
Notifications
You must be signed in to change notification settings - Fork 290
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
Regeneration Modifier Rework #1619
Regeneration Modifier Rework #1619
Conversation
47f47ed
to
e001865
Compare
d75c58b
to
d0c079a
Compare
src/mtype.h
Outdated
@@ -200,6 +200,14 @@ struct mon_effect_data { | |||
chance( nchance ), permanent( perm ) {} | |||
}; | |||
|
|||
struct regen_modifier { | |||
const float base_modifier = 0.00; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: const fields rarely useful. It is more important for variables and function arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still helps with readability IMO.
e63e4bb
to
8ae5d63
Compare
src/monstergenerator.cpp
Outdated
float amount = inner.get_float( 1 ); | ||
regeneration_modifiers.emplace( effect, amount ); | ||
float base_mod = inner.get_float( "base_mod" ); | ||
float scaling_mod = ( inner.has_float( "scaling_mod" ) ) ? inner.get_float( "scaling_mod" ) : 0 ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_float
has an overload with a fallback, used like this:
inner.get_float( "x", 0.0f );
529415f
to
09af49c
Compare
81ceb2e
to
7721d7a
Compare
7721d7a
to
d75060e
Compare
I don't get why is Mac version of Clang complaining. Try adding an explicit Also, a user on discord had heal msgs being printed for unseen critters. I checked the current version and it looks like the heal msg is printed regardless of whether you can see the monster or not. Could bundle a fix for this with this PR, since it should be just one extra |
I'm not sure how to do the |
* Rework Start * Update numbers to function right * Styling * Styling json * Documentation/fixes * Update monster.cpp * Fixes * Bugfix * Trying out new things. * Overload Update * Pls Work * Update regen messages to only when seen. * Const Remove * That ternary operator shouldn't be needed Co-authored-by: Coolthulhu <Coolthulhu@gmail.com>
Summary
SUMMARY: Infrastructure "Change regeneration modifiers into a JsonObject instead of an array."
Purpose of change
Suggested by @Coolthulhu to allow for easier read/write and to add scaling modifiers for effect intensities.
Describe the solution
Regeneration modifier in json converted to object with items Effect, base_mod and optional scaling_mod.
Temporarily adds a print message proceeding regeneration in order to know how much is actually being regenerated. Once this has been tested properly it will be removed before merge.
Describe alternatives you've considered
Considered to not be particularly user friendly for reading/writing.
Testing
Additional context