Skip to content

Commit

Permalink
Fix NPCs set to attack what you attack charging blindly (#3226)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosvolt authored Sep 23, 2023
1 parent 70efa4b commit 7ac04c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,8 @@ npc_action npc::method_of_attack()
bool can_use_gun = ( ( !is_player_ally() || rules.has_flag( ally_rule::use_guns ) ) &&
( ai_cache.danger >= 3 || emergency() || dist < 0 ) );
bool use_silent = ( is_player_ally() && rules.has_flag( ally_rule::use_silent ) );
const bool not_engaged_yet = !critter->has_effect( effect_hit_by_player ) &&
rules.engagement == combat_engagement::HIT;

// if there's enough of a threat to be here, power up the combat CBMs
activate_combat_cbms();
Expand Down Expand Up @@ -1428,7 +1430,7 @@ npc_action npc::method_of_attack()
return npc_aim;
}
add_msg( m_debug, "%s can't figure out what to do", disp_name() );
return ( dont_move || !same_z ) ? npc_undecided : npc_melee;
return ( dont_move || !same_z || not_engaged_yet ) ? npc_undecided : npc_melee;
}

npc_action npc::address_needs()
Expand Down

0 comments on commit 7ac04c1

Please sign in to comment.