mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-22 13:48:25 +07:00
Update Wall.java
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package mindustry.world.blocks.defense;
|
package mindustry.world.blocks.defense;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.audio.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
@ -20,11 +21,13 @@ public class Wall extends Block{
|
|||||||
public float lightningDamage = 20f;
|
public float lightningDamage = 20f;
|
||||||
public int lightningLength = 17;
|
public int lightningLength = 17;
|
||||||
public Color lightningColor = Pal.surge;
|
public Color lightningColor = Pal.surge;
|
||||||
|
public Sound lightningSound = Sounds.spark;
|
||||||
|
|
||||||
public float chanceDeflect = 10f;
|
public float chanceDeflect = 10f;
|
||||||
public boolean flashHit;
|
public boolean flashHit;
|
||||||
public Color flashColor = Color.white;
|
public Color flashColor = Color.white;
|
||||||
public boolean deflect;
|
public boolean deflect;
|
||||||
|
public Sound deflectSound = Sounds.none;
|
||||||
|
|
||||||
public Wall(String name){
|
public Wall(String name){
|
||||||
super(name);
|
super(name);
|
||||||
@ -94,6 +97,7 @@ public class Wall extends Block{
|
|||||||
if(lightningChance > 0){
|
if(lightningChance > 0){
|
||||||
if(Mathf.chance(lightningChance)){
|
if(Mathf.chance(lightningChance)){
|
||||||
Lightning.create(team, lightningColor, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
|
Lightning.create(team, lightningColor, lightningDamage, x, y, bullet.rotation() + 180f, lightningLength);
|
||||||
|
lightningSound.at(tile, Mathf.random(0.9f, 1.1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +109,9 @@ public class Wall extends Block{
|
|||||||
//bullet reflection chance depends on bullet damage
|
//bullet reflection chance depends on bullet damage
|
||||||
if(!Mathf.chance(chanceDeflect / bullet.damage())) return true;
|
if(!Mathf.chance(chanceDeflect / bullet.damage())) return true;
|
||||||
|
|
||||||
|
//make sound
|
||||||
|
deflectSound.at(tile, Mathf.random(0.9f, 1.1f));
|
||||||
|
|
||||||
//translate bullet back to where it was upon collision
|
//translate bullet back to where it was upon collision
|
||||||
bullet.trns(-bullet.vel.x, -bullet.vel.y);
|
bullet.trns(-bullet.vel.x, -bullet.vel.y);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user