From 0cce13664176f7613cbab486e9570807727997e8 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Fri, 12 Nov 2021 22:08:23 -0800 Subject: [PATCH 1/4] ShieldDamageMultiplier + Dynamic damage multipliers --- .../entities/abilities/ForceFieldAbility.java | 2 +- core/src/mindustry/entities/bullet/BulletType.java | 10 ++++++++++ core/src/mindustry/entities/comp/BuildingComp.java | 2 +- .../mindustry/world/blocks/defense/ForceProjector.java | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/abilities/ForceFieldAbility.java b/core/src/mindustry/entities/abilities/ForceFieldAbility.java index 86858f645642..116d90309f37 100644 --- a/core/src/mindustry/entities/abilities/ForceFieldAbility.java +++ b/core/src/mindustry/entities/abilities/ForceFieldAbility.java @@ -41,7 +41,7 @@ public class ForceFieldAbility extends Ability{ Fx.shieldBreak.at(paramUnit.x, paramUnit.y, paramField.radius, paramUnit.team.color, paramUnit); } - 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 8836c6b5cd91..97552a7a798c 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -69,6 +69,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. */ @@ -321,6 +323,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); } diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 26dc1284e175..b5aac2f94e52 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1278,7 +1278,7 @@ public boolean collide(Bullet other){ /** Handle a bullet collision. * @return whether the bullet should be removed. */ public boolean collision(Bullet other){ - damage(other.team, other.damage() * other.type().buildingDamageMultiplier); + damage(other.team, other.damage() * other.type().buildingDamage(other)); return true; } diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 41d56526fdcd..bdf04505c822 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java @@ -43,7 +43,7 @@ public class ForceProjector extends Block{ trait.absorb(); paramEffect.at(trait); paramEntity.hit = 1f; - paramEntity.buildup += trait.damage(); + paramEntity.buildup += trait.type().shieldDamage(trait); } }; From f3ead2e49fe4ff8469d969eff550936b8474eb0f Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Fri, 12 Nov 2021 22:09:06 -0800 Subject: [PATCH 2/4] Add to stats --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/world/meta/StatValues.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 56b938a3e2d8..93ec5183b1b5 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -825,6 +825,7 @@ bullet.homing = [stat]homing bullet.frags = [stat]{0}[lightgray]x frag bullets: bullet.lightning = [stat]{0}[lightgray]x 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}[lightgray]x pierce bullet.infinitepierce = [stat]pierce diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index ba07d8e19d16..3aad7854dc8e 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -293,6 +293,10 @@ public static StatValue ammo(ObjectMap 0){ sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1))); } From af6dc62d8d36bda250f0eb9539fc92aa41701613 Mon Sep 17 00:00:00 2001 From: "Matthew (or Maya) Peng" <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 20 Jan 2022 23:40:51 -0800 Subject: [PATCH 3/4] That's not right --- core/src/mindustry/entities/comp/BuildingComp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index b5aac2f94e52..93f469002902 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1278,7 +1278,7 @@ public boolean collide(Bullet other){ /** Handle a bullet collision. * @return whether the bullet should be removed. */ public boolean collision(Bullet other){ - damage(other.team, other.damage() * other.type().buildingDamage(other)); + damage(other.team, other.type().buildingDamage(other)); return true; } From 4fed59e6d1fbfd4cd89ab6d660a07819a34608b9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 6 Feb 2025 16:56:33 -0500 Subject: [PATCH 4/4] merge typo --- core/src/mindustry/entities/comp/BuildingComp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index bab0f81b41f3..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.type.buildingDamage(otherr); + float damage = other.type.buildingDamage(other); if(!other.type.pierceArmor){ damage = Damage.applyArmor(damage, block.armor); }