Skip to content

Commit

Permalink
NPCs: Make NPC automatic fire threshold halfway sensible
Browse files Browse the repository at this point in the history
NPCs are only supposed to use automatic fire instead of single shots
against dangerous enemies, and to hold their fire against non-threatening
enemies.

However, the danger threshold for automatic fire is 0.5, which means
NPCs are using automatic fire against just about everything.

Raise the threshold to 15 (moderately dangerous enemies) and increase
the threshold for holding fire to 3.  Weaker enemies will be attacked in
melee if they're the highest priority target.
  • Loading branch information
mlangsdorf authored and kevingranade committed Sep 15, 2019
1 parent f03dd8c commit 3648a54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ npc_action npc::method_of_attack()
return m.melee() || m.flags.count( "NPC_AVOID" ) ||
!m->ammo_sufficient( m.qty ) || !can_use( *m.target ) ||
m->get_gun_ups_drain() > ups_charges ||
( danger <= ( ( m.qty == 1 ) ? 0.0 : 0.5 ) && !emergency() ) ||
( ( danger <= ( m.qty == 1 ? 3.0 : 15.0 ) ) && !emergency() ) ||
( rules.has_flag( ally_rule::use_silent ) && is_player_ally() &&
!m.target->is_silent() );

Expand Down

0 comments on commit 3648a54

Please sign in to comment.