Skip to content

Commit eb1acab

Browse files
committed
Abort 'fired' reach attack if there are no valid targets
(Instead of letting the player declare the attack anyway)
1 parent 0473ef4 commit eb1acab

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ranged.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,6 +2748,12 @@ target_handler::trajectory target_ui::run()
27482748
src = you->pos_bub();
27492749
update_target_list();
27502750

2751+
if( mode == TargetMode::Reach && targets.empty() ) {
2752+
add_msg( m_info, _( "No hostile creature in reach." ) );
2753+
traj.clear();
2754+
return traj; // nothing to attack.
2755+
}
2756+
27512757
if( activity && activity->abort_if_no_targets && targets.empty() ) {
27522758
// this branch is taken when already shot once and re-entered
27532759
// aiming, if no targets are available we want to abort so

0 commit comments

Comments
 (0)