Merge branch 'genNAowl-unit-stats'

This commit is contained in:
Anuken
2020-11-13 14:42:58 -05:00
16 changed files with 2023 additions and 1937 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -635,6 +635,8 @@ stat.memorycapacity = Memory Capacity
stat.basepowergeneration = Base Power Generation stat.basepowergeneration = Base Power Generation
stat.productiontime = Production Time stat.productiontime = Production Time
stat.repairtime = Block Full Repair Time stat.repairtime = Block Full Repair Time
stat.weapons = Weapons
stat.bullet = Bullet
stat.speedincrease = Speed Increase stat.speedincrease = Speed Increase
stat.range = Range stat.range = Range
stat.drilltier = Drillables stat.drilltier = Drillables
@@ -704,12 +706,14 @@ units.processorcontrol = [lightgray]Processor Controlled
bullet.damage = [stat]{0}[lightgray] damage bullet.damage = [stat]{0}[lightgray] damage
bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles
bullet.incendiary = [stat]incendiary bullet.incendiary = [stat]incendiary
bullet.sapping = [stat]sapping
bullet.homing = [stat]homing bullet.homing = [stat]homing
bullet.shock = [stat]shock bullet.shock = [stat]shock
bullet.frag = [stat]frag bullet.frag = [stat]frag
bullet.knockback = [stat]{0}[lightgray] knockback bullet.knockback = [stat]{0}[lightgray] knockback
bullet.pierce = [stat]{0}[lightgray]x pierce bullet.pierce = [stat]{0}[lightgray]x pierce
bullet.infinitepierce = [stat]pierce bullet.infinitepierce = [stat]pierce
bullet.healpercent = [stat]{0}[lightgray]% healing
bullet.freezing = [stat]freezing bullet.freezing = [stat]freezing
bullet.tarred = [stat]tarred bullet.tarred = [stat]tarred
bullet.multiplier = [stat]{0}[lightgray]x ammo multiplier bullet.multiplier = [stat]{0}[lightgray]x ammo multiplier

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 KiB

After

Width:  |  Height:  |  Size: 944 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 KiB

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 186 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 188 KiB

View File

@@ -337,6 +337,8 @@ public class UnitTypes implements ContentList{
lightningLength = 7; lightningLength = 7;
lightningLengthRand = 7; lightningLengthRand = 7;
shootEffect = Fx.shootHeal; shootEffect = Fx.shootHeal;
//Does not actually do anything; Just here to make stats work
healPercent = 2f;
lightningType = new BulletType(0.0001f, 0f){{ lightningType = new BulletType(0.0001f, 0f){{
lifetime = Fx.lightning.lifetime; lifetime = Fx.lightning.lifetime;

View File

@@ -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;

View File

@@ -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));
} }
@@ -231,6 +231,10 @@ public class UnitType extends UnlockableContent{
if(inst instanceof Payloadc){ if(inst instanceof Payloadc){
stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared); stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared);
} }
if(weapons.any()){
stats.add(Stat.weapons, new WeaponListValue(this, weapons));
}
} }
@CallSuper @CallSuper

View File

@@ -55,6 +55,9 @@ public enum Stat{
linkRange(StatCat.crafting), linkRange(StatCat.crafting),
instructions(StatCat.crafting), instructions(StatCat.crafting),
weapons(StatCat.function),
bullet(StatCat.function),
speedIncrease(StatCat.function), speedIncrease(StatCat.function),
repairTime(StatCat.function), repairTime(StatCat.function),
range(StatCat.function), range(StatCat.function),

View File

@@ -10,6 +10,7 @@ import mindustry.content.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.entities.bullet.*; import mindustry.entities.bullet.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.meta.*; import mindustry.world.meta.*;
@@ -26,11 +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);
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
table.add(t.localizedName).padRight(10).left().top(); //no point in displaying unit icon twice
table.table(Tex.underline, bt -> { if(!unit){
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
table.add(t.localizedName).padRight(10).left().top();
}
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)){
@@ -41,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(!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));
} }
@@ -53,11 +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)));
} }
if(type.healPercent > 0f){
sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent));
}
if(type.pierce || type.pierceCap != -1){ if(type.pierce || type.pierceCap != -1){
sep(bt, type.pierceCap == -1 ? "@bullet.infinitepierce" : Core.bundle.format("bullet.pierce", type.pierceCap)); 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){ if(type.status == StatusEffects.burning || type.status == StatusEffects.melting || type.incendAmount > 0){
sep(bt, "@bullet.incendiary"); sep(bt, "@bullet.incendiary");
} }
@@ -69,6 +82,10 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
sep(bt, "@bullet.tarred"); sep(bt, "@bullet.tarred");
} }
if(type.status == StatusEffects.sapped){
sep(bt, "@bullet.sapping");
}
if(type.homingPower > 0.01f){ if(type.homingPower > 0.01f){
sep(bt, "@bullet.homing"); sep(bt, "@bullet.homing");
} }
@@ -80,7 +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");
} }
}).left().padTop(-9); }).padTop(unit ? 0 : -9).left().get().background(unit ? null : Tex.underline);
table.row(); table.row();
} }
} }

View File

@@ -0,0 +1,55 @@
package mindustry.world.meta.values;
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.*;
public class WeaponListValue implements StatValue{
private final Seq<Weapon> weapons;
private final UnitType unit;
public WeaponListValue(UnitType unit, Seq<Weapon> weapons){
this.weapons = weapons;
this.unit = unit;
}
@Override
public void display(Table table){
table.row();
for(int i = 0;i < weapons.size;i ++){
Weapon weapon = weapons.get(i);
if(weapon.flipSprite){
//flipped weapons are not given stats
continue;
}
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();
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));
var bullet = new AmmoListValue<UnitType>(OrderedMap.of(unit, weapon.bullet));
bullet.display(w);
}).padTop(-9).left();
table.row();
}
}
void sep(Table table, String text){
table.row();
table.add(text);
}
}

View File

@@ -504,7 +504,6 @@ public class Generators{
scaled.save(type.name + "-icon-logic"); scaled.save(type.name + "-icon-logic");
} }
} }
}catch(IllegalArgumentException e){ }catch(IllegalArgumentException e){
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage()); Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
} }