Cleanup of weapon stats
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 917 KiB After Width: | Height: | Size: 944 KiB |
|
Before Width: | Height: | Size: 608 KiB After Width: | Height: | Size: 596 KiB |
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 188 KiB |
@@ -19,7 +19,8 @@ public class SapBulletType extends BulletType{
|
|||||||
public SapBulletType(){
|
public SapBulletType(){
|
||||||
speed = 0.0001f;
|
speed = 0.0001f;
|
||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
pierce = true;
|
pierce = false;
|
||||||
|
collides = false;
|
||||||
hitSize = 0f;
|
hitSize = 0f;
|
||||||
hittable = false;
|
hittable = false;
|
||||||
hitEffect = Fx.hitLiquid;
|
hitEffect = Fx.hitLiquid;
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
stats.add(Stat.canBoost, canBoost);
|
stats.add(Stat.canBoost, canBoost);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inst instanceof Minerc && mineTier >= 1){
|
if(mineTier >= 1){
|
||||||
stats.addPercent(Stat.mineSpeed, mineSpeed);
|
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));
|
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.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
|
@CallSuper
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package mindustry.world.meta.values;
|
package mindustry.world.meta.values;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.func.*;
|
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
@@ -28,14 +27,19 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
|||||||
public void display(Table table){
|
public void display(Table table){
|
||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
for(T t : map.keys()){
|
for(T t : map.keys()){
|
||||||
|
boolean unit = t instanceof UnitType;
|
||||||
|
|
||||||
BulletType type = map.get(t);
|
BulletType type = map.get(t);
|
||||||
|
|
||||||
//no point in displaying unit icon twice
|
//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.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||||
table.add(t.localizedName).padRight(10).left().top();
|
table.add(t.localizedName).padRight(10).left().top();
|
||||||
}
|
}
|
||||||
Cons<Table> tableCons = bt -> {
|
|
||||||
|
table.table(bt -> {
|
||||||
bt.left().defaults().padRight(3).left();
|
bt.left().defaults().padRight(3).left();
|
||||||
|
|
||||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
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)));
|
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));
|
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)));
|
sep(bt, Core.bundle.format("bullet.knockback", Strings.fixed(type.knockback, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//sap bullets don't really have pierce
|
if(type.healPercent > 0f){
|
||||||
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)){
|
|
||||||
sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent));
|
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");
|
sep(bt, "@bullet.incendiary");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,12 +97,8 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
|||||||
if(type.fragBullet != null){
|
if(type.fragBullet != null){
|
||||||
sep(bt, "@bullet.frag");
|
sep(bt, "@bullet.frag");
|
||||||
}
|
}
|
||||||
};
|
}).padTop(unit ? 0 : -9).left().get().background(unit ? null : Tex.underline);
|
||||||
if(t instanceof UnitType){
|
|
||||||
table.table(tableCons);
|
|
||||||
}else{
|
|
||||||
table.table(Tex.underline, tableCons).left().padTop(-9);
|
|
||||||
}
|
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
package mindustry.world.meta.values;
|
package mindustry.world.meta.values;
|
||||||
|
|
||||||
import arc.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.util.*;
|
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class WeaponListValue implements StatValue{
|
public class WeaponListValue implements StatValue{
|
||||||
private final Seq<Weapon> weapons;
|
private final Seq<Weapon> weapons;
|
||||||
private final UnitType unit;
|
private final UnitType unit;
|
||||||
@@ -27,25 +25,25 @@ public class WeaponListValue implements StatValue{
|
|||||||
Weapon weapon = weapons.get(i);
|
Weapon weapon = weapons.get(i);
|
||||||
|
|
||||||
if(weapon.flipSprite){
|
if(weapon.flipSprite){
|
||||||
//fliped weapons are not given stats
|
//flipped weapons are not given stats
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(weapon.outlineRegion.found()){
|
TextureRegion region = weapon.outlineRegion.found() ? weapon.outlineRegion : unit.icon(Cicon.full);
|
||||||
table.image(weapon.outlineRegion).size(10 * 8).scaling(Scaling.fit).right().top();
|
|
||||||
}else{
|
table.image(region).size(60).scaling(Scaling.bounded).right().top();
|
||||||
table.image(unit.icon(Cicon.full)).size(10 * 8).scaling(Scaling.fit).right().top();
|
|
||||||
}
|
table.table(Tex.underline, w -> {
|
||||||
table.table(Tex.underline, w -> {
|
|
||||||
w.left().defaults().padRight(3).left();
|
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.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);
|
bullet.display(w);
|
||||||
}).left().padTop(-9);
|
}).padTop(-9).left();
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||