From ee31adb1c9faa0ad42be22c9d1e8000768354b34 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Tue, 23 Aug 2022 12:13:37 -0700 Subject: [PATCH] Move bullet damage multiplier to bulletType --- core/src/mindustry/entities/bullet/BulletType.java | 7 +++++++ core/src/mindustry/entities/comp/BulletComp.java | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 28bb749951..9a43f5a001 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -364,6 +364,13 @@ public class BulletType extends Content implements Cloneable{ } } + public float damageMultiplier(Bullet b){ + if(b.owner instanceof Unit u) return u.damageMultiplier() * state.rules.unitDamage(b.team); + if(b.owner instanceof Building) return state.rules.blockDamage(b.team); + + return 1f; + } + public void hit(Bullet b){ hit(b, b.x, b.y); } diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index 813b3979f0..32375d2ef7 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -82,10 +82,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw @Override public float damageMultiplier(){ - if(owner instanceof Unit u) return u.damageMultiplier() * state.rules.unitDamage(team); - if(owner instanceof Building) return state.rules.blockDamage(team); - - return 1f; + return type.damageMultiplier(self()); } @Override