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

Reduce dehydration from hypovolemia #42045

Merged
merged 4 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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
{

Expand Down Expand Up @@ -4777,6 +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 ) {
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