Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2023-03-26 22:46:35 -04:00
39 changed files with 84 additions and 17 deletions

View File

@@ -45,6 +45,11 @@ public class PointLaserBulletType extends BulletType{
drawSize = 1000f;
}
@Override
public float continuousDamage(){
return damage / damageInterval * 60f;
}
@Override
public float estimateDPS(){
return damage * 100f / damageInterval * 3f;

View File

@@ -119,6 +119,15 @@ public class TypeIO{
}else if(object instanceof Team t){
write.b((byte)20);
write.b(t.id);
}else if(object instanceof int[] i){
write.b((byte)21);
writeInts(write, i);
}else if(object instanceof Object[] objs){
write.b((byte)22);
write.i(objs.length);
for(Object obj : objs){
writeObject(write, obj);
}
}else{
throw new IllegalArgumentException("Unknown object type: " + object.getClass());
}
@@ -184,6 +193,13 @@ public class TypeIO{
}
case 19 -> new Vec2(read.f(), read.f());
case 20 -> Team.all[read.ub()];
case 21 -> readInts(read);
case 22 -> {
int objlen = read.i();
Object[] objs = new Object[objlen];
for(int i = 0; i < objlen; i++) objs[i] = readObjectBoxed(read, box);
yield objs;
}
default -> throw new IllegalArgumentException("Unknown object type: " + type);
};
}

View File

@@ -16,6 +16,7 @@ public class AttributeCrafter extends GenericCrafter{
public float minEfficiency = -1f;
public float displayEfficiencyScale = 1f;
public boolean displayEfficiency = true;
public boolean scaleLiquidConsumption = false;
public AttributeCrafter(String name){
super(name);
@@ -68,6 +69,11 @@ public class AttributeCrafter extends GenericCrafter{
public float efficiencyMultiplier(){
return baseEfficiency + Math.min(maxBoost, boostScale * attrsum) + attribute.env();
}
@Override
public float efficiencyScale(){
return scaleLiquidConsumption ? efficiencyMultiplier() : super.efficiencyScale();
}
@Override
public void pickedUp(){

View File

@@ -292,15 +292,15 @@ public class StatValues{
continue;
}
TextureRegion region = !weapon.name.equals("") && weapon.region.found() ? weapon.region : Core.atlas.find("clear");
TextureRegion region = !weapon.name.isEmpty() ? Core.atlas.find(weapon.name + "-preview", weapon.region) : null;
table.image(region).size(60).scaling(Scaling.bounded).right().top();
table.table(Tex.underline, w -> {
w.left().defaults().padRight(3).left();
table.table(Styles.grayPanel, w -> {
w.left().top().defaults().padRight(3).left();
if(region != null && region.found()) w.image(region).size(60).scaling(Scaling.bounded).left().top();
w.row();
weapon.addStats(unit, w);
}).padTop(-9).left();
}).growX().pad(5).margin(10);
table.row();
}
};
@@ -332,14 +332,16 @@ public class StatValues{
continue;
}
//no point in displaying unit icon twice
if(!compact && !(t instanceof Turret)){
table.image(icon(t)).size(3 * 8).padRight(4).right().scaling(Scaling.fit).top();
table.add(t.localizedName).padRight(10).left().top();
}
table.table(bt -> {
table.table(Styles.grayPanel, bt -> {
bt.left().top().defaults().padRight(3).left();
//no point in displaying unit icon twice
if(!compact && !(t instanceof Turret)){
bt.table(title -> {
title.image(icon(t)).size(3 * 8).padRight(4).right().scaling(Scaling.fit).top();
title.add(t.localizedName).padRight(10).left().top();
});
bt.row();
}
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
if(type.continuousDamage() > 0){
@@ -403,6 +405,10 @@ public class StatValues{
sep(bt, "@bullet.armorpierce");
}
if(type.suppressionRange > 0){
sep(bt, Core.bundle.format("bullet.suppression", Strings.autoFixed(type.suppressionDuration / 60f, 2), Strings.fixed(type.suppressionRange / tilesize, 1)));
}
if(type.status != StatusEffects.none){
sep(bt, (type.status.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName + (type.status.reactive ? "" : "[lightgray] ~ [stat]" + ((int)(type.statusDuration / 60f)) + "[lightgray] " + Core.bundle.get("unit.seconds")));
}
@@ -442,8 +448,7 @@ public class StatValues{
bt.row();
bt.add(coll);
}
}).padTop(compact ? 0 : -9).padLeft(indent * 8).left().get().background(compact ? null : Tex.underline);
}).padLeft(indent * 5).padTop(5).padBottom(compact ? 0 : 5).growX().margin(compact ? 0 : 10);
table.row();
}
};