summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/src/Builder.cpp2
-rw-r--r--sim/src/TurretControl.cpp2
-rw-r--r--universe/include/kurator/universe/TurretType.h1
-rw-r--r--universe/src/TurretType.cpp9
4 files changed, 12 insertions, 2 deletions
diff --git a/sim/src/Builder.cpp b/sim/src/Builder.cpp
index e6984fe..b5762b3 100644
--- a/sim/src/Builder.cpp
+++ b/sim/src/Builder.cpp
@@ -38,7 +38,7 @@ Builder::operator()(const universe::ShipType& ship_type, const int team) const
ship_type.max_speed,
ship_type.max_speed * 2.0,
ship_type.max_speed * 3.0);
- registry.emplace<AIState>(entity, 6000.0, Point{0.0, 0.0});
+ registry.emplace<AIState>(entity, 15000.0, Point{0.0, 0.0});
registry.emplace<HitPoints>(
entity,
ship_type.base_shield_points,
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp
index e2596c8..bfac27f 100644
--- a/sim/src/TurretControl.cpp
+++ b/sim/src/TurretControl.cpp
@@ -34,7 +34,7 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co
continue;
const auto& target = registry.get<Transform>(state.target);
const auto distance = transform.position.distance(target.position);
- if (distance > def.optimal_range * 2.5)
+ if (distance > def.effective_range())
continue;
auto remaining_dt = dt;
while (remaining_dt > 0.0) {
diff --git a/universe/include/kurator/universe/TurretType.h b/universe/include/kurator/universe/TurretType.h
index 553894b..0a0c5fd 100644
--- a/universe/include/kurator/universe/TurretType.h
+++ b/universe/include/kurator/universe/TurretType.h
@@ -20,6 +20,7 @@ struct TurretType
double falloff_modifier = 0.05;
double falloff_intensity = 0.2;
double effective_damage(double distance) const;
+ double effective_range() const;
};
diff --git a/universe/src/TurretType.cpp b/universe/src/TurretType.cpp
index d213d07..a215b32 100644
--- a/universe/src/TurretType.cpp
+++ b/universe/src/TurretType.cpp
@@ -19,5 +19,14 @@ TurretType::effective_damage(const double distance) const
}
+double
+TurretType::effective_range() const
+{
+ const double target = std::log2(0.01) / std::log2(falloff_intensity);
+ const double one_percent_falloff = target * falloff_modifier * optimal_range;
+ return one_percent_falloff + optimal_range;
+}
+
+
} // namespace universe
} // namespace kurator