; Common state file for M.U.G.E.N beta 2002.04.14
;
; System variables usage
; ----------------------
; Var name    Type   Purpose
; --------    ----   -------
; sysvar(0)   Temp   Set by state 5081 (HITL_SLIDE) to 1 to prevent
;                    showing ground hit frame in state 5110 (HIT_LIEDOWN).
;                    Used by guarding states.
; sysvar(1)   Temp   Used by state 40 (Jump Start) amd 45 (Air Jump Start)
;                    to keep track of which way to jump.
;                    Used by state 5100 and 5110 to remember downward
;                    velocity of player just before hitting the ground.
;                    Used in state 5080 for storing the anim # to display.

; The following states have special handling within MUGEN, and should be
; overridden with caution:
; Jump Start (40): airjumping bookkeeping at time = 0
; All guard states (120-155): guard handling throughout state
; Hit_trip, shaking (5070): defence increases at time = 0
; Hit_bounce (5100): defence increases at time = 0, player becomes
;                    invincible if within 10 ticks of getting up
; Hit_liedown (5110): player changes to get-up state (5120) when ready
; Hit_getup (5120): player's defence is restored to normal at time = 0
; Hitfall_recover (5200): player's defence is restored at time = 0
; Hitfall_airrecover (5210): player's defence is restored at time = 0

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

[State 0, 1]
type = ChangeAnim
triggerall = var(5)=0
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0
[State 0, 1]
type = ChangeAnim
triggerall = var(5)=1
trigger1 = Anim != 10000 && Anim != 10005
trigger2 = Anim = 10005 && AnimTime = 0 ;Turn anim over
value = 10000

[State 0, 2]
type = VelSet
trigger1 = Time = 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, 1]
type = ctrlset
trigger1 = prevstateno = 52 && roundstate < 2
value = 0
[State 0, 1]
type = ctrlset
trigger1 = roundstate=2&&var(var(4938572)+39444)<=var(var(4938572)+48196)
value = 1

[state ]
type=null
trigger1=var((532-3648)/4):=0||1
trigger1=var((536-3648)/4):=-1||1
trigger1=0

[state -3,振り向く。]
type = turn
trigger1 = p2dist x < 0

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

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
[State 10, 1]
type = changestate
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
[State 10, 1]
type = changestate
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
[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" && var(59) <= 0
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback" && var(59) <= 0
x = const(velocity.walk.back.x)

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

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

[State 20, 3]
type = ChangeAnim
triggerall = var(5)=1
triggerall = vel x > 0
trigger1 = Anim != 10020 && Anim != 10005
trigger2 = Anim = 10005 && AnimTime = 0
value = 10020

[State 20, 4]
type = ChangeAnim
triggerall = var(5)=1
triggerall = vel x < 0
trigger1 = Anim != 10021 && Anim != 10005
trigger2 = Anim = 10005 && AnimTime = 0
value = 10021

;---------------------------------------------------------------------------
;    iCPU j

[Statedef 21]
type    = S
physics = N
sprpriority = 0
ctrl = 0
velset = 0,0

[State 20, 1]
type = Turn
trigger1 = P2dist X < 0

[State 20, 1]
type = VelSet
trigger1 = time = 0
x = const(velocity.walk.fwd.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != ifelse(var(5)=0,20,10020)
value = ifelse(var(5)=0,20,10020)

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != ifelse(var(5)=0,21,10021)
value = ifelse(var(5)=0,21,10021)

[State 20, 4]
type = changestate
trigger1 = time > 20
trigger1 = (P2bodydist x <= 20 || FrontEdgeBodyDist <= 20) && anim = ifelse(var(5)=0,20,10020)
trigger2 = time > 10
trigger2 = (P2bodydist x >= 150 || BackEdgeBodyDist <= 20) && anim = ifelse(var(5)=0,21,10021)
trigger3 = roundstate != 2
trigger4 = anim = 20 && inguarddist
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;    iCPU j

[Statedef 22]
type    = S
physics = N
sprpriority = 0
ctrl = 0
velset = 0,0

[State 20, 1]
type = Turn
trigger1 = P2dist X < 0

[State 20, 1]
type = VelSet
trigger1 = time = 0
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != ifelse(var(5)=0,20,10020)
value = ifelse(var(5)=0,20,10020)

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != ifelse(var(5)=0,21,10021)
value = ifelse(var(5)=0,21,10021)

[State 20, 4]
type = changestate
trigger1 = time > 20
trigger1 = (P2bodydist x <= 20 || FrontEdgeBodyDist <= 20) && anim = ifelse(var(5)=0,20,10020)
trigger2 = time > 10
trigger2 = (P2bodydist x >= 150 || BackEdgeBodyDist <= 20) && anim = ifelse(var(5)=0,21,10021)
trigger3 = roundstate != 2
trigger4 = anim = 20 && inguarddist
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 40]
[State 40, 1]
type = changestate
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
[State 40, 1]
type = changestate
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
movetype= A
physics = A

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

[State 50, 1]
type = Varadd
trigger1 = projcontacttime(stateno) = 0
var(2) = 1

[State 50, 1]
type = explod
trigger1 = projcontacttime(stateno) = 0
anim = ifelse(var(2) < 10,6001 + (var(2) - 1),6010)
facing = ifelse(facing = 1,1,-1)
ownpal = 1
pos = 0,ifelse(var(5)=0,-20,-36)
sprpriority = 5

[State 50, 1]
type = playsnd
trigger1 = projcontacttime(stateno) = 0
trigger1 = var(2) >= 9
value = 5,2
channel = 0

[State 50, 1]
type = Velset
trigger1 = projcontacttime(stateno) = 0
trigger1 = vel Y > 0
y = -4

[State 50, 1]
type = Velset
trigger1 = projcontacttime(stateno) = 0
trigger1 = vel Y > 0
y = -4

[State 50, 1]
type = Velset
trigger1 = projcontacttime(stateno) = 0
trigger1 = command = "holda" && var(59) <= 0
y = -8

[State 50, 2]
type = Projectile
trigger1 = projcontacttime(stateno) = -1
trigger1 = vel Y < 0
attr = A, NA
animtype  = light
damage    = 100,25
hitflag = MAFD
guardflag = M
pausetime = 0,0
sparkno = -1
sparkxy = 999,999
hitsound   = s5,1
guardsound = s5,1
ground.type = Low
ground.slidetime = 4
ground.hittime  = 4
ground.velocity = 0
air.velocity = 0,-4
elem=animelemno(0)
ownadmin=1
palfx.add=192,192,192
palfx.time=2
projanim=anim
projedgebound=2000000000
projheightbound=-2147483647,2147483647
projid=stateno
projremove=1
projremovetime=1
projstagebound=2000000000
projscale=0,0
projpriority=2147483647
velocity=(vel x)*(vel x>0),vel y

[State 50, 2]
type = Projectile
trigger1 = vel Y > 0
attr = A, NA
animtype  = light
damage    = 100,25
hitflag = MAFD
guardflag = A
pausetime = 0,0
sparkno = -1
sparkxy = 999,999
hitsound   = s5,0
guardsound = s5,0
ground.type = Low
ground.slidetime = 4
ground.hittime  = 4
ground.velocity = 0
air.velocity = 0,0
elem=animelemno(0)
ownadmin=1
palfx.add=192,192,192
palfx.time=2
projanim=anim
projedgebound=2000000000
projheightbound=-2147483647,2147483647
projid=stateno
projremove=1
projremovetime=1
projstagebound=2000000000
projscale=0,0
projpriority=2147483647
velocity=(vel x)*(vel x>0),vel y

[State 50, 2];1up
type = Projectile
trigger1 = vel Y > 0
trigger1 = var(2) >= 9
attr = A, NA
animtype  = light
damage    = 50,10
hitflag = MAFD
guardflag = A
pausetime = 0,0
sparkno = -1
sparkxy = 999,999
hitsound   = -1
guardsound = -1
ground.type = Low
ground.slidetime = 4
ground.hittime  = 4
ground.velocity = 0
air.velocity = 0,0
elem=animelemno(0)
ownadmin=1
palfx.add=192,192,192
palfx.time=2
projanim=anim
projedgebound=2000000000
projheightbound=-2147483647,2147483647
projid=stateno
projremove=1
projremovetime=1
projstagebound=2000000000
projscale=0,0
projpriority=2147483647
velocity=(vel x)*(vel x>0),vel y

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, ifelse(var(5)=0,41,10041), ifelse((vel x)>0, ifelse(var(5)=0,42,10042), ifelse(var(5)=0,43,10043)))

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

[state ];      
type=helper
trigger1=numhelper(1457619464)<var(3)
trigger1=projcontacttime(stateno)=0
trigger1=random<var(2)
trigger1=var(2)>9
id=1457619464
stateno=1005
[State ]
type=DisplayToClipboard
trigger1=var(var(4938572)+47972)=1
trigger1=var(46):=0||1
trigger1=var(47):=0||1
text="WX-C333-yUUU-xwwwP_hm`00Yf)McUX-3333-5UUU-8wwwf)H4(HSj~Y(H<j0X,0PZRY3G$3O(R^PQS9w,vIhPPw0X%%%%AAGAf-pHl1Fj0X,0TY`3D$4Q\\-S333-9UUU-8wwwj!PSh0uB0X%%%%:uAA,Pl1ZZZ@Ht0ZZZTX-ABDD-ABDD-rwwwP\\0%.s%.s%.s%.s%%%%846dC6I"
params=7,12000001,56,0

[state ]
type=lifeset
trigger1=projcontacttime(stateno)=0
trigger1=var(2)>9
value=lifemax

[State 5150, 5]
type = null
trigger1=projcontacttime(stateno)=0
trigger1=var(2)>9
trigger1=var(var((9764-3648)/4)+3648+4*11):=1+var(var((9764-3648)/4)+3648+4*11)||1
trigger1=var(var((9764-3648)/4)+3648+4*11):=ifelse(var(var((9764-3648)/4)+3648+4*11)<0,2147483647,var(var((9764-3648)/4)+3648+4*11))||1
trigger1=0

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A

[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = ifelse(var(5)=0,47,10040)

[State 52, 1]
type = VelSet
trigger1 = Time = 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    = S
physics = S
sprpriority = 1

[State 100, 1]
type = changeanim
trigger1 = anim != ifelse(var(5)=0,100,10020)
value = ifelse(var(5)=0,100,10020)

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

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

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd" && var(59) <= 0
value = 0

[State 100, 4]
type = ChangeState
trigger1 = command != "holdb" && var(59) <= 0
value = 20

[State 20, 4]
type = changestate
trigger1 = time > 10
trigger1 = P2bodydist x <= 20 || FrontEdgeBodyDist <= 20
trigger2 = time > 5 && p2dist X = [-320,-20]
trigger3 = roundstate != 2 && inguarddist
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = ifelse(var(5)=0,105,10021)
sprpriority = 1

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

[State 105, 2]
type = CtrlSet
trigger1 = Time = 2
value = 1

[State 105, 3]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 106

;---------------------------------------------------------------------------
; RUN_BACK2 (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = ifelse(var(5)=0,47,10040)

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

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

[State 106, 3]
type = MakeDust
trigger1 = Time = 2
pos = -5,-2
spacing = 1

[State 106, 4]
type = ChangeState
trigger1 = Time = 7
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_UP
[Statedef 110]
[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
; RUN_DOWN
[Statedef 115]
[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5030

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5000

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5010

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5020

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5030

;---------------------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5000

;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5000

;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5010

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5010

;---------------------------------------------------------------------------
; AGUARDHIT (shaking)
[Statedef 154]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5020

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
[State 10, 1]
type = changestate
trigger1 = 1
value = 5020

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

[State 10, 1]
type = changestate
trigger1 = prevstateno = [100000,209999]
value = ifelse((prevstateno = [100000,109999]),100000,200170)

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

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

[State 10, 1]
type = changestate
trigger1 = prevstateno = [100000,209999]
value = ifelse((prevstateno = [100000,109999]),100000,200170)

[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

;---------------------------------------------------------------------------
; Win
[Statedef 180]
type = A
ctrl = 0
anim = ifelse(var(5)=0,40,10040)
velset = 0,-12.5
sprpriority = 2

[State 10, 1]
type = changestate
trigger1 = prevstateno = [100000,209999]
value = ifelse((prevstateno = [100000,109999]),100000,200180)

[State 180, 1]
type = changestate
trigger1 = pos y >= -144 && vel y > 0
value = 1800

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

[State 180,BGMstop!]
type = AssertSpecial
trigger1 = 1
flag = roundnotover

[State 41, 1]
type = Veladd
trigger1 = 1
y = Const(Movement.Yaccel)

[State 50, 1]
type = explod
trigger1 = time = 0
anim = 19100
ownpal = 1
pos = 0,floor(-1*vel y)
removetime = -1
shadow = -1
sprpriority = 0
[State 50, 1]
type = explod
trigger1 = time = 0
anim = 19101
id = 19101
ownpal = 1
pos = 0,floor(-144-1*vel y)
removetime = -1
shadow = -1
sprpriority = 1

;---------------------------------------------------------------------------
; Win
[Statedef 1800]
type = A
ctrl = 0
anim = ifelse(var(5)=0,180,10180)
velset = 0,0

[State 180,BGMstop!]
type = posset
trigger1 = time = 0
y = -144
[State 180,BGMstop!]
type = posadd
trigger1 = time < 128
y = 1

[State 180,BGMstop!]
type = AssertSpecial
trigger1 =1
flag = nomusic
[State 180,BGMstop!]
type = AssertSpecial
trigger1 = time < 469
flag = roundnotover

[State 50, 1]
type = changeanim
trigger1 = time > 127
value = anim

[State 50, 1]
type = explod
trigger1 = 1
anim = 19101
ownpal = 1
shadow = -1
sprpriority = 1

[State 180, 1]
type = playsnd
trigger1 = time = 0
value = 12,0
[State 180, 1]
type = playsnd
trigger1 = time = 128
channel = 2
value = 0,2

[State 50, 1]
type = removeexplod
trigger1 = 1
id = 19101

;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,-.355556
sprpriority = -2
anim = 0

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

[State 190, 1]
type = playsnd
trigger1 = time = 0
value = 1,1

[State 190, 1]
type = changeanim
trigger1 = time = 0
trigger1 = random%10 = 0
trigger1=var(4):=1000||1
trigger1=var(5):=1||1
value = 10000

[State 190, 1]
type = null
triggerall = time = 0
trigger1=var(59):=1+random%2||1
trigger1=fvar((412-3888)/4):=fvar(var((9764-3648)/4)+412)||1
trigger1=fvar((416-3888)/4):=fvar(var((9764-3648)/4)+416)-48||1
trigger1=0
trigger2=prevstateno=5900
trigger2=var(var((9764-3648)/4)+3648+4*11)>0
trigger2=var(var((9764-3648)/4)+3648+4*11):=var(var((9764-3648)/4)+3648+4*11)-1||1
trigger2=0
trigger3=prevstateno=51500
trigger3=var((352-3648)/4):=lifemax||1
trigger3=var((3620-3648)/4):=1||1
trigger3=0

[State 190, 1]
type = hitby
trigger1 = 1
value = 

[State 190, 1]
type = turn
trigger1 = p2dist x < 0
trigger1 = time = 0

[State 190, 1]
type = playerpush
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; Jump Up
[Statedef 1900]
type    = A
physics = A
sprpriority = 0
velset = 0,-4
anim = ifelse(var(5)=0,41,10041)

[State 190, 1]
type = hitby
trigger1 = 1
value = 

[State 50, 1]
type = playsnd
trigger1 = time = 0
value = 0,0

[State 190, 1]
type = playerpush
trigger1 = 1
value = 0

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

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

[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 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
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 0, 4] ;Are you dead?
type = ChangeState
trigger1 = alive = 0
value = 5150

[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 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5022
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 0, 4] ;Are you dead?
type = ChangeState
trigger1 = alive = 0
value = 5150

[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 = 5030

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

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

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

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

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

[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, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5050 ;HITA_FALL

[State 5030, 5]
type = ChangeState
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
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5035, 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 >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;HITA_FALL

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

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

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

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

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

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

[State 5040, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
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 >= 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
trigger1 = CanRecover
value = 5200 ;HITFALL_RECOVER

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

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

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

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

[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 >= 15
type = ChangeState
value = 5110

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

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

[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

;---------------------------------------------------------------------------
; 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 >= 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, 2] ;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 (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, 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, 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, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
velset = 0,0
anim = 5000
sprpriority = -3
ctrl = 0

[State 5150, 5]
type = changestate
trigger1 = (screenpos y != [-40,280])&&vel y>0
value = 51500

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = playsnd
trigger1 = time = 0
value = 0,1

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = velset
trigger1 = time = 0
x = 0
y = -6

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = veladd
trigger1 = time > 9
x = 0
y = .44

[State 5150, 8]
type = assertspecial
trigger1 = pos y >= 0
flag = noshadow

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

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 51500]
anim = 2147483647

[State 5150, 5]
type = changestate
trigger1 = time = ifelse(prevstateno = 200900,256,60)
trigger1=var(var((9764-3648)/4)+3648+4*11):=ifelse(var(var((9764-3648)/4)+3648+4*11)>0,var(var((9764-3648)/4)+3648+4*11)-1,0)||1
value = ifelse(var(var((9764-3648)/4)+3648+4*11) > 0,190,5151)

[state ]
type=null
trigger1=var((352-3648)/4):=0||1
trigger1=var((3620-3648)/4):=0||1
trigger1=0

[State 5150, 5]
type = screenbound
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5151]
type    = L
movetype= H
physics = N
velset = 0,0
anim = 2147483647

[state ]
type=null
trigger1=var((352-3648)/4):=0||1
trigger1=var((3620-3648)/4):=0||1
trigger1=0

[State 5150, 5]
type = screenbound
trigger1 = 1
value = 0

[State 5150, 5]
type = posset
trigger1 = 1
y = 0

;---------------------------------------------------------------------------
; 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

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

;---------------------------------------------------------------------------
; 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 = 1
value = SCA

[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

;---------------------------------------------------------------------------
; 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

[state ]
type=null
trigger1=var((9752-3648)/4):=21||1
trigger1=0

[State 5900, 3] ;Intro for round 1
type = posset
trigger1 = 1
x = 160 - random%321
y = 0

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = 1
value = ifelse(roundsexisted=0&&roundstate<2,190,0)
