I Like Stats (#5347)
Co-authored-by: Leonwang4234 <leonwang4234@gmail.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.audio.*;
|
||||
import mindustry.content.*;
|
||||
@@ -15,6 +17,7 @@ import mindustry.entities.bullet.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -119,6 +122,17 @@ public class Weapon implements Cloneable{
|
||||
this("");
|
||||
}
|
||||
|
||||
public void addStats(UnitType u, Table t){
|
||||
if(inaccuracy > 0){
|
||||
t.row();
|
||||
t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized());
|
||||
}
|
||||
t.row();
|
||||
t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shots, 2));
|
||||
|
||||
StatValues.ammo(ObjectMap.of(u, bullet)).display(t);
|
||||
}
|
||||
|
||||
public float dps(){
|
||||
return (bullet.estimateDPS() / reload) * shots * 60f;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.units.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
/**
|
||||
* Note that this weapon requires a bullet with a positive maxRange.
|
||||
@@ -47,6 +49,12 @@ public class RepairBeamWeapon extends Weapon{
|
||||
recoil = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStats(UnitType u, Table w){
|
||||
w.row();
|
||||
w.add("[lightgray]" + Stat.repairSpeed.localized() + ": " + (mirror ? "2x " : "") + "[white]" + (int)(repairSpeed * 60) + " " + StatUnit.perSecond.localized());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float dps(){
|
||||
return 0f;
|
||||
|
||||
@@ -198,15 +198,10 @@ public class StatValues{
|
||||
|
||||
table.image(region).size(60).scaling(Scaling.bounded).right().top();
|
||||
|
||||
table.table(Tex.underline, w -> {
|
||||
table.table(Tex.underline, w -> {
|
||||
w.left().defaults().padRight(3).left();
|
||||
|
||||
if(weapon.inaccuracy > 0){
|
||||
sep(w, "[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)weapon.inaccuracy + " " + StatUnit.degrees.localized());
|
||||
}
|
||||
sep(w, "[lightgray]" + Stat.reload.localized() + ": " + (weapon.mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / weapon.reload * weapon.shots, 2));
|
||||
|
||||
ammo(ObjectMap.of(unit, weapon.bullet)).display(w);
|
||||
weapon.addStats(unit, w);
|
||||
}).padTop(-9).left();
|
||||
table.row();
|
||||
}
|
||||
@@ -298,7 +293,6 @@ public class StatValues{
|
||||
}
|
||||
|
||||
//for AmmoListValue
|
||||
|
||||
private static void sep(Table table, String text){
|
||||
table.row();
|
||||
table.add(text);
|
||||
|
||||
Reference in New Issue
Block a user