mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Status effect display for bullets
This commit is contained in:
parent
c15a8b52d2
commit
4b9fa9a79e
@ -631,7 +631,7 @@ status.tarred.name = Tarred
|
||||
status.overclock.name = Overclock
|
||||
status.shocked.name = Shocked
|
||||
status.blasted.name = Blasted
|
||||
status.unmoving = Unmoving
|
||||
status.unmoving.name = Unmoving
|
||||
|
||||
settings.language = Language
|
||||
settings.data = Game Data
|
||||
@ -771,17 +771,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.lightning = [stat]{0}[lightgray]x lightning ~[stat]{1}[lightgray] damage
|
||||
bullet.buildingdamage = [stat]{0}%[lightgray] building damage
|
||||
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
|
||||
bullet.reload = [stat]{0}[lightgray]x fire rate
|
||||
|
||||
|
@ -161,6 +161,11 @@ public abstract class BulletType extends Content{
|
||||
return Math.max(speed * lifetime * (1f - drag), maxRange);
|
||||
}
|
||||
|
||||
/** @return continuous damage in damage/sec, or -1 if not continuous. */
|
||||
public float continuousDamage(){
|
||||
return -1f;
|
||||
}
|
||||
|
||||
public boolean testCollision(Bullet bullet, Building tile){
|
||||
return healPercent <= 0.001f || tile.team != bullet.team || tile.healthf() < 1f;
|
||||
}
|
||||
|
@ -46,6 +46,11 @@ public class ContinuousLaserBulletType extends BulletType{
|
||||
this(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float continuousDamage(){
|
||||
return damage / 5f * 60f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float estimateDPS(){
|
||||
//assume firing duration is about 100 by default, may not be accurate there's no way of knowing in this method
|
||||
|
@ -19,6 +19,8 @@ public class LightningBulletType extends BulletType{
|
||||
hitEffect = Fx.hitLancer;
|
||||
keepVelocity = false;
|
||||
hittable = false;
|
||||
//for stats
|
||||
status = StatusEffects.shocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,9 +35,6 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
stats.remove(Stat.booster);
|
||||
stats.add(Stat.input, new BoosterListValue(reloadTime, consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount, coolantMultiplier, false, l -> consumes.liquidfilters.get(l.id)));
|
||||
stats.remove(Stat.damage);
|
||||
//damages every 5 ticks, at least in meltdown's case
|
||||
stats.add(Stat.damage, shootType.damage * 60f / 5f, StatUnit.perSecond);
|
||||
}
|
||||
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import arc.struct.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.world.meta.*;
|
||||
import mindustry.world.meta.values.*;
|
||||
|
||||
public class PowerTurret extends Turret{
|
||||
public BulletType shootType;
|
||||
@ -16,7 +18,7 @@ public class PowerTurret extends Turret{
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
stats.add(Stat.damage, shootType.damage, StatUnit.none);
|
||||
stats.add(Stat.ammo, new AmmoListValue<>(OrderedMap.of(this, shootType)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@ import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@ -34,7 +35,7 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
BulletType type = map.get(t);
|
||||
|
||||
//no point in displaying unit icon twice
|
||||
if(!unit){
|
||||
if(!unit & !(t instanceof PowerTurret)){
|
||||
table.image(icon(t)).size(3 * 8).padRight(4).right().top();
|
||||
table.add(t.localizedName).padRight(10).left().top();
|
||||
}
|
||||
@ -43,7 +44,11 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
bt.left().defaults().padRight(3).left();
|
||||
|
||||
if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){
|
||||
bt.add(Core.bundle.format("bullet.damage", type.damage));
|
||||
if(type.continuousDamage() > 0){
|
||||
bt.add(Core.bundle.format("bullet.damage", type.damage) + " " + StatUnit.perSecond.localized());
|
||||
}else{
|
||||
bt.add(Core.bundle.format("bullet.damage", type.damage));
|
||||
}
|
||||
}
|
||||
|
||||
if(type.buildingDamageMultiplier != 1){
|
||||
@ -74,20 +79,12 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
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.incendAmount > 0){
|
||||
sep(bt, "@bullet.incendiary");
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.freezing){
|
||||
sep(bt, "@bullet.freezing");
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.tarred){
|
||||
sep(bt, "@bullet.tarred");
|
||||
}
|
||||
|
||||
if(type.status == StatusEffects.sapped){
|
||||
sep(bt, "@bullet.sapping");
|
||||
if(type.status != StatusEffects.none){
|
||||
sep(bt, (type.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName);
|
||||
}
|
||||
|
||||
if(type.homingPower > 0.01f){
|
||||
@ -95,7 +92,7 @@ public class AmmoListValue<T extends UnlockableContent> implements StatValue{
|
||||
}
|
||||
|
||||
if(type.lightning > 0){
|
||||
sep(bt, "@bullet.shock");
|
||||
sep(bt, Core.bundle.format("bullet.lightning", type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage));
|
||||
}
|
||||
|
||||
if(type.fragBullet != null){
|
||||
|
Loading…
Reference in New Issue
Block a user