From ed42bcb4f601ec888426865442d846b485b985b0 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:57:17 -0800 Subject: [PATCH] `ShieldDamageMultiplier` for bullets (#6331) * ShieldDamageMultiplier + Dynamic damage multipliers * Add to stats * That's not right * merge typo --------- Co-authored-by: Anuken --- core/assets/bundles/bundle.properties | 1 + .../entities/abilities/ForceFieldAbility.java | 3 +-- core/src/mindustry/entities/bullet/BulletType.java | 10 ++++++++++ core/src/mindustry/entities/comp/BuildingComp.java | 2 +- .../mindustry/world/blocks/defense/ForceProjector.java | 2 +- core/src/mindustry/world/meta/StatValues.java | 4 ++++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index efe52a37a192..ea0458975241 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1142,6 +1142,7 @@ bullet.interval = [stat]{0}/sec[lightgray] interval bullets: bullet.frags = [stat]{0}x[lightgray] frag bullets: bullet.lightning = [stat]{0}x[lightgray] lightning ~ [stat]{1}[lightgray] damage bullet.buildingdamage = [stat]{0}%[lightgray] building damage +bullet.shielddamage = [stat]{0}%[lightgray] shield damage bullet.knockback = [stat]{0}[lightgray] knockback bullet.pierce = [stat]{0}x[lightgray] pierce bullet.infinitepierce = [stat]pierce diff --git a/core/src/mindustry/entities/abilities/ForceFieldAbility.java b/core/src/mindustry/entities/abilities/ForceFieldAbility.java index d4cdac20d4d4..2ef8e8e8041b 100644 --- a/core/src/mindustry/entities/abilities/ForceFieldAbility.java +++ b/core/src/mindustry/entities/abilities/ForceFieldAbility.java @@ -41,8 +41,7 @@ public class ForceFieldAbility extends Ability{ if(trait.team != paramUnit.team && trait.type.absorbable && Intersector.isInRegularPolygon(paramField.sides, paramUnit.x, paramUnit.y, realRad, paramField.rotation, trait.x(), trait.y()) && paramUnit.shield > 0){ trait.absorb(); Fx.absorb.at(trait); - - paramUnit.shield -= trait.damage(); + paramUnit.shield -= trait.type().shieldDamage(trait); paramField.alpha = 1f; } }; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index cb177512f0e9..5f958bb01396 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -84,6 +84,8 @@ public class BulletType extends Content implements Cloneable{ public float reloadMultiplier = 1f; /** Multiplier of how much base damage is done to tiles. */ public float buildingDamageMultiplier = 1f; + /** Multiplier of how much base damage is done to force shields. */ + public float shieldDamageMultiplier = 1f; /** Recoil from shooter entities. */ public float recoil; /** Whether to kill the shooter when this is shot. For suicide bombers. */ @@ -569,6 +571,14 @@ public void removed(Bullet b){ } } + public float buildingDamage(Bullet b){ + return b.damage() * buildingDamageMultiplier; + } + + public float shieldDamage(Bullet b){ + return b.damage() * shieldDamageMultiplier; + } + public void draw(Bullet b){ drawTrail(b); drawParts(b); diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index cdb4d7303af8..49ccaa2ee528 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1645,7 +1645,7 @@ public boolean collide(Bullet other){ public boolean collision(Bullet other){ boolean wasDead = health <= 0; - float damage = other.damage() * other.type().buildingDamageMultiplier; + float damage = other.type.buildingDamage(other); if(!other.type.pierceArmor){ damage = Damage.applyArmor(damage, block.armor); } diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 9611bf2e2b3f..7aa49ecb9895 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java @@ -55,7 +55,7 @@ public class ForceProjector extends Block{ bullet.absorb(); paramEffect.at(bullet); paramEntity.hit = 1f; - paramEntity.buildup += bullet.damage; + paramEntity.buildup += bullet.type.shieldDamage(bullet); } }; diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 1e553c427262..917dfd4f7036 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -644,6 +644,10 @@ public static StatValue ammo(ObjectMap 0){ sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1))); }