;---------------------------------------------------------------------------
; Normal FX Helper
[StateDef 10200]
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = Root, Anim + 10000
sprpriority = 5

[State 10200, AfterImage]
type = AfterImage
trigger1 = Time <= 0
palcontrast = 50,0,40
palbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1
trans = Add
framegap = 1
length = 5
time = 2

[State 12001, AfterImageTime]
type = AfterImageTime
trigger1 = 1
time = 2

[State 10200, PlaySnd]
type = PlaySnd
trigger1 = !Time
value = S220,1
volumescale = 100
channel = 1

[State 10200, ChangeAnim]
type = ChangeAnim
triggerall = Root, MoveContact
trigger1 = Root,HitPauseTime > 0
value = Anim
elem = AnimElemNo(0)

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 10220
trigger1 = Root, MoveContact
trigger1 = AnimElemTime(14) = 0
value = Anim
elem = 13
persistent = 0

[State 10200, BindToRoot]
type = BindToRoot
trigger1 = 1
pos = 0,0

[State 10200, DestroySelf]
type = DestroySelf
trigger1 = Anim > 10191 && Anim != 13000 && AnimTime = 0
trigger2 = Root, StateNo + 10000 != Anim
trigger3 = Anim = 10191 && Root, AnimElem = 22
;---------------------------------------------------------------------------
; Special FX Helper
[StateDef 21000]
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
sprpriority = 5
anim = (Root, Anim) + 20000

[State 10200, AfterImage]
type = AfterImage
trigger1 = Time <= 0
palcontrast = 50,0,40
palbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1
trans = Add
framegap = 1
length = 5
time = 2

[State 12001, AfterImageTime]
type = AfterImageTime
trigger1 = 1
time = 2

[State 10200, ChangeAnim]
type = ChangeAnim
triggerall = Root, MoveContact
triggerall = Anim != [21020,21049]
trigger1 = (Root, HitPauseTime) > 0
value = Anim
elem = AnimElemNo(0)
persistent = 1

[State 10200, PlaySnd]
type = PlaySnd
triggerall = Anim = [21005,21007]
trigger1 = !Time
value = S1005,1
volumescale = 100
channel = 1

[State 10200, PlaySnd]
type = PlaySnd
triggerall = Anim = [21020,21029]
trigger1 = !Time
value = S1005,1
volumescale = 100
channel = 1

[State 10200, PlaySnd]
type = PlaySnd
triggerall = Anim = [21040,21049]
trigger1 = !Time
value = S3000,1
volumescale = 100
channel = 1

[State 10200, PlaySnd]
type = PlaySnd
triggerall = Anim = 23005
trigger1 = AnimElem = 2
trigger2 = AnimElem = 8
trigger3 = AnimElem = 14
trigger4 = AnimElem = 20
value = S1005,1
volumescale = 100
channel = 1

[State 10200, BindToRoot]
type = BindToRoot
trigger1 = 1
pos = 0, Cond(Anim < 21005, -60, 0)

[State 10200, DestroySelf]
type = DestroySelf
trigger1 = Anim != [21020,21049]
trigger1 = AnimTime = 0
trigger2 = Root, Anim + 20000 < 21000
trigger3 = Root, Anim = [3000,3999]
trigger3 = Anim < 23000
trigger4 = (Root, StateNo = 3003) && Root, Anim = 1030
trigger5 = Root, Anim + 20000 != Anim
;---------------------------------------------------------------------------
;Dust Helper
[StateDef 10040]
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 9000

[State 10040, PosSet]
type = PosSet
trigger1 = 1
y = 0

[State 10040, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 10040, Jump Dust Base]
type = Explod
triggerall = Root, StateNo = 50 || Root, StateNo = 105 || (Root, StateNo = [200,1052]) || (Root, StateNo = [3000,3050])
triggerall = NumExplod(10040) = 0
triggerall = Root, Pos Y < 0
trigger1 = Time = 0
anim = 10040
ID = 10040
pos = 0,0
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 1]
type = Explod
triggerall = Root, StateNo = 50 
triggerall = Root, Vel X = 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = Time = 1
anim = 10041
ID = 10041
pos = 0,-20
vel = 0,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 2]
type = Explod
triggerall = Root, StateNo = 50 
triggerall = Root, Vel X = 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = Time = 1
anim = 10041
ID = 10041
pos = 0,-40
vel = 0,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 3]
type = Explod
triggerall = Root, StateNo = 50 || (Root, StateNo = [200,1052]) || (Root, StateNo = [3000,3050])
triggerall = Root, Vel X > 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = !Time
anim = 10041
ID = 10041
pos = 10,-40
vel = 1.5,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 4]
type = Explod
triggerall = Root, StateNo = 50 || (Root, StateNo = [200,1052]) || (Root, StateNo = [3000,3050])
triggerall = Root, Vel X > 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = !Time
anim = 10041
ID = 10041
pos = 5,-20
vel = 1.5,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 5]
type = Explod
triggerall = Root, StateNo = 50 || (Root, StateNo = [200,1052]) || (Root, StateNo = [3000,3050])
triggerall = Root, Vel X < 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = Time = 1
anim = 10041
ID = 10041
pos = -10,-40
vel = -1.5,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Jump Dust 6]
type = Explod
triggerall = Root, StateNo = 50 || (Root, StateNo = [200,1052]) || (Root, StateNo = [3000,3050])
triggerall = Root, Vel X < 0
triggerall = Root, Pos Y < 0
triggerall = NumExplod(10041) < 2
trigger1 = Time = 1
anim = 10041
ID = 10041
pos = -5,-20
vel = -1.5,-1.5
scale = 0.5,0.5
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Landing Dust 1]
type = Explod
triggerall = Root,StateNo = 52 || (Root, StateNo = 101 || Root, Stateno = 106) || Root, StateNo = 1003
triggerall = NumExplod(10052) = 0
triggerall = Root, Pos Y = 0
trigger1 = Time = 0
anim = 10052
ID = 10052
pos = 0,0
scale = 0.5, 0.5
postype = p1
removetime = -2
sprpriority = 1
ownpal = 1

[State 10040, Landing Dust 2]
type = Explod
triggerall = Root,StateNo = 52 || (Root, StateNo = 101 || Root, Stateno = 106) || Root, StateNo = 1003
triggerall = NumExplod(10053) = 0
triggerall = Root, Pos Y = 0
trigger1 = Time = 0
anim = 10053
ID = 10053
pos = 0,0
scale = 0.5, 0.5
postype = p1
removetime = -2
sprpriority = 0
ownpal = 1

[State 10040, Dash Dust 1]
type = Explod
triggerall = Root,StateNo = 100
triggerall = NumExplod(10100) = 0
trigger1 = Time = 0
anim = 10100
ID = 10100
pos = -20,0
scale = 0.7,0.7
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, Dash Dust 2]
type = Explod
triggerall = Root,StateNo = 101
triggerall = NumExplod(10101) = 0
trigger1 = Time = 0
anim = 10100
ID = 10100
pos = 0,0
scale = 0.7,0.7
postype = p1
removetime = -2
sprpriority = 3
ownpal = 1

[State 10040, DestroySelf]
type = DestroySelf
trigger1 = Time = 1

;---------------------------------------------------------------------------
; Psi-Blast Projectile
[StateDef 11000]
type = A
movetype = A
physics = N
;juggle = IfElse(IsHelper(11003),7,5)
ctrl = 0
anim = cond(IsHelper(11000), 11000, cond(IsHelper(11001), 11001, 11002))
sprpriority = 4

[State 10200, AfterImage]
type = AfterImage
trigger1 = Time <= 0
palcontrast = 50,0,40
palbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1
trans = Add
framegap = 1
length = 5
time = 2

[State 12001, AfterImageTime]
type = AfterImageTime
trigger1 = 1
time = 2

[State 11000, PlaySnd]
type = PlaySnd
trigger1 = !Time
value = S1000,1
volumescale = 100
channel = 1
freqmul = 1.0
loop = 0
pan = 0

[State 11000, ParentVarSet];Checks if opponent is in attack state
type = ParentVarSet
triggerall = numenemy
trigger1 = enemy, movetype = a
var(21) = 1
ignorehitpause = 1

[State 11000, ParentVarSet]
type = ParentVarSet
trigger1 = !Time
var(25) = 1

[State 11000, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AP,AT       ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
stateno = 11003
time = -1
ignorehitpause = 1

[State 11000, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AP
time = -1
ignorehitpause = 1

[State 11000, Projectile]
type = Projectile
trigger1 = !0
ProjID = 11000
projanim = 11000
projhitanim = -1
projremanim = -1
projscale = 0,0
projpriority = 0
projremovetime = 1;abs(floor(frontedgedist/root,var(15)))
postype = p1         ;p2,front,back,left,right
velocity = Vel X, Vel Y
offset = 0,0

[State 11000, PowerAdd]
type = PowerAdd
trigger1 = !Time
trigger1 = IsHelper(11000)
value = 20

[State 11000, PowerAdd]
type = PowerAdd
trigger1 = !Time
trigger1 = IsHelper(11003)
value = 30

[State 11000, PowerAdd]
type = PowerAdd
trigger1 = !Time
trigger1 = IsHelper(11002)
value = 40

[State 11000, VelSet]
type = VelSet
trigger1 = !Time
x = 5
y = IfElse(IsHelper(11000), 5, IfElse(IsHelper(11001), 0, -5))

[State 11000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 11000, 1]
type = HitDef
triggerall = IsHelper(11000)
trigger1 = 1
attr = A, SP
damage = floor(80*Root,fvar(20)),15
animtype = Heavy
guardflag = MA
hitflag = MAFDP
priority = 4, Hit
pausetime = 0,0
sparkno = S10001
guard.sparkno = S10130
sparkxy = -15,0
hitsound = S5,12
guardsound = S6,1
ground.type = Low
ground.slidetime = 14
ground.hittime  = 25
ground.velocity = -9
airguard.velocity = -4,-5
air.type = Low
air.velocity = -7,-3
air.hittime = 25
ground.cornerpush.veloff = 0
envshake.time = 10
envshake.freq = 90
envshake.ampl = 4
envshake.freq = 180
air.fall = 1
fall = IfElse(Root, StateType != A, 0, 1)
fall.recover = 0
yaccel = 0.5
id = 11000
nochainid = 11000

[State 11000, ParentVarSet]
type = ParentVarSet
trigger1 = IsHelper(11000) && NumTarget(11000)
var(15) = 5
ignorehitpause = 1

[State 11000, 2]
type = HitDef
triggerall = !IsHelper(11000)
triggerall = Root,Var(15) < 2
trigger1 = 1
attr = A, SP
damage = floor(80*Root,fvar(20)),15
animtype = Heavy
guardflag = MA
hitflag = MAFP
priority = 4, Hit
pausetime = 0,0
sparkno = S10001
guard.sparkno = S10130
sparkxy = -15,0
hitsound = S5,12
guardsound = S6,1
ground.type = Low
ground.slidetime = 14
ground.hittime  = 25
ground.velocity = -9
airguard.velocity = -4,-5
air.type = Low
air.velocity = -7,-3
air.hittime = 25
ground.cornerpush.veloff = 0
envshake.time = 10
envshake.freq = 90
envshake.ampl = 4
envshake.freq = 180
air.fall = 1
fall = IfElse(Root, StateType != A, 0, 1)
fall.recover = 0
yaccel = 0.5

[State 11000, ParentVarSet]
type = ParentVarSet
triggerall = Root, var(15) < 3
triggerall = NumTarget
triggerall = Target, HitFall = 1
trigger1 = MoveHit = 1
var(15) = Cond(Root, var(15) < 2, 2, 3)
persistent = 0

[State 11000, ChangeState]
type = ChangeState
trigger1 = MoveContact
trigger2 = root,ProjCancelTime(0) != -1 && root,ProjCancelTime(0) < 15
trigger3 = Time = 90
trigger4 = Vel Y + Pos Y >= 0 && Vel Y > 0
value = 11003
ctrl = 0
ignorehitpause = 1

;---------------------------------------------------------------------------
;Psi-Blast Hit
[StateDef 11003]
type = A
movetype = I
physics = N
;juggle = 0
velset = 0,0
ctrl = 0
anim = cond(IsHelper(11000), 11003, cond(IsHelper(11001), 11004, 11005))
poweradd = 0
sprpriority = 4
movehitpersist = 1

[State 10200, AfterImage]
type = AfterImage
trigger1 = Time <= 0
palcontrast = 50,0,40
palbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1
trans = Add
framegap = 1
length = 5
time = 2

[State 12001, AfterImageTime]
type = AfterImageTime
trigger1 = 1
time = 2

[State 11003, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
ignorehitpause = 1

[State 11003, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow

[State 11003, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0

;---------------------------------------------------------------------------
; Kochou Gakure Helper
[StateDef 13010]
type = A
movetype = A
physics = N
;juggle = IfElse(IsHelper(11003),7,5)
ctrl = 0
anim = 13010
sprpriority = 4

[State 13010, 1]
type = HitDef
trigger1 = AnimElemTime(2) < 0
trigger1 = Time % 2 = 0
attr = A, HA
damage = floor(25*Root,fvar(20)),15
animtype = Heavy
guardflag = MA
hitflag = MAFP
priority = 4, Hit
pausetime = 2,5
sparkno = S10001
guard.sparkno = S10130
sparkxy = -15, cond(NumTarget(StateNo) = 0, -55, floor(Target, Pos Y - 30))
hitsound = S5,12
guardsound = S6,1
ground.type = Low
ground.slidetime = 14
ground.hittime  = 25
ground.velocity = 0, -5.5
airguard.velocity = -4,-5
air.type = Low
air.velocity = 0, -6.5
air.hittime = 25
ground.cornerpush.veloff = 0
envshake.time = 10
envshake.freq = 90
envshake.ampl = 4
envshake.freq = 180
fall = 1
fall.recover = 0
yaccel = 0.4
id = 13010

[State 13010, 2]
type = HitDef
trigger1 = AnimElemTime(3)>= 0
trigger1 = AnimElemTime(4) < 0
trigger1 = Time % 5 = 0
attr = A, HA
damage = floor(25*Root,fvar(20)),5
animtype = Heavy
guardflag = MA
hitflag = MAFP
priority = 4, Hit
pausetime = 2,5
sparkno = S10001
guard.sparkno = S10130
sparkxy = -15, cond(NumTarget(StateNo) = 0, -55, floor(Target, Pos Y - 30))
hitsound = S5,12
guardsound = S6,1
ground.type = Low
ground.slidetime = 14
ground.hittime  = 25
ground.velocity = 0, cond(Time < 55, -5.5, -8.5)
airguard.velocity = -4,-5
air.type = Low
air.velocity = 0, cond(Time < 55, -6.5, -8.5)
air.hittime = 25
ground.cornerpush.veloff = 0
envshake.time = 10
envshake.freq = 90
envshake.ampl = 4
envshake.freq = 180
fall = 1
fall.recover = 0
yaccel = 0.4
id = 13010

[State 13010, DestroySelf]
type = DestroySelf
trigger1 = AnimTime = 0
trigger2 = Root, MoveType = H

;---------------------------------------------------------------------------
; Super FX
[StateDef 30000]
type = S
movetype = I
physics = S
velset = 0,0
ctrl = 0
anim = IfElse(IsHelper(30000), 30000, IfElse(IsHelper(30001), 30001, 30002))
poweradd = IfElse(IsHelper(30000), -1000, IfElse(IsHelper(30001), -2000, -3000))
sprpriority = -1

[State 30000, VarSet]
type = VarSet
trigger1 = !Time
var(0) = IfElse(!IsHelper(30002), 0, 256)

[State 30000, ParentVarSet]
type = ParentVarSet
trigger1 = 1
var(17) = 0

[State 30000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 30000, PlaySnd]
type = PlaySnd
trigger1 = !Time
value = S30000,0
volumescale = 100

[State 30000, VarAdd]
type = VarAdd
triggerall = !IsHelper(30002)
trigger1 = Time < 8
var(0) = 32

[State 30000, VarAdd]
type = VarAdd
triggerall = !IsHelper(30002)
triggerall = Time > 32
trigger1 = Var(0) > 0
var(0) = -16

[State 30000, VarAdd]
type = VarAdd
triggerall = IsHelper(30002)
trigger1 = Time < 8
var(0) = -32

[State 30000, VarAdd]
type = VarAdd
triggerall = IsHelper(30002)
triggerall = Time > 32
trigger1 = Var(0) < 256
var(0) = 16

[State 30000, BGPalFX]
type = BGPalFX
trigger1 = !IsHelper(30002)
time = 1
add = 0,0,0
mul = 256,256,256
sinadd = 0,0,0,10
color = 256-var(0)
invertall = 0
persistent = 1

[State 30000, BGPalFX]
type = BGPalFX
trigger1 = IsHelper(30002)
time = 1
add = 0,0,0
mul = var(0), var(0), var(0) 
sinadd = 0,0,0,10
color = 256
invertall = 0
persistent = 1

[State 30000, AssertSpecial]
type = AssertSpecial
trigger1 = IsHelper(30002)
flag = noFG

[State 30000, end]
type = DestroySelf
trigger1 = !IsHelper(30002) && Time > 32 && var(0) = 0 
trigger2 = IsHelper(30002) && Time > 32 && var(0) = 256
