Skip to content

Commit

Permalink
Merge pull request #776 from WhiteCloud0123/develop
Browse files Browse the repository at this point in the history
修复current_reach_range
  • Loading branch information
WhiteCloud0123 authored Aug 11, 2024
2 parents 4547c01 + 71c2932 commit 6a89056
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8428,17 +8428,15 @@ int item::reach_range( const Character &guy ) const
int item::current_reach_range( const Character &guy ) const
{
int res = 1;
gun_mode mode = gun_current_mode();

if( has_flag( flag_REACH_ATTACK ) ) {
res = has_flag( flag_REACH3 ) ? 3 : 2;
} else if( is_gun() && !is_gunmod() && gun_current_mode().melee() ) {
res = gun_current_mode().target->gun_range();
}

if( is_gun() && !is_gunmod() ) {
gun_mode gun = gun_current_mode();
if( !( guy.is_npc() && gun.flags.count( "NPC_AVOID" ) ) && gun.melee() ) {
res = std::max( res, gun.qty );
if( !( guy.is_npc() && mode.flags.count( "NPC_AVOID" ) ) && mode.melee() ) {
res = std::max( res, mode.qty );
}
}

Expand Down

0 comments on commit 6a89056

Please sign in to comment.