Fixed shield ability effect spam
This commit is contained in:
@@ -23,7 +23,6 @@ public class ForceFieldAbility implements Ability{
|
|||||||
|
|
||||||
private float realRad;
|
private float realRad;
|
||||||
private Unit paramUnit;
|
private Unit paramUnit;
|
||||||
private boolean hadShield;
|
|
||||||
private final Cons<Shielderc> shieldConsumer = trait -> {
|
private final Cons<Shielderc> shieldConsumer = trait -> {
|
||||||
if(trait.team() != paramUnit.team && Intersector.isInsideHexagon(paramUnit.x, paramUnit.y, realRad * 2f, trait.x(), trait.y()) && paramUnit.shield > 0){
|
if(trait.team() != paramUnit.team && Intersector.isInsideHexagon(paramUnit.x, paramUnit.y, realRad * 2f, trait.x(), trait.y()) && paramUnit.shield > 0){
|
||||||
trait.absorb();
|
trait.absorb();
|
||||||
@@ -32,6 +31,8 @@ public class ForceFieldAbility implements Ability{
|
|||||||
//break shield
|
//break shield
|
||||||
if(paramUnit.shield <= trait.damage()){
|
if(paramUnit.shield <= trait.damage()){
|
||||||
paramUnit.shield -= cooldown * regen;
|
paramUnit.shield -= cooldown * regen;
|
||||||
|
|
||||||
|
Fx.shieldBreak.at(paramUnit.x, paramUnit.y, radius, paramUnit.team.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
paramUnit.shield -= trait.damage();
|
paramUnit.shield -= trait.damage();
|
||||||
@@ -54,13 +55,6 @@ public class ForceFieldAbility implements Ability{
|
|||||||
unit.shield += Time.delta * regen;
|
unit.shield += Time.delta * regen;
|
||||||
}
|
}
|
||||||
|
|
||||||
//break effect
|
|
||||||
if(hadShield && unit.shield <= 0){
|
|
||||||
Fx.shieldBreak.at(paramUnit.x, paramUnit.y, radius, paramUnit.team.color);
|
|
||||||
}
|
|
||||||
|
|
||||||
hadShield = unit.shield > 0;
|
|
||||||
|
|
||||||
if(unit.shield > 0){
|
if(unit.shield > 0){
|
||||||
unit.timer2 = Mathf.lerpDelta(unit.timer2, 1f, 0.06f);
|
unit.timer2 = Mathf.lerpDelta(unit.timer2, 1f, 0.06f);
|
||||||
paramUnit = unit;
|
paramUnit = unit;
|
||||||
|
|||||||
Reference in New Issue
Block a user