summaryrefslogtreecommitdiff
path: root/universe/src
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-27 00:27:39 +0100
committerAki <please@ignore.pl>2023-01-27 00:27:39 +0100
commit75440771ca95a28556586233a0a8399022a5559f (patch)
treeb2cbadb1937eba2aa914030e6048b2b78a84fa6f /universe/src
parenta40e6361ba7172e0a3f3b16e2d286db9928e94e2 (diff)
downloadkurator-75440771ca95a28556586233a0a8399022a5559f.zip
kurator-75440771ca95a28556586233a0a8399022a5559f.tar.gz
kurator-75440771ca95a28556586233a0a8399022a5559f.tar.bz2
Added effective range calculation for turrets
This is now used when deciding if turret should start shooting or not.
Diffstat (limited to 'universe/src')
-rw-r--r--universe/src/TurretType.cpp9
1 files changed, 9 insertions, 0 deletions
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