diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index d95145dfb6..3e88aef2e1 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -628,6 +628,9 @@ stat.ammo = Ammo stat.shieldhealth = Shield Health stat.cooldowntime = Cooldown Time stat.explosiveness = Explosiveness +stat.basedeflectchance = Base Deflect Chance +stat.lightningchance = Lightning Chance +stat.lightningdamage = Lightning Damage stat.flammability = Flammability stat.radioactivity = Radioactivity stat.heatcapacity = HeatCapacity diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 414fe99d36..8c2d6e2c8f 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -794,14 +794,16 @@ public class Blocks implements ContentList{ phaseWall = new Wall("phase-wall"){{ requirements(Category.defense, with(Items.phasefabric, 6)); health = 150 * wallHealthMultiplier; - flashHit = deflect = true; + chanceDeflect = 10f; + flashHit = true; }}; phaseWallLarge = new Wall("phase-wall-large"){{ requirements(Category.defense, ItemStack.mult(phaseWall.requirements, 4)); health = 150 * 4 * wallHealthMultiplier; size = 2; - flashHit = deflect = true; + chanceDeflect = 10f; + flashHit = true; }}; surgeWall = new Wall("surge-wall"){{ diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index abb941b899..a23a2583cd 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -17,16 +17,17 @@ import static mindustry.Vars.*; public class Wall extends Block{ public int variants = 0; - public float lightningChance = -0.001f; + /** Lighting chance. -1 to disable */ + public float lightningChance = -1f; public float lightningDamage = 20f; public int lightningLength = 17; public Color lightningColor = Pal.surge; public Sound lightningSound = Sounds.spark; - public float chanceDeflect = 10f; + /** Bullet deflection chance. -1 to disable */ + public float chanceDeflect = -1f; public boolean flashHit; public Color flashColor = Color.white; - public boolean deflect; public Sound deflectSound = Sounds.none; public Wall(String name){ @@ -38,6 +39,17 @@ public class Wall extends Block{ canOverdrive = false; } + @Override + public void setStats(){ + super.setStats(); + + if(chanceDeflect > 0f) stats.add(Stat.baseDeflectChance, chanceDeflect, StatUnit.none); + if(lightningChance > 0f){ + stats.add(Stat.lightningChance, lightningChance * 100f, StatUnit.percent); + stats.add(Stat.lightningDamage, lightningDamage, StatUnit.none); + } + } + @Override public void load(){ super.load(); @@ -96,7 +108,7 @@ public class Wall extends Block{ hit = 1f; //create lightning if necessary - if(lightningChance > 0){ + if(lightningChance > 0f){ if(Mathf.chance(lightningChance)){ Lightning.create(team, lightningColor, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength); lightningSound.at(tile, Mathf.random(0.9f, 1.1f)); @@ -104,7 +116,7 @@ public class Wall extends Block{ } //deflect bullets if necessary - if(deflect){ + if(chanceDeflect > 0f){ //slow bullets are not deflected if(bullet.vel().len() <= 0.1f || !bullet.type.reflectable) return true; diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index bb872f98c4..94e4c17b2c 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java @@ -22,6 +22,9 @@ public enum Stat{ buildSpeed, mineSpeed, mineTier, + baseDeflectChance, + lightningChance, + lightningDamage, itemCapacity(StatCat.items), itemsMoved(StatCat.items),