;------------------------------------
;Dust FX
[Statedef 7500]
type = A
movetype = I
physics = N
ctrl = 0
anim = 7500
sprpriority = 5

[State 0, BindToRoot]
type = BindToParent
trigger1 = 1
time=2
pos=0,0
ignorehitpause = 1

;[State 0, AfterImage]
;type = AfterImage
;trigger1 = animelem=4
;time = 9999
;length = 6
;framegap = 1
;trans = add

[State 901:destroyself]
type = destroyself
trigger1 = animtime=0
trigger2 = root,movetype=H&&(root,stateno!=9000)
trigger3 = !root,stateno

;------------------------------------
;Dust Trail FX
[Statedef 7505]
type = A
movetype = I
physics = N
ctrl = 0
anim = 7505
sprpriority = 5
velset = 0,0

[State 0, BindToRoot]
type = BindToParent
trigger1 = 1
time=2
pos=ifelse(parent,ishelper,Ceil(-25*root,const(size.xscale)),Ceil(0*root,const(size.xscale))),Ceil(-parent,Pos Y)
ignorehitpause = 1

;[State 0, AfterImage]
;type = AfterImage
;triggerall = anim = 7015
;trigger1 = animelem=4
;time = 9999
;length = 6
;framegap = 1
;trans = add

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = anim != 7506
trigger1 = parent,stateno = 1006 || parent,stateno = 1011 || parent,stateno = 1016 || parent,stateno = 1811
trigger1 = parent,ishelper
trigger2 = parent,stateno=450 && parent,animelemtime(21)>=0
value = 7506

[State 901:destroyself]
type = destroyself
trigger1 = anim=7506&&animtime=0
trigger2 = !parent,stateno && parent,ishelper
trigger3 = parent,movetype=H && parent,stateno!=9000 && !parent,ishelper
trigger4 = parent,stateno!=450 && !parent,ishelper

;-------------------------------------------------------------------------------
;Hyper Start Up Effect
;-------------------------------------------------------------------------------
[StateDef 8000]
movetype=I
ctrl = 0
anim = 9741

[State 8000, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nobardisplay
flag2=nofg
flag3=noshadow
ignorehitpause=1

[State 8000, Hyper Portrait]
type=Explod
trigger1=!NumExplod(8015)
trigger1=Time=0
anim=8015
ID=8015
pos=74,120
postype=Back
bindtime=-1;15
;vel=-.1,0
removetime=50
supermovetime=99999
pausemovetime=99999
scale=.5,.5
sprpriority=-8
ownpal=0
ignorehitpause=1

;[State 8000, Hyper Portrait]
;type=Explod
;trigger1=!NumExplod(8015)
;trigger1=Time=0
;anim=8015
;ID=8015
;pos=74,120
;postype=Back
;bindtime=15
;vel=-.1,0
;removetime=50
;supermovetime=99999
;pausemovetime=99999
;scale=.5,.5
;sprpriority=-10
;ownpal=0
;ignorehitpause=1

;[State 8000, ModifyExplod]
;type=ModifyExplod
;trigger1=numexplod(8015)&&time<10
;ID=8015
;scale = 2.5-(.21*(time)),2.5-(.21*(time))

;[State 8000, ModifyExplod]
;type=modifyexplod
;trigger1=numexplod(8015)&&time>=10
;ID=8015
;scale=.5,.5

[State 8000, BGPalFX]
type=BGPalFX
trigger1=time<=38
add=-200,-200,-200
time=1
ignorehitpause=1

[State 8000, MvC1 Hyper Start BG]
type=Explod
trigger1=Time=0
anim=8031
ID=8029
pos=0,0
postype=left
bindtime=-1
removetime=-2
supermovetime=99999
pausemovetime=99999
scale = 0.833333333333333,1.071428571428571
sprpriority=-9
ownpal=0

[State 8000, EnvColor]
type=null;EnvColor
trigger1=Time=0||Time=2||Time=4||Time=6||Time=8
;trigger2=Time=20||Time=22||Time=24||Time=26||Time=28||Time=30||Time=32||Time=34||Time=36
value=240,240,240
under=1
time=1

[State 8000, Hyper Spark 1]
type=Explod
triggerall=!NumExplod(8010)
trigger1=Time=0
anim=8010
ID=8010
postype=p1
bindtime=-1
removetime=-2
supermovetime=99999
pausemovetime=99999
sprpriority=10
ownpal=0
ignorehitpause=1

[State 8000, Hyper Spark 2]
type=Explod
triggerall=!NumExplod(8011)
trigger1=Time=14
anim=8011
ID=8011
postype=p1
bindtime=-1
removetime=30
supermovetime=99999
pausemovetime=99999
sprpriority=10
ownpal=0
ignorehitpause=1

[State 8000, Modify Hyper Spark 2]
type=modifyexplod
trigger1=numexplod(8011)
ID=8011
scale=.5+(.08*(time-14)),.5+(.08*(time-14))

[State 8000, Hyper Spark 3]
type=Explod
triggerall=!NumExplod(8012)
trigger1=Time=16
anim=8012
ID=8012
postype=p1
bindtime=-1
removetime=28
supermovetime=99999
pausemovetime=99999
sprpriority=10
ownpal=0
ignorehitpause=1

[State 8000, Modify Hyper Spark 3]
type=modifyexplod
trigger1=numexplod(8012)
ID=8012
scale=.5+(.04*(time-16)),.5+(.04*(time-16))

[State 8000, Play Hyper Sound]
type=PlaySnd
trigger1=Time=0
value=S8000,ifelse(root,var(45)>=3, 3, 0+root,var(45))
channel=15
pan=1
ignorehitpause=1

[State 8000, Stop Hyper Sound]
type=StopSnd
trigger1=time>=38
trigger2=root,movetype=H&&root,stateno!=9000
channel=15
ignorehitpause = 1

[State 8000, Remove Effects]
type = RemoveExplod
trigger1=time >=38
trigger2=root,movetype=H&&root,stateno!=9000

[State 8000, DestroySelf]
type=DestroySelf
trigger1=time >=38
trigger2=root,movetype=H&&root,stateno!=9000
ignorehitpause=1
;-------------------------------------------------------------------------------
 ;Hyper Background
;-------------------------------------------------------------------------------
[StateDef 8001]
movetype=I
ctrl=0
sprpriority=-10
anim=9741

[State 8001, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=noFG
flag2=noBG
ignorehitpause = 1

[State 8001, Explod]
type=Explod
trigger1=!NumExplod(8020)
anim=8021;8020+ifelse(root,var(45)>=5, 5, 0+root,var(45))
ID=8020
pos=0,0
postype=Left
bindtime=-1
removetime=-1
supermovetime=99999
pausemovetime=99999
scale=1,1;.5,.5
sprpriority=-10
ownpal=0
removeongethit=1
ignorehitpause=1

[State 8001, RemoveExplod]
type=RemoveExplod
trigger1 = RoundState=3
trigger2=root,movetype=H&&root,stateno!=9000
trigger3 = root, var(45)=0
trigger4 = numhelper(8000)
id=8020
ignorehitpause=1

[State 0, Hyper Combo Finish]
type = ChangeState
trigger1 = RoundState=3 || Root,WinKo
trigger1=root,movetype!=H&&root,stateno!=9000
trigger1 = root, var(45)!=0
value = 8003

;[State 8001, DestroySelf]
;Type = ChangeState
;trigger1 = root, movetype = H
;trigger2 = root, var(45)=0
;value=8002

[State 8001, DestroySelf]
Type = DestroySelf
trigger1 = numhelper(8000)
trigger2=root,movetype=H&&root,stateno!=9000
trigger3 = root, var(45)=0

;-------------------------------------------
; Glass Shatter Effect
[StateDef 8002]
movetype=I
ctrl=0
anim=9741

[State 8002, Glass Shatter Background]
type=Explod
triggerall=!NumExplod(8030)
trigger1=Time=0
anim=8030
ID=8030
postype=left
bindtime=-1
removetime=-2
supermovetime=9999
pausemovetime=9999
scale=1,1
sprpriority=10
ownpal=0
ignorehitpause=1

[State 8025, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = s8001,2
volume = 255
channel=10
ignorehitpause = 1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = Time = 1
;-------------------------------------------
; Hyper Combo KO Effect
[StateDef 8003]
movetype=I
ctrl=0
anim=9741

[State 8002, AssertSpecial]
type=AssertSpecial
trigger1=NumExplod(8035)
flag=nobardisplay
flag2=nomusic
flag3=nofg
ignorehitpause=1

[State 8002, Hyper Combo Finish Background]
type=Explod
triggerall=!NumExplod(8035)
trigger1=Time=0
anim=8035
ID=8035
postype=left
bindtime=-1
removetime=-2
supermovetime=9999
pausemovetime=9999
scale=1,1
sprpriority=-10
ownpal=0
ignorehitpause=1

[State 8025, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = s8002,0
volume = 255
channel=10
ignorehitpause = 1
abspan = 1

[State 8025, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = s8002,1
volume = 0
channel=11
ignorehitpause = 1
abspan = 1

;-------------------------------------------------------------------------------
 ;Hyper Background
;-------------------------------------------------------------------------------
[StateDef 8004]
movetype=I
ctrl=0
sprpriority=-10
anim=9741

[State 8001, AssertSpecial]
type=AssertSpecial
trigger1=Time
flag=noFG
flag2=noBG
ignorehitpause = 1

[State 7020, 9]
type   = Explod
;triggerall = p2life >0
trigger1 = numexplod(8020)=0
anim = 8028
postype = left
ID = 8020
sprpriority = -10
removetime = -1
pos = 0,0;160,0
scale = 1,.75
bindtime = -1
facing=1
ignorehitpause=1
supermovetime=9999
pausemovetime=9999
supermove = 9999
pausemove = 9999

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = 1
ID = 8020
pos = Floor(root,pos X / 8)*root,facing ;, ifelse((root,screenpos Y>=320)||(root,screenpos Y>=96),80 ,(root,screenpos Y)/3)
postype = left

[State 8001, RemoveExplod]
type=RemoveExplod
trigger1 = RoundState=3
trigger2 = root, movetype = H
trigger3 = root, var(45)=0
trigger4 = numhelper(8000)
id=8020
ignorehitpause=1

[State 0, Hyper Combo Finish]
type = ChangeState
trigger1 = RoundState=3 || Root,WinKo
trigger1 = root,movetype!=H
trigger1 = root, var(45)!=0
value = 8003

;[State 8001, DestroySelf]
;Type = ChangeState
;trigger1 = root, movetype = H
;trigger2 = root, var(45)=0
;value=8002

[State 8001, DestroySelf]
Type = DestroySelf
trigger1 = numhelper(8000)
trigger2 = root, movetype = H
trigger3 = root, var(45)=0

;-------------------------------------------------------------------------------
;Launcher FX
;-------------------------------------------------------------------------------
[StateDef 8009]
movetype=I
ctrl = 0
anim = 9741

[State 0, Explod]
type=Explod
trigger1=time=0
anim=80009
ID=80009
pos=0,0
postype=p1
bindtime=1
removetime=9
supermovetime=99999
pausemovetime=99999
scale=.5,.5
sprpriority=10

[State 0, Explod]
type=Explod
trigger1=time=8
anim=80010
ID=80010
pos=0,0
postype=p1
bindtime=1
removetime=9
supermovetime=99999
pausemovetime=99999
scale=.5,.5
sprpriority=10

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = numexplod(80009)
ID = 80009
scale = .5 + (time * .1),.5 + (time * .1)

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = numexplod(80010)
ID = 80010
scale = .5 + ((time-8) * .1),.5 + ((time-8) * .1)

[State 8000, Remove Effects]
type = RemoveExplod
trigger1=time >=15
;trigger2=root,movetype=H&&root,stateno!=9000

[State 8000, DestroySelf]
type=DestroySelf
trigger1=time >=15
;trigger2=root,movetype=H&&root,stateno!=9000
ignorehitpause=1

;------------------------------------
 ;Light Hit Spark
[StateDef 8230]
ctrl = 0
anim = 8230
sprpriority = 100

[State 8200, assert]
type=assertspecial
trigger1= 1
flag=noshadow

[State 0, Trans]
type=Trans
trigger1=1
trans=add
ignorehitpause=1

[State 0, AngleDraw]
type=AngleDraw
trigger1=1
ignorehitpause=1

[State 0, VarRandom]
type=VarRandom
trigger1=1
v=0
range=0,24
ignorehitpause=1

[State 0, AngleAdd]
type=AngleAdd
trigger1=Time=0
value=15*(var(0))
ignorehitpause=1

[State 8200, end]
type = DestroySelf
trigger1=AnimTime=0
;------------------------------------
 ;Medium Hit Spark
[StateDef 8235]
ctrl = 0
anim = 8235
sprpriority = 100

[State 8200, assert]
type=assertspecial
trigger1= 1
flag=noshadow

[State 0, Trans]
type=Trans
trigger1=1
trans=add
ignorehitpause=1

[State 0, AngleDraw]
type=AngleDraw
trigger1=1
ignorehitpause=1

[State 0, VarRandom]
type=VarRandom
trigger1=1
v=0
range=0,24
ignorehitpause=1

[State 0, AngleAdd]
type=AngleAdd
trigger1=Time=0
value=15*(var(0))
ignorehitpause=1

[State 8200, end]
type = DestroySelf
trigger1=AnimTime=0
;------------------------------------
 ;Light Hit Spark
[StateDef 8240]
ctrl = 0
anim = 8240
sprpriority = 100

[State 8200, assert]
type=assertspecial
trigger1= 1
flag=noshadow

[State 0, Trans]
type=Trans
trigger1=1
trans=add
ignorehitpause=1

[State 0, AngleDraw]
type=AngleDraw
trigger1=1
ignorehitpause=1

[State 0, VarRandom]
type=VarRandom
trigger1=1
v=0
range=0,24
ignorehitpause=1

[State 0, AngleAdd]
type=AngleAdd
trigger1=Time=0
value=15*(var(0))
ignorehitpause=1

[State 8200, end]
type = DestroySelf
trigger1=AnimTime=0
;------------------------------------
 ;Light Hit Spark
[StateDef 8245]
ctrl = 0
anim = 8245
sprpriority = 100

[State 8200, assert]
type=assertspecial
trigger1= 1
flag=noshadow

[State 0, Trans]
type=Trans
trigger1=1
trans=add
ignorehitpause=1

[State 0, AngleDraw]
type=AngleDraw
trigger1=1
ignorehitpause=1

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

;[State 0, VarRandom]
;type=VarRandom
;trigger1=1
;v=0
;range=0,24
;ignorehitpause=1

[State 0, AngleAdd]
type=AngleAdd
trigger1=Time=0
value=15;*(var(0))
ignorehitpause=1

[State 8200, end]
type = DestroySelf
trigger1=AnimTime=0
;-------------------------------------------------------------------------------
; Advanced Guard helper
[Statedef 8500]
type    = S
movetype= I
ctrl = 0
anim = 8500
sprpriority = -5

[State 8500, PlayerPush]
type = PlayerPush
trigger1 = Time >= 0
value = 1

[State 8500, VelSet]
type = VelSet
trigger1 = Time = [0,10]
x = 30

[State 8500, VelSet]
type = VelSet
trigger1 = Time = [11,13]
x = 20

[State 8500, VelSet]
type = VelSet
trigger1 = Time >= 14
x = 10

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S2,1
channel = 2

[State 8500, DestroySelf]
type = DestroySelf
trigger1 = Time >= 18
;========================<CAMERA CONTROL>=============================
[Statedef 8650]
physics=N
velset=0,0
anim=9741
[State 8650, bound]
type=screenbound
trigger1= 1
value=0
movecamera=1,1
[State 8650, end]
type=destroyself
trigger1= roundstate=2

;---------------------------------------------------------------------------
[StateDef 8900]
movetype=I
ctrl = 0
anim=9741

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = enemy(0),teamside = 1
value = ifelse(enemy(0),facing=-1,8901,8900)

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = enemy(0),teamside = 2
value = ifelse(enemy(0),facing=-1,8911,8910)

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = Enemy(0),Pos X
y = Ceil(-Enemy(0),ScreenPos Y + enemy(0),pos Y) + 240
ignorehitpause=1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = Enemy(0),ScreenPos Y < 300;240-(enemy(0),const(size.head.pos.y))

;---------------------------------------------------------------------------
[StateDef 8901]
movetype=I
ctrl = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = enemy(1),teamside = 1
value = ifelse(enemy(1),facing=-1,8921,8920)

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = enemy(1),teamside = 2
value = ifelse(enemy(1),facing=-1,8931,8930)

[State 0, PosSet]
type = PosSet
trigger1 = 1
x = Enemy(1),Pos X
y = Ceil(-Enemy(1),ScreenPos Y + enemy(1),pos Y) + 240
ignorehitpause=1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = Enemy(1),ScreenPos Y < 300;240-(enemy(1),const(size.head.pos.y))

;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

;[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
;type = VelSet
;trigger1 = abs(vel x) < 2
;trigger2 = Time = 4
;x = 0

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = N
anim = 10

;[State 10, 1]
;type = VelMul
;trigger1 = Time = 0
;x = .75

[State 10, VarSet];VarTimerSet
type=VarSet
trigger1=time=0&&((PrevStateNo!=[10,12])&&prevstateno!=9000)
var(1)=0
ignorehitpause=1

[State 10, VarAdd];VarTimerAdd
type=VarAdd
trigger1=1
var(1)=1
ignorehitpause=1

[State 10, ChangeAnim]
type=ChangeAnim
triggerall=(anim!=10)
trigger1=Time=0
value=10

;-------------------------------------------------------------------------------
[State 10, PosSet]
type=PosSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 10, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,9])||(PrevStateNo=[20,99])||(Vel X<1 && Vel X > -1)
trigger1=Time=0
x=0

[State 10, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 10, VelMul]
type=VelMul
trigger1=1
x=.9

[State 10, Explod]
type=Explod
triggerall=Vel X ;(prevstateno=10)
;trigger1=AnimElemTime(7)<0
trigger1=Var(1) % 4 = 0
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-Vel X,0
removetime=-2
supermovetime=9999
pausemovetime=9999
scale=const(size.xscale),const(size.yscale)
sprpriority=3
ownpal=1
removeongethit=1

[State 10, VelSet]
type=VelSet
trigger1=Vel X > -1 && Vel X < 1
x=0
y=0

[State 10, StateTypeSet]
type=StateTypeSet
trigger1=Vel X > -1 && Vel X < 1;AnimElemTime(4)>=0
physics=C
;-------------------------------------------------------------------------------

[State 10, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = N
;anim = 11
sprpriority = 0

[State 11, ChangeAnim]
type=ChangeAnim
triggerall=(anim!=11)
trigger1=Time=0
value=11

[State 11, VarSet];VarTimerSet
type=VarSet
trigger1=time=0&&((PrevStateNo!=[10,12])&&prevstateno!=9000)
var(1)=0
ignorehitpause=1

[State 11, VarAdd];VarTimerAdd
type=VarAdd
trigger1=1
var(1)=1
ignorehitpause=1

;-------------------------------------------------------------------------------
[State 11, PosSet]
type=PosSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 11, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,9])||(PrevStateNo=[20,99])||(Vel X<1 && Vel X > -1)
trigger1=Time=0
x=0

[State 11, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 11, VelMul]
type=VelMul
trigger1=1
x=.9

[State 11, Explod]
type=Explod
triggerall=Vel X ;(prevstateno=10)
;trigger1=AnimElemTime(7)<0
trigger1=Var(1) % 4 = 0
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-Vel X,0
removetime=-2
supermovetime=9999
pausemovetime=9999
scale=const(size.xscale),const(size.yscale)
sprpriority=3
ownpal=1
removeongethit=1

[State 11, VelSet]
type=VelSet
trigger1=Vel X > -1 && Vel X < 1
x=0
y=0

[State 11, StateTypeSet]
type=StateTypeSet
trigger1=Vel X > -1 && Vel X < 1;AnimElemTime(4)>=0
physics=C
;-------------------------------------------------------------------------------

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = N
;anim = 12

[State 12, ChangeAnim]
type=ChangeAnim
triggerall=(anim!=12)
trigger1=Time=0
value=12

[State 12, VarSet];VarTimerSet
type=VarSet
trigger1=time=0&&((PrevStateNo!=[10,12])&&prevstateno!=9000)
var(1)=0
ignorehitpause=1

[State 12, VarAdd];VarTimerAdd
type=VarAdd
trigger1=1
var(1)=1
ignorehitpause=1

;-------------------------------------------------------------------------------
[State 12, PosSet]
type=PosSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 12, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,9])||(PrevStateNo=[20,99])||(Vel X<1 && Vel X > -1)
trigger1=Time=0
x=0

[State 12, VelSet]
type=VelSet
trigger1=(PrevStateNo=[0,109])||(PrevStateNo=[0,12])||(PrevStateNo=[20,99])
trigger1=Time=0
y=0

[State 12, VelMul]
type=VelMul
trigger1=1
x=.9

[State 12, Explod]
type=Explod
triggerall=Vel X ;(prevstateno=10)
;trigger1=AnimElemTime(7)<0
trigger1=Var(1) % 4 = 0
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-Vel X,0
removetime=-2
supermovetime=9999
pausemovetime=9999
scale=const(size.xscale),const(size.yscale)
sprpriority=3
ownpal=1
removeongethit=1

[State 12, VelSet]
type=VelSet
trigger1=Vel X > -1 && Vel X < 1
x=0
y=0

[State 12, StateTypeSet]
type=StateTypeSet
trigger1=Vel X > -1 && Vel X < 1;AnimElemTime(4)>=0
physics=S
;-------------------------------------------------------------------------------

[State 12, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x) * const(size.xscale)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x) * const(size.xscale)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

;---------------------------------------------------------------------------
; Pre-Match Walk
[Statedef 22]
type=S
physics=S
sprpriority = 0

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

[State 0, VelSet]
type=VelSet
trigger1=Time=0
y=0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)/2

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)/2

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 22 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 22

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 23 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 23

[State 20, 5]
type = ChangeAnim
triggerall = P2Dist X < -5
trigger1 = Anim != 5
value = 5

[State 20, 6]
type=Turn
triggerall = P2Dist X < -5
trigger1 = Anim = 5

[State 20, 3]
type = ChangeAnim
triggerall = command != "holdback"&&command != "holdfwd"
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 0

[State 20, 2]
type = VelSet
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
x = 0

[State 20, VarSet Pos X]
type=VarSet
trigger1=roundstate!=2
fvar(9)=floor(pos x)

[State 20, PosSet]
type=PosSet
trigger1=roundstate=2
trigger1=fvar(9)!=0
x=fvar(9)

[State 20, VarSet]
type=VarSet
trigger1=roundstate=2
fvar(9)=0

[State 20, ChangeState]
type=ChangeState
trigger1=ctrl
value=ifelse((command="holdfwd")||(command ="holdback"),22,0)

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
;anim = 40
ctrl = 0
sprpriority = 1
;movehitpersist=ifelse(prevstateno=9000,1,0)
hitcountpersist=1;ifelse(prevstateno=9000,1,0)

[State 40, ChangeAnim]
type=ChangeAnim
triggerall=(anim!=40)
trigger1=Time=0
value=40

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 60, Explod]
type=Explod
triggerall = var(11)=2
trigger1 = AnimTime = 0
anim=8005
ID=8005
pos=0,-Floor(const(velocity.jump.y)*1.475)
postype=p1
bindtime=1
removetime=-2
sprpriority=5
ownpal=1
ignorehitpause=1

[State 60, 4]
type = VelSet
triggerall = var(11)=2
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)*1.475

[State 60, Super Jump Sound]
type=PlaySnd
triggerall = Var(11)=2
trigger1=AnimTime=0
value=S60,ifelse(var(0)<2,0,1)
channel=4

[State 40, 4]
type = VelSet
triggerall = var(11)!=2
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
triggerall = var(11)!=2
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0

[State 0, VarAdd]
type = VarAdd
trigger1 = Time = 2
v = 20
value = 1
ignorehitpause = 1

[State 45, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(44)
value = 44

[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 45, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 45, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)

[State 45, 7]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
physics = A
ctrl = 1
;movehitpersist=ifelse(prevstateno=9000,1,0)
hitcountpersist=1;ifelse(prevstateno=9000,1,0)

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, 2]
type = ChangeAnim
triggerall = (var(11)!=2||Var(20)) && (anim!=[41,43])
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 50, 2]
type = ChangeAnim
triggerall = var(11)=2&&!Var(20)&&(anim!=[51,53])
trigger1 = Time = 0
value = ifelse((vel x)=0, 51, ifelse((vel x)>0, 52, 53))

[State 50, 3]
type = ChangeAnim
triggerall = var(11)!=2 && anim != SelfAnimExist(anim + 3)
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 50, 4]
type=null;ChangeState
trigger1=pos Y >= floor(-vel y)
trigger1=vel Y >= 0
value=52
ctrl=0

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type=A
physics=A
movehitpersist=1
facep2=ifelse(var(11),1,0)
;movehitpersist=ifelse(prevstateno=9000,1,0)
hitcountpersist=1;ifelse(prevstateno=9000,1,0)

[State 0, CtrlSet]
type=CtrlSet
trigger1=var(11)
value=1

[State 51, 1]
type = ChangeAnim
trigger1 = Time = 0 && (Anim!=[54,56])
value = ifelse((vel x)=0, 54, ifelse((vel x)>0, 55, 56))

[State 51, 2]
type=null;ChangeState
trigger1=pos Y >= floor(-vel y)
trigger1=vel Y >= 0
value=52
ctrl=0

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = 47
facep2=1

[State 52, ChangeState]
type = ChangeState
trigger1=backedgebodydist < -10 || frontedgebodydist < -10
value=110

[State 52, 1]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 52, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, 3]
type = CtrlSet
trigger1 = Time = 3
value = 1

[State 52, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = A
physics = N
ctrl=0
sprpriority=1

[State 100, ChangeAnim]
type=ChangeAnim
triggerall=Time=0
trigger1=anim!=100
value=100

[State 0, PosSet]
type=PosSet
trigger1=Time=0&&(PrevStateNo=[105,106])
y=0

[State 0, VelSet]
type=VelSet
trigger1=Time=0&&(PrevStateNo=[105,106])
y=0

[State 100, CtrlSet]
type = CtrlSet
trigger1 =AnimElemTime(4)>=0
value = 1

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(2)=0
x = const(velocity.run.fwd.x)
y = const(velocity.run.fwd.y)

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = AnimElemTime(2)>=0
statetype = A

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 0, VelAdd]
type = VelAdd
triggerall = Vel X > 0
trigger1 = AnimElemTime(4)>0
x = -.1

[State 105, PlaySnd]
type = PlaySnd
trigger1 = AnimElemTime(2)=0
value = S100,0
channel = 0

[State 105, Dash FX]
type = Explod
triggerall = (time%2)=0
trigger1 = AnimElemTime(2)>=0&&AnimElemTime(15)<0
anim = 8000
ID = 8000
pos = Ceil(-5 * const(size.xscale)),Ceil(-60 * const(size.yscale))
postype = p1
Vel = -2,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 105, Dash FX]
type = Explod
triggerall = (time%2)=0
trigger1 = AnimElemTime(2)>=0&&AnimElemTime(15)<0
anim = 8000
ID = 8000
pos = Ceil(-45 * const(size.xscale)),Ceil(-60 * const(size.yscale))
postype = p1
Vel = -1,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nostandguard
flag2=nocrouchguard
flag3=noairguard

[State 0, PosSet]
type=PosSet
trigger1 = AnimElemTime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, VelSet]
type=VelSet
trigger1 = AnimElemTime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, ChangeState]
type = ChangeState
trigger1=AnimElemTime(4)>=0 && ctrl
trigger1=command="holdup"
value = 40
ctrl=0

[State 0, ChangeState]
type = ChangeState
trigger1=AnimElemTime(4)>=0 && ctrl
trigger1=command="holddown"
value = 10

[State 0, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(2)>0
y = .29

[State 100, 4]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= Floor(-Vel Y)
value = 101;ifelse(!Vel Y, 11, 101)
ctrl=0

;---------------------------------------------------------------------------
; RUN_END
[Statedef 101]
type    = S
physics = S
;anim=101
sprpriority=1

[State 100, ChangeAnim]
type=ChangeAnim
triggerall=Time=0
trigger1=anim!=101
value=101

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 0, ScreenBound]
type = ScreenBound
triggerall=prevstateno=111
trigger1=backedgebodydist < 0||frontedgebodydist<0
value=0
movecamera=0,0
ignorehitpause=1

[State 101, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 101, 3]
type=VelSet
trigger1 = Time = 0
y=0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nowalk

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nostandguard
flag2 = nocrouchguard
flag3 = noairguard

[State 101, 4]
type = ChangeState
triggerall=prevstateno=111
triggerall=backedgebodydist < 0||frontedgebodydist<0
trigger1=AnimTime=0
value = 110

[State 0, CtrlSet]
type = CtrlSet
triggerall=prevstateno=111
trigger1=backedgebodydist <0||frontedgebodydist<0
value = 0

[State 105, Landing Anim]
type = Explod
trigger1 = AnimElemTime(2)=0
anim = 8002
ID = 8002
pos = 0,0
postype = p1
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 105, PlaySnd]
type = PlaySnd
trigger1 = AnimElemTime(2)=0
value = S52,0
channel = 3

[State 100, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = S
physics = N
sprpriority = 1
ctrl=0

[State 0, PosSet]
type=PosSet
trigger1=Time=0&&(PrevStateNo=[100,101])
y=0

[State 0, VelSet]
type=VelSet
trigger1=Time=0&&(PrevStateNo=[100,101])
y=0

[State 0, ChangeAnim]
type = ChangeAnim
triggerall=anim!=105
trigger1=time=0
value=105

[State 0, PlaySnd]
type=PlaySnd
trigger1=AnimElemTime(3)=0
value=S41,0
channel=0

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nowalk
flag2=noautoturn

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nostandguard
flag2=nocrouchguard
flag3=noairguard

[State 0, CtrlSet]
type=CtrlSet
trigger1=AnimElemTime(4)>=0
value=1

[State 0, VelSet]
type=VelSet
trigger1=Time=0&&PrevStateNo!=9000
x=0
y=0

[State 0, StateTypeSet]
type = StateTypeSet
trigger1=AnimElemTime(3)>=0
statetype=A
physics=N

[State 0, VelSet]
type=VelSet
trigger1=animelemtime(4)=0
x=Const(velocity.run.back.x)
y=Const(velocity.run.back.y)

[State 0, VelAdd]
type=VelAdd
trigger1=animelemtime(5)>=0
y=.3

[State 0, VelAdd]
type=VelAdd
triggerall=Vel X<=-1
trigger1=animelemtime(5)>=0
x=.1

[State 0, PosSet]
type=PosSet
trigger1=animelemtime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, VelSet]
type=VelSet
trigger1=animelemtime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, ChangeState]
type=ChangeState
trigger1=animelemtime(4)>=0
trigger1=command="holddown"
value=10

[State 0, ChangeState]
type=ChangeState
trigger1=animelemtime(4)>=0
trigger1=command="holdup"
value=40

[State 0, Explod]
type=Explod
trigger1=animelemtime(4)>=0&&AnimElemTime(17)<0
trigger1=(gametime%4)=0
anim=8000
ID=8000
pos = Ceil(15 * const(size.xscale)),Ceil(-50 * const(size.yscale))
postype=p1
bindtime=1
vel=1,0
accel=.1,0
random=30,50
removetime=-2
scale=1,1
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, Explod]
type=Explod
trigger1=animelemtime(4)>=0&&AnimElemTime(17)<0
trigger1=(gametime%4)=0
anim=8000
ID=8000
pos = Ceil(30 * const(size.xscale)),Ceil(-25 * const(size.yscale))
postype=p1
bindtime=1
vel=.8,0
accel=.1,0
random=60,50
removetime=-2
scale=1,1
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 100, 4]
type = ChangeState
triggerall=animelemtime(4)>=0
trigger1=Pos Y>=Ceil(-Vel Y)
trigger1=Vel Y>=0
value=106

;---------------------------------------------------------------------------
; RUNBACK_LAND
[Statedef 106]
type=S
physics=S
ctrl=1

[State 0, ChangeAnim]
type = ChangeAnim
triggerall=anim!=106;&&(anim!=241)
trigger1=time=0
value=106

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nowalk
flag2=noautoturn

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nostandguard
flag2=nocrouchguard
flag3=noairguard

[State 0, VelSet]
type=VelSet
trigger1=Time=0
y=0

[State 0, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 105, Landing Anim]
type = Explod
trigger1 = AnimElemTime(2)=0
anim = 8002
ID = 8002
pos = 0,0
postype = p1
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 105, PlaySnd]
type = PlaySnd
trigger1 = AnimElemTime(2)=0
value = S52,0
channel = 3

[State 101, 4]
type = ChangeState
trigger1 = animTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Air RUN_FWD
[Statedef 108]
type    = A
physics = N
anim=108
ctrl=0
sprpriority=1

[State 0, Air Dash Var]
type = VarAdd
trigger1 = Time = 0
v = 22
value = 1

[State 100, CtrlSet]
type = CtrlSet
trigger1 = time = 4
value = 1

[State 100, 1]
type = VelSet
trigger1 = Time = 1
x = const(velocity.run.fwd.x)
y = 0

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
y = 0

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 0, VelAdd]
type = VelAdd
triggerall = Vel X > 0
trigger1 = Time > 1
x = -.1

[State 105, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S100,0
channel = 4

[State 105, Dash FX]
type = Explod
trigger1=(Time%2)=1
anim = 8000
ID = 8000
pos = -5*Ceil(const(size.xscale)),-85*Ceil(const(size.yscale))
postype = p1
Vel = -2,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 105, Dash FX]
type = Explod
trigger1=(Time%2)=1
anim = 8000
ID = 8000
pos = -45*Ceil(const(size.xscale)),-85*Ceil(const(size.yscale))
postype = p1
Vel = -1,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=noairguard

[State 100, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 51
ctrl=1

[State 100, 4]
type = ChangeState
trigger1 = Pos Y >= Floor(-Vel Y)
trigger1 = Vel Y > 0
value = 52
ctrl=1

;---------------------------------------------------------------------------
; Run In Screen
[Statedef 110]
type    = S
physics = S
ctrl = 0
;anim = 47
velset=0,0
facep2=1

[State 110, VarSet] ;Reset Flying Screen Var
type = VarSet
trigger1 = 1
var(12) = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = prevstateno!=[100,499]
trigger1 = Time = 0
value = 47

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

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
movecamera = 0,0

[State 52, 1]
type = VelSet
trigger1 = Time = 0
y = 0
x = 0

[State 52, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 0, Landing Sound]
type = PlaySnd
triggerall=anim=47
trigger1 = time = 1
value = s52,1
channel = 4

[State 0, Landing Anim]
type = Explod
triggerall=anim=47
trigger1 = time = 1
anim = 8001
ID = 8001
postype = p1
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = .6,.6
sprpriority = -1
ownpal = 1
removeongethit = 0
ignorehitpause =1
persistent =0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = animtime = 0 && anim != 0
value = 0

[State 0, PosSet]
type = PosSet
trigger1=backedgebodydist <= -48 || frontedgebodydist <= -48
x = Ceil(-256*facing)*const(size.xscale)

[State 0, ChangeState]
type = ChangeState
trigger1 = !numtarget || enemynear,movetype!=H
;trigger2 = (numtarget) && target,statetype=L
trigger2 = enemynear,statetype=L && enemynear,time>=10
trigger3 = !numenemy
value = 111
ctrl=0

;---------------------------------------------------------------------------
; RUN in Screen
[Statedef 111]
type    = S
physics = N
anim = 100
ctrl=0
velset=0,0
facep2=1

[State 0, NotHitBy]
type = NotHitBy
trigger1=backedgebodydist <= -10
value=SCA

[State 0, PosSet]
type=PosSet
trigger1=Time=0&&(PrevStateNo=[105,106])
y=0

[State 0, VelSet]
type=VelSet
trigger1=Time=0&&(PrevStateNo=[105,106])
y=0

[State 0, StateTypeSet]
type = StateTypeSet
trigger1 = AnimElemTime(2)>=0
statetype = A

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(2)=0
x = const(velocity.run.fwd.x)
y = const(velocity.run.fwd.y)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = NoAutoTurn

[State 0, AssertSpecial]
type=AssertSpecial
trigger1=1
flag=nostandguard
flag2=nocrouchguard
flag3=noairguard

[State 0, VelAdd]
type = VelAdd
triggerall = Vel X > 0
trigger1 = AnimElemTime(4)>0
x = -.1

[State 100, PlaySnd]
type = PlaySnd
trigger1 = AnimElemTime(2)=0
value = S100,0
channel = 4

[State 100, Dash FX]
type = Explod
triggerall = (time%2)=0
trigger1 = AnimElemTime(2)>=0&&AnimElemTime(15)<0
anim = 8000
ID = 8000
pos = -5*Ceil(const(size.xscale)),-75*Ceil(const(size.yscale))
postype = p1
Vel = -2,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

[State 100, Dash FX]
type = Explod
triggerall = (time%2)=0
trigger1 = AnimElemTime(2)>=0&&AnimElemTime(15)<0
anim = 8000
ID = 8000
pos = -45*Ceil(const(size.xscale)),-75*Ceil(const(size.yscale))
postype = p1
Vel = -1,0
accel = .25,0
random = 60,40
bindtime = 1
removetime = -2
supermove = 9999
pausemove = 9999
scale = 1,1
sprpriority = 3
ownpal = 1
ignorehitpause =1

;[State 0, ScreenBound]
;type = ScreenBound
;trigger1=backedgebodydist <= -const(size.ground.back)*2
;value = 0
;movecamera = 0,0

[State 0, ScreenBound]
type = ScreenBound
trigger1=1
value = 0
movecamera = 0,0

[State 0, CtrlSet]
type = CtrlSet
trigger1 =AnimElemTime(4)>=0
value = ifelse((backedgebodydist >= -10 || frontedgebodydist >=-10), 1, 0)

[State 0, PosSet]
type=PosSet
triggerall = backedgebodydist >= -10
trigger1 = AnimElemTime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, VelSet]
type=VelSet
triggerall = backedgebodydist >= -10
trigger1 = AnimElemTime(4)>=0
trigger1=command="holddown"||command="holdup"
y=0

[State 0, ChangeState]
type = ChangeState
triggerall = backedgebodydist >= -10
trigger1=AnimElemTime(4)>=0 && ctrl
trigger1=command="holdup"
value = 40
ctrl=0

[State 0, ChangeState]
type = ChangeState
triggerall = backedgebodydist >= -10
trigger1=AnimElemTime(4)>=0 && ctrl
trigger1=command="holddown"
value = 10

[State 0, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(2)>0
y = .29

[State 100, 4]
type = ChangeState
triggerall = backedgebodydist >= -10
trigger1 = Vel Y > 0 && Pos Y >= Floor(-Vel Y)
value = 101;ifelse(!Vel Y, 11, 101)
ctrl=1

[State 100, 4]
type = ChangeState
triggerall = backedgebodydist < -10
trigger1 = Vel Y > 0 && Pos Y >= Floor(-Vel Y)
value = 110

;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 120 + (statetype = C) + (statetype = A)*2

[State 120, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 120, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 120, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 120, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 130 + (statetype = C) + (statetype = A)*2

[State 120, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type    = S
physics = S

[State 130, 1]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

[State 130, Hi to Lo]
type = ChangeState
trigger1 = command = "holddown"
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type    = C
physics = C

[State 131, 1]
type = ChangeAnim
trigger1 = Anim != 131
value = 131

[State 131, Lo to Hi]
type = ChangeState
trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type    = A
physics = N

[State 132, 1]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

[State 132, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 132, 3]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 132, 4]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, 5]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 132, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2

[State 140, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 140, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

;[State 140, 5] ;Implemented within engine
;type = ChangeState
;trigger1 = AnimTime = 0
;value = (statetype = C)*11 + (statetype = A)*51

;---------------------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
type    = S
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = ChangeAnim
trigger1 = 1
value = 150

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 150, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 3

;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type    = S
movetype= H
physics = S
anim = 150

[State 151, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 151, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 151, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 151, 4]
type = ChangeState
trigger1 = HitOver
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type    = C
movetype= H
physics = N
velset = 0,0

[State 152, 1]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 152, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 152, 4]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type    = C
movetype= H
physics = C
anim = 151

[State 153, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 153, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 153, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 153, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 153, 4]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1

;---------------------------------------------------------------------------
; AGUARDHIT (shaking)
[Statedef 154]
type    = A
movetype= H
physics = N
velset = 0,0

[State 154, 1]
type = ChangeAnim
trigger1 = 1
value = 152

[State 154, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 155 ;AGUARDHIT2

[State 154, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type    = A
movetype= H
physics = N
anim = 152

[State 155, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 155, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 155, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 155, 4]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 155, 5]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 155, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52

;---------------------------------------------------------------------------
;Guard Push (Stand)
[Statedef 160]
type    = S
movetype= I
physics = N
velset = 0,0
ctrl = 0
anim = 160
sprpriority = 2

[State 0, VelMul]
type = VelMul
trigger1 = 1
x = 0.75

[State 0, VelSet]
type = VelSet
trigger1 = Time = 10
x = 0

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

[State 0, Helper]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 8500
ownpal = 0
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 0, Explod]
type = Explod
trigger1 = Time = 0
anim = 8007
postype = p1
pos = 45,-75
ownpal = 0
vel = 0,0
scale = 1,1
ignorehitpause = 1
sprpriority = 7

[State 0, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[Statedef 161];--------------crouch
type    = C
movetype= I
physics = N
poweradd= 0
velset = 0,0
ctrl = 0
anim = 161
sprpriority = 2

[State 0, VelMul]
type = VelMul
trigger1 = 1
x = 0.75

[State 0, VelSet]
type = VelSet
trigger1 = Time = 10
x = 0

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

[State 0, Helper]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 8500
ownpal = 0
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 0, Explod]
type = Explod
trigger1 = Time = 0
anim = 8007
postype = p1
pos = 60,-60
ownpal = 0
vel = 0,0
scale = 1,1
ignorehitpause = 1
sprpriority = 7

[State 0, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1


[Statedef 162];------------air
type    = A
movetype= I
physics = N
poweradd= 0
velset = 0,0
ctrl = 0
anim = 162
sprpriority = 2

[State 0, VelMul]
type = VelMul
trigger1 = 1
x = 0.75

[State 0, VelSet]
type = VelSet
trigger1 = Time = 10
x = 0

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

[State 0, Helper]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 8500
ownpal = 0
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 0, Explod]
type = Explod
trigger1 = Time = 0
anim = 8007
postype = p1
pos = 60,-90
ownpal = 1
vel = 0,0
scale = 1,1
ignorehitpause = 1
sprpriority = 7

[State 0, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 140
ctrl = 1
;-------------------------------------------------------------------------------
;Tech Hitted/Guard Break
;-------------------------------------------------------------------------------
[StateDef 165]
type=S
physics=N
ctrl = 0
anim = 165
facep2=1

[State 0, VarSet]
type=VarSet
trigger1=Time=1
var(29)=11

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8301
ID=8301
pos=Ceil(5*const(Size.xscale)),Ceil(-59*const(size.yscale))
postype=p1
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8302
ID=8302
postype=left
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
x = -5.625 * const(size.xscale)
y = 0

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= 5
x = .6

[State 5001, 4]
type = VelSet
trigger1 = Time = 10
x = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S2,2
channel = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S5000,0
channel = 5

[State 165, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;-------------------------------------------------------------------------------
;Tech Hitted/Guard Break Low
;-------------------------------------------------------------------------------
[StateDef 166]
type=C
physics=C
ctrl = 0
anim = 166

[State 0, VarSet]
type=VarSet
trigger1=Time=1
var(29)=11

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8301
ID=8301
pos=Ceil(5*const(Size.xscale)),Ceil(-59*const(size.yscale))
postype=p1
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8302
ID=8302
postype=left
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
x = -5.625 * const(size.xscale)
y = 0

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= 5
x = .6

[State 5001, 4]
type = VelSet
trigger1 = Time = 10
x = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S2,2
channel = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S5000,0
channel = 5

[State 165, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;-------------------------------------------------------------------------------
;Tech Hitted/Guard Break Air
;-------------------------------------------------------------------------------
[StateDef 167]
type=A
movetype = I
physics=A
ctrl = 0
anim = 167

[State 0, VarSet]
type=VarSet
trigger1=Time=1
var(29)=11

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8301
ID=8301
pos=Ceil(5*const(Size.xscale)),Ceil(-59*const(size.yscale))
postype=p1
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, Explod]
type=Explod
trigger1=Time=1
anim=8302
ID=8302
postype=left
bindtime=1
removetime=-2
sprpriority=5
ownpal=1

[State 0, VelSet]
type = VelSet
trigger1 = Time = 0
x = -5.625 * const(size.xscale)

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= 5
x = .6

[State 5001, 4]
type = VelSet
trigger1 = Time = 10
x = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S2,2
channel = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 1
value = S5000,0
channel = 5

[State 165, ChangeState]
type = ChangeState
trigger1 = AnimTime = 0
value = 51
ctrl = 1

;---------------------------------------------------------------------------
; LOSE (Time over)
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

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

;---------------------------------------------------------------------------
; DRAWGAME (Time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 175, 1] ; If no anim, use go to lose state.
type = ChangeState
trigger1 = Time = 0
trigger1 = !SelfAnimExist(175)
value = 170

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 175

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

;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(190)
value = 190

[State 190, 2] ;Go straight to intro.
type = ChangeState
trigger1 = Time = 0
value = 191

;---------------------------------------------------------------------------
; INTRO (override this state to give character an intro)
[Statedef 191]
type = S
ctrl = 0

[State 191, 1]
type = ChangeState
trigger1 = Time = 0
value = 0

;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;HITG_SLIDE

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype)=0
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype)=1
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype)>=2
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5001]
type    = S
movetype= H
physics = S

[State 5001, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HITC_SHAKE
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5010, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
triggerall = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;HITC_SLIDE

[State 5010, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5010, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype)=0
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype)=1
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype)>=2
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITC_SLIDE
[Statedef 5011]
type    = C
movetype= H
physics = C

[State 5011, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1


;---------------------------------------------------------------------------
; HITA_SHAKE
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

;[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
;type = ChangeAnim
;trigger1 = Time = 0
;trigger1 = GetHitVar(animtype) != [3,5]
;value = ifelse((GetHitVar(airtype) = 1),5037,5030) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype)=0
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype)=1
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype)>=2
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
;Forced Recovery
[Statedef 5025]
type=U
movetype=H
physics=N
velset=0,0
facep2=1

[State 5025, HitFallSet]
type=HitFallSet
trigger1=1
value=0

[State 5025, PosSet]
type=PosSet
trigger1=Pos Y > 0
y=0

[State 5025, End]
type=SelfState
trigger1=1
value=ifelse(pos y, 5020, 5000)

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, ChangeAnim] ;Going up
type = ChangeAnim
triggerall = (anim != [5047,5059]) && selfanimexist(5051)
triggerall = (anim != [5090,5099])
trigger1 = animtime = 0
trigger1 = Vel Y <= 0
trigger1 = (abs(gethitvar(xvel)) < abs(gethitvar(yvel)/3)) * const(size.xscale)
value = 5051

[State 5030, 4]
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = HitOver
trigger1 = (anim != [5090,5099])
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
trigger1 = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0
trigger3 = HitFall
trigger3 = Pos Y >= Floor(-Vel Y)
trigger3 = Vel Y > 0
trigger3 = (anim != [5090,5099])
trigger4 = HitFall
trigger4 = Pos Y >= Floor(-Vel Y)+15
trigger4 = Vel Y > 0
trigger4 = (anim = [5090,5099])
value = 5050 ;HITA_FALL

[State 5030, 6] ;Ground Recover
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y) && Vel Y > 0
trigger1 = (Anim != [5090,5099])
value = 5220

[State 5030, 6] ;Recovery Roll
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y)+15
trigger1 = Vel Y > 0
trigger1 = (Anim = [5090,5099])
value = ifelse(Vel X > 0, 5251, 5256)

[State 5030, 8]
type = ChangeState
triggerall = (anim != [5090,5099])
trigger1 = AnimTime = 0
value = 5035 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 5035, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5035, 3]
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = HitOver
trigger1 = (anim != [5090,5099])
value = 5040 ;HITA_RECOV

[State 5035, 4]
type = ChangeState
trigger1 = HitFall
trigger1 = HitOver
trigger2 = Vel Y >= 1
trigger3 = HitFall
trigger3 = Pos Y >= Floor(-Vel Y)
trigger3 = Vel Y > 0
trigger3 = (anim != [5090,5099])
trigger4 = HitFall
trigger4 = Pos Y >= Floor(-Vel Y)+15
trigger4 = Vel Y > 0
trigger4 = (anim = [5090,5099])
trigger5 = Time = 0
trigger5 = Anim != 5035
value = 5050 ;HITA_FALL

[State 5035, 5] ;Ground Recover
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y)
trigger1 = Vel Y > 0
trigger1 = (Anim != [5090,5099])
value = 5220

[State 5035, 6] ;Recovery Roll
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y)+15
trigger1 = Vel Y > 0
trigger1 = (Anim = [5090,5099])
value = ifelse(Vel X > 0, 5251, 5256)

;---------------------------------------------------------------------------
; HITA_RECOV (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= I;H
physics = N

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050

[State 5040, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != 5040
;trigger1 = AnimTime = 0
;trigger1 = Anim != 5040
;trigger2 = Time = 0
;trigger2 = Anim != 5035
value = 5040

[State 5040, 3]
type = CtrlSet
trigger1 = Time=0;HitOver
value = 1

[State 5040, 4]
type = StateTypeSet
trigger1 = Time=0;HitOver
movetype = I

[State 5040, 5]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel) + .2

[State 5040, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y)
value = 52 ;JUMPLAND

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= 1;ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

;[State 5050, 4] ;Recover near ground
;type = ChangeState
;triggerall = Vel Y > 0
;triggerall = Pos Y >= -20
;triggerall = alive
;triggerall = CanRecover
;trigger1 = Command = "recovery"
;value = 5200 ;HITFALL_RECOVER

;[State 5050, 5]; Recover in mid air
;type = ChangeState
;triggerall = Vel Y > -1
;triggerall = alive
;triggerall = CanRecover
;trigger1 = Command = "recovery"
;value = 5210 ;HITFALL_AIRRECOVER

[State 5050, 6]
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = HitOver
trigger1 = (anim != [5090,5099])
value = 5040 ;HITA_RECOV

[State 5035, 7] ;Ground Recover
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y)
trigger1 = Vel Y > 0
trigger1 = (Anim != [5090,5099])
value = 5220

[State 5035, 8] ;Recovery Roll
type = ChangeState
triggerall = !HitFall && Alive
trigger1 = Pos Y >= Floor(-Vel Y)+15
trigger1 = Vel Y > 0
trigger1 = (Anim = [5090,5099])
value = ifelse(Vel X > 0, 5251, 5256)

[State 5050, 9]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; Spin Fall
[Statedef 5055]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5060

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 0
;trigger1 = anim = 5000
;trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 1
;trigger1 = anim = 5001
;trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype) >= 2
;trigger1 = anim = 5012
;trigger2 = anim = 5002
;trigger3 = anim = 5030
;trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Spin Fall
[Statedef 5060]
type    = A
movetype= H
physics = N

[State 0, HitVelSet]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim2
triggerall=!SelfAnimExist(5055)
trigger1 = Time = 0
value = 5350

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
triggerall=SelfAnimExist(5055)
trigger1 = Time = 0
value = 5055

[State 5050, 2] ;Coming down anim
type = ChangeAnim2
trigger1 = Vel Y > 0
trigger1 = !SelfAnimExist(5065)
value = 5360
persistent = 0

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = Vel Y > 0
trigger1 = SelfAnimExist(5065)
value = 5065
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

;[State 5050, 4] ;Recover near ground
;type = ChangeState
;triggerall = Vel Y > 0
;triggerall = Pos Y >= -20
;triggerall = alive
;triggerall = CanRecover
;trigger1 = Command = "recovery"
;value = 5200 ;HITFALL_RECOVER

;[State 5050, 5]; Recover in mid air
;type = ChangeState
;triggerall = Vel Y > -1
;triggerall = alive
;triggerall = CanRecover
;trigger1 = Command = "recovery"
;value = 5210 ;HITFALL_AIRRECOVER

[State 5050, 3]
type = SelfState
triggerall = !HitFall&&Alive
trigger1 = HitOver
trigger1 = Pos Y >= 0
trigger1 = Vel Y >= 0
value = 5040

;[State 5050, Recovery]
;type=ChangeState
;trigger1=!HitFall&&Alive
;trigger1 = Vel Y > 0
;trigger1 = Pos Y >= Floor(-Vel Y)
;value=5220

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0 ;Floor(-Vel Y)
value = 5105 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_TRIP (shaking)
[Statedef 5070]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5070, 1]
type = ChangeAnim
trigger1 = 1
value = 5070

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type    = A
movetype= H
physics = N

[State 5071, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5071, 2] ;Acceleration
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);15
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type    = L
movetype= H
physics = C

[State 5081, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 5110 ;HIT_LIEDOWN

;---OTG---
[Statedef 5085]
type=L
physics=N
movetype=H
velset=0,0
anim=5090
ctrl=0
facep2=1

[State 5025, HitFallSet]
type=HitFallSet
trigger1=1
value=0

[State 5085, nothitby]
type=nothitby
trigger1= gethitvar(fallcount)>1
value=SCA
time=1
[State 5085, hfs]
type=hitfallset
trigger1= 1
value=0
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 =  time > 0
value = 5090
[State 5085, End]
type=changestate
trigger1= hitshakeover
value= 5086

[Statedef 5086]
type=A
physics=N
movetype=H
ctrl=0
[State 5086, nothitby]
type=nothitby
trigger1= gethitvar(fallcount)>1
value=SCA
time=1
[State 5086, Vel]
type=hitvelset
trigger1= !time
x=1
y=1
[State 5086, grav]
type=veladd
trigger1= 1
y=gethitvar(yaccel)
[State 5086, End]
type=Changestate
triggerall=selfanimexist(5250)&&selfanimexist(5251)&&selfanimexist(5252)
trigger1= vel y>0 && pos y>=Floor(-Vel Y)+15
value= 5087
[State 5086, End]
type=selfstate
triggerall=!selfanimexist(5250)&&!selfanimexist(5251)&&!selfanimexist(5252)
trigger1= vel y>0 && pos y>=Floor(-Vel Y)+15
value= ifelse(!Alive, 5200, 5100)

[Statedef 5087]
type=L
movetype=I
physics=N
anim=5251
Velset=ifelse(Vel X <= 0 , -9, 9),0
ctrl=0

[State 5220, ChangeState]
type = SelfState
trigger1 = Time = 0
trigger1 = !Alive
value = 5100

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=f120
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=ifelse(Vel X < 0, 3.5, -3.5),-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=f60
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = F7,(sysvar(1) > 5) + (sysvar(1) > 14)
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = Time = 23
x = 0

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

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

[State 5220, ChangeState]
type = SelfState
trigger1 = Time = 23
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5100]
type    = L
movetype= H
physics = N

[State 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5100, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5100, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5100, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5100, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5100, 11]
type = PosFreeze
trigger1 = 1

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101

[State 5100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

;[State 5101, 4]
;type = PosSet
;trigger1 = Time = 0
;y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);12
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 3] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170
[State 5110, 3] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0 && gethitvar(fall.yvel) = 0 && SelfAnimExist(5180)
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5180 + (anim % 10))
value = 5180

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)
[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0 && gethitvar(fall.yvel) = 0 && SelfAnimExist(5180 + (anim % 10))
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5180 + (anim % 10)

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5120]
type    = L
movetype= I
physics = N

[State 5120, ChangeState] ;Recovery Roll
type = ChangeState
trigger1 = time = 0
trigger1 = command = "holdfwd" || command = "holdback"
trigger1 = alive
value = ifelse(command = "holdfwd", 5241, 5242)

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

[State 5120, 2]
type = VelSet
trigger1 = Time = 0
x = 0

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

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

[State 0, PosSet]
type = null;PosSet
trigger1 = time = 0
y = 0

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

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

[State 5200, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5200, 3]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 10
value = 5201

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (on the ground)
[Statedef 5201]
type    = A
movetype= H
physics = A
anim = 5200

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -.15
y = -3.5

[State 5201, 3]
type = PosSet
trigger1 = Time = 0
y = 0

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

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5201, 6]
type = GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5210, 1]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

[State 5210, 1]
type = VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
y = -4.5

[State 5210, 1]
type = VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

[State 5210, 2] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = 1.5

[State 5210, 2] ;Go fwd
type = VelMul
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = 1

[State 5210, 2] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = -1

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd;Gravity
trigger1 = Time >= 4
y = .35

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMP_LAND
ctrl = 1

;-------------------------------------------------------------------------------
[StateDef 5220]
type=A
movetype=I
physics=N
ctrl = 1
;anim = 5220

[State 5220, ChangeAnim]
type=ChangeAnim
trigger1=selfanimexist(5220)
trigger1=Time=0&&Anim!=5220
value=5220

[State 5220, ChangeAnim]
type=ChangeAnim
trigger1=!selfanimexist(5210)
trigger1=Time=0&&Anim!=5210
value=5210

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, PosFreeze]
type=PosFreeze
trigger1=Time<1
value=1

[State 5220, VelSet]
type=VelSet
trigger1=Time=0
y=-1.695 + (-abs(vel y)*.5)

[State 5220, VelMul]
type=VelMul
trigger1=Time>0
x=.9

[State 5220, VelAdd]
type=VelAdd
trigger1=Time>=1
y=GetHitVar(yaccel)

[State 5220, PlaySnd]
type=PlaySnd
trigger1=Time=0
value=F7,2

[State 5220, Explod]
type=Explod
trigger1=Time=0
anim=F62
ID=8004
pos=0,-Ceil(Pos Y)
postype=p1
bindtime=1
removetime=-2
supermovetime=99999
pausemovetime=99999
sprpriority=-1
ownpal=1

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

[State 0, ChangeState]
type=SelfState
trigger1=Pos Y>=Floor(-Vel Y)
trigger1=Vel Y>0
value=52

;-------------------------------------------------------------------------------

[Statedef 5240]
type=L
movetype=I
physics=N
anim=5240
Velset=-1.75,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5240, ChangeState]
type=ChangeState
;triggerall=animelemtime(2)<0
triggerall=Time=0
trigger1=command="holdfwd"||command="holdback"
value=ifelse(command="holdfwd", 5241, 5242)

[State 5240, Explod]
type=Explod
trigger1=time<=12
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=1.75,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120
trigger1 = time = 1
value = S6000,2
channel = 3

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

[State 0, VelSet]
type = VelSet
trigger1 = Time = 12
x = 0

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

[Statedef 5241]
type=L
movetype=I
physics=N
anim=5241
Velset=7,0
ctrl=0

[State 5240, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5240, Explod]
type=Explod
trigger1=time<=26
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5240, Explod]
type=Explod
triggerall = prevstateno!= 5120
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = Time = 26
x = 0

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

[State 0, PlayerPush]
type = PlayerPush
trigger1 = time <= 26
value = 0

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

[Statedef 5242]
type=L
movetype=I
physics=N
anim=5242
Velset=-7,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5240, Explod]
type=Explod
trigger1=time<=26
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5240, Explod]
type=Explod
triggerall = prevstateno!= 5120
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, VelSet]
type = VelSet
trigger1 = Time = 26
x = 0

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

[State 0, PlayerPush]
type = PlayerPush
trigger1 = time <= 26
value = 0

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120
trigger1 = time = 1
value = S6000,2
channel = 3

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1



;------------------------------
;Recovery Rolls Fwd X
[Statedef 5250]
type=L
movetype=I
physics=N
anim=5250
Velset=9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;------------------------------
;Recovery Rolls Fwd Y
[Statedef 5251]
type=L
movetype=I
physics=N
anim=5251
Velset=9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;------------------------------
;Recovery Rolls Fwd X
[Statedef 5252]
type=L
movetype=I
physics=N
anim=5252
Velset=9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;------------------------------
;Recovery Rolls Fwd A
[Statedef 5255]
type=L
movetype=I
physics=N
anim=5250
Velset=-9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;------------------------------
;Recovery Rolls Fwd B
[Statedef 5256]
type=L
movetype=I
physics=N
anim=5251
Velset=-9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;------------------------------
;Recovery Rolls Fwd C
[Statedef 5257]
type=L
movetype=I
physics=N
anim=5252
Velset=-9,0
ctrl=0

[State 5220, PosSet]
type=PosSet
trigger1=Time=0
y=0

[State 5220, Explod]
type=Explod
trigger1=(time%4)=1
anim=8001
ID=8001
pos=0,0
postype=p1
bindtime=1
vel=-3.5,-.1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=5
ownpal=1
removeongethit=0
ignorehitpause=1

[State 5220, Explod]
type=Explod
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
anim=8004
ID=8004
pos=0,0
postype=p1
bindtime=1
removetime=-2
supermovetime=9999
pausemovetime=9999
sprpriority=3
ownpal=1
removeongethit=0
ignorehitpause=1

[State 0, PlaySnd]
type = PlaySnd
triggerall = prevstateno!= 5120 && (PrevStateNo != [5100,5119])
trigger1 = time = 1
value = S6000,2
channel = 3

[State 0, VelSet]
type = VelSet
trigger1 = AnimTime=0
x = 0

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

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

[State 5220, ChangeState]
type = ChangeState
trigger1 = animtime=0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Continue?
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, 1] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S
anim = 0

[State 5900: Start with 1000 Power]
type = PowerAdd
trigger1 = RoundNo = 1 && TeamMode = Single
value = 1000

[State 5900: Start with 1000 Power]
type = PowerAdd
trigger1 = RoundNo = 1 && TeamMode = Simul
value = 500

[State 5900: Start with 1000 Power]
type = PowerAdd
trigger1 = RoundNo = 1 && TeamMode = Turns
value = 1000

[State 5900, 3]
type = ChangeState
trigger1 = !roundsexisted
value = 190

[State 5900, 4] ;Intro for round 1
type = ChangeState
trigger1 = roundno > 1
value = 22

;---------------------------------------------------------------------------
; Marvel Style Knockdown (No Recovery)
;---------------------------------------------------------------------------
[Statedef 5021]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5021, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5021, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5021, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5021, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5021, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5031

[State 5021, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype)=0
persistent = 0
time = 6
waveform = square

[State 5021, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype)=1
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5021, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype)>=2
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5031]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5031, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

[State 5031, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5031, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Floor(-Vel Y)  ;.
value = 5040 ;HITA_RECOV

[State 5031, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Floor(-Vel Y)  ;.
value = 5051 ;HITA_FALL

[State 5031, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 5036 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5036]
type    = A
movetype= H
physics = N

[State 5036, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 5036, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5036, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Floor(-Vel Y)  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5036, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Floor(-Vel Y)  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5051 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5051]
type    = A
movetype= H
physics = N

[State 5051, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5051, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y > 0;ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5051, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5051, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5105 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5105]
type    = L
movetype= H
physics = N

[State 5105, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5105, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5105, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5105, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5105, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5105, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5105, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5105, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5105, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5115 ;HIT_LIEDOWN

[State 5105, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5105, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5105, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5105, 11]
type = PosFreeze
trigger1 = 1

[State 5105, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5106

[State 5105, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5106]
type    = L
movetype= H
physics = N

[State 5106, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5106, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5106, 3]
type = HitFallVel
trigger1 = Time = 0

;[State 5106, 4]
;type = PosSet
;trigger1 = Time = 0
;y = 20

[State 5106, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = gethitvar(yaccel);.4

[State 5106, 6] ;Hit ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y)
value = 5115

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5115]
type    = L
movetype= H
physics = N

[State 5115, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 3] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170
[State 5110, 3] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0 && gethitvar(fall.yvel) = 0 && SelfAnimExist(5180)
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5180 + (anim % 10))
value = 5180

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)
[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0 && gethitvar(fall.yvel) = 0 && SelfAnimExist(5180 + (anim % 10))
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5180 + (anim % 10)

[State 5115, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5115, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5115, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5115, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5115, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5115, 8]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 5115, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5115, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5115, 11] ;If just died
type = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5115, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5115, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5115, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5115, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

[State 5115, 16]
type = SelfState
trigger1 = (Anim = [5110,5119])
trigger1 = Time >= gethitvar(recovertime);ifelse(!GetHitVar(fall.yvel), 15, 30)
value = 5120

;---------------------------------------------------------------------------
; Wall Bounce Custom State
[Statedef 6500]
type    = A
movetype= H
physics = N
velset = 0,0

[State 6500, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 6500, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 6500, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 6500, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 6500, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 6501

[State 6500, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 0
persistent = 0
time = 6
waveform = square

[State 6500, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 1
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 6500, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype) >= 2
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
;-------------------------------------------------------------------------------
[Statedef 6501]
type    = A
movetype= H
physics = N
ctrl = 0

[State 6501, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

[State 6501, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 6500, HitWall]
type=ChangeState
trigger1=Vel Y < 0
trigger1=backedgebodydist<=const(size.air.back)
value=6504

[State 6501, 3]
type = SelfState
triggerall = !HitFall
trigger1 = Vel Y > 0    ;Hit ground
trigger1 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

[State 6501, 4]
type = ChangeState
trigger1 = HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 6503 ;HITA_FALL

[State 6501, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 6502 ;HITA_UP (transition)
;-------------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 6502]
type    = A
movetype= H
physics = N

[State 6502, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 6502, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 6500, HitWall]
type=ChangeState
trigger1=backedgebodydist<=const(size.air.back)
value=6504

[State 6502, 3]
type = SelfState
triggerall = !HitFall
trigger1 = Vel Y > 0    ;Hit ground
trigger1 = Pos Y >= 10
value = 5040 ;HITA_RECOV

[State 6502, 4]
type = ChangeState
triggerall = HitFall
trigger1 = AnimTime = 0 ;Anim is over
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
trigger3 = Time = 0     ;No transition anim
trigger3 = Anim != 5035 ;.
value = 6503 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 6503]
type    = A
movetype= H
physics = N

[State 6503, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 6503, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 6503, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 6500, HitWall]
type=ChangeState
trigger1=backedgebodydist<=const(size.air.back)
value=6504

[State 6503, 6]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100

;---------------------------------------------------------------------------
; Hit Wall
[Statedef 6504]
type    = A
movetype= H
physics = N

[State 0, PosFreeze]
type = PosFreeze
trigger1 = time
value = 1

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = 0
value = 5010

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = 1
value = 5011

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) >= 2
value = 5012

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 0, Explod]
type = Explod
trigger1 = !time
anim = F72
pos = 0,floor(ScreenPos Y)+const(size.mid.pos.y)
postype = Back
sprpriority = 3

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !time
value = F7,2
channel = -1
freqmul = 1.0

[State 0, EnvShake]
type = EnvShake
trigger1 = !time
time = 15
ampl = -5

[State 0, Turn]
type = Turn
trigger1 = Time=7;HitShakeOver

[State 5020, 5]
type = ChangeState
trigger1 = Time>=7;HitShakeOver
value = 6505

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 6505]
type    = A
movetype= H
physics = N

[State 6505, 0]
type = VelSet
trigger1 = Time = 0
x = -abs(p2bodydist X /40);-abs(gethitvar(xvel) / 2);((-gethitvar(xvel))*facing)/2
y = (gethitvar(yvel))

[State 6507, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 6507, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 6507, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 6507, 6]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; (Custom) Ground Bounce (Knockdown/Soft Knockdown)
;---------------------------------------------------------------------------
[Statedef 6600]
type    = A
movetype= H
physics = N
velset = 0,0

[State 6600, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 6600, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 6600, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 6600, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 6600, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5031

[State 6600, FFB Light]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 0
;trigger1 = anim = 5000
;trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 6600, FFB Medium]
type = ForceFeedback
trigger1 = gethitvar(animtype) = 1
;trigger1 = anim = 5001
;trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 6600, FFB Hard]
type = ForceFeedback
trigger1 = gethitvar(animtype) >= 2
;trigger1 = anim = 5012
;trigger2 = anim = 5002
;trigger3 = anim = 5030
;trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; (Custom) HITA_UP (initial going up)
[Statedef 6601]
type    = A
movetype= H
physics = N
ctrl = 0

[State 6601, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = (GetHitVar(animtype) != 4) && (SelfAnimExist(5051)) && (anim != 5051)
trigger1 = (anim != [5090,5099])
trigger1 = abs(Vel Y * gethitvar(yaccel)) > abs(Vel X / gethitvar(yaccel))
value = 5051

[State 6601, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

[State 6601, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 6601, 3]
type = SelfState
triggerall = !HitFall
trigger1 = anim != [5090,5099]
trigger1 = HitOver
value = 5040

[State 6601, 4]
type = ChangeState
trigger1 = HitFall
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y)
value = 5051

[State 6601, 5]
type = ChangeState
trigger1 = AnimTime = 0
trigger1 = Anim != [5090,5099]
value = 6602 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; (Custom) HITA_UP_T (transition)
[Statedef 6602]
type    = A
movetype= H
physics = N

[State 6602, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 6602, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 6602, 3]
type = SelfState
triggerall = !HitFall
trigger1 = anim != [5090,5099]
trigger1 = HitOver
value = 5040

[State 6602, 4]
type = ChangeState
trigger1 = HitFall
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y)
trigger2 = AnimTime = 0
trigger3 = Anim = [5051,5059]
trigger3 = Anim != 5090
trigger3 = Vel Y > 0
value = 6603

;---------------------------------------------------------------------------
; (Custom) HITA_FALL (knocked up, falling)
[Statedef 6603]
type    = A
movetype= H
physics = N

[State 6603, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 6603, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= 1;ifelse(anim = 5050, 1, 3)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 6603, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 6603, 3]
type = SelfState
triggerall = !HitFall&&Alive
trigger1 = anim != [5090,5099]
trigger1 = HitOver
value = 5040

[State 6603, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y);15;ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 6604 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; (Custom) HIT_BOUNCE (hit ground)
[Statedef 6604]
type    = A
movetype= H
physics = N

[State 6604, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 6604, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 6604, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 6604, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 6604, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 6604, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 6604, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 6604, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 6604, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5115 ;HIT_LIEDOWN

[State 6604, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 6604, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 6604, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 6604, 11]
type = PosFreeze
trigger1 = 1

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 6605

[State 6604, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; (Custom) HIT_BOUNCE (bounce into air)
[Statedef 6605]
type    = A
movetype= H
physics = N

[State 6605, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5106,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 6605, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 6605, 3]
type = HitFallVel
trigger1 = Time = 0

[State 6605, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 6605, HitBy] ;Avoids Automated NotHitBy from engine
type = HitBy
trigger1 = 1
value = SCA,AA,AP

[State 6605, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Floor(-Vel Y)
type = ChangeState
value = 5115

