From a7e8dd126edf2a3e40358582d5a4cc52f61657d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=97=E9=97=A8=E9=98=B3=E5=BE=B7?= <66559840+nanmenyangde@users.noreply.github.com> Date: Sat, 12 Aug 2023 23:40:25 +0800 Subject: [PATCH] Fix point defense weapons ignore damage multiplier (#8922) --- core/src/mindustry/type/weapons/PointDefenseWeapon.java | 8 ++++++-- .../world/blocks/defense/turrets/PointDefenseTurret.java | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/type/weapons/PointDefenseWeapon.java b/core/src/mindustry/type/weapons/PointDefenseWeapon.java index 741b5cd29d..9063503a13 100644 --- a/core/src/mindustry/type/weapons/PointDefenseWeapon.java +++ b/core/src/mindustry/type/weapons/PointDefenseWeapon.java @@ -9,6 +9,8 @@ import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.type.*; +import static mindustry.Vars.*; + /** * Note that this requires several things: * - A bullet with positive maxRange @@ -49,8 +51,10 @@ public class PointDefenseWeapon extends Weapon{ protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation){ if(!(mount.target instanceof Bullet target)) return; - if(target.damage() > bullet.damage){ - target.damage(target.damage() - bullet.damage); + // not sure whether it should multiply by the damageMultiplier of the unit + float bulletDamage = bullet.damage * unit.damageMultiplier() * state.rules.unitDamage(unit.team); + if(target.damage() > bulletDamage){ + target.damage(target.damage() - bulletDamage); }else{ target.remove(); } diff --git a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java index e6d5a09c1a..97aedf43b5 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java @@ -14,6 +14,8 @@ import mindustry.gen.*; import mindustry.graphics.*; import mindustry.world.meta.*; +import static mindustry.Vars.*; + public class PointDefenseTurret extends ReloadTurret{ public final int timerTarget = timers++; public float retargetTime = 5f; @@ -80,8 +82,9 @@ public class PointDefenseTurret extends ReloadTurret{ //shoot when possible if(Angles.within(rotation, dest, shootCone) && reloadCounter >= reload){ - if(target.damage() > bulletDamage){ - target.damage(target.damage() - bulletDamage); + float realDamage = bulletDamage * state.rules.blockDamage(team); + if(target.damage() > realDamage){ + target.damage(target.damage() - realDamage); }else{ target.remove(); }