summaryrefslogtreecommitdiff
path: root/universe/tests
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-02-28 00:06:05 +0100
committerAki <please@ignore.pl>2023-02-28 00:06:32 +0100
commit4e1f59b5c6689e38023f12daee7d5c6f3d4715e5 (patch)
tree38a06dbd1bfb596cb1cc1d1fceb9ec28e5b8f534 /universe/tests
parent5f59cc347bcfd2236f01532511974078aacde980 (diff)
downloadkurator-4e1f59b5c6689e38023f12daee7d5c6f3d4715e5.zip
kurator-4e1f59b5c6689e38023f12daee7d5c6f3d4715e5.tar.gz
kurator-4e1f59b5c6689e38023f12daee7d5c6f3d4715e5.tar.bz2
Turrets will now start shooting when they can deal 1 dmg point
Previously they were shooting at 1% base damage range, meaning higher damage turrets were cut off earlier.
Diffstat (limited to 'universe/tests')
-rw-r--r--universe/tests/TurretType.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/universe/tests/TurretType.cpp b/universe/tests/TurretType.cpp
new file mode 100644
index 0000000..7ce70c0
--- /dev/null
+++ b/universe/tests/TurretType.cpp
@@ -0,0 +1,49 @@
+#include <gtest/gtest.h>
+
+#include <kurator/universe/TurretType.h>
+
+
+namespace kurator
+{
+namespace tests
+{
+
+
+const universe::TurretType LOW {
+ "",
+ 1,
+ 10.0,
+ 1.0,
+ 0.0,
+ 1000.0,
+ 0.05,
+ 0.2,
+};
+
+
+const universe::TurretType HIGH {
+ "",
+ 1,
+ 1000.0,
+ 1.0,
+ 0.0,
+ 1000.0,
+ 0.05,
+ 0.2,
+};
+
+
+
+TEST(TurretType, effective_range)
+{
+ const auto low = LOW.effective_range();
+ EXPECT_LE(1.0, LOW.range_modifier(low - 1.0) * LOW.base_damage);
+ EXPECT_GE(1.0, LOW.range_modifier(low + 1.0) * LOW.base_damage);
+ const auto high = HIGH.effective_range();
+ EXPECT_LE(1.0, HIGH.range_modifier(high - 1.0) * HIGH.base_damage);
+ EXPECT_GE(1.0, HIGH.range_modifier(high + 1.0) * HIGH.base_damage);
+}
+
+
+} // namespace tests
+} // namespace kurator