Skip to content

Commit

Permalink
Reduce dehydration from hypovolemia (#42045)
Browse files Browse the repository at this point in the history
* reduce dehydration on hypovolemia

* lock blood volume regen when dehydrated

* astyle
  • Loading branch information
kevingranade authored Jul 14, 2020
2 parents 8472d2a + 8aa3846 commit 878bddf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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" );
Expand Down Expand Up @@ -372,6 +373,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
{

Expand Down Expand Up @@ -4778,6 +4781,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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/player_hardcoded_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 878bddf

Please sign in to comment.