Skip to content

Commit

Permalink
Change str/reload modifiers to proportional
Browse files Browse the repository at this point in the history
Basically trying to change the reload modifier from percentage to multiplicative since nothing else uses a percentage multiplier and also change the str modifier from additive to also multiplicative, since that's what it was originally supposed to be.
  • Loading branch information
darktoes authored Jun 6, 2019
1 parent f2a8921 commit c1f4581
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,13 +1655,15 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts
info.push_back( iteminfo( "GUNMOD", string_format( _( "Ammo: <stat>%s</stat>" ),
type->mod->ammo_modifier->name() ) ) );
}
if( mod.reload_modifier != 0 && parts->test( iteminfo_parts::GUNMOD_RELOAD ) ) {
info.emplace_back( "GUNMOD", _( "Reload modifier: " ), _( "<num>%" ),
iteminfo::lower_is_better, mod.reload_modifier );
if( mod.reload_modifier != 1 && parts->test( iteminfo_parts::GUNMOD_RELOAD ) ) {
info.emplace_back( "GUNMOD", _( "Reload modifier: " ), "",
iteminfo::no_newline | iteminfo::is_decimal | iteminfo::lower_is_better,
*mod.reload_modifier );
}
if( mod.min_str_required_mod > 0 && parts->test( iteminfo_parts::GUNMOD_STRENGTH ) ) {
info.push_back( iteminfo( "GUNMOD", _( "Minimum strength required modifier: " ),
mod.min_str_required_mod ) );
if( mod.min_str_required_mod != 1 && parts->test( iteminfo_parts::GUNMOD_STRENGTH ) ) {
info.emplace_back( "GUNMOD", _( "Minimum strength required modifier: " ), "",
iteminfo::no_newline | iteminfo::is_decimal,
*mod.min_str_required_mod );
}
if( !mod.add_mod.empty() && parts->test( iteminfo_parts::GUNMOD_ADD_MOD ) ) {
insert_separation_line();
Expand Down Expand Up @@ -4568,7 +4570,7 @@ int item::get_reload_time() const

int reload_time = is_gun() ? type->gun->reload_time : type->magazine->reload_time;
for( const auto mod : gunmods() ) {
reload_time = static_cast<int>( reload_time * ( 100 + mod->type->gunmod->reload_modifier ) / 100 );
reload_time = static_cast<int>( reload_time * mod->type->gunmod->reload_modifier );
}

return reload_time;
Expand Down Expand Up @@ -7927,7 +7929,7 @@ int item::get_min_str() const
if( type->gun ) {
int min_str = type->min_str;
for( const auto mod : gunmods() ) {
min_str += mod->type->gunmod->min_str_required_mod;
static_cast<int>(min_str *= mod->type->gunmod->min_str_required_mod);
}
return min_str > 0 ? min_str : 0;
} else {
Expand Down

0 comments on commit c1f4581

Please sign in to comment.