Cleanup of weapon stats
This commit is contained in:
@@ -19,7 +19,8 @@ public class SapBulletType extends BulletType{
|
||||
public SapBulletType(){
|
||||
speed = 0.0001f;
|
||||
despawnEffect = Fx.none;
|
||||
pierce = true;
|
||||
pierce = false;
|
||||
collides = false;
|
||||
hitSize = 0f;
|
||||
hittable = false;
|
||||
hitEffect = Fx.hitLiquid;
|
||||
|
||||
@@ -221,7 +221,7 @@ public class UnitType extends UnlockableContent{
|
||||
stats.add(Stat.canBoost, canBoost);
|
||||
}
|
||||
|
||||
if(inst instanceof Minerc && mineTier >= 1){
|
||||
if(mineTier >= 1){
|
||||
stats.addPercent(Stat.mineSpeed, mineSpeed);
|
||||
stats.add(Stat.mineTier, new BlockFilterValue(b -> b instanceof Floor f && f.itemDrop != null && f.itemDrop.hardness <= mineTier && !f.playerUnmineable));
|
||||
}
|
||||
@@ -232,7 +232,9 @@ public class UnitType extends UnlockableContent{
|
||||
stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared);
|
||||
}
|
||||
|
||||
stats.add(Stat.weapons, new WeaponListValue(this, weapons));
|
||||
if(weapons.any()){
|
||||
stats.add(Stat.weapons, new WeaponListValue(this, weapons));
|
||||
}
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
@@ -28,14 +27,19 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
public void display(Table table){
|
||||
|
||||
table.row();
|
||||
|
||||
for(T t : map.keys()){
|
||||
boolean unit = t instanceof UnitType;
|
||||
|
||||
BulletType type = map.get(t);
|
||||
|
||||
//no point in displaying unit icon twice
|
||||
if(!(t instanceof UnitType)){
|
||||
if(!unit){
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
}
|
||||
Cons<Table> tableCons = bt -> {
|
||||
|
||||
table.table(bt -> {
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
||||
@@ -46,7 +50,7 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1)));
|
||||
}
|
||||
|
||||
if(!(t instanceof UnitType) && !Mathf.equal(type.ammoMultiplier, 1f) && !(type instanceof LiquidBulletType)){
|
||||
if(!unit && !Mathf.equal(type.ammoMultiplier, 1f) && !(type instanceof LiquidBulletType)){
|
||||
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
|
||||
}
|
||||
|
||||
@@ -58,16 +62,15 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, Core.bundle.format("bullet.knockback", Strings.fixed(type.knockback, 1)));
|
||||
}
|
||||
|
||||
//sap bullets don't really have pierce
|
||||
if((type.pierce || type.pierceCap != -1) && !(type instanceof SapBulletType)){
|
||||
sep(bt, type.pierceCap == -1 ? "@bullet.infinitepierce" : Core.bundle.format("bullet.pierce", type.pierceCap));
|
||||
}
|
||||
|
||||
if((type.healPercent > 0f)){
|
||||
if(type.healPercent > 0f){
|
||||
sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent));
|
||||
}
|
||||
|
||||
if((type.status == StatusEffects.burning || type.status == StatusEffects.melting) || type.incendAmount > 0){
|
||||
if(type.pierce || type.pierceCap != -1){
|
||||
sep(bt, type.pierceCap == -1 ? "@bullet.infinitepierce" : Core.bundle.format("bullet.pierce", type.pierceCap));
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.burning || type.status == StatusEffects.melting || type.incendAmount > 0){
|
||||
sep(bt, "@bullet.incendiary");
|
||||
}
|
||||
|
||||
@@ -94,12 +97,8 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
if(type.fragBullet != null){
|
||||
sep(bt, "@bullet.frag");
|
||||
}
|
||||
};
|
||||
if(t instanceof UnitType){
|
||||
table.table(tableCons);
|
||||
}else{
|
||||
table.table(Tex.underline, tableCons).left().padTop(-9);
|
||||
}
|
||||
}).padTop(unit ? 0 : -9).left().get().background(unit ? null : Tex.underline);
|
||||
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.*;
|
||||
import arc.util.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class WeaponListValue implements StatValue{
|
||||
private final Seq<Weapon> weapons;
|
||||
private final UnitType unit;
|
||||
@@ -27,25 +25,25 @@ public class WeaponListValue implements StatValue{
|
||||
Weapon weapon = weapons.get(i);
|
||||
|
||||
if(weapon.flipSprite){
|
||||
//fliped weapons are not given stats
|
||||
//flipped weapons are not given stats
|
||||
continue;
|
||||
}
|
||||
|
||||
if(weapon.outlineRegion.found()){
|
||||
table.image(weapon.outlineRegion).size(10 * 8).scaling(Scaling.fit).right().top();
|
||||
}else{
|
||||
table.image(unit.icon(Cicon.full)).size(10 * 8).scaling(Scaling.fit).right().top();
|
||||
}
|
||||
table.table(Tex.underline, w -> {
|
||||
TextureRegion region = weapon.outlineRegion.found() ? weapon.outlineRegion : unit.icon(Cicon.full);
|
||||
|
||||
table.image(region).size(60).scaling(Scaling.bounded).right().top();
|
||||
|
||||
table.table(Tex.underline, w -> {
|
||||
w.left().defaults().padRight(3).left();
|
||||
|
||||
sep(w, "[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)weapon.inaccuracy + " " + StatUnit.degrees.localized());
|
||||
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, 1));
|
||||
sep(w, "[lightgray]" + Stat.bullet.localized() + ":");
|
||||
|
||||
AmmoListValue bullet = new AmmoListValue(OrderedMap.of(unit, weapon.bullet));
|
||||
var bullet = new AmmoListValue<UnitType>(OrderedMap.of(unit, weapon.bullet));
|
||||
bullet.display(w);
|
||||
}).left().padTop(-9);
|
||||
}).padTop(-9).left();
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user