From bb8f91d769970018a53e37f83a545967c8f150d0 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 4 Dec 2022 23:49:13 +0100 Subject: Turrets no longer shoot past optimal range * 2.5 --- sim/src/BaseBattle.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sim') diff --git a/sim/src/BaseBattle.cpp b/sim/src/BaseBattle.cpp index 9587ca7..17dc739 100644 --- a/sim/src/BaseBattle.cpp +++ b/sim/src/BaseBattle.cpp @@ -136,6 +136,8 @@ BaseBattle::turrets(const float dt) auto& target_points = _registry.get(state.target); const auto& target = _registry.get(state.target); const auto distance = transform.position - target.position; + if (distance.magnitude() > def.optimal_range * 2.5) + continue; const auto damage = effective_damage(def, distance.magnitude()); if (damage > 0.0) { target_points.health -= damage; -- cgit v1.1