Skip to content

Commit

Permalink
src: Eliminate randomness from sprinting distance
Browse files Browse the repository at this point in the history
Stamina regen: Use std::ceil instead of roll_remainder in
update_stamina. This ensures that the floating-point value is always
rounded up (instead of only randomly being rounded up), and should give
at most 1 extra point of stamina regen.

Getting winded: Before, there was a random chance to become winded below
20% of maximum stamina, meaning total running distance could be cut
short by 8-12 steps or more (effectively capping maximum stamina at 80%,
at random). Now, becoming winded is more predictable, occurring only
upon reaching 0 stamina.
  • Loading branch information
wapcaplet committed Jan 1, 2022
1 parent 451e33d commit 985b7bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6315,7 +6315,7 @@ void Character::update_stamina( int turns )
}

// Roll to determine actual stamina recovery over this period
int recover_amount = roll_remainder( stamina_recovery * turns );
int recover_amount = std::ceil( stamina_recovery * turns );
mod_stamina( recover_amount );
add_msg_debug( debugmode::DF_CHARACTER, "Stamina recovery: %d", recover_amount );

Expand Down
2 changes: 1 addition & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10216,7 +10216,7 @@ void game::on_move_effects()
if( !u.can_run() ) {
u.toggle_run_mode();
}
if( u.get_stamina() < u.get_stamina_max() / 5 && one_in( u.get_stamina() ) ) {
if( u.get_stamina() <= 0 ) {
u.add_effect( effect_winded, 10_turns );
}
}
Expand Down

0 comments on commit 985b7bb

Please sign in to comment.