summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-12-04 23:49:13 +0100
committerAki <please@ignore.pl>2022-12-04 23:49:13 +0100
commitbb8f91d769970018a53e37f83a545967c8f150d0 (patch)
tree5e23a6f7117e060092be28b5f712ffd5beeb99d8 /sim/src
parent4cd1c6163a5101f21826248c2b0d4e0e804168ca (diff)
downloadkurator-bb8f91d769970018a53e37f83a545967c8f150d0.zip
kurator-bb8f91d769970018a53e37f83a545967c8f150d0.tar.gz
kurator-bb8f91d769970018a53e37f83a545967c8f150d0.tar.bz2
Turrets no longer shoot past optimal range * 2.5
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/BaseBattle.cpp2
1 files changed, 2 insertions, 0 deletions
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<HitPoints>(state.target);
const auto& target = _registry.get<Transform>(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;