Make certain negative stats red (#7842)

This commit is contained in:
MEEPofFaith
2022-11-07 21:28:28 -05:00
committed by GitHub
parent 68434ad42e
commit 8f9736d1d9
4 changed files with 12 additions and 4 deletions
@@ -351,11 +351,11 @@ public class StatValues{
if(type.buildingDamageMultiplier != 1){
int val = (int)(type.buildingDamageMultiplier * 100 - 100);
sep(bt, Core.bundle.format("bullet.buildingdamage", (val > 0 ? "+" : "") + val));
sep(bt, Core.bundle.format("bullet.buildingdamage", ammoStat(val)));
}
if(type.rangeChange != 0 && !compact){
sep(bt, Core.bundle.format("bullet.range", (type.rangeChange > 0 ? "+" : "-") + Strings.autoFixed(type.rangeChange / tilesize, 1)));
sep(bt, Core.bundle.format("bullet.range", ammoStat(type.rangeChange / tilesize)));
}
if(type.splashDamage > 0){
@@ -367,7 +367,8 @@ public class StatValues{
}
if(!compact && !Mathf.equal(type.reloadMultiplier, 1f)){
sep(bt, Core.bundle.format("bullet.reload", Strings.autoFixed(type.reloadMultiplier, 2)));
int val = (int)(type.reloadMultiplier * 100 - 100);
sep(bt, Core.bundle.format("bullet.reload", ammoStat(val)));
}
if(type.knockback > 0){
@@ -425,6 +426,11 @@ public class StatValues{
table.add(text);
}
//for AmmoListValue
private static String ammoStat(float val){
return (val > 0 ? "[stat]+" : "[negstat]") + Strings.autoFixed(val, 1);
}
private static TextureRegion icon(UnlockableContent t){
return t.uiIcon;
}