;==============================================================
; CNS File for Buu Z2 by Barker & XGargoyle
; Helper States
;==============================================================

;Hungry Helper (Kirby)
[Statedef 415]
type = A
movetype = I
physics = N
ctrl = 0
anim = 415
velset = 0,0
sprpriority = -10

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = 1
var(9)= 0
ignorehitpause = 1
persistent = 0

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NP,SP,HP
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, NotHitBy]
type = null ;NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NT,ST,HT
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NP,SP,HP
slot = 0
stateno = 416
time = 1
forceair = 0
;ignorehitpause =
;persistent =

[State 415, DestroySelf]
type = DestroySelf
trigger1 = time=3

;Hungry Helper Vanish
[Statedef 416]
type = A
movetype = I
physics = N
ctrl = 0
anim = 9999
velset = 0,0
sprpriority = -10

[State 0, Success!]
type = PlaySnd
trigger1 = !time
value = 410,5+random%2
volumescale = 100
channel = -1
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(9)= gethitvar(damage)
ignorehitpause = 1
persistent = 0


[State 415, DestroySelf]
type = DestroySelf
trigger1 = time=2

;a.SP Arm overlay
[Statedef 621]
type = A
movetype = I
physics = N
ctrl = 0
anim = 621
velset = 0,0
sprpriority = -10

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 621, DestroySelf]
type = DestroySelf
;trigger1 = !animtime
;trigger2 = root,pos Y>-5
trigger1 = root,anim=620 ;j.SP
trigger1 = root,animelemtime(5)>=0
trigger2 = root,anim=225  ;dash attack
trigger2 = root,animelemtime(4)>=0
trigger3 = root,anim=761 ;Zetto Counter
trigger3 = root,animelemtime(5)>=0
trigger4 = root,anim!=620
trigger4 = root,anim!=225
trigger4 = root,anim!=761
ignorehitpause = 1


;======================================================================
; POWER CHARGE AURA

[Statedef 905]
type = A
movetype = I
physics = N
ctrl = 0
anim = 905
velset = 0,0
sprpriority = -1

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

[State 905, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 905, BindToParent]
type = BindToParent
trigger1 = anim = 905
pos = 0,0

[State 905, Anim]
type = ChangeAnim
triggerall = anim = 905
trigger1 = root,stateno = 901
value = 906

[State 905, DestroySelf]
type = DestroySelf
trigger1 = (anim = 905) && (Root,StateNo != [900,901])
trigger2 = (anim = 906) && animtime = 0
trigger3 = Root,stateno = [5000,5090]

; PAIN TRAIN SHIELD
[Statedef 915]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1

[State 0, VarAdd] ;Superarmor hit count
type = VarAdd
trigger1 = !time
trigger1 = root,stateno=2501
var(1) = 1
ignorehitpause = 1
;persistent =


[State 0, Turn]
type = Turn
trigger1 = facing!=root,facing
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 0, ParentVarAdd] ;reduce EMO bar
type = null;ParentVarAdd
trigger1 = !time
var(33)= -floor(2.1*gethitvar(damage)) ;deals equivalent damage to EMO bar
ignorehitpause = 1
persistent = 0

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= gethitvar(damage)
ignorehitpause = 1
persistent = 0

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = time=1
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "damage=%d v53=%d Emo=%d"
params = gethitvar(damage),(parent,var(53)),(parent,var(33))
ignorehitpause = 1
;persistent =


[State 905, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible
ignorehitpause = 1

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
slot = 0
stateno = 915
time = 1
forceair = 0
ignorehitpause = 1
;persistent =

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
triggerall = SelfAnimExist(Anim) ;prevent debug error on custom anims
trigger1 = Anim != (root, anim)
trigger2 = AnimElemNo(0) > (root, AnimElemNo(0))
value = root, anim
elem = root,AnimElemNo(0)
ignorehitpause = 1

[State 905, DestroySelf]
type = DestroySelf
trigger1 = root,stateno!=[2500,2501]
trigger2 = root,stateno=910
trigger3 = NumHelper(2510) ;Pain Train Wall
trigger4 = root,movetype=H
trigger5 = root,stateno=2501
trigger5 = var(1)>1 ;Superarmor absorbed hits
ignorehitpause = 1

; EMO SHIELD
[Statedef 916]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1

;fix
[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = A
statetype = A       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = S
statetype = S       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = C
statetype = C       ;S,A,C,L
persistent = 1
;end fix

[State 0, Turn]
type = Turn
trigger1 = facing!=root,facing
ignorehitpause = 1
;persistent =

[State -2, EMO Steam 1]
type = helper
trigger1 = !NumHelper(921) ;!time;!time
ID = 921
stateno = 921
pos = 0, 0
postype = p1
helpertype = normal
name = "Steam 1"
pausemovetime = 999999
supermovetime = 999999
sprpriority = 7
ownpal = 1
keyctrl = 0
scale = 0.5,0.5
ignorehitpause = 1

[State -2, EMO Steam 2]
type = helper
trigger1 = !NumHelper(922) ;!time;!time
ID = 922
stateno = 921
pos = 0, 0
postype = p1
helpertype = normal
name = "Steam 2"
pausemovetime = 999999
supermovetime = 999999
sprpriority = 7
ownpal = 1
keyctrl = 0
scale = 0.5,0.5
ignorehitpause = 1

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 0, VarSet]
type = VarSet
trigger1 = !Var(1)
var(1)=1
ignorehitpause = 1
;persistent =

[State 0, ParentVarAdd] ;reduce EMO bar
type = null;ParentVarAdd
trigger1 = !time
trigger1 = gethitvar(damage)!=0
var(33)= -23 ;remove 1 full EMO bar ;floor(2.1*gethitvar(damage)) ;deals equivalent damage to EMO bar
ignorehitpause = 1
persistent = 0

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= gethitvar(damage)
ignorehitpause = 1
persistent = 0

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = time=1
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "damage=%d v53=%d Emo=%d hitime=%d v1=%d emolevel=%d"
params = gethitvar(damage),(parent,var(53)),(parent,var(33)), GetHitVar(hittime), var(1), floor((root,var(33))/23.0)
ignorehitpause = 1
;persistent =


[State 905, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = Time >=0
value = , AT
time = 1
ignorehitpause = 1

[State 0, HitOverride Normal]
type = HitOverride
triggerall = time>=0
trigger1 = var(1)<=(floor((root,var(33))/23.0))
;attr = SCA,NA,NP,NT
;attr = SCA,NA,SA,HA,NP,SP,HP;,NT,ST,HT
;attr = SCA,NA,SA,HA,NP,SP,HP;,NT,ST,HT
;attr = SCA,AA,AP
attr = SCA,AA,AP
slot = 0
stateno = 917
time = 1
forceair = 0
ignorehitpause = 1
;persistent =

[State 0, HitOverride Normal Throw]
type = HitOverride
triggerall = time>=0
trigger1 = var(1)<=(floor((root,var(33))/23.0))
;attr = SCA,NA,NP,NT
;attr = SCA,NA,SA,HA,NP,SP,HP;,NT,ST,HT
;attr = SCA,NA,SA,HA,NP,SP,HP;,NT,ST,HT
;attr = SCA,AA,AP
attr = SCA,AT
slot = 2
stateno = 917
time = 1
forceair = 0
ignorehitpause = 1
;persistent =


[State 0, HitOverride]
type = HitOverride
triggerall = time>=0    ;root cause?
trigger1 = var(1)>(floor((root,var(33))/23.0))
;attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT   ;with SCA removed, ex head charge is fixed, but basics create a clone WTF
;attr = SCA,AA,AP;,AT
attr = SCA,AA,AP
slot = 3
stateno = 920 ;cooldown
time = 1
forceair = 0
ignorehitpause = 1
;persistent =

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
trigger1 = !SelfAnimExist(root,Anim) ;prevent debug error on custom anims
value = 9999
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
triggerall = SelfAnimExist(root,Anim) ;prevent debug error on custom anims
trigger1 = Anim != (root, anim)
trigger2 = AnimElemNo(0) > (root, AnimElemNo(0))
value = root, anim
elem = root,AnimElemNo(0)
ignorehitpause = 1

[State 0, StopSnd]   ;stop steam sound
type = StopSnd
trigger1 = root,var(33)<=0;root,var(33)<23
trigger2 = root,stateno=910
trigger3 = root,stateno=[2500,2501] ;Pain Train
trigger4 = root,stateno=[1300,1301] ;Focus Attack
trigger5 = root,stateno=[300,330] ;Puddle Mode
trigger6 = root,movetype=H && root,stateno!=[120,155] ;hit but not block
trigger7 = roundstate!=2 ;do not play in winposes
trigger8 = root,var(32)<=0;
;trigger3 = var(1)>=2 ;only 1 hit armor
;trigger3 = time>20 ;should cover the majority of the hitpauses
;trigger3 = NumHelper(2510) ;Pain Train Wall
channel = 3
ignorehitpause = 1
;persistent =

[State 0, ChangeState]
type = ChangeState
trigger1 = root, StateNo = [120,155]
value = 922
ignorehitpause = 1

[State 905, DestroySelf]
type = DestroySelf
trigger1 = root,var(33)<=0;root,var(33)<23
trigger2 = root,stateno=910
trigger3 = root,stateno=[2500,2501] ;Pain Train
trigger4 = root,stateno=[1300,1301] ;Focus Attack
trigger5 = root,stateno=[300,330] ;Puddle Mode
trigger6 = root,movetype=H && root,stateno!=[120,155] ;hit but not block
trigger7 = roundstate!=2 ;do not play in winposes
trigger8 = root,var(32)<=0;
;trigger3 = var(1)>=2 ;only 1 hit armor
;trigger3 = time>20 ;should cover the majority of the hitpauses
;trigger3 = NumHelper(2510) ;Pain Train Wall
ignorehitpause = 1

; EMO SHIELD NORMAL
[Statedef 917]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1




;fix
[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = A
statetype = A       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = S
statetype = S       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = C
statetype = C       ;S,A,C,L
persistent = 1
;end fix

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "damage=%d hitshaketime=%d hitpausetime=%d hitime=%d emolevel=%d movehit=%d"
params = gethitvar(damage),GetHitVar(hitshaketime),GetHitVar(hitshaketime), GetHitVar(hittime), floor((root,var(33))/23.0), (enemynear,movehit) ;GetHitVar(hitshaketime)
ignorehitpause = 1
;persistent =

[State 905, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible
ignorehitpause = 1

[State 0, Turn]
type = Turn
trigger1 = facing!=root,facing
ignorehitpause = 1
;persistent =

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, VarAdd] ;Counter
type = VarAdd
trigger1 = !time
var(1) = 1   ;Normal 1 hit
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= gethitvar(damage)
ignorehitpause = 1
persistent = 0

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = time=1
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
trigger1 = !SelfAnimExist(root,Anim) ;prevent debug error on custom anims
value = 9999
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
triggerall = SelfAnimExist(root,Anim) ;prevent debug error on custom anims
trigger1 = Anim != (root, anim)
trigger2 = AnimElemNo(0) > (root, AnimElemNo(0))
value = root, anim
elem = root,AnimElemNo(0)
ignorehitpause = 1
;persistent =
[State 0, ChangeState]
type = ChangeState
;trigger1 = time=20 ;(GetHitVar(hittime)-enemynear,movehit)=0;enemynear,movehit>8 ;time=20 ;GetHitVar(hittime)<0 && GetHitVar(hitshaketime)=0 && HitShakeOver=1;&& enemynear,HitPauseTime = 0 ;0 ;time=14 ;10 ;5
trigger1 =time>=1
value = 916
ctrl = 0
;anim =
;ignorehitpause = 1
;persistent =

[State 0, ChangeState] ;prevent lockup
type = ChangeState
triggerall = time>0
trigger1 = var(1)>floor((root,var(33))/23.0)+1
value = 920
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =


; EMO SHIELD COOLDOWN
[Statedef 920]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1


[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(1) = GetHitVar(hitshaketime)+5

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(1)>0
var(1) = -1
;fix
[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = A
statetype = A       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = S
statetype = S       ;S,A,C,L
persistent = 1

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = root, StateType = C
statetype = C       ;S,A,C,L
persistent = 1
;end fix

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "damage=%d hitshaketime=%d hitpausetime=%d hitime=%d emolevel=%d movehit=%d"
params = gethitvar(damage),GetHitVar(hitshaketime),GetHitVar(hitshaketime), GetHitVar(hittime), floor((root,var(33))/23.0), (enemynear,movehit) ;GetHitVar(hitshaketime)
ignorehitpause = 1
;persistent =

[State 905, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible
ignorehitpause = 1

[State 0, Turn]
type = Turn
trigger1 = facing!=root,facing
ignorehitpause = 1
;persistent =

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, StopSnd]
type = StopSnd
trigger1 = !time ;time=360 ;600
channel = 3
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= gethitvar(damage)
ignorehitpause = 1
persistent = 0

[State 4500, 2];long sound
type = null;PlaySnd
trigger1 = !time
value = 8,0
loop = 1
pan = 1
volumescale = 25
channel = 3

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = time=1
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
trigger1 = !SelfAnimExist(root,Anim) ;prevent debug error on custom anims
value = 9999
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
triggerall = SelfAnimExist(root,Anim) ;prevent debug error on custom anims
trigger1 = Anim != (root, anim)
trigger2 = AnimElemNo(0) > (root, AnimElemNo(0))
value = root, anim
elem = root,AnimElemNo(0)
ignorehitpause = 1

[State 0, StopSnd]
type = null;StopSnd
trigger1 = time=360 ;600
channel = 3
ignorehitpause = 1
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time=360 ;600   ;temp
ignorehitpause = 1
;persistent =

; EMO SHIELD Guarding
[Statedef 922]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1

[State 0, Turn]
type = Turn
trigger1 = facing!=root,facing
ignorehitpause = 1
;persistent =

[State 0, ParentVarAdd] ;Add EMO bar on block
type = ParentVarAdd
triggerall = !NumHelper(9996) ;MCB Limiter
trigger1 = root,gethitvar(guarded)=1
trigger1 = root,gethitvar(hitshaketime)=1
var(33)= 1
ignorehitpause = 1
;persistent = 0

[State 905, BindToParent]
type = BindToParent
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = Time >=0
value = SCA
time = 1

[State 905, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
trigger1 = !SelfAnimExist(root,Anim) ;prevent debug error on custom anims
value = 9999
ignorehitpause = 1

[State 6666, 2] ;this will allow the helper to replicate the same animation than the root
type = ChangeAnim
triggerall = SelfAnimExist(root,Anim) ;prevent debug error on custom anims
trigger1 = Anim != (root, anim)
trigger2 = AnimElemNo(0) > (root, AnimElemNo(0))
value = root, anim
elem = root,AnimElemNo(0)
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = root, StateNo != [120,155]
value = 917
ignorehitpause = 1

; EMO STEAM
[Statedef 921]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = -1
facep2 = 1
anim=915

[State 0, AngleDraw]
type = null;AngleDraw
trigger1 = IsHelper(921)
trigger2 = IsHelper(922)
value = 1
scale = 0.5,0.5
ignorehitpause = 1
;persistent =

[State 0, AngleDraw]
type = null;AngleDraw
trigger1 = IsHelper(923)
trigger2 = IsHelper(924)
value = 1
scale = 0.3,0.3
ignorehitpause = 1
;persistent =


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

[State 0, Turn L]
type = Turn
triggerall = facing!=root,facing
trigger1 = IsHelper(921)
trigger2 = IsHelper(923)
ignorehitpause = 1
;persistent =

[State 0, Turn R]
type = Turn
triggerall = facing=root,facing
trigger1 = IsHelper(922)
trigger2 = IsHelper(924)
ignorehitpause = 1
;persistent =

[State 905, BindToParent 1]
type = BindToRoot
trigger1 = IsHelper(921)
;pos = -5-5*(root,statetype=C)-35*(root,statetype=L),-50+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)
pos = -5+5*(root,statetype=C)-35*(root,statetype=L)-40*(root,Anim=495||root,Anim=496),-10+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)+50*(root,stateno=302)+35*(root,Anim=495||root,Anim=496)
ignorehitpause = 1

[State 905, BindToParent 2]
type = BindToRoot
trigger1 = IsHelper(922)
;pos = 15+5*(root,statetype=C)+5*(root,statetype=L),-45+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)
pos = 15+5*(root,statetype=C)+5*(root,statetype=L)-40*(root,Anim=495||root,Anim=496),-5+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)+45*(root,stateno=302)+35*(root,Anim=495||root,Anim=496)
ignorehitpause = 1

[State 905, BindToParent 3]
type = BindToRoot
trigger1 = IsHelper(923)
pos = 10+5*(root,statetype=C)-35*(root,statetype=L),-75+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)
ignorehitpause = 1

[State 905, BindToParent 4]
type = BindToRoot
trigger1 = IsHelper(924)
pos = 20+5*(root,statetype=C)-5*(root,statetype=L),-75+25*(root,statetype=C)+80*(root,statetype=L)+60*(root,Anim=1401||root,Anim=1403)+60*(root,Anim=[2601,2602])-20*(root,stateno=20)
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 4500, 2];long sound
type = PlaySnd
trigger1 = IsHelper(921)
trigger1 = !time
value = 8,0
;loop = 1
pan = 1
volumescale = 10 ;25
channel = 3

[State 0, StopSnd]
type = StopSnd
trigger1 = !animtime ;!time ;time=360 ;600
channel = 3
ignorehitpause = 1
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = !animtime ;time=360 ;600   ;temp
trigger2 = roundstate!=2
ignorehitpause = 1
;persistent =






;========================================================
;BURP FIREBALL HELPER
;Burp Fireball : 1005
;Burp Fireball Vanish : 1006
;========================================================

;Burp Fireball Helper
[Statedef 1005]
type    = A ;S
movetype= A
physics = N
anim = 1005 ;3302
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

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

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 0, VarSet]
type = VarSet
trigger1 = !time
var(15) = root,var(15)
;ignorehitpause =
;persistent =

[State 0, PlaySnd Launch]
type = PlaySnd
trigger1 = !time
value = 1006,0
channel = -1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = time = 0
v = 18
value = 1

[State 1061, Velocity LP]
type = VelSet
triggerall = var(15)=1
trigger1 = Time = 0
x = 3
y = -3

[State 1061, Velocity MP]
type = VelSet
triggerall = var(15)=2
trigger1 = Time = 0
x = 5
y = -5

[State 1061, Velocity SP]
type = VelSet
triggerall = var(15)=3
trigger1 = Time = 0
x = 5
y = -9

[State 0, Gravity]
type = VelAdd
trigger1 = 1
y = const(movement.yaccel)
;ignorehitpause =
;persistent =

[State 1061, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 1061, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 1061, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1006
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1061, Hitdef]
type = HitDef
trigger1 = Time>0
attr = S, SP
animtype  = hard
;damage    = 20+ceil(10*var(15)), 2+ceil(5*var(15))
damage = ceil(ifElse(root,fvar(11) * (20+ceil(10*var(15))) < 7, 7, (root,fvar(11)) * (20+ceil(10*var(15))))), 2+ceil(5*var(15))
priority  = 4,Hit
guardflag = MA ;HA
hitflag = MAFD
pausetime = 0,10
sparkno = -1 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s1006,1 ;s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = ifelse(p2movetype=H,40,140), 10
givepower = 35,35
persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

;----------------------
;Aimed projectile, based on code made by Bea

;Finds the X component of the vector Player, EnemyNear
;Formula to find the components of a given vector AB
;V(x) = B(x) - A(x)
;V(y) = B(y) - A(y)
[State 1640, X]
Type = VarSet
Trigger1 = 1
fvar(1) = (EnemyNear(0),Pos X - Pos X) * Facing ;Adjust the direction towards player facing
;Finds the Y component of the vector Player, EnemyNear
[State 1640, Y]
Type = VarSet
trigger1 = 1
fvar(2) = (EnemyNear(0),pos Y - Pos Y)

;Finds the vector length
;Formula of the length of a given vector AB
;|AB| = (AB(x)^2  + AB(y)^2)^1/2
[State 1640, Vector Length 0]
Type = VarSet
trigger1 = 1
fvar(3) = Exp(0.5*ln((fvar(1) * fvar(1))+(fvar(2) * fvar(2))))

[State 37001, Velocity 0]
type = null;VelSet
trigger1 = Time = 0
x = (Fvar(1)/fvar(3)) * 10.0
y = (FVar(2)/fvar(3)) * 10.0
;Normalizes the components
;and multiply by the desired absolute velocity.
;----------------------
[State 0, VarSet] ;angle
type = VarSet
trigger1 = 1 ;time=0
fvar(4)= (180/pi)*atan((-1*(vel y))/vel x)
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = fvar(4)
scale = 1,1
;ignorehitpause =
;persistent =

[State 1061, Velocity]
type = VelSet
trigger1 = Movehit
x = 0

[State 3001, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = movecontact
v = 18
value = 0

[State 1061, End]
type = destroyself
trigger1 = (pos x!=[-240,240])
trigger2 = time>180

[State 0, PlaySnd Ground impact]
type = PlaySnd
trigger1 = pos Y >= -5 ;10
value = 1006,1
channel = -1
persistent=0

[State 1061, Fade]
type = changestate
trigger1 = movecontact
trigger2 = pos Y >= -5 ;10
value = 1006
ignorehitpause=1

;Burp Fireball Vanish
[Statedef 1006]
type    = A
movetype= A
physics = N
;anim = 1006
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = IfElse((pos Y >= -5),1006,1007)
;elem = 1
ignorehitpause = 1
;persistent =


[State 0, AngleDraw]
type = AngleDraw
trigger1 = !time
value = 0
scale = 1,1
ignorehitpause = 1
;persistent =


[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1061, End]
type = destroyself
trigger1 = animtime = 0

;========================================================
;EX BURP FIREBALL HELPER
;EX Burp Fireball : 1055
;EX Burp Fireball Vanish : 1006
;========================================================

;EX Burp Fireball 1 Helper
[Statedef 1055]
type    = A ;S
movetype= A
physics = N
anim = 1055
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

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

[State 0, Yellow Lightning] ;TEMP
type = PalFX
trigger1 = !time
time = -1
add = 40,40,-40
mul = 256,256,256
sinadd = 40,30,0,10
invertall = 0
color = 256
;ignorehitpause = 0
;persistent = 1

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = time = 0
v = 18
value = 1

[State 1061, Velocity EX]
type = VelSet
trigger1 = Time = 0
x = 4+random%3
y = -4-random%3

[State 0, VelSet Bounce]
type = VelSet
trigger1 = pos Y >= -5 ;10
x = 4
y = -4
ignorehitpause = 1

[state 450, Dust]
type = explod
triggerall = !NumExplod(451)
trigger1 = pos Y >= -10
anim = 451
ID = 451
pos = 0,10
postype=P1
sprpriority=10
ownpal = 1
removetime = -2
removeongethit = 0
bindtime = 1

[State 3002, Bounce Snd]
type = PlaySnd
trigger1 = pos Y >= -10
value = 1055,0 ;50,0 ;6300,1
channel = 3
lowpriority = 1

[State 0, Gravity]
type = VelAdd
trigger1 = 1
y = const(movement.yaccel)
;ignorehitpause =
;persistent =

[State 1061, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 1061, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 1061, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1006
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1061, Hitdef]
type = HitDef
trigger1 = Time>0
attr = S, SP
animtype  = hard
;damage    = 30,3 ;ceil(90*root,fvar(12)), ceil(9*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 7, 7, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 0,10
sparkno = s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s1006,1 ;s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0 ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

;----------------------
;Aimed projectile, based on code made by Bea

;Finds the X component of the vector Player, EnemyNear
;Formula to find the components of a given vector AB
;V(x) = B(x) - A(x)
;V(y) = B(y) - A(y)
[State 1640, X]
Type = VarSet
Trigger1 = 1
fvar(1) = (EnemyNear(0),Pos X - Pos X) * Facing ;Adjust the direction towards player facing
;Finds the Y component of the vector Player, EnemyNear
[State 1640, Y]
Type = VarSet
trigger1 = 1
fvar(2) = (EnemyNear(0),pos Y - Pos Y)

;Finds the vector length
;Formula of the length of a given vector AB
;|AB| = (AB(x)^2  + AB(y)^2)^1/2
[State 1640, Vector Length 0]
Type = VarSet
trigger1 = 1
fvar(3) = Exp(0.5*ln((fvar(1) * fvar(1))+(fvar(2) * fvar(2))))

[State 37001, Velocity 0]
type = null;VelSet
trigger1 = Time = 0
x = (Fvar(1)/fvar(3)) * 10.0
y = (FVar(2)/fvar(3)) * 10.0
;Normalizes the components
;and multiply by the desired absolute velocity.
;----------------------
[State 0, VarSet] ;angle
type = VarSet
trigger1 = 1 ;time=0
fvar(4)= (180/pi)*atan((-1*(vel y))/vel x)
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = fvar(4)
scale = 1,1
;ignorehitpause =
;persistent =

[State 1061, Velocity]
type = VelSet
trigger1 = Movehit
x = 0

[State 3001, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = movecontact
v = 18
value = 0

[State 1061, End]
type = destroyself
trigger1 = (pos x!=[-240,240])


[State 1061, Fade]
type = changestate
trigger1 = movecontact
trigger2 = time>180
value = 1006
ignorehitpause=1

;EX Burp Fireball 2 Helper
[Statedef 1056]
type    = A ;S
movetype= A
physics = N
anim = 1055
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

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

[State 0, Yellow Lightning] ;TEMP
type = PalFX
trigger1 = !time
time = -1
add = 40,40,-40
mul = 256,256,256
sinadd = 40,30,0,10
invertall = 0
color = 256
;ignorehitpause = 0
;persistent = 1

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = time = 0
v = 18
value = 1

[State 1061, Velocity EX]
type = VelSet
trigger1 = Time = 0
x = 2+random%3
y = -8-random%3

[State 0, VelSet Bounce]
type = VelSet
trigger1 = pos Y >= -5 ;10
x = 2
y = -8
ignorehitpause = 1

[state 450, Dust]
type = explod
triggerall = !NumExplod(451)
trigger1 = pos Y >= -10
anim = 451
ID = 451
pos = 0,10
postype=P1
sprpriority=10
ownpal = 1
removetime = -2
removeongethit = 0
bindtime = 1

[State 3002, Bounce Snd]
type = PlaySnd
trigger1 = pos Y >= -10
value = 1055,0 ;50,0 ;6300,1
channel = 3
lowpriority = 1

[State 0, Gravity]
type = VelAdd
trigger1 = 1
y = const(movement.yaccel)
;ignorehitpause =
;persistent =

[State 1061, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 1061, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 1061, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1006
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1061, Hitdef]
type = HitDef
trigger1 = Time>0
attr = S, SP
animtype  = hard
;damage    = 30,3 ;ceil(90*root,fvar(12)), ceil(9*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 7, 7, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 0,10
sparkno = s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s1006,1 ;s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0 ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

;----------------------
;Aimed projectile, based on code made by Bea

;Finds the X component of the vector Player, EnemyNear
;Formula to find the components of a given vector AB
;V(x) = B(x) - A(x)
;V(y) = B(y) - A(y)
[State 1640, X]
Type = VarSet
Trigger1 = 1
fvar(1) = (EnemyNear(0),Pos X - Pos X) * Facing ;Adjust the direction towards player facing
;Finds the Y component of the vector Player, EnemyNear
[State 1640, Y]
Type = VarSet
trigger1 = 1
fvar(2) = (EnemyNear(0),pos Y - Pos Y)

;Finds the vector length
;Formula of the length of a given vector AB
;|AB| = (AB(x)^2  + AB(y)^2)^1/2
[State 1640, Vector Length 0]
Type = VarSet
trigger1 = 1
fvar(3) = Exp(0.5*ln((fvar(1) * fvar(1))+(fvar(2) * fvar(2))))

[State 37001, Velocity 0]
type = null;VelSet
trigger1 = Time = 0
x = (Fvar(1)/fvar(3)) * 10.0
y = (FVar(2)/fvar(3)) * 10.0
;Normalizes the components
;and multiply by the desired absolute velocity.
;----------------------
[State 0, VarSet] ;angle
type = VarSet
trigger1 = 1 ;time=0
fvar(4)= (180/pi)*atan((-1*(vel y))/vel x)
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = fvar(4)
scale = 1,1
;ignorehitpause =
;persistent =

[State 1061, Velocity]
type = VelSet
trigger1 = Movehit
x = 0

[State 3001, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = movecontact
v = 18
value = 0

[State 1061, End]
type = destroyself
trigger1 = (pos x!=[-240,240])


[State 1061, Fade]
type = changestate
trigger1 = movecontact
trigger2 = time>180
value = 1006
ignorehitpause=1

;EX Burp Fireball 3 Helper
[Statedef 1057]
type    = A ;S
movetype= A
physics = N
anim = 1055
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

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

[State 0, Yellow Lightning] ;TEMP
type = PalFX
trigger1 = !time
time = -1
add = 40,40,-40
mul = 256,256,256
sinadd = 40,30,0,10
invertall = 0
color = 256
;ignorehitpause = 0
;persistent = 1

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = time = 0
v = 18
value = 1

[State 1061, Velocity EX]
type = VelSet
trigger1 = Time = 0
x = 4+random%3
y = -10-random%3

[State 0, VelSet Bounce]
type = VelSet
trigger1 = pos Y >= -5 ;10
x = 4
y = -10
ignorehitpause = 1

[state 450, Dust]
type = explod
triggerall = !NumExplod(451)
trigger1 = pos Y >= -10
anim = 451
ID = 451
pos = 0,10
postype=P1
sprpriority=10
ownpal = 1
removetime = -2
removeongethit = 0
bindtime = 1

[State 3002, Bounce Snd]
type = PlaySnd
trigger1 = pos Y >= -10
value = 1055,0 ;50,0 ;6300,1
channel = 3
lowpriority = 1

[State 0, Gravity]
type = VelAdd
trigger1 = 1
y = const(movement.yaccel)
;ignorehitpause =
;persistent =

[State 1061, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 1061, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 1061, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1006
attr = SCA, AA, AP, AT
ignorehitpause = 1

[State 1061, Hitdef]
type = HitDef
trigger1 = Time>0
attr = S, SP
animtype  = hard
;damage    = 30,3 ;ceil(90*root,fvar(12)), ceil(9*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 7, 7, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 0,10
sparkno = s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s1006,1 ;s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = -7.8,0
guard.velocity = -7.5
air.velocity = -5.8,-3
airguard.velocity = -5, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0 ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

;----------------------
;Aimed projectile, based on code made by Bea

;Finds the X component of the vector Player, EnemyNear
;Formula to find the components of a given vector AB
;V(x) = B(x) - A(x)
;V(y) = B(y) - A(y)
[State 1640, X]
Type = VarSet
Trigger1 = 1
fvar(1) = (EnemyNear(0),Pos X - Pos X) * Facing ;Adjust the direction towards player facing
;Finds the Y component of the vector Player, EnemyNear
[State 1640, Y]
Type = VarSet
trigger1 = 1
fvar(2) = (EnemyNear(0),pos Y - Pos Y)

;Finds the vector length
;Formula of the length of a given vector AB
;|AB| = (AB(x)^2  + AB(y)^2)^1/2
[State 1640, Vector Length 0]
Type = VarSet
trigger1 = 1
fvar(3) = Exp(0.5*ln((fvar(1) * fvar(1))+(fvar(2) * fvar(2))))

[State 37001, Velocity 0]
type = null;VelSet
trigger1 = Time = 0
x = (Fvar(1)/fvar(3)) * 10.0
y = (FVar(2)/fvar(3)) * 10.0
;Normalizes the components
;and multiply by the desired absolute velocity.
;----------------------
[State 0, VarSet] ;angle
type = VarSet
trigger1 = 1 ;time=0
fvar(4)= (180/pi)*atan((-1*(vel y))/vel x)
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = fvar(4)
scale = 1,1
;ignorehitpause =
;persistent =

[State 1061, Velocity]
type = VelSet
trigger1 = Movehit
x = 0

[State 3001, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 1061, NoJuggle]
type = parentvarset
trigger1 = movecontact
v = 18
value = 0

[State 1061, End]
type = destroyself
trigger1 = (pos x!=[-240,240])


[State 1061, Fade]
type = changestate
trigger1 = movecontact
trigger2 = time>180
value = 1006
ignorehitpause=1

; HEAD - Being Launched
[Statedef 1150]
type    = S
movetype= I
physics = N
anim = 1150
;sprpriority = 2
sprpriority = IfElse(root,var(43)=2900,3,2)
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 1158
time = 1
forceair = 0
;ignorehitpause =
;persistent =


[State 0, VarSet]
type = VarSet
trigger1 = !time
var(15) = root,var(15)
;ignorehitpause =
;persistent =

[State 0, VelSet]
type = VelSet
trigger1 = root,animelemtime(6)=0
x = 5
y = 5
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = pos y>0
value = 1151
;elem = 1
;ignorehitpause =
;persistent =

[State 0, PlaySnd] ;hit ground
type = PlaySnd
trigger1 = Anim=1151
trigger1 = Animelemtime(1)=0
value = 1150,1
persistent = 0

[State 0, VelSet]
type = VelSet
trigger1 = Anim=1151
x = 0
y = 0
;ignorehitpause =
;persistent =

[State 0, PosSet]
type = PosSet
trigger1 = Anim=1151
y = 0
;ignorehitpause =
;persistent =

[State 0, ChangeState]  ;Cinematic leave
type = ChangeState
trigger1 = enemy, NumExplod(991901) || root,NumExplod(991901)
trigger2 = root,var(58)-root,var(59)>=120  ;2 secs may be considered a cinematic/custom state
trigger3 = Roundstate!=2 ;leave when round is over
value = 1158
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =

[State 0, ChangeState] ; To idle
type = ChangeState
triggerall = var(15) = 2
trigger1 = anim = 1151
trigger1 = !animtime
value = 1152
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 0, ChangeState] ;to walk
type = ChangeState
triggerall = var(15) != 2
trigger1 = anim = 1151
trigger1 = !animtime
value = 1155
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

; HEAD - Idle
[Statedef 1152]
type    = S
movetype= I
physics = N
anim = 1152
;sprpriority = -10
sprpriority = IfElse(root,var(43)=2900,2,-10)
hitcountpersist = 1
movehitpersist = 1

[State -2, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = (authorname="Team Z2")
text = "rootdistX=%d, P2X=%d, P2Y=%d, PosX=%d, RootP2X=%d\n"
params = RootDist X, p2bodydist x, p2bodydist y, pos X, (root,p2bodydist x)
ignorehitpause = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 1159
time = 1
forceair = 0
;ignorehitpause =
;persistent =

[State 0, PlaySnd] ;mini voice
type = PlaySnd
triggerall = Anim=1152
triggerall = time>299
trigger1 = time%300=0
value = 1150,10+random%3

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = Anim=1152
triggerall = time>299
trigger1 = time%300=0
value = 1161
;elem = 1
;ignorehitpause =
;persistent =

[State 0, ChangeAnim] ;Taunt
type = ChangeAnim
triggerall = Anim=1161
trigger1 = time%300=60
value = 1162

[State 0, ChangeAnim] ;Taunt off
type = ChangeAnim
triggerall = Anim=1162
trigger1 = !animtime
value = 1152

[State 0, ChangeState]  ;Cinematic leave
type = ChangeState
trigger1 = enemy, NumExplod(991901) || root,NumExplod(991901)
trigger2 = root,var(58)-root,var(59)>=120  ;2 secs may be considered a cinematic/custom state
trigger3 = Roundstate!=2 ;leave when round is over
value = 1159
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =

[State 0, ChangeState] ;recall
type = ChangeState
trigger1 = root,stateno=1110
value = 1153
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

; HEAD - Recall/Attack
[Statedef 1153]
type    = S
movetype= I
physics = N
anim = 1153
;sprpriority = 8
sprpriority = IfElse(root,var(43)=2900,9,8)
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 1158
time = 1
forceair = 0
;ignorehitpause =
;persistent =

[State 0, PlaySnd] ;recall
type = PlaySnd
trigger1 = !time
value = 1150,2

[State 0, Turn]
type = Turn
trigger1 = facing != root,facing
trigger2 = facing=1 && root,facing = 1 && rootdist X>0
trigger3 = facing=-1 && root,facing = -1 && rootdist X>0
;ignorehitpause =
persistent = 0


[State 0, PosAdd]
type = PosAdd
trigger1 = Anim=1153
trigger1 = AnimElemtime(3)=0
x = -33
y = -31
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Anim=1153
trigger1 = !Animtime
value = 1154
;elem = 1
;ignorehitpause =
;persistent =

[State 0, SprPriority]
type = SprPriority
trigger1 = Anim=1154
value = 9
;ignorehitpause =
;persistent =


;----------------------
;Aimed projectile, based on code made by Bea

;Finds the X component of the vector Player, EnemyNear
;Formula to find the components of a given vector AB
;V(x) = B(x) - A(x)
;V(y) = B(y) - A(y)
[State 1640, X]
Type = VarSet
;Trigger1 = 1
trigger1 = Anim=1154 ;AnimElemtime(3)>0
fvar(1) = (Pos X - (root,Const(size.head.pos.x)+root,Pos X)) * Facing ;Adjust the direction towards player facing
;Finds the Y component of the vector Player, EnemyNear
[State 1640, Y]
Type = VarSet
;trigger1 = 1
trigger1 = Anim=1154 ;AnimElemtime(3)>0
fvar(2) = (Pos Y - (root,Const(size.head.pos.y)+root,pos Y+25*(root,statetype=C || root,Stateno=52)))

;Finds the vector length
;Formula of the length of a given vector AB
;|AB| = (AB(x)^2  + AB(y)^2)^1/2
[State 1640, Vector Length 0]
Type = VarSet
;trigger1 = 1
trigger1 = Anim=1154 ;AnimElemtime(3)>0
fvar(3) = Exp(0.5*ln((fvar(1) * fvar(1))+(fvar(2) * fvar(2))))

[State 37001, Velocity 0]
type = VelSet
;trigger1 = Time = 0
trigger1 = Anim=1154 ;AnimElemtime(3)>0
x = -(Fvar(1)/fvar(3)) * 5.0
y = -(FVar(2)/fvar(3)) * 5.0
;Normalizes the components
;and multiply by the desired absolute velocity.
;----------------------
[State 0, VarSet] ;angle
type = VarSet
;trigger1 = 1 ;time=0
trigger1 = Anim=1154 ;AnimElemtime(3)>0
fvar(4)= (180/pi)*atan((-1*(vel y))/vel x)
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
;trigger1 = 1
trigger1 = Anim=1154 ;AnimElemtime(3)>0
value = 15+IfElse(fvar(4)<0,fvar(4),-fvar(4))
scale = 1,1
;ignorehitpause =
;persistent =

[State 0, StateTypeSet]
type = StateTypeSet
;triggerall = time<180
;trigger1 = p2dist x=[-60,60]
trigger1 = ScreenPos X - (enemynear,ScreenPos X) = [-60,60]
trigger2 = InGuardDist
trigger3 = enemy,name="Piccolo Z2" ;dirty hack against clones
trigger3 = (enemy,NumHelper(3501)>0)
movetype = A        ;I,A,H
ignorehitpause = 1
;persistent =

[State 0, StateTypeSet]
type = StateTypeSet
;triggerall = time<180
;trigger1 = p2dist x!=[-60,60]
trigger1 = ScreenPos X - (enemynear,ScreenPos X) != [-60,60]
;trigger2 = !InGuardDist
trigger1 = enemy,name="Piccolo Z2" ;dirty hack against clones
trigger1 = (enemy,NumHelper(3501)=0)
movetype = I        ;I,A,H
ignorehitpause = 1
;persistent =


[State 1061, Hitdef]
type = HitDef
trigger1 = 1
attr = S, SP
animtype  = hard
;damage    = 20, 2
damage = ceil(ifElse(root,fvar(11) * 20 < 7, 7, (root,fvar(11)) * 20)), 2
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 0,15 ;10
sparkno = s7010
guard.sparkno = s7000
sparkxy = -50,0
hitsound   = s410,1 ;s1006,1 ;s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 16 ;20
ground.hittime  = 16 ;20
ground.velocity = 3.8,0
guard.velocity = 3.5
air.velocity = 2.8,-3
airguard.velocity = 2, -4
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = ifelse(p2movetype=H,40,140), 10
givepower = 35,35
persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 0, ChangeAnim] ;to Chomp
type = ChangeAnim
trigger1 = anim=1154
trigger1 = movecontact
value = 1157
;elem = 1
ignorehitpause = 1
persistent = 0

[State 0, VelSet]
type = VelSet
trigger1 = anim=1157
x = -(Fvar(1)/fvar(3)) * 1.0
y = -(FVar(2)/fvar(3)) * 1.0
ignorehitpause = 1
;persistent =


[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = anim=1157
trigger1 = !animtime
value = 1154
;elem = 1
ignorehitpause = 1
;persistent =

[State 0, ChangeState]  ;Cinematic leave
type = ChangeState
trigger1 = enemy, NumExplod(991901) || root,NumExplod(991901)
trigger2 = root,var(58)-root,var(59)>=120  ;2 secs may be considered a cinematic/custom state
trigger3 = Roundstate!=2 ;leave when round is over
value = 1158
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =


[State 0, DestroySelf]
type = DestroySelf
;trigger1 = (Pos X - (root,Const(size.head.pos.x)+root,Pos X))<5
;trigger1 = (Pos Y - (root,Const(size.head.pos.y)+root,Pos Y))<5
trigger1 = Root,NumExplod(1160) ;time =200
;ignorehitpause =
;persistent =

; HEAD - Walking
[Statedef 1155]
type    = S
movetype= I
physics = N
;sprpriority = -10
sprpriority = IfElse(root,var(43)=2900,2,-10)
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP
slot = 0
stateno = 1159
time = 1
forceair = 0
;ignorehitpause =
;persistent =



[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = var(15)=1
trigger1 = !time
value = 1155
;elem = 1
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = var(15)=3
trigger1 = !time
value = 1156
;elem = 1
;ignorehitpause =
;persistent =

[State 0, VelSet F]
type = VelSet
trigger1 = Anim=1156
trigger1 = Animelemtime(2)=0
x = 3
;ignorehitpause =
;persistent =

[State 0, VelSet B]
type = VelSet
trigger1 = Anim=1155
trigger1 = Animelemtime(2)=0
x = -3
;ignorehitpause =
;persistent =

[State 0, VelSet]
type = VelSet
trigger1 = time=60
x = 0
;ignorehitpause =
;persistent =

[State 0, ChangeState] ;recall
type = ChangeState
trigger1 = root,stateno=1110
value = 1153
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 0, ChangeState]  ;Cinematic leave
type = ChangeState
trigger1 = enemy, NumExplod(991901) || root,NumExplod(991901)
trigger2 = root,var(58)-root,var(59)>=120  ;2 secs may be considered a cinematic/custom state
trigger3 = Roundstate!=2 ;leave when round is over
value = 1159
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =

[State 0, ChangeState]
type = ChangeState
trigger1 = time=60
value = 1152
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

; HEAD - Vanish Air
[Statedef 1158]
type    = S
movetype= I
physics = N
velset = 0,0
;sprpriority = 8
sprpriority = IfElse(root,var(43)=2900,9,8)
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, PlaySnd] ;Head gethit
type = PlaySnd
trigger1 = !time
value = 1150,4

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1158
elem = 2
ignorehitpause = 1
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = !animtime
;ignorehitpause =
;persistent =

; HEAD - Vanish Ground
[Statedef 1159]
type    = S
movetype= I
physics = N
;sprpriority = 8
sprpriority = IfElse(root,var(43)=2900,9,8)
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, PlaySnd] ;Head gethit
type = PlaySnd
trigger1 = !time
value = 1150,4

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1158
elem = 1
ignorehitpause = 1
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = !animtime
;ignorehitpause =
;persistent =

; Pop Kick Helper
[Statedef 1210]
type    = S
movetype= A
physics = N
anim = 1210
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nojugglecheck
ignorehitpause = 1
;persistent =

[State 0, VarSet]
type = VarSet
trigger1 = !time
var(15) = root,var(15)
;ignorehitpause =
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time ;1
var(53)= 0
ignorehitpause = 1
persistent = 0

[State 0, PosSet]
type = PosSet
trigger1 = !time
trigger1 = pos x>=160
x = 140
;ignorehitpause =
;persistent =

[State 0, PosSet]
type = PosSet
trigger1 = !time
trigger1 = pos x<=-160
x = -140
;ignorehitpause =
;persistent =

[State 3010, earth geyser]
type = Explod
trigger1 = !time ;AnimElemTime(3)=0
anim =  7200
ID =  7200
pos = 0,0 ;IfElse(FrontEdgeDist<195,60,60+45*(var(15))),0
postype = p1  ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1.5,1.5
sprpriority = 10
ownpal = 1
removeongethit = 0
ignorehitpause = 1

[State 3020, Transparency]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 3020, NoJuggle]
type = parentvarset
trigger1 = time = 0
v = 18
value = 1

[State 3020, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NT, ST, HT
ignorehitpause = 1

[State 3020, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NA, SA, HA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3020, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 1213 ;1211
attr = SCA, NA, SA, HA, NP, SP, HP
ignorehitpause = 1

[State 0, ChangeState] ;Buu gets hit
type = ChangeState
triggerall = root,movetype=H
trigger1 =  Animelemtime(2)>=0
value = 1213
ctrl = 0
;anim =
ignorehitpause = 1
;persistent =

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Animelemtime(2)=0
value = 1200,0
channel = -1
;ignorehitpause =
;persistent =

[State 3020, Hitdef]
type = HitDef
trigger1 = 1
attr = S, SA
animtype = Back
air.animtype = Back
fall.animtype = Back
;damage    = (13+10*var(15)), 0 ;ceil((5*root,var(15))+25*root,fvar(12)), ceil((2+root,var(15))*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * (13+10*var(15)) < 7, 7, (root,fvar(11)) * (13+10*var(15)))), 0
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 0,10
guard.pausetime = 2,15 ;1
sparkno = s7020 ;-1 ;s7010
guard.sparkno = s7000 ;-1
sparkxy = Cond(numtarget,(target,const(size.ground.front)-2),0),-62 ;(target,const(size.ground.front)-2),-62;0,-50
hitsound   = s5,(2+var(15))
guardsound = S6,1
ground.type = High
air.type = Low
ground.hittime = 16
ground.slidetime = 16
guard.slidetime = 16 ;7
guard.hittime = 16
air.hittime = 13
airguard.ctrltime = 16
ground.velocity = 2,-13;-1,-2 ;-2,-2
guard.velocity = -2
air.velocity = 2,-13 ;-1,-5 ;-2,-5
airguard.velocity = -1,-2 ;-2,-2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
fall=1
air.fall = 1
fall.recover = 0
fall.recovertime = 13
forcestand = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
;palfx.sinadd=64,64,64,4
;palfx.mul=128,128,128
;palfx.time=32
;palfx.add = 255,50,0
;palfx.sinadd = -255,-50,0,20
;palfx.time = 25
persistent = 0

[State 0, TargetLifeAdd]
type = TargetLifeAdd
trigger1 = var(15)=0
trigger1 = MoveHit = 1
value = -36
ID = -1
kill = 1
absolute = 0
ignorehitpause = 1
;persistent =


[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3020, Sparks] ;Cybaster way
type= null ;explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
pos=(target,const(size.ground.front)-2),-62 ;-77;floor(p2dist y)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 3020, Guard Sparks] ;Cybaster way
type= null;explod
trigger1= moveguarded
anim=7010
sprpriority=7
postype=p2
pos=(target,const(size.ground.front)-2),-62 ;-77;floor(p2dist y)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 0, Wall helper] ; P2 Back
type = null;helper
triggerall = !NumHelper(1215)
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
helpertype = normal
stateno = 1215
ID = 1215
name = "Wall"
postype = p1 ;front
pos = 0,0 ;-100
persistent = 0
size.ground.back = 5
size.ground.front = 5
size.height = 240

[State 3020, Helper Limiter]
type = Helper
triggerall = !NumHelper(9998)
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
helpertype = normal
name =  "Limiter"
ID = 9998
stateno = 9999
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1


[State 3020, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 3020, NoJuggle]
type = parentvarset
trigger1 = movecontact
v = 18
value = 0

[State 3020, end]   ;Contact
type = changestate
trigger1 = movecontact
value = 1211

[State 3020, end]   ;No contact
type = changestate
trigger1 = !animtime
value = 1211


[State 3020, End]   ;just in case
type = destroyself
trigger1 = !animtime

;-------------------------------------------------------------------------------
; Pop Kick Vanish
[Statedef 1211]
type    = S
movetype= A
physics = N
velset=0,0
anim = 1211
ctrl=0
sprpriority=5
hitcountpersist = 1
movehitpersist = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nojugglecheck
ignorehitpause = 1
;persistent =


[State 3021, NoShadow]
type = null ;AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 3321, Sound]
type = PlaySnd
trigger1 = !time
value = 3300, 1

[State 3021, nothitby]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 3021, Transparency]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 3021, End]
type= destroyself
trigger1 = !animtime

;-------------------------------------------------------------------------------
; Pop Kick - Gethit
[Statedef 1213]
type    = S
movetype= H ;A
physics = N
velset=0,0
anim = 1213
ctrl=0
sprpriority=5
hitcountpersist = 1
movehitpersist = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nojugglecheck
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(53)= gethitvar(damage)
ignorehitpause = 1
persistent = 0

[State 3021, NoShadow]
type = null ;AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 3021, nothitby]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 3020, end]   ;Go to vanish
type = null;changestate
trigger1 = !animtime
value = 1211

[State 3021, End]
type= destroyself
trigger1 = !animtime

; Pop Kick Wall Helper
[Statedef 1215] ; P2 BACK
physics = N
velset = 0, 0
anim = 1215

[State 0, BindToParent]
type = BindToParent
trigger1 = 1 ;!time ;1
time = 1
;facing = 0
pos = 75,0
ignorehitpause = 1
;persistent =

[State 0, VarSet]
type = null;VarSet
trigger1 = !time
var(1) = ceil(parentdist X)
ignorehitpause = 1
;persistent =

[State 3205, NHB]
type = nothitby
trigger1 = 1
time = -1
value = SCA

[State 3205, HitOverride]
type = null;hitoverride
trigger1 = 1
time = -1
attr = SCA, AA, AP, AT
stateno = 1215
ignorehitpause = 1

[State 3205, bound]
type = screenbound
trigger1 = 1
value = 1

[State 3205, Push]
type = playerpush
trigger1 = 1 ;p2bodydist x = [ -10, 10]
value = 1


[State 0, PosFreeze]
type = PosFreeze
trigger1 = 1 ;time>0
value = 1
;ignorehitpause =
;persistent =

[State 0, VelAdd]
type = null;VelAdd
trigger1 = parentdist x < var(1)
x = -10
ignorehitpause = 1
;persistent =


[State 0, PosAdd]
type = null;PosAdd
trigger1 = parentdist x > var(1)
x = -10
ignorehitpause = 1
;persistent =


[State 3205, End]
type = destroyself
trigger1 = time=50 ;!numhelper(1210)

; Pop Kick - No Push Dummy
[Statedef 1216]
ctrl = 0
hitcountpersist = 1
movehitpersist = 1

[State 1216, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = Parent, Anim
elem = Parent, AnimElemNo(0)

[State 1216, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 1

[State 1216, BindToParent]
type = BindToParent
trigger1 = !Time
time = -1
facing = 1

[State 1216, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
flag2 = Invisible

[State 1216, NotHitBy]
type = NotHitBy
trigger1 = !Time
value = SCA
time = -1

[State 1216, Remove]
type = DestroySelf
trigger1 = Parent, StateNo != [1200,1203]

;======================================================================
; Repel helper : 1305
; Destroyed : 1306
; Reflect with random projectile : 1308
; Reflected projectile : 1315
; Reflected projectile explods : 1316
;======================================================================

; REPEL HELPER FOR SLASH CHOP

[Statedef 1305]
type = S
physics = N
movetype = A
ctrl = 0
sprpriority = 4

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1305, nothitby]
type = nothitby
trigger1 = 1
time = -1
value = SCA
ignorehitpause = 1

[State 1305, HB]
type = hitby
trigger1 = 1
time = 1
value = SCA, NP, SP, HP
ignorehitpause = 1

[State 1305, HitOverride]
type = hitoverride
trigger1 = 1
time = -1
attr = SCA, AA, AP, AT
stateno = 1306
ignorehitpause = 1

[State 1305, HitOverride]
type = hitoverride
trigger1 = 1
time = -1
attr = SCA, NP, SP,HP
stateno = 1308
ignorehitpause = 1

[State 1305, Anim]
type = changeanim
trigger1 = anim != 4050 ;1305
value = 4050 ;1305

[State 1305, timevar]
type = varadd
trigger1 = 1
var(4) = 1

[State 1305, Shadows]
type = afterimage
trigger1 = !time && !prevstateno
time = 999
timegap = 1
framegap = 4
length = 12
palcontrast = 30, 60, 120
trans = add

[State 1305, Type]
type = statetypeset
trigger1 = movecontact
movetype = I

[State 1305, End]
type = changestate
trigger1 = var(4) >= 13
value = 1306

;-----------------------------------------
; Destroyed
[Statedef 1306]
type = A
physics = N
movetype = I
velset = 0, 0
ctrl = 0
sprpriority = 1
anim = 4051 ;15998

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 3000, nhb]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 1306, End]
type = destroyself
trigger1 = !animtime

;-----------------------------------------
; Reflect with projectile
[Statedef 1308]
type = A
physics = N
movetype = I
ctrl = 0
anim = 15998

[State 1308, nothitby]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 1308, reflected]
type = helper
trigger1 = !time
helpertype = normal
stateno = 1315
ID = 1315
name = "Reflected"
postype = p1
pos = 0,0 ;25, -20
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 1308, End]
type = changestate
trigger1 = 1
value = 1306   ;1305

;-----------------------------------------
; Reflected projectile Kamehameha
[Statedef 1315]
type=S
physics=N
movetype=A
ctrl=0
velset=0,0
sprpriority=4
poweradd = 100

[State 200, Ki goes SFX]
type = PlaySnd
trigger1 = !time
value = 10,0
channel = 1

[State -2, Explod];P1 Side.
type = Explod
trigger1 = !time && numexplod(13300)=0 && teamside = 1
anim = 13300
pos = 10,80
postype = left  ;p2,front,back,left,right
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13300
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

[State -2, Explod];P2 Side.
type = Explod
trigger1 = !time && numexplod(13300)=0 && teamside = 2
anim = 13301
pos = -169,80 ;-95,80
postype = right ;left
removetime = -2
supermove = 1
;scale = 0.5,0.5
sprpriority = 0
id = 13300
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
persistent = 0

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

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1315, HitOverride]
type=hitoverride
trigger1= 1
time=-1
attr=SCA,AA,AP,AT
stateno=1316
ignorehitpause=1

[State 1315, HB]
type=hitby
trigger1= 1
time=-1
value=SCA,NP,SP,HP
ignorehitpause=1

[state 1315]
type = varset
triggerall = numenemy
triggerall = enemy,authorname = "Team Z2"
trigger1 = enemy,name = "Goku Z2"
trigger2 = enemy,name = "SSJ Goku Z2"
trigger3 = enemy,name = "Vegeta Z2"
trigger4 = enemy,name = "Gohan Z2"
var(11) = 1

[State 1315, Anim];normal kamehameha FX (yellow/blue)
type=changeanim
trigger1= !time && !prevstateno && var(11)=0 && root,var(44)=0
value=1311
[State 1315, Anim];normal kamehameha FX (old purple)
type=changeanim
trigger1= !time && !prevstateno && var(11)=0 && root,var(44)>=1
value=1310
[State 1315, Anim];Vegeta kamehameha FX
type=changeanim
trigger1= !time && !prevstateno && var(11)=1
value=1010

[State 1315, Vel]
type=velset
trigger1= 1
x = 8

[State 1315, image]
type=afterimage
trigger1= !time && !prevstateno
time=999
timegap=1
framegap=2
length=5
palcontrast=50,50,200
trans=add

[State 1315, Hit]
type=hitdef
trigger1= 1
priority=4,Hit
attr = S,SP
;damage = ceil(61*root,fvar(12)), ceil(6*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 60 < 7, 7, (root,fvar(11)) * 60)), 6
animtype = Hard
hitflag = MAF
guardflag=MA
pausetime=0,10
sparkno = s7020 ;-1
guard.sparkno = -1
sparkxy = 0,0 ;Cond(numtarget,(target,const(size.ground.front)-10),0),-floor(p2dist y) ;-10,0
hitsound  = S1000,0
guardsound = S6,1
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=-10,0
ground.cornerpush.veloff=0
air.velocity=-4,-2
getpower= ifelse(p2movetype=H,40,140), 35
givepower = 35,35
envshake.time=14
envshake.freq=120
envshake.ampl=4
air.fall=1
fall.recover=1
fall.recovertime=16
yaccel=.5
airguard.ctrltime= 16
airguard.velocity= -8, -1.5
forcestand=1
p1sprpriority = 5

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 1315, Sparks] ;Cybaster way
type=null;explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=3
postype=p2
pos=(target,const(size.ground.front)-10),-floor(p2dist y)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 1315, End]
type=changestate
trigger1= movecontact
value=1316
ignorehitpause=1

[State 1315, End]
type=destroyself
trigger1=pos x!=[-200,200]

;-----------------------------------------
; Kamehameha explod/vanish
[Statedef 1316]
type=A
physics=N
movetype=I
velset=0,0
ctrl=0
sprpriority=4

[State 1308, nothitby]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 3005, anim];VS Z2 chars
type = changeanim
trigger1 = !time && var(11)=1
value = 1013
[State 3005, anim];Repel (old)
type = changeanim
trigger1 = !time && var(11)=0 && prevstateno=1315 && root,var(44)>=1
value = 1316
[State 3005, anim];Repel (yellow/blue)
type = changeanim
trigger1 = !time && var(11)=0 && prevstateno=1315 && root,var(44)=0
value = 1311

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

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1316, End]
type=destroyself
trigger1= !animtime


;Maniac Ball Dash Aura Helper
[Statedef 1405]
type=A
movetype=I
physics=N
anim=1405
sprpriority=-5
velset=0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
;flag2 = invisible
;flag3 = roundnotover
ignorehitpause = 1
;persistent =

[State 0, VarSet] ;Angledraw hack
type = VarSet
trigger1 = root,var(3)!=0
;trigger2 = ((root,var(3))-var(3))!=0 ;no direction change
;trigger1 = 1 ;!time
var(3) = Root,var(3)
;ignorehitpause =
;persistent =



[State 1405, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1
;persistent =

[state 1405,bind 1]
type = bindtoparent
;trigger1 = root,var(3)=1
trigger1 = var(3)=1
pos = 0,-50

[state 1405,bind 2]
type = bindtoparent
;trigger1 = root,var(3)=2
trigger1 = var(3)=2
pos = -30,-30

[state 1405,bind 3]
type = bindtoparent
;trigger1 = root,var(3)=3
trigger1 = var(3)=3
pos = -20,0

[state 1405,bind 4]
type = bindtoparent
;trigger1 = root,var(3)=4
trigger1 = var(3)=4
pos = 0,-50

[state 1405,bind 6]
type = bindtoparent
;trigger1 = root,var(3)=6
trigger1 = var(3)=6
pos = 0,0

[state 1405,bind 7]
type = bindtoparent
;trigger1 = root,var(3)=7
trigger1 = var(3)=7
pos = 30,-40

[state 1405,bind 8]
type = bindtoparent
;trigger1 = root,var(3)=8
trigger1 = var(3)=8
pos = 20,0

[state 1405,bind 9]
type = bindtoparent
;trigger1 = root,var(3)=9
trigger1 = var(3)=9
pos = 0,20

[State 1405, AngleDraw]
type = AngleDraw
trigger1 = 1
;value = 0*(root,var(3)=6)+45*(root,var(3)=9)+90*(root,var(3)=8)+135*(root,var(3)=7)+180*(root,var(3)=4)+225*(root,var(3)=1)+270*(root,var(3)=2)+315*(root,var(3)=3)
value = 0*(var(3)=6)+45*(var(3)=9)+90*(var(3)=8)+135*(var(3)=7)+180*(var(3)=4)+225*(var(3)=1)+270*(var(3)=2)+315*(var(3)=3)
;scale = 1,1
scale = 1,1 ;.5 ;.8
ignorehitpause = 1
;persistent = 0

[State 1405]
type=destroyself
trigger1=root,stateno!=1410 ; Combo
trigger1=root,stateno!=1460 ; EX Combo
trigger2=root,anim=1402

;Air Maniac Ball Aura Helper
[Statedef 1425]
type=A
movetype=I
physics=N
anim=1405
sprpriority=-5
velset=0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
;flag2 = invisible
;flag3 = roundnotover
ignorehitpause = 1
;persistent =


[State 1405, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1
;persistent =

[state 1405,bind]
type = bindtoparent
trigger1 = 1
pos = -20,0


[State 1405, AngleDraw]
type = AngleDraw
trigger1 = 1
value = 315
scale = 1,1
ignorehitpause = 1
;persistent =

[State 1405]
type=destroyself
trigger1=root,stateno!=1420 ; Air
trigger1=root,stateno!=1470 ; EX Air
trigger2=root,anim=1402

;MB Camera Helper
[Statedef 1426]
type=A
movetype=I
physics=N
anim=1426
sprpriority=-5
velset=0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
;flag3 = roundnotover
ignorehitpause = 1
;persistent =

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,(1*root,stateno=2600)
ignorehitpause = 1
;persistent =

[State 1405, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1
ignorehitpause = 1
;persistent =

[State 1405]
type=destroyself
trigger1=time>=20 && root,stateno!=2600 ;2502
trigger2=time>=200 && root,stateno=2600 ;2502

;EX Maniac Ball Armor
[Statedef 1480]
type = A
movetype = I
physics = N
ctrl = 0
anim = 1450
velset = 0,0
sprpriority = -10

[State 0, BindToRoot]
type = BindToRoot
trigger1 =  1
time = -1
pos = 0,0
ignorehitpause = 1
;persistent =

[State 0, HitBy]
type = HitBy
trigger1 = 1
value = SCA,NP,SP,HP
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, NotHitBy]
type = null ;NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NT,ST,HT
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, HitOverride]
type = HitOverride
trigger1 = 1
attr = SCA,NP,SP,HP
slot = 0
stateno = 1481
time = 1
forceair = 0
;ignorehitpause =
;persistent =

[State 415, DestroySelf]
type = DestroySelf
trigger1 = root,stateno!=[1450,1471]

;EX Maniac Ball Armor Vanish
[Statedef 1481]
type = A
movetype = I
physics = N
ctrl = 0
anim = 9999
velset = 0,0
sprpriority = -10

[State 415, DestroySelf]
type = DestroySelf
trigger1 = 1

;===============================================================================
;CANDY BEAM HELPER
[Statedef 1605]
type = A
physics = N
movetype = A
anim = 1605
ctrl = 0
sprpriority = 10

[State 1605, hitoverride]
type = hitoverride
trigger1 = 1
time = -1
attr = SCA, AA, AP, AT
stateno = 1606
ignorehitpause = 1
[State 1605, hitby]
type = nothitby
trigger1 = 1
time = -1
value = SCA, NP, SP, HP
ignorehitpause = 1

[State 1605, Pos]
type = bindtoroot
trigger1 = 1
pos = 0,0 ;30, -44

[State 1605, scale]
type = null ;angledraw
trigger1 = 1
scale = 0.5, 0.375 + (random / 4000.0)
ignorehitpause = 1

[State 1605, trans]
type = null;trans
trigger1 = 1
trans = addalpha
alpha = 192 + ceil(64 * random / 1000.0), 256
ignorehitpause = 1


[State 1605, grab]
type = null;reversaldef
trigger1 = (gametime % 2) = 1 && !movecontact
reversal.attr = SCA, AA, AT
damage = 0, 0
ID = 1600
hitonce = 1
p1stateno = 1640
p2stateno = 1650
pausetime = 0, 0
hitsound = s5, 33
sparkno = 2
guard.sparkno = 40
sparkxy = 0, 0
sprpriority = 3
kill = 0

[State 1605, hit]
type = hitdef
trigger1 = 1 ;(gametime % 2) = 0 && !movecontact
ID = 1600
attr = S, SP
damage = 0, 0
animtype = Hard
fall.animtype = Hard
hitflag = MAFD
guardflag = MA
priority = 4, Hit
pausetime = 0, 0
guard.dist = 320
sparkno = -1 ;2
guard.sparkno = -1 ;40
sparkxy = 0,0 ;-10, ceil(p2dist y -48)
hitsound = s600,1 ;s5, 33
guardsound = s2, 0
ground.type = High
ground.slidetime = 16
ground.hittime = 16
ground.velocity = -4, 0
ground.cornerpush.veloff = 0
air.velocity = -4, -4
airguard.velocity = -2, -3
down.velocity = -4, -4
getpower = 0,0 ;ifelse(p2movetype = H, 96, 192), 48
fall = 0
air.fall = 1
forcestand = 1
fall.recover = 0
sprpriority = 10
yaccel = 0.5
hitonce = 1
;p1stateno = 1640
;p2stateno = 1650
kill = 0
persistent = 0

[State 0, Candy Variable ON]
type = ParentVarSet
trigger1 = movehit ;movecontact
var(50)=1600
ignorehitpause = 1
persistent = 0

[State 3331, Sparks]
type=explod
triggerall = !NumExplod(1606)
trigger1= movehit && numtarget
trigger1 = !(target,ishelper)
trigger1= (target,movetype=H) && !(target,time)
anim=3303
ID = 1606
sprpriority=9
postype=p2
pos= 0,0 ;(target,const(size.ground.front)-10),floor(p2dist y)
removetime=-2
bindtime=-1
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 0, PlaySnd]
type = PlaySnd
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
value = 1550,4
channel = 5
ignorehitpause = 1
;persistent =

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "numtarget(1600) = %d | numtarget = %d"
params = NumTarget(1600), NumTarget
ignorehitpause = 1
;persistent =


[State -2, TargetState]
type= targetstate
ID=1600
triggerall= numtarget(1600)>0
trigger1 = !moveguarded&& !movereversed&&MoveHit
trigger1 = NumTarget > 0&&!(target,ishelper)
trigger1 = Target, MoveType = H
trigger1 = Target, StateTime <= 0
ignorehitpause=1
value= 1650

[State 1500, Changestate]
type=Changestate
triggerall = !animtime
triggerall= numtarget(1600)>0
triggerall= !moveguarded&& !movereversed&&movehit
triggerall= !(target,ishelper)
trigger1=Enemy(0),stateno=1650
trigger2=TeamMode = Simul
trigger2=Enemy(1),stateno=1650
trigger3=(Enemy(Enemy, TeamMode = Simul),stateno=1650)
value = 1640
ignorehitpause=1

[State 1605, End]
type = changestate
trigger1 = root,var(50)!=1600 ;enemy is not candied
;trigger1 = root, stateno != 1600 || root, movetype = H
;trigger2 = root, stateno = 1600 && root, animtime=0 ;animelemtime(7) >= 0
trigger1 = time>=39 ;!animtime
trigger2 = root, movetype = H
trigger3 = root,var(50)=1600 ;enemy is candied
trigger3 = time>=39
value = 1606
ignorehitpause = 1

;===============================================================================
;Candy beam destroy
[Statedef 1606]
type = A
physics = N
movetype = A
anim = 1606
ctrl = 0
[State 1606, End]
type = destroyself
trigger1 = !animtime ;1


;--- Normal Food anims ---
[Statedef 1640]
type = A
physics = N
movetype = I
anim = 1640+(random%6) ;(root,var(50)); (random % 6)
ctrl = 0
velset = 0, 0
sprpriority = 1

[State 3010, Vanish]
type = Explod
trigger1 = !time
anim =  1606
ID =  1606
pos = 0,0
postype = p1  ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
;bindtime = 50 ;-1
removetime = -2
scale = 1,1
sprpriority = 10
ownpal = 1
removeongethit = 0
ignorehitpause = 1

[State 0, Hack]
type = AssertSpecial
trigger1 = !time
flag = invisible
ignorehitpause = 1
;persistent =

[State 0, Candy Variable OFF]
type = ParentVarSet
trigger1 = !time
var(50)=0
ignorehitpause = 1
;persistent =


[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "numtarget(1600) = %d | numtarget = %d"
params = NumTarget(1600), NumTarget
ignorehitpause = 1
;persistent =



[State 1640, bind]
type = turn
trigger1 = numtarget(1600)
trigger1 = facing != target(1600), facing
[State 1640, bind]
type = posset
trigger1 = numtarget(1600)
x = ceil(target(1600), pos x)
y = ceil(target(1600), pos y + 1)

[State 0, BindToCandy]
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(1)>=0 && root,animelemtime(2)<0
time = 1
;facing = 0
pos = 43,0
;ignorehitpause =
;persistent =

[State 0, BindToCandy]
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(2)>=0 && root,animelemtime(3)<0
time = 1
;facing = 0
pos = 43,-33
;ignorehitpause =
;persistent =

[State 0, BindToCandy]
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(3)>=0 && root,animelemtime(4)<0
time = 1
;facing = 0
pos = 35,-38
;ignorehitpause =
;persistent =

[State 0, BindToCandy]
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(4)>=0
time = 1
;facing = 0
pos = -500,500
;ignorehitpause =
;persistent =

[State 1640, angle]
type = angleset
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1650 || target(1600), stateno = 1652
value = 0
[State 1640, spin]
type = angleset
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1651
value = ceil(20 * cos(gametime / 8.0 * pi))
[State 1640, angle]
type = angledraw
trigger1 = 1
scale = 1, 1

[State 1640, walk]
type = playsnd
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1651
value = 5, 37
channel = 1
lowpriority = 1
[State 1640, snd]
type = sndpan
trigger1 = 1
channel = 1
pan = 0
[State 1640, walk]
type = stopsnd
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno != 1651
channel = 1

[State 1640, sparks]
type = null ;explod
trigger1 = (time = [1, 16]) && !(time % 4)
anim = f2
sprpriority = 5
postype = p1
random = 50, 50
facing = ifelse(random < 500, -1, 1)
vfacing = ifelse(random < 500, -1, 1)
ownpal = 1
pausemovetime = -1
supermovetime = -1

[State 3331, Spit]
type=explod
triggerall = !NumExplod(1626)
;trigger1 = numtarget(1600)
;trigger1 = target(1600),stateno=1626
;;trigger1 = !time
trigger1 = root,anim=1623
trigger1 = root,AnimElemtime(4)=3
anim = 1626
ID = 1626
sprpriority=8
postype=p2
pos= 0,0 ;(target,const(size.ground.front)-10),floor(p2dist y)
removetime=-1
bindtime=-1
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 1640, End]
type = changestate
triggerall = root, stateno!=[1620,1623] ;Don't disable under Candy Grab
trigger1 = roundstate != 2 ;time >= 160 || roundstate != 2
trigger2 = !numtarget(1600)
trigger3 = numtarget(1600)
trigger3 = (target(1600), stateno != [1650, 1652]) || (target(1600), ishelper)
trigger4 = time >= 210
value = 1641


;--- Over ---
[Statedef 1641]
type = A
physics = N
movetype = I
ctrl = 0
sprpriority = 1
[State 1641, bind]
type = targetstate
trigger1 = 1
ID = 1600
value = 1655
[State 1641, walk]
type = stopsnd
trigger1 = 1
channel = 1

[State 3331, Sparks]
type=explod
triggerall = !NumExplod(1606)
trigger1 = !time
anim=3303 ;3712
ID = 1606
sprpriority=9
postype=p2
pos= 0,0 ;(target,const(size.ground.front)-10),floor(p2dist y)
removetime=-2
bindtime=-1
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 0, PlaySnd]
type = PlaySnd
trigger1= !time
value = 1550,4
channel = 5
ignorehitpause = 1
;persistent =

[State 0, Remove Spit]
type = RemoveExplod
trigger1 = !time
id =  1626
;ignorehitpause =
;persistent =


[State 1641, End]
type = destroyself
trigger1 = time=1

;--- MegaFood anims ---
[Statedef 1642]
type = A
physics = N
movetype = I
anim = 1640+(random%6) ;(root,var(50)); (random % 6)
ctrl = 0
velset = 0, 0
sprpriority = 1

[State 1501, NotHitBY] ;multiple hit
type = NotHitBy
Trigger1 = 1
value = SCA
Time = 1

[State 3010, Vanish]
type = null;Explod
trigger1 = !time
anim =  2905
ID =  1606
pos = 0,0
postype = p1  ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
;bindtime = 50 ;-1
removetime = -2
scale = 1,1
sprpriority = 10
ownpal = 1
removeongethit = 0
ignorehitpause = 1

[State 0, Hack]
type = AssertSpecial
trigger1 = !time
flag = invisible
ignorehitpause = 1
;persistent =

[State 0, Candy Variable OFF]
type = ParentVarSet
trigger1 = !time
var(50)=0
ignorehitpause = 1
;persistent =


[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "targetCB= %d targetMegaCB= %d"
params = numtarget(1600), numtarget
;ignorehitpause =
;persistent =



[State 1640, bind]
type = turn
trigger1 = numtarget(1600)
trigger1 = facing != target(1600), facing
[State 1640, bind]
type = posset
trigger1 = numtarget(1600)
x = ceil(target(1600), pos x)
y = ceil(target(1600), pos y + 1)

[State 1640, bind] ;Mega Candy Beam
type = posset
triggerall = root,var(43)=2900
trigger1 = !numtarget(1600)
trigger1 = numtarget
trigger1 = root, stateno!=[1621,1622]
x = ceil(target, pos x)
y = ceil(target, pos y + 1)

[State 0, EnvColor]
type = null;EnvColor
triggerall = root,var(43)=2900
triggerall = Numtarget
trigger1 = root,movehit
;trigger1 = target,time=0 ;need to find a way to trigger it 1 tick only
value = 255,255,255
time = 1
;under = 0
ignorehitpause = 1
persistent = 0   ;this fixes but prevents repeating again

[State 0, BindToCandy] ;Candy Grab
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(1)>=0 && root,animelemtime(2)<0
time = 1
;facing = 0
pos = 43,0
;ignorehitpause =
;persistent =

[State 0, BindToCandy] ;Candy Grab
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(2)>=0 && root,animelemtime(3)<0
time = 1
;facing = 0
pos = 43,-33
;ignorehitpause =
;persistent =

[State 0, BindToCandy] ;Candy Grab
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(3)>=0 && root,animelemtime(4)<0
time = 1
;facing = 0
pos = 35,-38
;ignorehitpause =
;persistent =

[State 0, BindToCandy] ;Candy Grab
type = BindToRoot
triggerall = !numtarget(1600)
triggerall = root, stateno=1621
trigger1 = root,animelemtime(4)>=0
time = 1
;facing = 0
pos = -500,500
;ignorehitpause =
;persistent =

[State 1640, angle]
type = angleset
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1650 || target(1600), stateno = 1652
value = 0
[State 1640, spin]
type = angleset
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1651
value = ceil(20 * cos(gametime / 8.0 * pi))
[State 1640, angle]
type = angledraw
trigger1 = 1
scale = 1, 1

[State 1640, walk]
type = playsnd
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno = 1651
value = 5, 37
channel = 1
lowpriority = 1
[State 1640, snd]
type = sndpan
trigger1 = 1
channel = 1
pan = 0
[State 1640, walk]
type = stopsnd
trigger1 = numtarget(1600)
trigger1 = target(1600), stateno != 1651
channel = 1

[State 1640, sparks]
type = null ;explod
trigger1 = (time = [1, 16]) && !(time % 4)
anim = f2
sprpriority = 5
postype = p1
random = 50, 50
facing = ifelse(random < 500, -1, 1)
vfacing = ifelse(random < 500, -1, 1)
ownpal = 1
pausemovetime = -1
supermovetime = -1

[State 3331, Spit]
type=explod
triggerall = !NumExplod(1626)
;trigger1 = numtarget(1600)
;trigger1 = target(1600),stateno=1626
;;trigger1 = !time
trigger1 = root,anim=1623
trigger1 = root,AnimElemtime(4)=3
anim = 1626
ID = 1626
sprpriority=8
postype=p2
pos= 0,0 ;(target,const(size.ground.front)-10),floor(p2dist y)
removetime=-1
bindtime=-1
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 0, Hack]
type = AssertSpecial
trigger1 = root, stateno=1623
flag = invisible
ignorehitpause = 1
;persistent =

[State 1501, 7] ;multiple hit
type = TargetState
triggerall = root,var(43)=2900 ;Mega Candy Beam
;trigger1 = !numtarget(1600)
trigger1 = numtarget
trigger1 = target, stateno = [5000,5099]
;trigger1 = target,prevstateno != [1531,1539]
;trigger1 = target,prevstateno != [1542,1543]
trigger1 = target, stateno != [1650, 1652]
trigger1 = target, life != 0
ignorehitpause=1
value = 1653 ;1642 ;1528

[State 1640, End]
type = changestate
triggerall = root, stateno!=[1620,1623] ;Don't disable under Candy Grab
trigger1 = roundstate != 2
trigger2 = !numtarget(1600)
trigger2 = root,var(43)=0 && root,NumHelper(9996)=0 ;Disable after MCB
trigger3 = numtarget(1600)
trigger3 = (target(1600), stateno != [1650, 1653]) || (target(1600), ishelper)
trigger3 = root,var(43)=0 && root,NumHelper(9996)=0 ;Disable after MCB
trigger4 = time >= 210 && root,var(43)=0 && root,NumHelper(9996)=0 ;Disable after MCB limit
value = 1641

;Jumpscare Face Helper
[Statedef 1862]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = 10

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = 0
y = -(GameHeight/2)+(GameHeight-(root,ScreenPos Y))
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1862
;elem = 1
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[0,2]
scale = 1.3,1.3
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[3,5]
scale = 1.2,1.2
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[6,8]
scale = 1.1,1.1
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=9
;value = 1
scale = 1,1
;ignorehitpause =
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time=300
;ignorehitpause =
;persistent =

;Jumpscare Eye Helper
[Statedef 1863]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = 11

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = 0
y = -(GameHeight/2)+(GameHeight-(root,ScreenPos Y))
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 1863
;elem = 1
;ignorehitpause =
;persistent =

[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[0,2]
scale = 1.3,1.3
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[3,5]
scale = 1.2,1.2
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=[6,8]
scale = 1.1,1.1
;ignorehitpause =
;persistent =
[State 0, AngleDraw]
type = AngleDraw
trigger1 = time=9
;value = 1
scale = 1,1
;ignorehitpause =
;persistent =

[State 0, Offset]
type = Offset
trigger1 = time>10
x = 2*cos(time-10)
;ignorehitpause =
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time=300
;ignorehitpause =
;persistent =


;Toilet Helper
[Statedef 3903]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = 8 ;-10

[State 0, Turn]
type = Turn
trigger1 = !time
trigger1 = (root,facing)!=facing
;ignorehitpause =
persistent = 0


[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 3903
;elem = 1
;ignorehitpause =
;persistent =

[State 0, ChangeAnim] ;door opens
type = ChangeAnim
;trigger1 = time=20
trigger1 = Anim=3903
trigger1 = root,Anim=100
trigger1 = root,AnimelemTime(1)=0
value = 3904
;value = 0
;elem = 1
;ignorehitpause =
persistent = 0

[State 0, PlaySnd] ;door open
type = PlaySnd
trigger1 = Anim=3904
trigger1 = AnimElemtime(1)=0
value = 3900,0
channel = 8
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 3010, door]
type = Explod
triggerall = !NumExplod(3906)
trigger1 = Anim=3904
trigger1 = AnimElemTime(1)=0
anim =  3906
ID =  3906
pos = 0,0
postype = p1 ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -9
ownpal = 1
removeongethit = 0
ignorehitpause = 1
persistent = 0

[State 0, ChangeAnim] ;door closes
type = ChangeAnim
trigger1 = Anim=3904
;trigger1 = time=80
trigger1 = abs(root,ScreenPos X - ScreenPos X)=[0,20]
value = 3903
;value = 0
;elem = 1
;ignorehitpause =
persistent = 0

[State 0, PlaySnd] ;door closes
type = PlaySnd
trigger1 = Anim=3903
trigger1 = root,Anim=9999
trigger1 = root,AnimElemtime(1)=0
value = 3900,0
channel = 8
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 0, Remove door]
type = RemoveExplod
trigger1 = Anim=3903
id = 3906

[State 0, ChangeAnim] ;shake
type = ChangeAnim
;trigger1 = time=100
trigger1 = Anim=3903
;trigger1 = abs(root,ScreenPos X - ScreenPos X)=[0,20]
trigger1 = root,Anim=9999
value = 3905
;value = 0
;elem = 1
;ignorehitpause =
persistent = 0

[State 0, PlaySnd] ;toilet shake
type = PlaySnd
trigger1 = Anim=3905
trigger1 = AnimElemtime(1)=0
value = 3900,2
channel = 7
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 0, StopSnd]  ;toilet shake
type = StopSnd
trigger1 = Anim!=3905
channel = 7
;ignorehitpause =
;persistent =


[State 0, ChangeAnim] ;liftoff or Fart
type = ChangeAnim
trigger1 = Anim=3905
;trigger1 = time>=120
trigger1 = root,Anim=9999
;trigger1 = root,AnimElemTime(1)=60
trigger1 = root,Time>=260
value = IfElse(random<333,3903,3908)
;value = 0
;elem = 1
;ignorehitpause =
persistent = 0

[State 0, VelSet]
type = VelSet
;trigger1 = time=150
trigger1 = Anim=3903
trigger1 = root,Anim=9999
;trigger1 = root,AnimElemTime(1)=90
trigger1 = root,Time>=290
y = -2.8
;ignorehitpause =
;persistent =

[State 3010, exhaust]
type = Explod
triggerall = !NumExplod(3907)
trigger1 = vel y!=0
anim =  3907
ID =  3907
pos = 0,0
postype = p1 ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -9
ownpal = 1
removeongethit = 0
ignorehitpause = 1
persistent = 0

[State 181, Buu Away!]
type = playsnd
trigger1 = NumExplod(3907)
value = 182,random%3
volumescale = 300
channel = 0
persistent = 0

[State 0, PlaySnd] ;rocket exhaust
type = PlaySnd
trigger1 = NumExplod(3907)
value = 3900,1
channel = 9
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 0, VelAdd]
type = VelAdd
;trigger1 = time>150
trigger1 = Anim=3903
trigger1 = root,Anim=9999
;trigger1 = root,AnimElemTime(1)>90
trigger1 = root,Time>=290
y = -0.25
;ignorehitpause =
;persistent =

[State 0, Offset]
type = Offset
trigger1 = vel y!=0
x = 2*cos(time)
;ignorehitpause =
;persistent =

[State 181, Mmmmmmm!]
type = playsnd
trigger1 = Anim=3908
trigger1 = root,Time=295
value = 3900,5+random%2
volumescale = 300
persistent = 0

[State 0, PlaySnd] ;toilet shake
type = PlaySnd
triggerall = Anim=3908
trigger1 = root,Time=295
trigger2 = root,Time=460
value = 3900,2
channel = 10
;lowpriority = 1
;ignorehitpause =


[State 0, PlaySnd] ;fart 1
type = PlaySnd
trigger1 = Anim=3908
trigger1 = root,Time=360
value = 3900,11
channel = 9
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 0, PlaySnd] ;fart 2
type = PlaySnd
trigger1 = Anim=3908
trigger1 = root,Time=450
value = 3900,10
channel = 9
;lowpriority = 1
;ignorehitpause =
persistent = 0

[State 9105, DestroySelf]
type = DestroySelf
trigger1 = ScreenPos Y <-100 ;Root,StateNo=0
trigger2 = Anim=3908 && root,Time>=500

; Intro 2 Warp hole helper
[Statedef 1921]
type = A
movetype = I
physics = N
ctrl = 0
anim = 1921
velset = 0,0
sprpriority = -10

[State 1921, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
;ignorehitpause =
;persistent =


[State 1921, 1] ;Freeze animation until PreIntro is over
type = ChangeAnim
trigger1 = RoundState = 0
value = 1921

[State 1921, DestroySelf]
type = DestroySelf
trigger1 = !animtime

; INTRO 4 - Skinny smoke helper
[Statedef 1942]
type = A
movetype = I
physics = N
ctrl = 0
anim = 1942
velset = 0,0
sprpriority = 10

[State 0, PlaySnd] ;smoke
type = PlaySnd
trigger1 = !time
value = 1001,0
channel = 8
lowpriority = 1
;ignorehitpause =
;persistent =

[State 0, ChangeAnim]  ;to smoke loop
type = ChangeAnim
triggerall = Anim=1942
trigger1 = !animtime
value = 1943
;elem = 1
;ignorehitpause =
;persistent =

[State 1921, DestroySelf]
type = DestroySelf
triggerall = Anim=1943
trigger1 = time=150

;HR TEMP BLAST
[Statedef 2010]
type    = S
movetype= A
physics = N
;anim = 1010
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 0, VarSet]
type = VarSet
triggerall = IsHelper(2010)
trigger1 = !time
var(15) = root,var(15)
;ignorehitpause =
;persistent =

[State 4106, Launch Sound]
type = PlaySnd
triggerall = IsHelper(2010)
trigger1 = !time
value = 2010, 1

[State 3302, anim]
type = changeanim
triggerall = IsHelper(2010)
trigger1 = !time
value = 2010

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
;flag2 = invisible
ignorehitpause = 1

[State 4106, transparency]
type = Trans
trigger1 = root,var(2)=1
trans = addalpha
alpha = 200,128
ignorehitpause = 1

[State 4106, Turn]
type = null;AngleDraw
trigger1 = vel y<0
value = 180

[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 2011
attr = SCA, NP, SP, HP
ignorehitpause = 1


[State 4106, Velocity Onscreen]
type = VelSet
triggerall = IsHelper(2010)
trigger1 = !time
x = 0 ;0.0 + Tan(random%2) - Tan(random%2)
y = -18

[State 4106, Velocity Offscreen]
type = VelSet
triggerall = IsHelper(2011)
trigger1 = !time
x = 0 ;0.0 + Tan(random%2) - Tan(random%2)
y = 0

[State 3302, UP to DOWN anim]
type = changeanim
triggerall = IsHelper(2011)
trigger1 = !time
value = 2011

[State 4106, Velocity]
type = VelSet
trigger1 = Movehit
y = 0

[State 4106, Hitdef]
type = HitDef
;trigger1 = 1
trigger1 = time >= 45
trigger1 = Screenpos Y >5
attr = A, HP
animtype  = hard
;damage    = 30,3 ;ceil(16*root,fvar(12)), ceil(2*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 15, 15, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA ;HA ;MA
hitflag = MAFD
pausetime = 0,12
guard.pausetime = 2,1
sparkno = -1 ;S3435 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s1000,0
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 15
ground.hittime  = 15
guard.slidetime = 7
guard.hittime  = 7
ground.velocity = -2,0
guard.velocity = -2
air.velocity = -2,5
airguard.velocity = -2, 2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
air.fall = 0
fall.recover = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
;p2stateno = 4112 ;4113
;kill = 0
persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3302, Sparks] ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
pos=(target,const(size.ground.front)),ceil((Helper(2010),pos y)-(target,pos y)) ;-62 ;-77;floor(p2dist y)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100


[State 4106, Sound]
type = PlaySnd
trigger1 = movecontact
value = 3330, 1

[State 4106, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 0, PosSet]
type = null;PosAdd
trigger1 = time = 45
x = 30*var(15)
;ignorehitpause =
;persistent =

[State 3302, UP to DOWN anim]
type = changeanim
triggerall = IsHelper(2010)
trigger1 = time=45
value = 2011

[State 4106, Velocity ONSCREEN]
type = VelSet
triggerall = IsHelper(2010)
trigger1 = time = 45
x = 0.0 + Tan(random%2) - Tan(random%2)
;x = 0.0 + Tan(random%(root,var(15))) - Tan(random%(root,var(15)))
y = 18 + Tan(random%2) - Tan(random%2)

[State 4106, Velocity OFFSCREEN]
type = VelSet
triggerall = IsHelper(2011)
trigger1 = time = 45
x = 0.0 + Tan(random%2) - Tan(random%2)
;x = 0.0 + Tan(random%(root,var(15))) - Tan(random%(root,var(15)))
y = 16 + Tan(random%4) - Tan(random%4)

[State 0, PosSet]
type = PosSet
trigger1 = time=45+5*var(15)
x = (enemynear,Pos X);+(random%10)*(root,var(15))
;ignorehitpause =
;persistent =

[State 4106, Turn]
type = null ;AngleDraw
trigger1 = vel y>0
value = -90

[State 3302, end]   ;Contact
type = changestate
trigger1 = movecontact
trigger2 = pos Y >= 0
value = 2011

[State 4106, End]
type = null ;destroyself
trigger1 = (pos y!=[-260,600])
trigger2 = time>100

;-----------------------------------------
; HR TEMP Blast explod/vanish
[Statedef 2011]
type    = A
movetype= A
physics = N
anim = 1013  ;TEMP
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 4106, Ground Hit Sound]
type = PlaySnd
trigger1 = !time
value = 2010, 2

[State 4106, Turn]
type = AngleDraw
trigger1 = 1
value = -90

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1061, End]
type = destroyself
trigger1= !animtime

;VICE SHOT TEMP BLAST
[Statedef 2150]
type    = S
movetype= A
physics = N
anim = 2150
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 4106, Launch Sound]
type = PlaySnd
trigger1 = !time && !prevstateno
value = 2150, 0

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1


[State 0, Explod]
type = Explod
triggerall = !NumExplod(2150)
trigger1 = !time
anim = 2150
ID = 2150
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
supermovetime = 9999 ;
pausemovetime = 9999 ;0
scale = 1,1
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1
;trans =
;persistent =
;supermove = 0
;pausemove = 0

[State 4106, transparency]
type = Trans
trigger1 = root,var(2)=1
trans = addalpha
alpha = 200,128
ignorehitpause = 1

[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = ifelse((root,var(36))<5,2152,2151)
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 4106, Velocity]
type = VelSet
trigger1 = !time
x = 6
y = 6

[State 4106, Hitdef]
type = HitDef
trigger1 = 1
attr = A, HP
animtype  = hard
;damage    = 30,3 ;ceil(16*root,fvar(12)), ceil(2*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 15, 15, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 5,10
guard.pausetime = 2,1
sparkno = -1 ;S3435 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s2150,1
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 15
ground.hittime  = 15
guard.slidetime = 7
guard.hittime  = 7
ground.velocity = -2,0
guard.velocity = -2
air.velocity = -2,5
airguard.velocity = -2, 2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
fall = ((root,var(36))>=5)
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
p1sprpriority = 5
;kill = 0
;persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3302, Sparks] ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
;pos=(target,const(size.ground.front)-2),-92 ;-77;floor(p2dist y)
pos=(target,const(size.ground.front)-15+random%10),ceil((Helper(2150),pos y)-(target,pos y)-random%10)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 4106, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 3302, respawn]   ;Contact
type = changestate
trigger1 = (root,var(36))<5 ;HitCount >=5
trigger1 = movecontact
value = 2152
ignorehitpause = 1

[State 3302, end]   ;Contact
type = changestate
trigger1 = (root,var(36))>=5 ;HitCount >=5
trigger1 = movecontact
trigger2 = pos Y >= 0
value = 2151

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100
id = 2150
ignorehitpause = 1
;persistent =

[State 4106, End]
type = destroyself
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100

;-----------------------------------------
; VICE SHOT TEMP Blast explod/vanish
[Statedef 2151]
type    = A
movetype= A
physics = N
anim = 2152 ;2202  ;TEMP
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =


[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = time=1
id = 2150
ignorehitpause = 1
;persistent =


[State 4106, Ground Hit Sound]
type = PlaySnd
trigger1 = !time
value = 2010, 2

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1061, End]
type = destroyself
trigger1= P2MoveType !=H
trigger1= Time>=15;!animtime
trigger2 = Numenemy
trigger2 = enemynear,alive=0
trigger2 = !NumExplod(2150)

;===================================================
; empty state for respawning the VS
[Statedef 2152]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1= !time
var(36) = 1
;ignorehitpause =
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = !time
value = IfElse((root,var(36)<=5),2150,2152)
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 1061, End]
type = destroyself
trigger1= time=1

;======================================================================
;TELEPORT AFTERIMAGE HELPER
[Statedef 2160]
type = A
movetype = I
physics = N
sprpriority = 1
velset = 0,0

[State 3000, nhb]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 3033, save anim]
type = null;varset
trigger1 = !time
var(1) = root,var(33)

[state 17100,bind]
type = null;bindtoparent
trigger1 = !time
pos = 0,0

[State 1406, No Shadow]
type = null; AssertSpecial
trigger1 = 1
flag = noshadow

[State 4001, Air anim]
type = ChangeAnim
triggerall = !time
trigger1 = root,stateno=[2200,2201]
trigger2 = root,stateno=[2460,2461]
value = 44

[State 4001, Ground anim]
type = ChangeAnim
triggerall = !time
trigger1 = root,stateno=[2100,2101]
trigger2 = root,stateno=[2400,2401]
value = 0


[State 4001, end anim]
type = null;ChangeAnim
trigger1 = animtime = -1
value = var(1)
elem = animelemno(0)

[State 1415, Hit Floor]
type = trans
trigger1 = time>10 && time<36
trans = addalpha
;alpha = 256-10*(time-10), 10*(time-10)
alpha = 128-5*(time-10), 5*(time-10)

[State 17100]
type = destroyself
trigger1 = time=36 ; !animtime


;AIR VICE SHOT TEMP BLAST
[Statedef 2250]
type    = S
movetype= A
physics = N
anim = 2150
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 4106, Launch Sound]
type = PlaySnd
trigger1 = !time && !prevstateno
value = 2150, 0

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1

[State 0, Explod]
type = Explod
triggerall = !NumExplod(2150)
trigger1 = !time
anim = 2150
ID = 2150
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
supermovetime = 9999 ;
pausemovetime = 9999 ;0
scale = 1,1
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1
;trans =
;persistent =
;supermove = 0
;pausemove = 0

[State 4106, transparency]
type = Trans
trigger1 = root,var(2)=1
trans = addalpha
alpha = 200,128
ignorehitpause = 1

[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = ifelse((root,var(36))<5,2252,2251)
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 4106, Velocity]
type = VelSet
trigger1 = !time
x = 6
;y = 6

[State 4106, Hitdef]
type = HitDef
trigger1 = 1
attr = A, HP
animtype  = hard
;damage    = 30,3 ;ceil(16*root,fvar(12)), ceil(2*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 30 < 15, 15, (root,fvar(11)) * 30)), 3
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 5,10
guard.pausetime = 2,1
sparkno = -1 ;S3435 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s2150,1
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 15
ground.hittime  = 15
guard.slidetime = 7
guard.hittime  = 7
ground.velocity = -2,0
guard.velocity = -2
air.velocity = -2,5
airguard.velocity = -2, 2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
fall = ((root,var(36))>=5)
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
p1sprpriority = 5
;kill = 0
;persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3302, Sparks]   ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
;pos=(target,const(size.ground.front)-2),-62 ;-77;floor(p2dist y)
pos=(target,const(size.ground.front)-15+random%10),ceil((Helper(2150),pos y)-(target,pos y)-random%10)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 4106, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 3302, respawn]   ;Contact
type = changestate
trigger1 = (root,var(36))<5 ;HitCount >=5
trigger1 = movecontact
value = 2252
ignorehitpause = 1

[State 3302, end]   ;Contact
type = changestate
trigger1 = (root,var(36))>=5 ;HitCount >=5
trigger1 = movecontact
trigger2 = pos Y >= 0
value = 2251

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100
id = 2150
ignorehitpause = 1
;persistent =

[State 4106, End]
type = destroyself
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100

;-----------------------------------------
; AIR VICE SHOT TEMP Blast explod/vanish
[Statedef 2251]
type    = A
movetype= A
physics = N
anim = 2152 ;2202  ;TEMP
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, AngleDraw] ;TEMP
type = AngleDraw
trigger1 = 1
value = 35
scale = 1,1
ignorehitpause = 1
;persistent =


[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = time=1
id = 2150
ignorehitpause = 1
;persistent =


[State 4106, Ground Hit Sound]
type = PlaySnd
trigger1 = !time
value = 2010, 2

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1061, End]
type = destroyself
trigger1= P2MoveType != H
trigger1= Time>=15;!animtime
trigger2 = Numenemy
trigger2 = enemynear,alive=0
trigger2 = !NumExplod(2150)

;===================================================
; empty state for respawning the VS
[Statedef 2252]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1= !time
var(36) = 1
;ignorehitpause =
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = !time
value = IfElse((root,var(36)<=5),2250,2252)
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 1061, End]
type = destroyself
trigger1= time=1

;==========================================================

; GACKT HELPER
; 2310 - Main Helper
; 2311 - Tail
; 2312 - Damage
; 2313 - Body
; 2314 - Tip
; 2315 - Empty state for respawn
;GACKT HELPER
[Statedef 2310]
type = A
physics = N
movetype = I
anim = 9999
ctrl = 0
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 2310, BindToRoot Launch]
type = BindToRoot
trigger1 = root,Anim=2301
time = 1
;facing = 0
pos = 90,-120
;pos = 140,-69
ignorehitpause = 1
;persistent = 0

[State 2310, BindToRoot UUF]
type = BindToRoot
trigger1 = root,Anim=2302
time = 1
;facing = 0
pos = 92,-117
ignorehitpause = 1
;persistent = 0

[State 2310, BindToRoot UFF]
type = BindToRoot
trigger1 = root,Anim=2303
time = 1
;facing = 0
pos = 92,-108
ignorehitpause = 1
;persistent = 0

[State 2310, BindToRoot FFF0]
type = BindToRoot
trigger1 = root,Anim=2304
time = 1
;facing = 0
pos = 95,-90
ignorehitpause = 1
;persistent = 0

[State 2310, BindToRoot FFF]
type = BindToRoot
trigger1 = root,Anim=2305
time = 1
;facing = 0
pos = 95,-70 ;-80
ignorehitpause = 1
;persistent = 0

[State 2310, Gackt Beam]
type = helper
trigger1 = !time
helpertype = normal
stateno = 2311
ID = 2311
name = "gackt beam"
postype = p1
pos = 0,0
ownpal = 1

[State 2310, Scale Tracker X]
type = VarAdd
triggerall = var(1)<23
trigger1 = NumHelper(2312)
trigger1 = Helper(2312),vel x>0
trigger2 = root,vel x<0
trigger2 = (root,BackEdgeDist>30) ;|| (root,AnimElemTime(5)<30)
;trigger2 = rootdist x<30
var(1) = 1
ignorehitpause = 0
;persistent =

[State 2310, Scale Tracker Y]
type = VarAdd
;trigger1 = var(2)<10
trigger1 = NumHelper(2311)
trigger1 = Helper(2311),var(3)>=(root,var(21))  ; hit 7 times
;trigger2 = time>60
var(2) = 1
ignorehitpause = 0
;persistent =


[State 2310, End]
type = destroyself
trigger1 = var(2)>=10
trigger2 = root,stateno!=[2301,2302]

;Gackt Beam
[Statedef 2311]
type = A
physics = N
movetype = A
;anim = 2312
ctrl = 0
sprpriority = 4
hitcountpersist = 1
movehitpersist = 1

[State 2311, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1
;persistent =

[State 2311, BindToParent]
type = BindToParent
trigger1 = 1
time = 1
pos = 0,0
ignorehitpause = 1
;persistent =

[State 2311, ChangeAnim 1st - UUU]
type = ChangeAnim
trigger1 = !time && !prevstateno
value = 2315 ;UUU
ignorehitpause = 1
;persistent =

[State 2311, ChangeAnim 2nd - UUF]
type = ChangeAnim
trigger1 = root,Anim=2302
;trigger1 = Anim=2314 && root,Anim=2302
value = 2314 ;UUF
;elem = 1
ignorehitpause = 1
persistent = 0

[State 2311, ChangeAnim 3rd - UFF]
type = ChangeAnim
trigger1 = root,Anim=2303
;trigger1 = Anim=2313 && root,Anim=2303
value = 2313 ;UUF
;elem = 1
ignorehitpause = 1
persistent = 0

[State 2311, ChangeAnim 3rd - FFF0]
type = ChangeAnim
trigger1 = root,Anim=2304
;trigger1 = Anim=2312 && root,Anim=2304
value = 2312 ;UUF
;elem = 1
ignorehitpause = 1
persistent = 0

[State 2311, ChangeAnim 4th - FFF]
type = ChangeAnim
trigger1 = root,Anim=2305
;trigger1 = Anim=2312 && root,Anim=2304
value = 2311 ;UUF
;elem = 1
ignorehitpause = 1
persistent = 0

[State 2311, ChangeAnim after spawn - UUF]
type = ChangeAnim
trigger1 = root,Anim=2302
trigger1 = !time && prevstateno=2315
value = 2314 ;var(1)
elem = var(2)
ignorehitpause = 1
;persistent =
[State 2311, ChangeAnim after spawn - UFF]
type = ChangeAnim
trigger1 = root,Anim=2303
trigger1 = !time && prevstateno=2315
value = 2313 ;var(1)
elem = var(2)
ignorehitpause = 1
;persistent =
[State 2311, ChangeAnim after spawn - FFF0]
type = ChangeAnim
trigger1 = root,Anim=2304
trigger1 = !time && prevstateno=2315
value = 2312 ;var(1)
elem = var(2)
ignorehitpause = 1
;persistent =
[State 2311, ChangeAnim after spawn - FFF]
type = ChangeAnim
trigger1 = root,Anim=2305
trigger1 = !time && prevstateno=2315
value = 2311 ;var(1)
elem = var(2)
ignorehitpause = 1
;persistent =

[State 2311, ChangeAnim after spawn] ;original code, but failed when hits were not tracked against enemy helpers
type = null;ChangeAnim
trigger1 = !time && prevstateno=2315
value = var(1)
elem = var(2)
ignorehitpause = 1
;persistent =

[State 2311, AngleDraw UUU]
type = AngleDraw
trigger1 = NumHelper(2310) ;1
trigger1 = Anim=2315
value = 45
scale = 1,1-(Helper(2310),var(2))/10.0
ignorehitpause = 0
;persistent =

[State 2311, AngleDraw UUF]
type = AngleDraw
trigger1 = NumHelper(2310) ;1
trigger1 = Anim=2314
value = 40
scale = 1,1-(Helper(2310),var(2))/10.0
ignorehitpause = 0
;persistent =

[State 2311, AngleDraw UFF]
type = AngleDraw
trigger1 = NumHelper(2310) ;1
trigger1 = Anim=2313
value = 20
scale = 1,1-(Helper(2310),var(2))/10.0
ignorehitpause = 0
;persistent =

[State 2311, AngleDraw FFF0]
type = AngleDraw
trigger1 = NumHelper(2310) ;1
trigger1 = Anim=2312
value = 12
scale = 1,1-(Helper(2310),var(2))/10.0
ignorehitpause = 0
;persistent =

[State 2311, AngleDraw FFF]
type = AngleDraw
trigger1 = NumHelper(2310) ;1
trigger1 = Anim=2311
value = 0
scale = 1,1-(Helper(2310),var(2))/10.0
ignorehitpause = 0
;persistent =


[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
trigger1 = var(1):=Anim
trigger1 = var(2):=AnimElemno(0)
slot = 1
time = 1
stateno = 2315
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 2311, 1st hit]
type = hitdef
trigger1 = !prevstateno
trigger1 = var(3)<(root,var(21));7
attr = S,HP
hitflag = MAFD
guardflag = MA
priority = 7,Hit
;damage = ceil(8/(abs(((enemynear,ScreenPos X)-(root,ScreenPos X))/600.0))),ceil(4/(abs(((enemynear,ScreenPos X)-(root,ScreenPos X))/600.0))) ;10,0 ;ceil(13*root,fvar(12)), 3; abs((target,ScreenPos X)-(root,ScreenPos X))
;damage = ceil(40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))),ceil(10*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X))))
damage = ceil(ifElse(root,fvar(11) * (40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))) < 20, 20, (root,fvar(11)) * (40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))))), ceil(7*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X))))
getpower = 0,0
givepower = 20,20
pausetime = 0,10
animtype = Back
air.animtype = Back
fall.animtype = Back
ground.type = High
air.type = Low
ground.hittime = 16
ground.slidetime = 16
guard.hittime = 16
air.hittime = 13
airguard.ctrltime = 16
ground.velocity= -2,0
guard.velocity = -9
air.velocity = -5.5,3.9
airguard.velocity = -5.5, 1.5
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
air.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
yaccel = .5
fall=0
air.fall = 1
fall.recover = 0
fall.recovertime = 13
sparkno = -1
hitsound   = s2310,2
guardsound = S6,1
envshake.time = 16
envshake.ampl = 6
envshake.freq = 100
forcestand = 1
;palfx.sinadd=64,64,64,4
;palfx.mul=128,128,128
;palfx.time=32
p1sprpriority = 5
p2sprpriority = 3
;kill = 0
getpower = 0,0
ID = 2310
;chainID = 2310
;persistent = 0

[State 2311, last hit]
type = hitdef
trigger1 = prevstateno=2315
trigger1 = time>6
trigger1 = var(3)<(root,var(21));7
attr = S,HP
hitflag = MAFD
guardflag = MA
priority = 7,Hit
;damage = ceil(8/(abs(((enemynear,ScreenPos X)-(root,ScreenPos X))/600.0))),ceil(4/(abs(((enemynear,ScreenPos X)-(root,ScreenPos X))/600.0))) ;7,0 ;ceil(13*root,fvar(12)), 3
;damage = ceil(40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))),ceil(10*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X))))
damage = ceil(ifElse(root,fvar(11) * (40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))) < 20, 20, (root,fvar(11)) * (40*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X)))))), ceil(7*((399/400.0)**abs((enemynear,ScreenPos X)-(root,ScreenPos X))))
getpower = 0,0
givepower = 20,20
pausetime = 0,10
animtype = Back
air.animtype = Back
fall.animtype = Back
ground.type = High
air.type = Low
ground.hittime = 16
ground.slidetime = 16
guard.hittime = 16
air.hittime = 13
airguard.ctrltime = 16
ground.velocity= -2,0
guard.velocity = -9
air.velocity = -5.5,3.9
airguard.velocity = -5.5, 1.5
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
air.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
yaccel = .5
fall=0
air.fall = 1
fall.recover = 0
fall.recovertime = 13
sparkno = -1
hitsound   = s2310,2
guardsound = S6,1
envshake.time = 16
envshake.ampl = 6
envshake.freq = 100
forcestand = 1
;palfx.sinadd=64,64,64,4
;palfx.mul=128,128,128
;palfx.time=32
p1sprpriority = 5
p2sprpriority = 3
kill = 1
getpower = 0,0
ID = 2310
;chainID = 2310
;persistent = 0

[State -2, Special Projectile]
type = Projectile
;trigger1 = movehit
;trigger1 = numtarget
;trigger1 = target,alive=0
triggerall = root,NumProjID(3410)=0
trigger1 = root,winKO=1
ProjID = 3410
projanim = 9999
projremovetime = 10
postype = p2
offset = 0, -30
attr = A, NP
hitflag = MAF
guardflag =
pausetime = 0, 0
sparkno = -1
hitsound = -1
numhits = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 2311, Sparks]     ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
ID = 7020
anim=7020
sprpriority=10
postype=p2
pos=(target,const(size.ground.front)-random%20),-62-random%20 ;-77;floor(p2dist y)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
;persistent=0
pausemovetime=100
supermovetime=100

[State 2311, Capture Anim]
type = VarSet
trigger1 = movecontact
var(1) = Anim
ignorehitpause = 1
;persistent =

[State 2311, Capture AnimElemno]
type = VarSet
trigger1 = movecontact
var(2) = AnimElemno(0)
ignorehitpause = 1
;persistent =


[State 2311, to spawn]
type = ChangeState
triggerall = var(3)<(root,var(21));7
trigger1 = movecontact ;&& numtarget  ;new
trigger1= HitPauseTime = 0 ;target,HitShakeOver=0
;trigger2 = !movehit  ;prevent infinite loop
trigger2 = Anim=2311
;trigger2 = !animtime
trigger2 = time >= 12
value = 2315
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 2311, End]
type = destroyself
trigger1 = !NumHelper(2310)

;Empty state for spawning Gackt
[Statedef 2315]
type = A
physics = N
movetype = I
ctrl = 0

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

[State 2315, VarAdd] ;Number of hits
type = VarAdd
trigger1 = !time
var(3) = 1
ignorehitpause = 1
persistent = 0

[State 2315, ChangeState]
type = ChangeState
trigger1 = !time
value = 2311
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

;LV2 G.VICE SHOT TEMP BLAST
[Statedef 2450]
type    = S
movetype= A
physics = N
anim = 2150
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1 = MoveHit
var(35) = 1
[State 4106, Launch Sound]
type = PlaySnd
trigger1 = !time && !prevstateno
value = 2150, 0

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1


[State 0, Explod]
type = Explod
triggerall = !NumExplod(2150)
trigger1 = !time
anim = 2150
ID = 2150
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = 0
scale = 1,1
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1
;trans =
;persistent =
;supermove = 0
;pausemove = 0

[State 4106, transparency]
type = Trans
trigger1 = root,var(2)=1
trans = addalpha
alpha = 200,128
ignorehitpause = 1

[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = ifelse((root,var(36))<5,2452,2451)
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 4106, Velocity]
type = VelSet
trigger1 = !time
x = 6
y = 6

[State 4106, Hitdef]
type = HitDef
trigger1 = 1
attr = A, HP
animtype  = hard
;damage    = 30,3 ;ceil(16*root,fvar(12)), ceil(2*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 35 < 24, 24, (root,fvar(11)) * 35)), 4
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 5,10
guard.pausetime = 2,1
sparkno = -1 ;S3435 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s2150,1
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 15
ground.hittime  = 15
guard.slidetime = 7
guard.hittime  = 7
ground.velocity = -2,0
guard.velocity = -2
air.velocity = -2,5
airguard.velocity = -2, 2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
fall = ((root,var(36))>=5)
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
p1sprpriority = 5
kill = 0
;persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3302, Sparks] ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
;pos=(target,const(size.ground.front)-2),-92 ;-77;floor(p2dist y)
pos=(target,const(size.ground.front)-15+random%10),ceil((Helper(2450),pos y)-(target,pos y)-random%10)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 4106, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 3302, respawn]   ;Contact
type = changestate
trigger1 = (root,var(36))<5 ;HitCount >=5
trigger1 = movecontact
value = 2452
ignorehitpause = 1

[State 0, TargetState]
type = TargetState
trigger1 = (root,var(36))>=5
value = 2410
ID = -1
ignorehitpause = 1
;persistent =

[State 3302, end]   ;Contact
type = changestate
trigger1 = (root,var(36))>=5 ;HitCount >=5
trigger1 = movecontact
trigger2 = pos Y >= 0
value = 2451

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100
id = 2150
ignorehitpause = 1
;persistent =

[State 4106, End]
type = destroyself
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100

;-----------------------------------------
; LV2 G.VICE SHOT TEMP Blast explod/vanish
[Statedef 2451]
type    = A
movetype= A
physics = N
anim = 2152 ;2202  ;TEMP
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = time=1
id = 2150
ignorehitpause = 1
;persistent =


[State 4106, Ground Hit Sound]
type = PlaySnd
trigger1 = !time
value = 2010, 2

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1061, End]
type = destroyself
trigger1= P2MoveType !=H
trigger1= Time>=15;!animtime
trigger2 = Numenemy
trigger2 = enemynear,alive=0
trigger2 = !NumExplod(2150)

;===================================================
; LV2 empty state for respawning the VS
[Statedef 2452]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1= !time
var(36) = 1
;ignorehitpause =
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = !time
value = IfElse((root,var(36)<=5),2450,2452)
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 1061, End]
type = destroyself
trigger1= time=1
trigger1 = P2StateNo != [120,155]
trigger2 = time = 40
trigger2 = P2StateNo = [120,155]

;LV2 A.VICE SHOT TEMP BLAST
[Statedef 2470]
type    = S
movetype= A
physics = N
anim = 2150
sprpriority = 5
hitcountpersist = 1
movehitpersist = 1

[State 4106, Launch Sound]
type = PlaySnd
trigger1 = !time && !prevstateno
value = 2150, 0

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1


[State 0, Explod]
type = Explod
triggerall = !NumExplod(2150)
trigger1 = !time
anim = 2150
ID = 2150
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = 0
scale = 1,1
sprpriority = 5
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1
;trans =
;persistent =
;supermove = 0
;pausemove = 0

[State 4106, transparency]
type = Trans
trigger1 = root,var(2)=1
trans = addalpha
alpha = 200,128
ignorehitpause = 1

[State 3302, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT
ignorehitpause = 1

[State 3302, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, NP, SP, HP
time = 1
ignorehitpause = 1

[State 3302, HitOverride]
type = HitOverride
;trigger1 = 1
trigger1 = Time >= 0
slot = 1
time = 1
stateno = ifelse((root,var(36))<5,2472,2471)
attr = SCA, NP, SP, HP
ignorehitpause = 1

[State 4106, Velocity]
type = VelSet
trigger1 = !time
x = 6
;y = 6

[State 4106, Hitdef]
type = HitDef
trigger1 = 1
attr = A, HP
animtype  = hard
;damage    = 30,3 ;ceil(16*root,fvar(12)), ceil(2*root,fvar(12))
damage = ceil(ifElse(root,fvar(11) * 35 < 24, 24, (root,fvar(11)) * 35)), 4
priority  = 4,Hit
guardflag = MA
hitflag = MAFD
pausetime = 5,10
guard.pausetime = 2,1
sparkno = -1 ;S3435 ;s7010
guard.sparkno = -1
sparkxy = 0,0
hitsound   = s2150,1
guardsound = S6,1
ground.type = high
air.type = low
ground.slidetime = 15
ground.hittime  = 15
guard.slidetime = 7
guard.hittime  = 7
ground.velocity = -2,0
guard.velocity = -2
air.velocity = -2,5
airguard.velocity = -2, 2
envshake.time = 5
envshake.ampl = 4
envshake.freq = 176
fall.envshake.time = 10
fall.envshake.ampl = 4
fall.envshake.freq = 176
yaccel = 0.5
fall = ((root,var(36))>=5)
air.fall = 0
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
getpower = 0,0  ;ifelse(p2movetype=H,40,140), 10
givepower = 35,35
p1sprpriority = 5
kill = 0
;persistent = 0

[State 0, VarAdd]
type = ParentVarAdd
trigger1 = MoveHit = 1
fvar(13) = 1

[State 3302, Sparks] ;Cybaster way
type=explod
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
anim=7020
sprpriority=7
postype=p2
;pos=(target,const(size.ground.front)-2),-92 ;-77;floor(p2dist y)
pos=(target,const(size.ground.front)-15+random%10),ceil((Helper(2450),pos y)-(target,pos y)-random%10)
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 4106, Guardshake]
type = envshake
trigger1 = moveguarded
time = 4
ampl = 6
freq = 176
ignorehitpause = 1

[State 3302, respawn]   ;Contact
type = changestate
trigger1 = (root,var(36))<5 ;HitCount >=5
trigger1 = movecontact
value = 2472
ignorehitpause = 1

[State 0, TargetState]
type = TargetState
trigger1 = (root,var(36))>=5
value = 2410
ID = -1
ignorehitpause = 1
;persistent =

[State 3302, end]   ;Contact
type = changestate
trigger1 = (root,var(36))>=5 ;HitCount >=5
trigger1 = movecontact
trigger2 = pos Y >= 0
value = 2471

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100
id = 2150
ignorehitpause = 1
;persistent =

[State 4106, End]
type = destroyself
trigger1 = (pos y!=[-260,10])
trigger2 = pos x!=[-240,240]
trigger3 = time>100

;-----------------------------------------
; LV2 A.VICE SHOT TEMP Blast explod/vanish
[Statedef 2471]
type    = A
movetype= A
physics = N
anim = 2152 ;2202  ;TEMP
sprpriority = 5
velset = 0,0
hitcountpersist = 1
movehitpersist = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = time=1
id = 2150
ignorehitpause = 1
;persistent =


[State 4106, Ground Hit Sound]
type = PlaySnd
trigger1 = !time
value = 2010, 2

[State 1061, NoShadow]
type = Trans
trigger1 = root,var(2)=0
trans = none
ignorehitpause = 1

[State 1061, NoJuggle Safety]
type = parentvarset
trigger1 = !time
v = 18
value = 0

[State 1002, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 0, Projectile]
type = Projectile
trigger1 = Time=15
ProjID = 2450
projanim = 15999
projremovetime = 1

[State 1061, End]
type = destroyself
trigger1= P2MoveType !=H
trigger1= Time>=15;!animtime
trigger2 = Numenemy
trigger2 = enemynear,alive=0
trigger2 = !NumExplod(2150)

;===================================================
; LV2 empty state for respawning the VS
[Statedef 2472]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
;persistent =

[State 3302, NoShadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible
ignorehitpause = 1

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1= !time
var(36) = 1
;ignorehitpause =
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = !time
value = IfElse((root,var(36)<=5),2470,2472)
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

[State 1061, End]
type = destroyself
trigger1= time=1
trigger1 = P2StateNo != [120,155]
trigger2 = time = 40
trigger2 = P2StateNo = [120,155]

;Pain Train Wall Helper
[Statedef 2510]
type = S
physics = N ;S
movetype = A
velset = 0, 0
anim = 2510

[State 3205, NHB]
type = nothitby
trigger1 = 1
time = -1
value = SCA

[State 3205, bound]
type = screenbound
trigger1 = 1
value = 1

[State 0, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1
;ignorehitpause =
;persistent =

[State 200, 1]  ;target
type = HitDef
;trigger1 = 1 ;time>10
trigger1 = time>0 && root,numtarget>0
attr = S, NA
damage = 0,0
hitflag = MAF
;guardflag = MA
affectteam = F
priority = 4, Hit
pausetime = 15,15
guard.pausetime = 15,15
sparkno = s7030
guard.sparkno = s7000
sparkxy = -40,-85
hitsound   = s5, 2
guardsound = S6,1
animtype = Up
ground.type = High
ground.slidetime = 12
ground.hittime = 12
ground.velocity = 5,-6.5
guard.velocity = 9
air.velocity = ifelse(p2movetype=H,-3,-1),ifelse(p2movetype=H,-5,-10)
fall = 1
fall.recover = 1
air.animtype = back
getpower= 0,0
givepower = 0,0
yaccel = 0.45
ID = 1098
persistent = 0

[State 200, 1]  ;No target
type = HitDef
;trigger1 = 1 ;time>10
trigger1 = time>0 && root,numtarget=0
attr = S, NA
damage = 0,0
hitflag = MAF
;guardflag = MA
affectteam = F
priority = 4, Hit
pausetime = 15,15
guard.pausetime = 15,15
sparkno = s7030
guard.sparkno = s7000
sparkxy = -40,-85
hitsound   = s5, 2
guardsound = S6,1
animtype = Up
ground.type = High
ground.slidetime = 12
ground.hittime = 12
ground.velocity = 5,-6.5
guard.velocity = 9
air.velocity = ifelse(p2movetype=H,-3,-1),ifelse(p2movetype=H,-5,-10)
fall = 1
fall.recover = 0
air.animtype = back
getpower= 0,0
givepower = 0,0
yaccel = 0.45
ID = 1098
persistent = 0

[State 181, Pain!] ;Waugh!
type = playsnd
trigger1 = movecontact ;!time
value = 2502,0
volumescale = 300
channel = 0
ignorehitpause = 1
persistent = 0

[State 0, TargetState]
type = null;TargetState
triggerall = !winKO
trigger1 = root,var(3)=1
value = 2502
ID = -1
ignorehitpause = 1
;persistent =

[State 3205, End]
type = destroyself
trigger1 = movecontact
ignorehitpause = 1

;==========================================================
;EMO GAUGE HELPER P1
[Statedef 2750]
physics = N
velset = 0, 0
sprpriority = 10
anim = 9999

[State 4750, Assert]
type = assertspecial
trigger1 = 1
flag = invisible
;flag = noshadow
ignorehitpause = 1

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Spos Y = %d  Pos Y = %d, Gameheight =%d"
params = Screenpos Y, Pos Y, gameheight
ignorehitpause = 1
;persistent =

[State 4750, Bar Filling]
type = Explod
trigger1 = (root,var(32))>0
anim = 4700+root,var(33)
pos = 20+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 4700
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;(2751+floor(var(33)/24.0))
[State 4750, Bar Display 0]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[0,23)
anim = 2750
pos = 20+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2750
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display 1]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[23,46)
anim = 2751
pos = 20+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2751
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display 2]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[46,69)
anim = 2752
pos = 20+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1 ;0.5,0.5
sprpriority = 10
id = 2752
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display MAX]
type = Explod
trigger1 = !NumExplod(2753)
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=69
anim = 2753
pos = 20+(root,var(45)),235-(root,var(46))
postype = left
removetime = -1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2753
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = root,var(33)!=69
id = 2753
;ignorehitpause =
;persistent =



[State 0, Helper LV 1 Sound]
type = Helper
triggerall = !NumExplod(4762)
trigger1 = (root,var(33))>=23 && !NumHelper(47501)
helpertype = normal ;player
name =  "Lv 1"
ID = 47501
stateno = 47501
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1

[State 0, Helper LV 2 Sound]
type = Helper
triggerall = !NumExplod(4762)
trigger1 = (root,var(33))>=46 && !NumHelper(47502)
helpertype = normal ;player
name =  "Lv 2"
ID = 47502
stateno = 47502
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1


;-------------------------------------------------------------------------------
[State 4750, Explod];Sanity Gauge fades
type = null;Explod
trigger1 = !NumExplod(4762) && (root,var(32))<=0
anim = 4762
pos = 31+(root,var(45)),230-(root,var(46))
postype = left
removetime = 14
supermove = 1
scale = 0.5,0.5
sprpriority = 7
id = 4762
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
persistent = 0

[State 4750, Kanji Fade];Sanity Kanji fades
type = null;Explod
triggerall = root,var(33)>=700
trigger1 = !NumExplod(4764) && (root,var(32))<=0
anim = 4764+(root,var(33)>=1400)+(root,var(33)>=2100)
pos = 31+(root,var(45)),230-(root,var(46))
postype = left
removetime = 14
supermove = 1
scale = 0.5,0.5
sprpriority = 7
id = 4764
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
persistent = 0

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 4700
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2750
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2751
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2752
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2753
ignorehitpause = 1
;persistent =

[State 4750, End]
type = destroyself
trigger1 = (root,var(32))<=0 && !numexplod(4700)

;==========================================================
;EMO GAUGE HELPER P2
[Statedef 2760]
physics = N
velset = 0, 0
sprpriority = 10
anim = 9999

[State 4750, Assert]
type = assertspecial
trigger1 = 1
flag = invisible
;flag = noshadow
ignorehitpause = 1

[State 0, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Spos Y = %d  Pos Y = %d, Gameheight =%d"
params = Screenpos Y, Pos Y, gameheight
ignorehitpause = 1
;persistent =

[State 4750, Bar Filling]
type = Explod
trigger1 = (root,var(32))>0
anim = 4700+root,var(33)
pos = 298+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 4700
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;(2751+floor(var(33)/24.0))
[State 4750, Bar Display 0]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[0,23)
anim = 2750
pos = 224+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2750
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display 1]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[23,46)
anim = 2751
pos = 224+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2751
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display 2]
type = Explod
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=[46,69)
anim = 2752
pos = 224+(root,var(45)),235-(root,var(46))
postype = left
removetime = 1
supermove = 1
scale = 1,1 ;0.5,0.5
sprpriority = 10
id = 2752
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
[State 4750, Bar Display MAX]
type = Explod
trigger1 = !NumExplod(2753)
trigger1 = (root,var(32))>0
trigger1 = root,var(33)=69
anim = 2753
pos = 224+(root,var(45)),235-(root,var(46))
postype = left
removetime = -1
supermove = 1
scale = 1,1
sprpriority = 10
id = 2753
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = root,var(33)!=69
id = 2753
;ignorehitpause =
;persistent =



[State 0, Helper LV 1 Sound]
type = Helper
triggerall = !NumExplod(4762)
trigger1 = (root,var(33))>=23 && !NumHelper(47501)
helpertype = normal ;player
name =  "Lv 1"
ID = 47501
stateno = 47501
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1

[State 0, Helper LV 2 Sound]
type = Helper
triggerall = !NumExplod(4762)
trigger1 = (root,var(33))>=46 && !NumHelper(47502)
helpertype = normal ;player
name =  "Lv 2"
ID = 47502
stateno = 47502
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1


;-------------------------------------------------------------------------------
[State 4750, Explod];Sanity Gauge fades
type = null;Explod
trigger1 = !NumExplod(4762) && (root,var(32))<=0
anim = 4762
pos = 31+(root,var(45)),230-(root,var(46))
postype = left
removetime = 14
supermove = 1
scale = 0.5,0.5
sprpriority = 7
id = 4762
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
persistent = 0

[State 4750, Kanji Fade];Sanity Kanji fades
type = null;Explod
triggerall = root,var(33)>=700
trigger1 = !NumExplod(4764) && (root,var(32))<=0
anim = 4764+(root,var(33)>=1400)+(root,var(33)>=2100)
pos = 31+(root,var(45)),230-(root,var(46))
postype = left
removetime = 14
supermove = 1
scale = 0.5,0.5
sprpriority = 7
id = 4764
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
persistent = 0

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 4700
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2750
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2751
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2752
ignorehitpause = 1
;persistent =
[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,var(32))<=0
id = 2753
ignorehitpause = 1
;persistent =

[State 4750, End]
type = destroyself
trigger1 = (root,var(32))<=0 && !numexplod(4700)

;==========================================================
; SG LV1 Sound
[Statedef 47501]
physics = N
velset = 0, 0
sprpriority = 7
anim = 15999

[State 47501, Assert]
type = assertspecial
trigger1 = 1
flag = invisible
ignorehitpause = 1

[State 47501, PlaySnd - Sanity level]
type = PlaySnd
triggerall = root,var(32)>0
trigger1 = !time
value = 4700,0
volumescale =300
channel = -1
ignorehitpause = 1
persistent = 0

[State 47501, End]
type = destroyself
trigger1 = (root,var(32))<=0
trigger2 = (root,var(33))<23

; SG LV2 Sound
[Statedef 47502]
physics = N
velset = 0, 0
sprpriority = 7
anim = 15999

[State 47502, Assert]
type = assertspecial
trigger1 = 1
flag = invisible
ignorehitpause = 1

[State 47502, PlaySnd - Sanity level]
type = PlaySnd
triggerall = root,var(32)>0
trigger1 = !time
value = 4700,0
volumescale =300
channel = -1
ignorehitpause = 1
persistent = 0

[State 47502, End]
type = destroyself
trigger1 = (root,var(32))<=0
trigger2 = (root,var(33))<46

;===============================================================================
;MEGACANDY BEAM HELPER
[Statedef 2905]
type = A
physics = N
movetype = A
anim = 2905
ctrl = 0
sprpriority = -9

[State 1605, hitoverride]
type = hitoverride
trigger1 = 1
time = -1
attr = SCA, AA, AP, AT
stateno = 2906
ignorehitpause = 1
[State 1605, hitby]
type = nothitby
trigger1 = 1
time = -1
value = SCA, NP, SP, HP
ignorehitpause = 1

[State 1605, Pos]
type = bindtoroot
trigger1 = 1
pos = -20,-127

[State 3010, Explod hack]
type = Explod
trigger1 = !time
anim =  2905
ID =  2906
pos = 0,0
postype = p1  ;p2,front,back,left,right
supermovetime = 9999
pausemovetime = 9999
facing = 1
vfacing = 1
;bindtime = 50 ;-1
removetime = 30 ;-2
scale = 1,1
sprpriority = -10
ownpal = 1
removeongethit = 1
ignorehitpause = 1


[State 1605, grab]
type = null;reversaldef
trigger1 = (gametime % 2) = 1 && !movecontact
reversal.attr = SCA, AA, AT
damage = 0, 0
ID = 1600
hitonce = 1
p1stateno = 1642
p2stateno = 1650
pausetime = 0, 0
hitsound = s5, 33
sparkno = 2
guard.sparkno = 40
sparkxy = 0, 0
sprpriority = 3
kill = 0

[State 1605, hit]
type = hitdef
trigger1 = 1 ;(gametime % 2) = 0 && !movecontact
ID = 1600
attr = S, HP
damage = 0, 0
animtype = Hard
fall.animtype = Hard
hitflag = MAFD
guardflag = MA
priority = 4, Hit
pausetime = 0, 0
guard.dist = 320
sparkno = -1 ;2
guard.sparkno = -1 ;40
sparkxy = 0,0 ;-10, ceil(p2dist y -48)
;sparkno = s7030
;guard.sparkno = s7000
;sparkxy = 0,50 ;-30,-55
hitsound = s600,1 ;s5, 33
guardsound = s2, 0
ground.type = High
ground.slidetime = 16
ground.hittime = 16
ground.velocity = -4, 0
ground.cornerpush.veloff = 0
air.velocity = -4, -4
airguard.velocity = -2, -3
down.velocity = -4, -4
getpower = 0,0 ;ifelse(p2movetype = H, 96, 192), 48
fall = 0
air.fall = 1
forcestand = 1
fall.recover = 0
sprpriority = -10
yaccel = 0.5
hitonce = 1
;p1stateno = 1640
;p2stateno = 1650
kill = 0
persistent = 0


[State 0, Candy Variable ON]
type = ParentVarSet
trigger1 = movehit ;contact
var(50)=1600
ignorehitpause = 1
persistent = 0

[State 0, MegaCandy Variable ON]
type = ParentVarSet
trigger1 = movehit ;contact
var(43)=2900
ignorehitpause = 1
persistent = 0

[State 3331, Sparks]
type=explod
triggerall = !NumExplod(1606)
trigger1= movehit && numtarget
trigger1 = !(target,ishelper)
trigger1= (target,movetype=H) && !(target,time)
anim=3303
ID = 1606
sprpriority=9
postype=p2
pos= 0,0 ;(target,const(size.ground.front)-10),floor(p2dist y)
removetime=-2
bindtime=-1
ownpal=1
facing=-1
ignorehitpause=1
persistent=0
pausemovetime=100
supermovetime=100

[State 0, PlaySnd]
type = PlaySnd
trigger1= movehit && numtarget
trigger1= (target,movetype=H) && !(target,time)
value = 1550,4
channel = 5
ignorehitpause = 1
;persistent =

[State -2, TargetState]
type= targetstate
ID=1600
triggerall= numtarget(1600)>0
trigger1 = !moveguarded&& !movereversed&&MoveHit
trigger1 = NumTarget > 0&&!(target,ishelper)
trigger1 = Target, MoveType = H
trigger1 = Target, StateTime <= 0
ignorehitpause=1
value= 1650

[State 1500, Changestate]
type=Changestate
triggerall = !animtime
triggerall= numtarget(1600)>0
triggerall= !moveguarded&& !movereversed&&movehit
triggerall= !(target,ishelper)
trigger1=Enemy(0),stateno=1650
trigger2=TeamMode = Simul
trigger2=Enemy(1),stateno=1650
trigger3=(Enemy(Enemy, TeamMode = Simul),stateno=1650)
value = 1642
ignorehitpause=1

[State 1605, End]
type = changestate
trigger1 = root,var(50)!=1600 ;enemy is candied
;trigger1 = root, stateno != 1600 || root, movetype = H
;trigger2 = root, stateno = 1600 && root, animtime=0 ;animelemtime(7) >= 0
trigger1 = time>=30 ;!animtime
trigger2 = root,var(50)!=1600 ;enemy is candied
trigger2 = root, movetype = H
trigger3 = time>=35 ;safe
value = 2906
ignorehitpause = 1

;MegaCandy beam destroy
[Statedef 2906]
type = A
physics = N
movetype = I
anim = 2905 ;9999 ;1606
ctrl = 0
[State 1606, End]
type = destroyself
trigger1 = !animtime ;1
;===================================================
;DASH COLLISION NOTIFICATION
[Statedef 13200]
type=A
physics=N
movetype=I
anim = 15999
velset=0,0
sprpriority=6

[State 8000, Assert]
type=assertspecial
trigger1= 1
flag=noshadow
ignorehitpause = 1

[State -2, Explod]; Notification
type = null;Explod
trigger1 = !time
anim = 13200
removetime = -2
supermove = 1
sprpriority = 1
id = 13200
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
facing = facing
scale = 0.5,0.5

[state 17100,scale FX]
type = null;modifyexplod
trigger1 = numexplod(13200)
trigger1 = time>=10
scale = 0.5+0.02*(time-10),0.5+0.02*(time-10)
id = 13200

[State 8000, End]
type=destroyself
trigger1= time>=40

;===================================================
; Limit basics comboability
[Statedef 15999]
type    = S
movetype= A
physics = N
anim = 15999
sprpriority = -5

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2260, destroy]
type = DestroySelf
trigger1 = numenemy
trigger1 = enemynear, movetype != H || (enemynear, stateno = [120,155]) || enemynear, ctrl
trigger2 = time = 24

;======================================================================
;LAND FX
[Statedef 17100]
type=A
movetype=I
physics=N
anim=15999
sprpriority=1
velset=0,0

[state 17100,bind]
type = bindtoparent
trigger1 = !time
pos = -11,0

[state 17100, Landing Effect]
type=explod
trigger1=!time
anim=17100
id=17100
pos=0,0
postype=P1
sprpriority=-3
ownpal=1
supermovetime=-1

[state 17100]
type=removeexplod
trigger1=time>10

[State 17100]
type=destroyself
trigger1=time>10

;======================================================================
;END ------------------------------------------------------------------




;==========================================================
; SUPER BG - Street Fighter 3

[Statedef 19875]
type = S
velset = 0,0
sprpriority = 0
anim = 15999
ctrl = 0

[State 10500, snd]
type = playsnd
trigger1 = !time
value = 9,0

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = time <= 55
flag = noFG

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 10000, Explod]; White BG
type = Explod
trigger1 = time = 0
anim = 19877
id = 19875
pos =  160,120
postype = left
sprpriority = -7
facing = 1
bindtime = -1
ownpal = 1
removetime = 99999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
supermove = 1
scale = 1.20,1.20
ignorehitpause = 1
persistent = 0

[State 10000, Explod SF3]
type = Explod
trigger1 = time = 0
anim = 19875
id = 10000
pos =  160,120
postype = left
sprpriority = -7
facing = 1
bindtime = -1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
supermove = 1
scale = 1.20*0.9,1.20*1.05
ignorehitpause = 1
persistent = 0

[State 10000, pause]
type = Pause
trigger1 = Time = 0
time = 40
movetime = 40

[State 10000, RemoveExplod]
type = RemoveExplod
trigger1 = time = 44
id = 10000

[State 10000, RemoveExplod]
type = RemoveExplod
trigger1 = time = 55
id = 10500

[State 8020, End]
type = destroyself
trigger1 = !(roundstate>2)
trigger2 = time=1000

;==========================================================
; SUPER BG - Super DBZ (Physics)

[Statedef 19885]
type = S
velset = 0,0
sprpriority = 0
anim = 15999
ctrl = 0

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4) && time<150
time=4
freq=80
ampl=7

[State 10500, snd]
type = playsnd
trigger1 = !time
value = 9,0

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noFG
flag2 = nokoslow
ignorehitpause = 1

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic
flag2 = nobardisplay
ignorehitpause = 1

[State 10000, Explod]; White BG
type = Explod
trigger1 = time = 0
anim = 19884
id = 19884
pos =  160,120
postype = left
sprpriority = -4
facing = 1
bindtime = -1
ownpal = 1
pausemovetime = 99999999999999
supermovetime = 99999999999999
scale = 1.20,1.20
ignorehitpause = 1
persistent = 0
removetime = -2

[State 10000, Explod Krak]
type = Explod
trigger1 = time = 0
anim = 19885
id = 19885
pos =  160,120
postype = left
sprpriority = -7
facing = 1
bindtime = -1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
supermove = 1
scale = 1,1
ignorehitpause = 1
persistent = 0

[State 10000, Scale Explod]
type = ModifyExplod
trigger1 = time>6
scale = 1+.01*time, 1+.01*time
id = 19885

[State 10000, RemoveExplod Krak]
type = RemoveExplod
trigger1 = time = 44
id = 19885

[State 10000, Explod Space BG]
type = Explod
trigger1 = time = 23
anim = 19886
id = 19886
pos =  160,120
postype = left
sprpriority = -7
facing = 1
bindtime = -1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
scale = 1.3,1.3
ignorehitpause = 1
persistent = 0

[State 10000, Explod planet left]
type = Explod
trigger1 = time = 23
anim = 19887
id = 19886
pos =  0,240
postype = left
sprpriority = -6
facing = 1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
scale = 1.2,1.2
ignorehitpause = 1
persistent = 0
;vel = -.2,0
bindtime = -1

[State 10000, Explod planet right]
type = Explod
trigger1 = time = 23
anim = 19888
id = 19886
pos =  320,240
postype = left
sprpriority = -6
facing = 1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
scale = 1.2,1.2
ignorehitpause = 1
persistent = 0
;vel = .2,0
bindtime = -1

[State 1000, Helper]
type = Helper
trigger1 = time>=23 && time<70 && !(time%5) && numhelper(19890)<80 && numhelper(19891)<80
helpertype = Normal
name = "rocks"
id = 19890
pos = 160,20
postype = left
facing = 1
stateno = 19890
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State 13300, black screen fade]
type = Explod
trigger1 = Time = 60
anim = 19883   ;2771
ID = 2771
postype = left
pos = 0,-50
bindtime = -1
removetime = 91
pausemovetime = 91
ontop = 1
scale = 2,3

[State 10000, RemoveExplod Krak]
type = RemoveExplod
trigger1 = time = 150
id = 19886

[State 8020, End]
type = destroyself
trigger1 = !(roundstate>2)
trigger2 = time=150  ;1000

;------------------------------------------------------
;Rocks going up

[Statedef 19890]
type = A
movetype = I
physics = N
anim = 15999

[State 1003, Helper]
type = Helper
trigger1 = !time
helpertype = Normal
name = "rocks"
id = 19891
pos = ((random%320)),10*(random%13)
postype = left
facing = 1
stateno = 19891
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1
size.xscale = .5
size.yscale = .5

[State 1003, Helper]
type = Helper
trigger1 = !time
helpertype = Normal
name = "rocks"
id = 19891
pos = ((random%320)+320),10*(random%13)
postype = left
facing = 1
stateno = 19891
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1
size.xscale = .5
size.yscale = .5

[State 1003, Helper]
type = Helper
trigger1 = !time
helpertype = Normal
name = "rocks"
id = 19891
pos = ((random%320)-320),10*(random%13)
postype = left
facing = 1
stateno = 19891
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1
size.xscale = .5
size.yscale = .5

[State 1003, DestroySelf]
type = DestroySelf
trigger1 = time=2

;-----------------
[Statedef 19891]
type = A
movetype = I
physics = N
anim = 19890 + random%6
sprpriority = -5

[State 1004, assert]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 1004, vel]
type = velset
trigger1 = !time
y = -3-random%7

[State 1004, vel]
type = varset
trigger1 = !time
var(10) = random%2

[State 1004, assert]
type = angledraw
trigger1 = 1
value = ifelse(var(10)=0,5*time,-5*time)

[State 1004, DestroySelf]
type = DestroySelf
trigger1 = time > 300
trigger2 = pos Y < -340
trigger3 = root,stateno = 180

;==========================================================
; SUPER BG - Super DBZ (Ki attacks)

[Statedef 19892]
type = S
velset = 0,0
sprpriority = 0
anim = 15999
ctrl = 0

[State 3001, screen]
type = PosSet
trigger1 = !time
x = 0
y = -ceil(screenpos Y)
ignorehitpause = 1

[State 3001, screen]
type = PosSet
trigger1 = 1
x = 0
ignorehitpause = 1

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4) && time<150
time=4
freq=80
ampl=7

[State 10500, snd]
type = playsnd
trigger1 = !time
value = 9,0

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noFG
flag2 = nokoslow
ignorehitpause = 1

[State 10000, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic
flag2 = nobardisplay
ignorehitpause = 1

[State 10000, Explod]; White BG
type = Explod
trigger1 = !time
anim = 957
id = 11111
pos =  0,-30
postype = left
sprpriority = -7
facing = 1
bindtime = -1
ownpal = 1
removetime = -1
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1
scale = 2,2

[State 10000, Explod Zwang]
type = Explod
trigger1 = time = 0
anim = 19896
id = 19896
pos =  160,120
postype = left
sprpriority = -5
facing = 1
bindtime = -1
ownpal = 1
removetime = 9999999999999
pausemovetime = 99999999999999
supermovetime = 99999999999999
ignorehitpause = 1
scale = .9,1.2

[State 10000, Scale Explod]
type = ModifyExplod
trigger1 = time>50
scale = .9+.005*(time-50), 1.2+.005*(time-50)
id = 19896

[State 1003, Helper]
type = Helper
trigger1 = !time
helpertype = Normal
name = "yellow_BG"
id = 19897
pos = 0,0
postype = left
facing = 1
stateno = 19897
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1
persistent = 0

[State 13300, white screen fade]
type = Explod
trigger1 = Time = 60
anim = 19883
ID = 2771
postype = left
pos = 0,-50
bindtime = -1
removetime = 91
pausemovetime = 91
ontop = 1
scale = 2,3
ignorehitpause = 1

[State 10000, RemoveExplod zwang]
type = RemoveExplod
trigger1 = time = 140
id = 19896
[State 10000, RemoveExplod yellow BG]
type = RemoveExplod
trigger1 = time = 140
id = 19897
[State 10000, RemoveExplod white BG]
type = RemoveExplod
trigger1 = time = 140
id = 11111

[State 10000, pause]
type = Pause
trigger1 = !time
time = 20
movetime = 20
ignorehitpause = 1

[State 8020, End]
type = destroyself
trigger1 = !(roundstate>2)
trigger2 = time=150

;--------------------------------------
;Yellow Super BG Helper
[Statedef 19897]
type = S
movetype = I
physics = N
anim = 19897
sprpriority = -6

[State 1004, assert]
type = bindtoparent
trigger1 = 1
pos = 0,120
ignorehitpause = 1

[State 1004, assert]
type = assertspecial
trigger1 = 1
flag = noshadow
flag2 = noFG
ignorehitpause = 1

[State 1004, assert]
type = angledraw
trigger1 = time < 50
value = 10*time
scale = .7,.7
ignorehitpause = 1

[State 1004, assert]
type = angledraw
trigger1 = time >= 50
value = 10*time
scale = .7+.01*(time-50),.7+.01*(time-50)
ignorehitpause = 1

[State 1004, DestroySelf]
type = DestroySelf
trigger1 = time > 130

;==========================================================
; SUPER BG - Jojo's Bizarre Adventure

[Statedef 19900]
type    = A
movetype= I
physics = N
ctrl = 0
anim = 15999
sprpriority = -21

[State 1211, Exclamation]
type = Explod
trigger1 = Time = 0
anim = 19910
id = 8001
pos = 0,-10
postype = back
sprpriority = -21
bindtime = -1
scale = 0.83333333333333333333333333333333,1.0810810810810810810810810810811
removetime = -1
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1

[State 1211, Exclamation]
type = Explod
trigger1 = Time = 0
anim = 19911
id = 8001
pos = 0,-10
postype = back
sprpriority = -21
bindtime = -1
scale = 0.83333333333333333333333333333333,1.0810810810810810810810810810811
removetime = -1
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1

[State 1211, Exclamation]
type = Explod
trigger1 = Time = 0
anim = 19912
id = 8001
pos = 0,-10
postype = back
sprpriority = -21
bindtime = -1
scale = 0.83333333333333333333333333333333,1.0810810810810810810810810810811
removetime = -1
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1

[State 1211, Exclamation]
type = Explod
trigger1 = Time = 0
anim = 19913
id = 8001
pos = 0,-10
postype = back
sprpriority = -21
bindtime = -1
scale = 0.83333333333333333333333333333333,1.0810810810810810810810810810811
removetime = -1
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1

[State 1211, Exclamation]
type = Explod
trigger1 = Time = 0
anim = 19900
id = 19900
pos = 0,0
postype = back
sprpriority = 5
bindtime = -1
scale = .84, 1.07
supermovetime = -1
pausemovetime = -1
ignorehitpause = 1
persistent = 0
ontop = 1

[State 10500, snd]
type = playsnd
trigger1 = !time
value = 9,0

[state haha]
type = varset
trigger1 = time = 0
var(3) = 0

[state haha]
type = varadd
trigger1 = time >= 5
trigger1 = var(3) < 220
var(3) = 5

[State that starts the inverted effect]
type           = PalFX
trigger1       = time >= 5
add            = var(3),var(3),var(3)
time           = 1
ignorehitpause = 1

[State 2030, 0]
type = AssertSpecial
Trigger1 = Time < ifelse(matchover, 120, 50)
flag = nofg
flag2 = nobardisplay
ignorehitpause = 1

[State haha]
type = RemoveExplod
trigger1 = Time = ifelse(matchover, 120, 50)
id = 8001

[State ChangeState!]
type = DestroySelf
trigger1 = RoundState = 0



;===================================================
;BEAM COLLISION NOTIFICATION

[Statedef 13250]
type=A
physics=N
movetype=I
anim = 15999
velset=0,0
sprpriority=6

[State 8000, Assert]
type=assertspecial
trigger1= 1
flag=noshadow
ignorehitpause = 1

[State -2, Explod]; Notification
type = Explod
trigger1 = !time
anim = 13250
removetime = -2
supermove = 1
sprpriority = 1
id = 13250
bindtime = -1
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1
pos = 160,120
postype = left
scale = 0.5,0.5

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(13250)
trigger1 = time>=10
scale = 0.5+0.02*(time-10),0.5+0.02*(time-10)
id = 13250

[State 8000, End]
type=destroyself
trigger1= time>=40

;===================================================
[StateDef 2771] ; Fade in/out effects BLACK
type = A
movetype = I
physics = N
anim = 15999
velset = 0,0

[State 13300, Expl]
type = Explod
trigger1 = Time = 30
anim = 2771
ID = 2771
postype = left
pos = -30,-30
bindtime = -1
removetime = 71
pausemovetime = 71
ontop = 1
scale = 2,2

[State 13300, Fadeout]
type = PalFX
trigger1 = Time = [30,100]
time = 1
add = 4*(Time-30),4*(Time-30),4*(Time-30)

[State 13001, End]
type = DestroySelf
trigger1 = time=101



;===================================================
;Pulse Effect during fall recovery (taken from Possessed Heita by The_None)

[Statedef 52100]
type    = S
movetype = I
physics = S
sprpriority = 4
anim = 15999
ctrl = 0

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP,AT

[State 0, PosAdd]
type = PosAdd
trigger1 = 1
x = ifelse(root,stateno=5201,ceil(parentdist x/3.0),parentdist x)
y = parentdist y

[State 0, VarSet]
type = VarSet
trigger1 = !time
var(0) = parent,anim

[State 0, VarSet]
type = VarSet
trigger1 = !time
var(1) = parent,animelemno(0)

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = time
value = var(0)
elem = var(1)

[State 0, VarSet]
type = VarAdd
trigger1 = time
fvar(0) = 11.2

[State 0, VarSet]
type = VarAdd
trigger1 = time
fvar(1) = 0.015

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 1+fvar(1),1+fvar(1)

[State 0, Trans]
type = Trans
trigger1 = 1
trans = add

[State 0, PalFX]
type = PalFX
trigger1 = 1
time = 1
add = floor(0-fvar(0)),floor(0-fvar(0)),floor(0-fvar(0))

[State 0, ]
type = DestroySelf
trigger1 = root,stateno != 5201
trigger1 = root,stateno != 5210

;---------------------------
;Detect life Helper (Coded by 2OS)

[Statedef 2]

[State 2OS]
type = statetypeset
trigger1 = 1
movetype = I
ignorehitpause = 1
persistent = 1

[State 2OS, Blank Animation]
type = changeanim
trigger1 = 1
value = 15999
ignorehitpause = 1
persistent = 1

[State 2OS]
type = bindtoroot
trigger1 = 1
pos = 0,0
ignorehitpause = 1
persistent = 1

[State 2OS, Damage Var Delay Reset]
type = varset
trigger1 = var(1)>1
var(1) = 0
ignorehitpause = 1
persistent = 1

[State 2OS, Damage Var Delay]
type = varadd
trigger1 = var(2) != root,life
var(1) = 1
ignorehitpause = 1
persistent = 1

[State 2OS, Damage Var]
type = varset
trigger1 = (var(1)!=[0,1])
var(2) = root,life
ignorehitpause = 1
persistent = 1


;====================================
; Broken Back - BG Arms + legs

[Statedef 245947]
type = S
movetype = H
physics = N
velset = 0,0
anim = 5947

[State 2260, bind]
type = bindtoroot
trigger1 = !ishelper
trigger1 = 1
pos = 0,0

[State 2260, bind]
type = bindtoparent
trigger1 = IsHelper
trigger1 = 1
pos = 0,0

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2260, destroy]
type = DestroySelf
trigger1 = time = 126

;====================================
; RE Broken Back - BG Arms + legs

[Statedef 355947]
type = S
movetype = H
physics = N
velset = 0,0
anim = 5947

[State 2260, bind]
type = bindtoroot
trigger1 = !ishelper
trigger1 = 1
pos = 0,0

[State 2260, bind]
type = bindtoparent
trigger1 = IsHelper
trigger1 = 1
pos = 0,0

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2260, destroy]
type = DestroySelf
trigger1 = time = 19



;====================================
; Galactic Gunfire - Vertical Lines BG
[Statedef 2623]
type = A
movetype = A
physics = N
anim = 2771
velset = 0,0

[State 2260, push]
type = PlayerPush
trigger1 = Time >= 0
value = 0

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[State 2260, flash]
type = null ;PalFX
trigger1 = TimeMod = 4,0
trigger1 = 1
time = 1
invertall = 1
ignorehitpause = 0

[state 3250, speedlines]
type = explod
trigger1 = time = 0
anim = 12773
ID = 2773
postype = back
pos = 10,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
;pausemovetime = 145
removetime = -1

[state 3250, speedlines2]
type = explod
trigger1 = time = 0
anim = 12773
ID = 2773
postype = back
pos = 240,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
;pausemovetime = 145
removetime = -1

[State 2260, destroy explod]
type = RemoveExplod
trigger1 = root,stateno != 2620
trigger1 = root,stateno != 2820
trigger1 = root,stateno != 2830		;Charged Blast
trigger1 = root,stateno != 2866		;Final Galick Ho
ID = 2773

[State 2260, destroy]
type = DestroySelf
trigger1 = root,stateno != 2620
trigger1 = root,stateno != 2820
trigger1 = root,stateno != 2830		;Charged Blast
trigger1 = root,stateno != 2866		;Final Galick Ho





;======================================================================
;KILLED BY FINAL FLASH, BURNED, SMOKE HELPER
[Statedef 5945]
type = A
movetype = I
physics = N
anim = 15999
sprpriority = 3
velset = 0,0

[State 0, posset]
type = posset
trigger1 = ishelper(5945)
trigger1 = playeridexist(root,var(28))
x = playerid(root,var(28)),pos x
y = playerid(root,var(28)),pos y-20
ignorehitpause = 1
 
[State 0, posset]
type = posset
trigger1 = ishelper(59450)
trigger1 = playeridexist(root,var(29))
x = playerid(root,var(29)),pos x
y = playerid(root,var(29)),pos y-20
ignorehitpause = 1

[state 1315]
type = varset
triggerall = numenemy
trigger1 = !time
fvar(1) = abs(enemy,const(size.head.pos.y)/65.0)

[state 17100, big smoke]
type = explod
trigger1 = (time%20)=0
anim = 5930
id = 5930
pos = ceil(10*fvar(1)),-20
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2

[state 17100, big smoke]
type = explod
trigger1 = (time%20)=6
anim = 5930
id = 5930
pos = ceil(-30*fvar(1)),-10
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2

[state 17100, big smoke]
type = explod
trigger1 = (time%20)=3
anim = 5930
id = 5930
pos = ceil(47*fvar(1)),-5
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2

[state 17100, small smoke]
type = explod
trigger1 = (time%20)=8
anim = 5931
id = 5931
pos = ceil(-10*fvar(1)),-25
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2

[state 17100, small smoke]
type = explod
trigger1 = (time%20)=12
anim = 5931
id = 5931
pos = ceil(32*fvar(1)),-15
postype = P1
sprpriority = -3
ownpal = 1
removetime = -2

[state 17100, small smoke]
type = explod
trigger1 = (time%20)=16
anim = 5931
id = 5931
pos = ceil(0*fvar(1)),-5
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2

[state 17100, small smoke]
type = explod
trigger1 = (time%20)=3
anim = 5931
id = 5931
pos = ceil(25*fvar(1)),-25
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2





;------------------------------------------------
; Vertical white foreground Final Galick Ho fatality

[Statedef 2876]
type    = S
movetype= I
physics = N
anim = 5944
sprpriority = 8

[State 2260, muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 0, rotate]
type = AngleDraw
trigger1 = 1
value = -90

[State 2260, destroy]
type = DestroySelf
trigger1 = !animtime

;----------------------------------------------------
;Super Limiter Timer
[Statedef 9999]
type    = S
movetype= I
physics = N
anim = 9999
sprpriority = 9

;ID:9993 Chaos Burst (AI)
;ID:9994 Meltdown Taunt (AI)
;ID:9995 Extended normals
;ID:9996 MegaCandy Beam
;ID:9997 Maniac Ball
;ID:9998 Pop Kick
;ID:9999 Madman's Ball Lv1

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

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = invisible

[State 0, ParentVarSet] ;Reset EMO Mode
type = ParentVarSet
triggerall = IsHelper(9996)
trigger1 = root,var(33)<=0
trigger2 = root,stateno!=2900 && root,NumHelper(1605)=0 ;Candy Beam off
var(32) = 0
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet] ;Reset MCB
type = ParentVarSet
triggerall = IsHelper(9996)
trigger1 = time>=120
trigger1 = root,NumHelper(1605)=1 && root,var(33)<=0
trigger2 = root,stateno=1623 && root,time=15 ;Candy Spit
var(43)=0
ignorehitpause = 1
;persistent =

[State 0, ParentVarSet] ;Reset EMO bar
type = ParentVarSet
triggerall = IsHelper(9996)
trigger1 = root,stateno!=2900 && root,NumHelper(1605)=0 ;Candy Beam off
var(33) = 0
ignorehitpause = 1
;persistent =


[State 1061, End]
type = destroyself
trigger1 = !IsHelper(9993)
trigger1 = !IsHelper(9994)
trigger1 = !IsHelper(9995)
trigger1 = !IsHelper(9996)
trigger1 = !IsHelper(9997)
trigger1 = !IsHelper(9998)
trigger1 = time>=120
trigger2 = IsHelper(9997) && root,statetype!=A
trigger3 = IsHelper(9996) && root,stateno!=2900 && root,var(33)<=0
trigger4 = IsHelper(9998) && enemynear,movetype!=H ;use Pop Kick only once per combo
trigger5 = IsHelper(9996) && root,stateno!=2900 && root,NumHelper(1605)=0 ;Candy Beam off
trigger6 = IsHelper(9995) && enemynear,movetype!=H ;use Extended Normals only once per combo
trigger7 = IsHelper(9993) && root,stateno!=1750 ; Finish Chaos Burst
trigger8 = IsHelper(9996) && root,stateno=1623 && root,time=15 ;Candy Spit

