Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPCs set to attack what you attack charging blindly #3226

Merged
merged 1 commit into from
Sep 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading