mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-08 01:43:59 +07:00
Fixed #9804
This commit is contained in:
parent
0e618a2f71
commit
179adabd56
@ -2434,12 +2434,9 @@ public class Fx{
|
||||
shieldBreak = new Effect(40, e -> {
|
||||
color(e.color);
|
||||
stroke(3f * e.fout());
|
||||
if(e.data instanceof Unit u){
|
||||
var ab = (ForceFieldAbility)Structs.find(u.abilities, a -> a instanceof ForceFieldAbility);
|
||||
if(ab != null){
|
||||
Lines.poly(e.x, e.y, ab.sides, e.rotation + e.fin(), ab.rotation);
|
||||
return;
|
||||
}
|
||||
if(e.data instanceof ForceFieldAbility ab){
|
||||
Lines.poly(e.x, e.y, ab.sides, e.rotation + e.fin(), ab.rotation);
|
||||
return;
|
||||
}
|
||||
|
||||
Lines.poly(e.x, e.y, 6, e.rotation + e.fin());
|
||||
|
@ -32,6 +32,7 @@ public class ForceFieldAbility extends Ability{
|
||||
|
||||
/** State. */
|
||||
protected float radiusScale, alpha;
|
||||
protected boolean wasBroken;
|
||||
|
||||
private static float realRad;
|
||||
private static Unit paramUnit;
|
||||
@ -41,13 +42,6 @@ public class ForceFieldAbility extends Ability{
|
||||
trait.absorb();
|
||||
Fx.absorb.at(trait);
|
||||
|
||||
//break shield
|
||||
if(paramUnit.shield <= trait.damage()){
|
||||
paramUnit.shield -= paramField.cooldown * paramField.regen;
|
||||
|
||||
Fx.shieldBreak.at(paramUnit.x, paramUnit.y, paramField.radius, paramUnit.team.color, paramUnit);
|
||||
}
|
||||
|
||||
paramUnit.shield -= trait.damage();
|
||||
paramField.alpha = 1f;
|
||||
}
|
||||
@ -85,6 +79,14 @@ public class ForceFieldAbility extends Ability{
|
||||
|
||||
@Override
|
||||
public void update(Unit unit){
|
||||
if(unit.shield <= 0f && !wasBroken){
|
||||
unit.shield -= cooldown * regen;
|
||||
|
||||
Fx.shieldBreak.at(unit.x, unit.y, radius, unit.team.color, this);
|
||||
}
|
||||
|
||||
wasBroken = unit.shield <= 0f;
|
||||
|
||||
if(unit.shield < max){
|
||||
unit.shield += Time.delta * regen;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user