From 6c1c4651d2cc2323400c2a58f79e83829166adff Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Sat, 23 Sep 2023 12:35:18 -0500 Subject: [PATCH] Fix NPCs set to attack what you attack charging blindly --- src/npcmove.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 41a674f91456..a84a864ca6ac 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -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(); @@ -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()