Skip to content

Commit

Permalink
Smooth out weary intake/tracker a bit
Browse files Browse the repository at this point in the history
Weary levels keep fluctuating unrealistically, probably because
weary.intake (and weary.tracker?) are changing in large jumps at times.
  • Loading branch information
actual-nh committed Feb 11, 2021
1 parent f37d217 commit db03ee5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5697,24 +5697,24 @@ void Character::try_reduce_weariness( const float exertion )
}

const float recovery_mult = get_option<float>( "WEARY_RECOVERY_MULT" );
const int bmr = base_bmr();

if( weary.low_activity_ticks >= 6 ) {
while( weary.low_activity_ticks >= 6 ) {
int reduction = weary.tracker;
const int bmr = base_bmr();
// 1/20 of whichever's bigger
if( bmr > reduction ) {
reduction = bmr * recovery_mult;
} else {
reduction *= recovery_mult;
}
weary.low_activity_ticks = 0;
weary.low_activity_ticks -= 6;

weary.tracker -= reduction;
}

if( weary.tick_counter >= 12 ) {
weary.intake *= 1 - recovery_mult;
weary.tick_counter = 0;
if( weary.tick_counter >= 6 ) {
weary.intake *= std::sqrt( 1 - recovery_mult );
weary.tick_counter -= 6;
}

// Normalize values, make sure we stay above 0
Expand Down

0 comments on commit db03ee5

Please sign in to comment.