update sprite generation + update bullet stats

This commit is contained in:
Leonwang4234
2020-11-08 14:35:06 -08:00
parent d133709423
commit 82348d4fff
5 changed files with 27 additions and 13 deletions

View File

@ -695,12 +695,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

View File

@ -336,6 +336,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;

View File

@ -53,10 +53,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 +74,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");
}

View File

@ -34,15 +34,11 @@ public class WeaponListValue implements StatValue{
Weapon weapon = weapons.get(i);
if(weapon.flipSprite){
//fliped weapons are not given stats
continue;
}
if(weapon.outlineRegion.found()){
table.image(Core.atlas.find(unit.name + "-weapon" + i)).size(15 * 8).right().top();
}else{
table.image(unit.icon(Cicon.full)).size(15 * 8).right().top();
}
table.image(Core.atlas.find(unit.name + "-weapon" + i)).size(15 * 8).right().top();
table.table(Tex.underline, w -> {
w.left().defaults().padRight(3).left();

View File

@ -506,30 +506,35 @@ public class Generators{
}
//generate weapon stat UI
//TODO: optimize
Image base = new Image(image.width, image.height);
//largest side calculated here to prevent sprite squishing
int largestSide = Math.max(image.width, image.height);
Image base = new Image(largestSide, largestSide);
image.each((x, y) -> {
int newX = x - image.width/2 + base.width/2;
int newY = y - image.height/2 + base.height/2;
Color c = image.getColor(x, y);
base.draw(x, y, c.set(c.r, c.g, c.b, c.a * 0.2f));
base.draw(newX, newY, c.set(c.r, c.g, c.b, c.a * 0.2f));
});
for(int i = 0;i < type.weapons.size;i ++){
Weapon weapon = type.weapons.get(i);
if(weapon.flipSprite){
//fliped weapons are not given stats
continue;
}
weapon.load();
Image finalBase = base.copy();
Image baseWithWeapon = base.copy();
finalBase.draw(outline.get(ImagePacker.get(weapon.region)),
baseWithWeapon.draw(outline.get(ImagePacker.get(weapon.region)),
(int)(weapon.x / Draw.scl + base.width / 2f - weapon.region.width / 2f),
(int)(-weapon.y / Draw.scl + base.height / 2f - weapon.region.height / 2f),
weapon.flipSprite, false);
finalBase.save(type.name + "-weapon" + i);
baseWithWeapon.save(type.name + "-weapon" + i);
}
}catch(IllegalArgumentException e){
Log.err("WARNING: Skipping unit @: @", type.name, e.getMessage());