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

Update throwing stamina cost #39987

Merged
merged 3 commits into from
Apr 30, 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
8 changes: 6 additions & 2 deletions src/melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,12 @@ void Character::melee_attack( Creature &t, bool allow_special, const matec_id &f
}

const int melee = get_skill_level( skill_melee );
/** @EFFECT_STR reduces stamina cost for melee attack with heavier weapons */
const int weight_cost = cur_weapon.weight() / ( 2_gram * std::max( 1, str_cur ) );

// Previously calculated as 2_gram * std::max( 1, str_cur )
// using 16_gram normalizes it to 8 str. Same effort expenditure
// for each strike, regardless of weight. This is compensated
// for by the additional move cost as weapon weight increases
const int weight_cost = cur_weapon.weight() / ( 16_gram );
const int encumbrance_cost = roll_remainder( ( encumb( bp_arm_l ) + encumb( bp_arm_r ) ) *
2.0f );
const int deft_bonus = hit_spread < 0 && has_trait( trait_DEFT ) ? 50 : 0;
Expand Down
10 changes: 8 additions & 2 deletions src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,11 +654,17 @@ dealt_projectile_attack player::throw_item( const tripoint &target, const item &
const int move_cost = throw_cost( *this, to_throw );
mod_moves( -move_cost );

const int throwing_skill = get_skill_level( skill_throw );
units::volume volume = to_throw.volume();
units::mass weight = to_throw.weight();

const int stamina_cost = ( static_cast<int>( get_option<float>( "PLAYER_BASE_STAMINA_REGEN_RATE" ) )
+ ( weight / 10_gram ) + 200 ) * -1;
// Previously calculated as 2_gram * std::max( 1, str_cur )
// using 16_gram normalizes it to 8 str. Same effort expenditure
// for being able to throw farther.
const int weight_cost = weight / ( 16_gram );
const int encumbrance_cost = roll_remainder( ( encumb( bp_arm_l ) + encumb( bp_arm_r ) ) * 2.0f );
const int stamina_cost = ( weight_cost + encumbrance_cost - throwing_skill + 50 ) * -1;

bool throw_assist = false;
int throw_assist_str = 0;
if( is_mounted() ) {
Expand Down