Skip to content

Commit

Permalink
Merge pull request #36093 from Qrox/fix-redundant-unlubricated
Browse files Browse the repository at this point in the history
Don't add unlubricated fault if dirt fault is already present
  • Loading branch information
ZhilkinSerg authored Dec 14, 2019
2 parents 7ef0929 + ee15c5f commit 72dbda8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/item_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,15 @@ void Item_modifier::modify( item &new_item ) const
if( new_item.is_gun() &&
// no need for dirt if it's a bow
!new_item.has_flag( "PRIMITIVE_RANGED_WEAPON" ) ) {
if( one_in( 10 ) &&
// chance to be unlubed, but only if it's not a laser or something
!new_item.has_flag( "NEEDS_NO_LUBE" ) ) {
new_item.faults.emplace( "fault_gun_unlubricated" );
}
int random_dirt = rng( dirt.first, dirt.second );
// if gun RNG is dirty, must add dirt fault to allow cleaning
if( random_dirt > 0 ) {
new_item.set_var( "dirt", random_dirt );
new_item.faults.emplace( "fault_gun_dirt" );
} else if( one_in( 10 ) &&
// chance to be unlubed, but only if it's not a laser or something
!new_item.has_flag( "NEEDS_NO_LUBE" ) ) {
new_item.faults.emplace( "fault_gun_unlubricated" );
}
}

Expand Down

0 comments on commit 72dbda8

Please sign in to comment.