From 6b936aa7f6afb3aeed50a8c72fd3ce6d11fa8e10 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 25 Mar 2023 19:45:07 -0700 Subject: [PATCH] Better Ammo Stats Display (#8429) * Cleaner ammo stats based on unit factory recipe stats * Display suppression in bullet stats Also reword from "regen" to "repair" to more accurately convey that build towers are affected as well. * PointLaserBulletTypes don't display damage in dps * Display preview region instead of region * autoFixed --- core/assets/bundles/bundle.properties | 5 +-- .../entities/bullet/PointLaserBulletType.java | 5 +++ core/src/mindustry/world/meta/StatValues.java | 35 +++++++++++-------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 82703a709d..e8a6c0cc53 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -952,7 +952,7 @@ ability.unitspawn = {0} Factory ability.shieldregenfield = Shield Regen Field ability.movelightning = Movement Lightning ability.shieldarc = Shield Arc -ability.suppressionfield = Regen Suppression Field +ability.suppressionfield = Repair Suppression Field ability.energyfield = Energy Field: [accent]{0}[] damage ~ [accent]{1}[] blocks / [accent]{2}[] targets bar.onlycoredeposit = Only Core Depositing Allowed @@ -989,10 +989,11 @@ bar.strength = [stat]{0}[lightgray]x strength units.processorcontrol = [lightgray]Processor Controlled bullet.damage = [stat]{0}[lightgray] damage -bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles +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.suppression = [stat]{0} sec[lightgray] repair suppression ~ [stat]{1}[lightgray] tiles bullet.interval = [stat]{0}/sec[lightgray] interval bullets: bullet.frags = [stat]{0}[lightgray]x frag bullets: bullet.lightning = [stat]{0}[lightgray]x lightning ~ [stat]{1}[lightgray] damage diff --git a/core/src/mindustry/entities/bullet/PointLaserBulletType.java b/core/src/mindustry/entities/bullet/PointLaserBulletType.java index 9434d1eb3f..e78b91d2d8 100644 --- a/core/src/mindustry/entities/bullet/PointLaserBulletType.java +++ b/core/src/mindustry/entities/bullet/PointLaserBulletType.java @@ -45,6 +45,11 @@ public class PointLaserBulletType extends BulletType{ drawSize = 1000f; } + @Override + public float continuousDamage(){ + return damage / damageInterval * 60f; + } + @Override public float estimateDPS(){ return damage * 100f / damageInterval * 3f; diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 56895c6948..445af18fd8 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -292,15 +292,15 @@ public class StatValues{ continue; } - TextureRegion region = !weapon.name.equals("") && weapon.region.found() ? weapon.region : Core.atlas.find("clear"); + TextureRegion region = !weapon.name.isEmpty() ? Core.atlas.find(weapon.name + "-preview", weapon.region) : null; - table.image(region).size(60).scaling(Scaling.bounded).right().top(); - - table.table(Tex.underline, w -> { - w.left().defaults().padRight(3).left(); + table.table(Styles.grayPanel, w -> { + w.left().top().defaults().padRight(3).left(); + if(region != null && region.found()) w.image(region).size(60).scaling(Scaling.bounded).left().top(); + w.row(); weapon.addStats(unit, w); - }).padTop(-9).left(); + }).growX().pad(5).margin(10); table.row(); } }; @@ -332,14 +332,16 @@ public class StatValues{ continue; } - //no point in displaying unit icon twice - if(!compact && !(t instanceof Turret)){ - table.image(icon(t)).size(3 * 8).padRight(4).right().scaling(Scaling.fit).top(); - table.add(t.localizedName).padRight(10).left().top(); - } - - table.table(bt -> { + table.table(Styles.grayPanel, bt -> { bt.left().top().defaults().padRight(3).left(); + //no point in displaying unit icon twice + if(!compact && !(t instanceof Turret)){ + bt.table(title -> { + title.image(icon(t)).size(3 * 8).padRight(4).right().scaling(Scaling.fit).top(); + title.add(t.localizedName).padRight(10).left().top(); + }); + bt.row(); + } if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){ if(type.continuousDamage() > 0){ @@ -403,6 +405,10 @@ public class StatValues{ sep(bt, "@bullet.armorpierce"); } + if(type.suppressionRange > 0){ + sep(bt, Core.bundle.format("bullet.suppression", Strings.autoFixed(type.suppressionDuration / 60f, 2), Strings.fixed(type.suppressionRange / tilesize, 1))); + } + if(type.status != StatusEffects.none){ sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName + (type.status.reactive ? "" : "[lightgray] ~ [stat]" + ((int)(type.statusDuration / 60f)) + "[lightgray] " + Core.bundle.get("unit.seconds"))); } @@ -442,8 +448,7 @@ public class StatValues{ bt.row(); bt.add(coll); } - }).padTop(compact ? 0 : -9).padLeft(indent * 8).left().get().background(compact ? null : Tex.underline); - + }).padLeft(indent * 8).growX().pad(5).margin(compact ? 0 : 10); table.row(); } };