From 7ee205a0f1d26bd6143fae714f0810b576e74eef Mon Sep 17 00:00:00 2001 From: nexusmrsep Date: Sat, 11 Jul 2020 23:52:19 +0200 Subject: [PATCH 1/3] reduce dehydration on hypovolemia --- src/player_hardcoded_effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/player_hardcoded_effects.cpp b/src/player_hardcoded_effects.cpp index 9de734ff2aad4..842b55eb174cf 100644 --- a/src/player_hardcoded_effects.cpp +++ b/src/player_hardcoded_effects.cpp @@ -905,7 +905,7 @@ void player::hardcoded_effects( effect &it ) } else if( id == effect_hypovolemia ) { // hypovolemia and dehydration are closely related so it will pull water // from your system to replenish blood quantity - if( calendar::once_every( -vitamin_rate( vitamin_blood ) ) ) { + if( calendar::once_every( -vitamin_rate( vitamin_blood ) ) && one_in( 5 ) && get_thirst() <= 240 ) { mod_thirst( rng( 0, intense ) ); } // bleed out lambda From 002018fd6ce52d3a08611e7d5152c1b922fa9aa1 Mon Sep 17 00:00:00 2001 From: nexusmrsep Date: Mon, 13 Jul 2020 21:57:20 +0200 Subject: [PATCH 2/3] lock blood volume regen when dehydrated --- src/character.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/character.cpp b/src/character.cpp index 8c5aab4dd8d28..e8491ae2df9b7 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -147,6 +147,7 @@ static const efftype_id effect_hunger_near_starving( "hunger_near_starving" ); static const efftype_id effect_hunger_satisfied( "hunger_satisfied" ); static const efftype_id effect_hunger_starving( "hunger_starving" ); static const efftype_id effect_hunger_very_hungry( "hunger_very_hungry" ); +static const efftype_id effect_hypovolemia( "hypovolemia" ); static const efftype_id effect_in_pit( "in_pit" ); static const efftype_id effect_infected( "infected" ); static const efftype_id effect_jetinjector( "jetinjector" ); @@ -371,6 +372,8 @@ static const std::string flag_USE_UPS( "USE_UPS" ); static const mtype_id mon_player_blob( "mon_player_blob" ); static const mtype_id mon_shadow_snake( "mon_shadow_snake" ); +static const vitamin_id vitamin_blood( "blood" ); + namespace io { @@ -4710,6 +4713,12 @@ void Character::update_body( const time_point &from, const time_point &to ) for( const auto &v : vitamin::all() ) { const time_duration rate = vitamin_rate( v.first ); + + // No blood volume regeneration if body lacks fluids + if( v.first == vitamin_blood && has_effect( effect_hypovolemia ) && get_thirst() > 240 ) { + continue; + } + if( rate > 0_turns ) { int qty = ticks_between( from, to, rate ); if( qty > 0 ) { From 8aa3846a94042f07e2a3bc6430428f7334447355 Mon Sep 17 00:00:00 2001 From: nexusmrsep Date: Mon, 13 Jul 2020 22:00:13 +0200 Subject: [PATCH 3/3] astyle --- src/character.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 4e203849e577d..a55d4d9912bba 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -4780,12 +4780,12 @@ void Character::update_body( const time_point &from, const time_point &to ) for( const auto &v : vitamin::all() ) { const time_duration rate = vitamin_rate( v.first ); - + // No blood volume regeneration if body lacks fluids - if( v.first == vitamin_blood && has_effect( effect_hypovolemia ) && get_thirst() > 240 ) { + if( v.first == vitamin_blood && has_effect( effect_hypovolemia ) && get_thirst() > 240 ) { continue; } - + if( rate > 0_turns ) { int qty = ticks_between( from, to, rate ); if( qty > 0 ) {