summaryrefslogtreecommitdiff
path: root/sim/src
diff options
context:
space:
mode:
Diffstat (limited to 'sim/src')
-rw-r--r--sim/src/HitPoints.cpp4
-rw-r--r--sim/src/TurretControl.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/sim/src/HitPoints.cpp b/sim/src/HitPoints.cpp
index bcb7e97..d83c369 100644
--- a/sim/src/HitPoints.cpp
+++ b/sim/src/HitPoints.cpp
@@ -7,10 +7,12 @@ namespace sim
{
-void
+double
HitPoints::deal(double damage)
{
+ damage *= structure_resists;
structure -= damage;
+ return damage;
}
diff --git a/sim/src/TurretControl.cpp b/sim/src/TurretControl.cpp
index 6513f39..e2596c8 100644
--- a/sim/src/TurretControl.cpp
+++ b/sim/src/TurretControl.cpp
@@ -42,9 +42,9 @@ TurretControl::update(entt::registry& registry, entt::dispatcher& dispatcher, co
control.rounds = def.rounds;
if (control.rounds > 0 && consume(remaining_dt, control.delay)) {
auto& target_points = registry.get<HitPoints>(state.target);
- const auto damage = def.effective_damage(distance);
+ auto damage = def.effective_damage(distance);
if (damage > 0.0) {
- target_points.deal(damage);
+ damage = target_points.deal(damage);
dispatcher.trigger(Hit{damage, control.owner, state.target});
}
control.delay = def.rate_of_fire;