diff options
Diffstat (limited to 'crates/fparkan-runtime/src/unit_combat.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/unit_combat.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/unit_combat.rs b/crates/fparkan-runtime/src/unit_combat.rs index f46b46bf..59c9ec64 100644 --- a/crates/fparkan-runtime/src/unit_combat.rs +++ b/crates/fparkan-runtime/src/unit_combat.rs @@ -460,6 +460,9 @@ impl AutoDemoCombat { return None; } let idle_clock = fire_clock_ms.filter(|_| unit.uses_default_targeting(patrol)); + let search = patrol + .filter(|_| !use_weapon_range) + .and_then(|patrol| patrol.search_target(handle)); let search_distance = if use_weapon_range && idle_clock.is_none() { self.maximum_firing_distance(unit) } else { @@ -470,6 +473,7 @@ impl AutoDemoCombat { .filter_map(|&(enemy, other, to, radius, target_position)| { let enemy = enemy.handle; if enemy == handle + || search.is_some_and(|target| target != Some(enemy)) || limit .is_some_and(|limit| !limit.allows_target(enemy, target_position)) || self.hostile.get(clan)?.get(other) != Some(&true) |
