mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 12:38:05 +07:00
Merge branch 'unit-stats' of git://github.com/genNAowl/Mndstry into genNAowl-unit-stats
This commit is contained in:
commit
e0b4eb7f8f
@ -635,6 +635,8 @@ stat.memorycapacity = Memory Capacity
|
||||
stat.basepowergeneration = Base Power Generation
|
||||
stat.productiontime = Production Time
|
||||
stat.repairtime = Block Full Repair Time
|
||||
stat.weapons = Weapons
|
||||
stat.bullet = Bullet
|
||||
stat.speedincrease = Speed Increase
|
||||
stat.range = Range
|
||||
stat.drilltier = Drillables
|
||||
@ -704,12 +706,14 @@ units.processorcontrol = [lightgray]Processor Controlled
|
||||
bullet.damage = [stat]{0}[lightgray] damage
|
||||
bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles
|
||||
bullet.incendiary = [stat]incendiary
|
||||
bullet.sapping = [stat]sapping
|
||||
bullet.homing = [stat]homing
|
||||
bullet.shock = [stat]shock
|
||||
bullet.frag = [stat]frag
|
||||
bullet.knockback = [stat]{0}[lightgray] knockback
|
||||
bullet.pierce = [stat]{0}[lightgray]x pierce
|
||||
bullet.infinitepierce = [stat]pierce
|
||||
bullet.healpercent = [stat]{0}[lightgray]% healing
|
||||
bullet.freezing = [stat]freezing
|
||||
bullet.tarred = [stat]tarred
|
||||
bullet.multiplier = [stat]{0}[lightgray]x ammo multiplier
|
||||
|
@ -337,6 +337,8 @@ public class UnitTypes implements ContentList{
|
||||
lightningLength = 7;
|
||||
lightningLengthRand = 7;
|
||||
shootEffect = Fx.shootHeal;
|
||||
//Does not actually do anything; Just here to make stats work
|
||||
healPercent = 2f;
|
||||
|
||||
lightningType = new BulletType(0.0001f, 0f){{
|
||||
lifetime = Fx.lightning.lifetime;
|
||||
|
@ -231,6 +231,8 @@ public class UnitType extends UnlockableContent{
|
||||
if(inst instanceof Payloadc){
|
||||
stats.add(Stat.payloadCapacity, (payloadCapacity / (tilesize * tilesize)), StatUnit.blocksSquared);
|
||||
}
|
||||
|
||||
stats.add(Stat.weapons, new WeaponListValue(this, weapons));
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
|
@ -55,6 +55,9 @@ public enum Stat{
|
||||
linkRange(StatCat.crafting),
|
||||
instructions(StatCat.crafting),
|
||||
|
||||
weapons(StatCat.function),
|
||||
bullet(StatCat.function),
|
||||
|
||||
speedIncrease(StatCat.function),
|
||||
repairTime(StatCat.function),
|
||||
range(StatCat.function),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
@ -10,6 +11,7 @@ import mindustry.content.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
@ -28,9 +30,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
table.row();
|
||||
for(T t : map.keys()){
|
||||
BulletType type = map.get(t);
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
table.table(Tex.underline, bt -> {
|
||||
//no point in displaying unit icon twice
|
||||
if(!(t instanceof UnitType)){
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
}
|
||||
Cons<Table> tableCons = bt -> {
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
||||
@ -41,7 +46,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(!Mathf.equal(type.ammoMultiplier, 1f) && !(type instanceof LiquidBulletType)){
|
||||
if(!(t instanceof UnitType) && !Mathf.equal(type.ammoMultiplier, 1f) && !(type instanceof LiquidBulletType)){
|
||||
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
|
||||
}
|
||||
|
||||
@ -53,10 +58,15 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, Core.bundle.format("bullet.knockback", Strings.fixed(type.knockback, 1)));
|
||||
}
|
||||
|
||||
if(type.pierce || type.pierceCap != -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)){
|
||||
sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent));
|
||||
}
|
||||
|
||||
if((type.status == StatusEffects.burning || type.status == StatusEffects.melting) || type.incendAmount > 0){
|
||||
sep(bt, "@bullet.incendiary");
|
||||
}
|
||||
@ -69,6 +79,10 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
sep(bt, "@bullet.tarred");
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.sapped){
|
||||
sep(bt, "@bullet.sapping");
|
||||
}
|
||||
|
||||
if(type.homingPower > 0.01f){
|
||||
sep(bt, "@bullet.homing");
|
||||
}
|
||||
@ -80,7 +94,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
if(type.fragBullet != null){
|
||||
sep(bt, "@bullet.frag");
|
||||
}
|
||||
}).left().padTop(-9);
|
||||
};
|
||||
if(t instanceof UnitType){
|
||||
table.table(tableCons);
|
||||
}else{
|
||||
table.table(Tex.underline, tableCons).left().padTop(-9);
|
||||
}
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
57
core/src/mindustry/world/meta/values/WeaponListValue.java
Normal file
57
core/src/mindustry/world/meta/values/WeaponListValue.java
Normal file
@ -0,0 +1,57 @@
|
||||
package mindustry.world.meta.values;
|
||||
|
||||
import arc.*;
|
||||
import arc.util.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
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;
|
||||
|
||||
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){
|
||||
//fliped 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 -> {
|
||||
w.left().defaults().padRight(3).left();
|
||||
|
||||
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));
|
||||
bullet.display(w);
|
||||
}).left().padTop(-9);
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
void sep(Table table, String text){
|
||||
table.row();
|
||||
table.add(text);
|
||||
}
|
||||
}
|
@ -504,7 +504,6 @@ public class Generators{
|
||||
scaled.save(type.name + "-icon-logic");
|
||||
}
|
||||
}
|
||||
|
||||
}catch(IllegalArgumentException e){
|
||||
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user