This commit is contained in:
MEEP of Faith 2020-10-21 23:14:54 -07:00
parent e7b6013d8d
commit da3c11a201

View File

@ -9,11 +9,19 @@ import mindustry.entities.*;
import mindustry.gen.*;
public class MovementLightningAbility extends Ability{
public float damage = 35f, reload = 0.15f;
//Lightning damage
public float damage = 35f;
//Ticks between firing
public float reload = 15f;
//Length of lightning
public int length = 12;
//Speeds for when to start lightninging and when to stop getting faster
public float minSpeed = 0.8f, maxSpeed = 1.2f;
//Shoot effect
public Effect shootEffect = Fx.sparkShoot;
//Shoot sound
public Sound shootSound = Sounds.spark;
//Lightning Color
public Color color = Color.valueOf("a9d8ff");
MovementLightningAbility(){}
@ -30,7 +38,7 @@ public class MovementLightningAbility extends Ability{
@Override
public void update(Unit unit){
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
if(Mathf.chance(Time.delta * (reload * scl))){
if(Mathf.chance(Time.delta * (reload/10 * scl))){
shootEffect.at(unit.x, unit.y, unit.rotation, color);
Lightning.create(unit.team, color, damage, unit.x + unit.vel().x, unit.y + unit.vel().y, unit.rotation, length);
shootSound.at(unit.x, unit.y);