From 6014f2353aeca7c1710f38cb8576ad678d0d8e40 Mon Sep 17 00:00:00 2001 From: Ilya246 <57039557+Ilya246@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:58:26 +0400 Subject: [PATCH] foreshadow overhaul (#9223) * overhaul foreshadow * whar ? --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/content/Blocks.java | 11 +++++++---- core/src/mindustry/entities/bullet/BulletType.java | 12 ++++++++++-- core/src/mindustry/world/meta/StatValues.java | 4 ++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index ea984b2160..044d48dcaf 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1025,6 +1025,7 @@ bullet.splashdamage = [stat]{0}[lightgray] area dmg ~ [stat]{1}[lightgray] tiles bullet.incendiary = [stat]incendiary bullet.homing = [stat]homing bullet.armorpierce = [stat]armor piercing +bullet.maxdamagefraction = [stat]{0}%[lightgray] damage limit bullet.suppression = [stat]{0}[lightgray] seconds of repair suppression ~ [stat]{1}[lightgray] tiles bullet.interval = [stat]{0}/sec[lightgray] interval bullets: bullet.frags = [stat]{0}[lightgray]x frag bullets: diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 6d7f4623f4..775af9c679 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -3849,16 +3849,19 @@ public class Blocks{ requirements(Category.turret, with(Items.copper, 1000, Items.metaglass, 600, Items.surgeAlloy, 300, Items.plastanium, 200, Items.silicon, 600)); ammo( - Items.surgeAlloy, new PointBulletType(){{ + Items.surgeAlloy, new RailBulletType(){{ shootEffect = Fx.instShoot; hitEffect = Fx.instHit; + pierceEffect = Fx.railHit; smokeEffect = Fx.smokeCloud; - trailEffect = Fx.instTrail; + pointEffect = Fx.instTrail; despawnEffect = Fx.instBomb; - trailSpacing = 20f; + pointEffectSpace = 20f; damage = 1350; buildingDamageMultiplier = 0.2f; - speed = brange; + maxDamageFraction = 0.6f; + pierceDamageFactor = 1f; + length = brange; hitShake = 6f; ammoMultiplier = 1f; }} diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index c0966d48b3..7edb314973 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -48,6 +48,8 @@ public class BulletType extends Content implements Cloneable{ public int pierceCap = -1; /** Multiplier of damage decreased per health pierced. */ public float pierceDamageFactor = 0f; + /** If positive, limits non-splash damage dealt to a fraction of the target's maximum health. */ + public float maxDamageFraction = -1f; /** If false, this bullet isn't removed after pierceCap is exceeded. Expert usage only. */ public boolean removeAfterPierce = true; /** For piercing lasers, setting this to true makes it get absorbed by plastanium walls. */ @@ -382,10 +384,16 @@ public class BulletType extends Content implements Cloneable{ boolean wasDead = entity instanceof Unit u && u.dead; if(entity instanceof Healthc h){ + float damage = b.damage; + if(maxDamageFraction > 0){ + damage = Math.min(damage, h.maxHealth() * maxDamageFraction); + //cap health to effective health for handlePierce to handle it properly + health = Math.min(health, h.maxHealth() * maxDamageFraction); + } if(pierceArmor){ - h.damagePierce(b.damage); + h.damagePierce(damage); }else{ - h.damage(b.damage); + h.damage(damage); } } diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index f7c32b3a25..36872d3546 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -487,6 +487,10 @@ public class StatValues{ sep(bt, "@bullet.armorpierce"); } + if(type.maxDamageFraction > 0){ + sep(bt, Core.bundle.format("bullet.maxdamagefraction", (int)(type.maxDamageFraction * 100))); + } + if(type.suppressionRange > 0){ sep(bt, Core.bundle.format("bullet.suppression", Strings.autoFixed(type.suppressionDuration / 60f, 2), Strings.fixed(type.suppressionRange / tilesize, 1))); }