Skip to content

Commit

Permalink
atNotShoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Otamamori917 authored Jul 1, 2023
1 parent 05874ad commit 0f0814e
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions core/src/mindustry/entities/abilities/StatusFieldAbility.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
package mindustry.entities.abilities;

import arc.*;
import arc.audio.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.entities.abilities.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;

import static mindustry.Vars.*;

public class StatusFieldAbility extends Ability{
public StatusEffect effect;
public float duration = 60, reload = 100, range = 20;
public boolean onShoot = false;
public boolean onShoot = false, atNotShoot = false;
public Effect applyEffect = Fx.none;
public Effect activeEffect = Fx.overdriveWave;
public float effectX, effectY;
Expand All @@ -37,14 +47,16 @@ public String localized(){
public void update(Unit unit){
timer += Time.delta;

if(timer >= reload && (!onShoot || unit.isShooting)){
Units.nearby(unit.team, unit.x, unit.y, range, other -> {
other.apply(effect, duration);
applyEffect.at(other, parentizeEffects);
});

float x = unit.x + Angles.trnsx(unit.rotation, effectY, effectX), y = unit.y + Angles.trnsy(unit.rotation, effectY, effectX);
activeEffect.at(x, y, effectSizeParam ? range : unit.rotation, parentizeEffects ? unit : null);
if(timer >= reload){
if(!atNotShoot && unit.isShooting || !onShoot && !unit.isShooting){
Units.nearby(unit.team, unit.x, unit.y, range, other -> {
other.apply(effect, duration);
applyEffect.at(other, parentizeEffects);
});
float x = unit.x + Angles.trnsx(unit.rotation, effectY, effectX), y = unit.y + Angles.trnsy(unit.rotation, effectY, effectX);
activeEffect.at(x, y, effectSizeParam ? range : unit.rotation, parentizeEffects ? unit : null);
}
timer %= reload;

timer = 0f;
}
Expand Down

0 comments on commit 0f0814e

Please sign in to comment.