From 56b7e6357f887b2aed54f1171f6b12c553c5fb91 Mon Sep 17 00:00:00 2001 From: EggleEgg <125359838+EggleEgg@users.noreply.github.com> Date: Tue, 4 Nov 2025 16:44:08 +0100 Subject: [PATCH] Random assorted changes (#11338) * shield stat changes * shield stats + leg crush stats + apply floormultiplier to comp --- core/assets/bundles/bundle.properties | 5 +++ .../abilities/RepairFieldAbility.java | 15 +++++++-- .../mindustry/entities/comp/CrawlComp.java | 2 +- .../src/mindustry/entities/comp/UnitComp.java | 2 +- core/src/mindustry/type/UnitType.java | 9 ++++-- .../world/blocks/defense/ForceProjector.java | 31 ++++++++++++++++++- core/src/mindustry/world/meta/Stat.java | 3 ++ core/src/mindustry/world/meta/StatUnit.java | 1 + core/src/mindustry/world/meta/StatValues.java | 2 +- 9 files changed, 62 insertions(+), 8 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 4e62e68383..fc95300e51 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1031,6 +1031,8 @@ stat.frequency = Frequency stat.targetsair = Targets Air stat.targetsground = Targets Ground stat.crushdamage = Crush Damage +stat.legsplashdamage = Leg Splash Damage +stat.legsplashrange = Leg Splash Range stat.itemsmoved = Move Speed stat.launchtime = Time Between Launches stat.shootrange = Range @@ -1070,6 +1072,7 @@ stat.reload = Firing Rate stat.ammo = Ammo stat.shieldhealth = Shield Health stat.cooldowntime = Cooldown Time +stat.regenerationrate = Regeneration Rate stat.explosiveness = Explosiveness stat.basedeflectchance = Base Deflect Chance stat.lightningchance = Lightning Chance @@ -1179,6 +1182,7 @@ bar.launchcooldown = Launch Cooldown bar.input = Input bar.output = Output bar.strength = [stat]{0}[lightgray]x strength +bar.regenerationrate = [stat]{0}/sec[lightgray] regen rate units.processorcontrol = [lightgray]Processor Controlled @@ -1229,6 +1233,7 @@ unit.millions = mil unit.billions = b unit.shots = shots unit.pershot = /shot +unit.perleg = per leg category.purpose = Purpose category.general = General category.power = Power diff --git a/core/src/mindustry/entities/abilities/RepairFieldAbility.java b/core/src/mindustry/entities/abilities/RepairFieldAbility.java index 486a11980b..9337b20dc6 100644 --- a/core/src/mindustry/entities/abilities/RepairFieldAbility.java +++ b/core/src/mindustry/entities/abilities/RepairFieldAbility.java @@ -10,7 +10,7 @@ import mindustry.gen.*; import static mindustry.Vars.*; public class RepairFieldAbility extends Ability{ - public float amount = 1, reload = 100, range = 60; + public float amount = 1, reload = 100, range = 60, healPercent = 0f; public Effect healEffect = Fx.heal; public Effect activeEffect = Fx.healWaveDynamic; public boolean parentizeEffects = false; @@ -27,6 +27,12 @@ public class RepairFieldAbility extends Ability{ this.reload = reload; this.range = range; } + public RepairFieldAbility(float amount, float reload, float range, float healPercent){ + this.amount = amount; + this.reload = reload; + this.range = range; + this.healPercent = healPercent; + } @Override public void addStats(Table t){ @@ -34,6 +40,11 @@ public class RepairFieldAbility extends Ability{ t.add(Core.bundle.format("bullet.range", Strings.autoFixed(range / tilesize, 2))); t.row(); t.add(abilityStat("repairspeed", Strings.autoFixed(amount * 60f / reload, 2))); + t.row(); + if(healPercent > 0f){ + t.row(); + t.add(Core.bundle.format("bullet.healpercent", Strings.autoFixed(healPercent, 2))); + } if(sameTypeHealMult != 1f){ t.row(); t.add(abilityStat("sametypehealmultiplier", (sameTypeHealMult < 1f ? "[negstat]" : "") + Strings.autoFixed(sameTypeHealMult * 100f, 2))); @@ -53,7 +64,7 @@ public class RepairFieldAbility extends Ability{ wasHealed = true; } float healMult = unit.type == other.type ? sameTypeHealMult : 1f; - other.heal(amount * healMult); + other.heal((amount + healPercent / 100f * other.maxHealth()) * healMult); }); if(wasHealed){ diff --git a/core/src/mindustry/entities/comp/CrawlComp.java b/core/src/mindustry/entities/comp/CrawlComp.java index 918023197c..23429ad6dc 100644 --- a/core/src/mindustry/entities/comp/CrawlComp.java +++ b/core/src/mindustry/entities/comp/CrawlComp.java @@ -36,7 +36,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{ public float floorSpeedMultiplier(){ Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); //TODO take into account extra blocks - return (on.isDeep() ? 0.45f : on.speedMultiplier) * speedMultiplier * lastCrawlSlowdown; + return ((float)Math.pow(on.isDeep() ? 0.45f : on.speedMultiplier, type.floorMultiplier)) * speedMultiplier * lastCrawlSlowdown; } @Override diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index c1c3d48211..f66efa3cac 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -102,7 +102,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I public float floorSpeedMultiplier(){ Floor on = isFlying() || type.hovering ? Blocks.air.asFloor() : floorOn(); - return on.speedMultiplier * speedMultiplier; + return (float)Math.pow(on.speedMultiplier, type.floorMultiplier) * speedMultiplier; } /** Called when this unit was unloaded from a factory or spawn point. */ diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 2e233c59e1..5139516901 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -57,6 +57,8 @@ public class UnitType extends UnlockableContent implements Senseable{ public float speed = 1.1f, /** multiplier for speed when boosting */ boostMultiplier = 1f, + /** how affected this unit is by terrain */ + floorMultiplier = 1f, /** body rotation speed in degrees/t */ rotateSpeed = 5f, /** mech base rotation speed in degrees/t*/ @@ -439,8 +441,6 @@ public class UnitType extends UnlockableContent implements Senseable{ public int treadFrames = 18; /** how much of a top part of a tread sprite is "cut off" relative to the pattern; this is corrected for */ public int treadPullOffset = 0; - /** how affected this unit is by terrain */ - public float floorMultiplier = 1f; //SEGMENTED / CRAWL UNITS (this is WIP content!) @@ -750,6 +750,11 @@ public class UnitType extends UnlockableContent implements Senseable{ stats.add(Stat.crushDamage, crushDamage * 60f * 5f, StatUnit.perSecond); } + if(legSplashDamage > 0 && legSplashRange > 0){ + stats.add(Stat.legSplashDamage, legSplashDamage, StatUnit.perLeg); + stats.add(Stat.legSplashRange, Strings.autoFixed(legSplashRange / tilesize, 1), StatUnit.blocks); + } + stats.add(Stat.targetsAir, targetAir); stats.add(Stat.targetsGround, targetGround); diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 7aa49ecb98..c4e846fe1e 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java @@ -17,6 +17,7 @@ import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.logic.*; +import mindustry.type.*; import mindustry.ui.*; import mindustry.world.*; import mindustry.world.blocks.*; @@ -101,12 +102,40 @@ public class ForceProjector extends Block{ if(consItems) stats.timePeriod = phaseUseTime; super.setStats(); stats.add(Stat.shieldHealth, shieldHealth, StatUnit.none); + stats.add(Stat.regenerationRate, cooldownNormal * 60f, StatUnit.perSecond); stats.add(Stat.cooldownTime, (int) (shieldHealth / cooldownBrokenBase / 60f), StatUnit.seconds); if(consItems && itemConsumer instanceof ConsumeItems coni){ stats.remove(Stat.booster); stats.add(Stat.booster, StatValues.itemBoosters("+{0} " + StatUnit.shieldHealth.localized(), stats.timePeriod, phaseShieldBoost, phaseRadiusBoost, coni.items)); - stats.add(Stat.booster, StatValues.speedBoosters("", coolantConsumption, Float.MAX_VALUE, true, this::consumesLiquid)); + + stats.add(Stat.booster, (table) -> { + table.row(); + table.table(c -> { + for(Liquid liquid : content.liquids()){ + if(!consumesLiquid(liquid)) continue; + + c.table(Styles.grayPanel, b -> { + b.image(liquid.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit).with(i -> StatValues.withTooltip(i, liquid, false)); + b.table(info -> { + info.add(liquid.localizedName).left().row(); + info.add(Strings.autoFixed(coolantConsumption * 60f, 2) + StatUnit.perSecond.localized()).left().color(Color.lightGray); + }); + + float liquidHeat = (1f + (liquid.heatCapacity - 0.4f) * 0.9f); + float regenBoost = ((cooldownNormal * (cooldownLiquid * liquidHeat)) - cooldownNormal) * 60f; + float cooldownBoost = (shieldHealth / (cooldownBrokenBase * (cooldownLiquid * liquidHeat)) - shieldHealth / cooldownBrokenBase) / 60f; + + b.table(bt -> { + bt.right().defaults().padRight(3).left(); + bt.add("[lightgray]+" + Core.bundle.format("bar.regenerationrate", Strings.autoFixed(regenBoost, 2))).pad(5).row(); + bt.add(Core.bundle.format("ability.stat.cooldown", Strings.autoFixed(cooldownBoost, 2))).pad(5); + }).right().grow().pad(10f).padRight(15f); + }).growX().pad(5).row(); + } + }).growX().colspan(table.getColumns()); + table.row(); + }); } } diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index 54b2614910..37974939ef 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java @@ -83,6 +83,8 @@ public class Stat implements Comparable{ shots = new Stat("shots", StatCat.function), reload = new Stat("reload", StatCat.function), crushDamage = new Stat("crushDamage", StatCat.function), + legSplashDamage = new Stat("legSplashDamage", StatCat.function), + legSplashRange = new Stat("legSplashRange", StatCat.function), targetsAir = new Stat("targetsAir", StatCat.function), targetsGround = new Stat("targetsGround", StatCat.function), damage = new Stat("damage", StatCat.function), @@ -92,6 +94,7 @@ public class Stat implements Comparable{ ammoUse = new Stat("ammoUse", StatCat.function), shieldHealth = new Stat("shieldHealth", StatCat.function), cooldownTime = new Stat("cooldownTime", StatCat.function), + regenerationRate = new Stat("regenerationRate", StatCat.function), moduleTier = new Stat("moduletier", StatCat.function), unitType = new Stat("unittype", StatCat.function), diff --git a/core/src/mindustry/world/meta/StatUnit.java b/core/src/mindustry/world/meta/StatUnit.java index 917b88937d..a896741236 100644 --- a/core/src/mindustry/world/meta/StatUnit.java +++ b/core/src/mindustry/world/meta/StatUnit.java @@ -28,6 +28,7 @@ public class StatUnit{ perSecond = new StatUnit("perSecond", false), perMinute = new StatUnit("perMinute", false), perShot = new StatUnit("perShot", false), + perLeg = new StatUnit("perLeg"), timesSpeed = new StatUnit("timesSpeed", false), multiplier = new StatUnit("multiplier", false), percent = new StatUnit("percent", false), diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index ac1b5a740d..b2694d1c8f 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -509,7 +509,7 @@ public class StatValues{ if(!filter.get(liquid)) continue; c.table(Styles.grayPanel, b -> { - b.image(liquid.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit).with(i -> withTooltip(i, liquid, false));; + b.image(liquid.uiIcon).size(40).pad(10f).left().scaling(Scaling.fit).with(i -> withTooltip(i, liquid, false)); b.table(info -> { info.add(liquid.localizedName).left().row(); info.add(Strings.autoFixed(amount * 60f, 2) + StatUnit.perSecond.localized()).left().color(Color.lightGray);