From 6eeb49bb3768c38eb44cf5b7423f5c95b58ce472 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 11 Jan 2023 06:06:44 -0800 Subject: [PATCH] Fix armor piercing not working against buildings (#8150) --- core/src/mindustry/entities/comp/BuildingComp.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 034cfa080f..c2adce674c 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1597,7 +1597,12 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public boolean collision(Bullet other){ boolean wasDead = health <= 0; - damage(other.team, other.damage() * other.type().buildingDamageMultiplier); + float damage = other.damage() * other.type().buildingDamageMultiplier; + if(!other.type.pierceArmor){ + damage = Damage.applyArmor(damage, block.armor); + } + + damage(other.team, damage); Events.fire(bulletDamageEvent.set(self(), other)); if(health <= 0 && !wasDead){ @@ -1853,7 +1858,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, if(Mathf.zero(dm)){ damage = health + 1; }else{ - damage = Damage.applyArmor(damage, block.armor) / dm; + damage /= dm; } //TODO handle this better on the client.