Random assorted changes (#11338)

* shield stat changes

* shield stats + leg crush stats + apply floormultiplier to comp
This commit is contained in:
EggleEgg
2025-11-04 16:44:08 +01:00
committed by GitHub
parent 38d9bc83a3
commit 56b7e6357f
9 changed files with 62 additions and 8 deletions

View File

@@ -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){

View File

@@ -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

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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();
});
}
}

View File

@@ -83,6 +83,8 @@ public class Stat implements Comparable<Stat>{
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<Stat>{
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),

View File

@@ -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),

View File

@@ -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);