Skip to content

Commit

Permalink
Make weary.tracker reduction happen every time
Browse files Browse the repository at this point in the history
As far as I can tell, the cause of the weary.tracker going up during
resting periods is that rest does still expend calories (bmr),
and it happens every 5 minutes - while weary.tracker was only reduced
every 30 (current) or 15 (this branch) minutes. This commit makes
weary.tracker reduction occur every 5 minutes - every time
try_reduce_weariness() is called.
  • Loading branch information
actual-nh committed Feb 20, 2021
1 parent c01a661 commit 5d9dcb2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5708,16 +5708,16 @@ void Character::try_reduce_weariness( const float exertion )

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

if( weary.low_activity_ticks >= 3 ) {
if( weary.low_activity_ticks > 0 ) {
int reduction = weary.tracker;
const int bmr = base_bmr();
// 1/40 of whichever's bigger
// 1/120 of whichever's bigger
if( bmr > reduction ) {
reduction = std::floor( bmr * recovery_mult * 0.5f );
reduction = std::floor( bmr * recovery_mult * weary.low_activity_ticks / 6 );
} else {
reduction = std::ceil( reduction * recovery_mult * 0.5f );
reduction = std::ceil( reduction * recovery_mult * weary.low_activity_ticks / 6 );
}
weary.low_activity_ticks -= 3;
weary.low_activity_ticks = 0;

weary.tracker -= std::max( reduction, 1 );
}
Expand Down

0 comments on commit 5d9dcb2

Please sign in to comment.