From a14ae1bdf8d167621840586c1c52ced177d3c8b5 Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Wed, 28 Oct 2020 21:00:24 -0700 Subject: [PATCH] Lightning chance fix. --- .../entities/abilities/MovementLightningAbility.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/entities/abilities/MovementLightningAbility.java b/core/src/mindustry/entities/abilities/MovementLightningAbility.java index 24bc2a55aa..b482afb8dc 100644 --- a/core/src/mindustry/entities/abilities/MovementLightningAbility.java +++ b/core/src/mindustry/entities/abilities/MovementLightningAbility.java @@ -11,8 +11,8 @@ import mindustry.gen.*; public class MovementLightningAbility extends Ability{ //Lightning damage public float damage = 35f; - //Ticks between firing - public float reload = 15f; + //Chance of firing every tick. Set >= 1 to always fire lightning every tick at max speed. + public float chance = 0.15f; //Length of the lightning public int length = 12; //Speeds for when to start lightninging and when to stop getting faster @@ -25,10 +25,10 @@ public class MovementLightningAbility extends Ability{ MovementLightningAbility(){} - public MovementLightningAbility(float damage, int length, float reload, float minSpeed, float maxSpeed, Color color){ + public MovementLightningAbility(float damage, int length, float chance, float minSpeed, float maxSpeed, Color color){ this.damage = damage; this.length = length; - this.reload = reload; + this.chance = chance; this.minSpeed = minSpeed; this.maxSpeed = maxSpeed; this.color = color; @@ -37,10 +37,10 @@ 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/10 * scl))){ + if(Mathf.chance(Time.delta * (chance * 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); } } -} \ No newline at end of file +}