diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 98a86da1a5..dcf02d1837 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1045,6 +1045,7 @@ stat.boosteffect = Boost Effect stat.maxunits = Max Active Units stat.health = Health stat.armor = Armor +stat.armor.info = Applied damage = incoming damage - armor.\nUp to 90% maximum damage reduction. stat.buildtime = Build Time stat.maxconsecutive = Max Consecutive stat.buildcost = Build Cost diff --git a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java index 619c35dc72..bc658d7e18 100644 --- a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java +++ b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java @@ -88,7 +88,7 @@ public class ContentInfoDialog extends BaseDialog{ for(Stat stat : map.keys()){ table.table(inset -> { inset.left(); - inset.add("[lightgray]" + stat.localized() + ":[] ").left().top(); + stats.statInfo(inset.add("[lightgray]" + stat.localized() + ":[] ").left().top(), stat); Seq arr = map.get(stat); for(StatValue value : arr){ value.display(inset); diff --git a/core/src/mindustry/world/meta/Stats.java b/core/src/mindustry/world/meta/Stats.java index d9651e9b6d..e9adfb6bd5 100644 --- a/core/src/mindustry/world/meta/Stats.java +++ b/core/src/mindustry/world/meta/Stats.java @@ -1,11 +1,17 @@ package mindustry.world.meta; +import arc.*; +import arc.scene.ui.layout.*; import arc.struct.ObjectMap.*; import arc.struct.*; import arc.util.*; +import mindustry.*; +import mindustry.gen.*; import mindustry.mod.*; import mindustry.type.*; +import java.util.*; + /** Hold and organizes a list of block stats. */ @NoPatch public class Stats{ @@ -131,4 +137,21 @@ public class Stats{ } return map; } + + public void statInfo(Cell cell, Stat stat){ + if(cell == null || stat == null) return; + + String key = "stat." + stat.name.toLowerCase(Locale.ROOT); + if(Core.bundle.has(key + ".info")){ + if(Vars.mobile && !Core.graphics.isPortrait()){ //disabled in portrait - broken and goes offscreen + Table table = new Table(); + table.add(cell.get()).left().expandX().fillX(); + cell.clearElement(); + table.button(Icon.infoSmall, () -> Vars.ui.showInfo("@" + key + ".info")).size(32f).right(); + cell.setElement(table).left().expandX().fillX(); + }else{ + cell.tooltip("@" + key + ".info"); + } + } + } }