;---------------------------------------------------------------------------
; Downed get-hit (lying down)
[Statedef 15110]
type    = L
movetype= H
physics = N

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

[State 15110, 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 15110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [15110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 15110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [15110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5171)
value = 5171

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

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

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

[State 15110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56))

;[State 15110, 7]
;type = Null
;trigger1 = Time = 0
;trigger1 = !SysVar(0)
;anim = F(60 + (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56)))
;pos = 0, 0
;sprpriority = ifelse (sysvar(1) <= Const720p(56), -10, 10)

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

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

[State 15110, 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 15110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [15110,5119]
value = 5150

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

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

[State 15110, 14] ;Friction
type = VelSet
trigger1 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

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

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

[State 15110, ChangeState]
type = ChangeState
trigger1 = Time = 30
value = 5120
ctrl = 0
;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 50801]
type = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 50801, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 50801
;---------------------------------------------------------------------------
; Opponent Thrown
[Statedef 50802]
type = L
movetype= H
physics = N
velset = 0,0
poweradd = 0
anim = 5100

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

[State 50802, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56))

[State 50802, Explod]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = F(60 + (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56)))
pos = 0, 0
sprpriority = ifelse (sysvar(1) <= Const720p(56), -10, 10)

[State 50802, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5100 && AnimTime = 0
value = 5110
elem = 1

[State 50802, end] ;Hit ground
type = SelfState
trigger1 = Anim = 5110 && Time = 60 
value = IfElse(Alive, 5120, 5150)
ctrl = IfElse(!Alive, 1, 0)
;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 50811]
type = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 50811, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 50811

[State 50811, VelSet]
type = VelSet
trigger1 = AnimElem = 6
x = 3
y = 5

[State 50811, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(6) >= 0
y = 0.5

[State 50811, ChangeState]
type = ChangeState
trigger1 = Vel Y > 0 && Vel Y >= -Pos Y
value = 50812
ctrl = 0 

;---------------------------------------------------------------------------
; Opponent Thrown
[Statedef 50812]
type = L
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 50812, end] ;Hit ground
type = SelfState
trigger1 = !Time
value = 5100
ctrl = 0
;---------------------------------------------------------------------------
; Shinjou Tai (P2)
[Statedef 51021]
type = S
movetype= H
physics = N
velset = 0,0
poweradd = 0

[State 51021, HitBy]
type = HitBy
trigger1 = 1
value = SCA,ST

[State 51021, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 5000

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

[State 51021, SelfState]
type = SelfState
trigger1 = time = 150
value = 0
;--------------------------------------------------------------
[Statedef 51022]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 51022, HitBy]
type = HitBy
trigger1 = 1
value = SCA,ST

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

[State 51022, PosSet]
type = posset
trigger1 = time = 0
y = 0

[State 51022, 2]
type = Velset
trigger1 = !gethitvar(isbound)
x = 0

[State 51022, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 0
value = 5012

[State 51022, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5012 && !animtime
value = 5017

[State 51022, SelfState]
type = SelfState
trigger1 = time = 150
value = 0

;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 53010]
type = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 53010, 1]
type = ChangeAnim2
Trigger1 = !Time
value = 53010

;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 53011]
type = L
movetype = H
physics = N
velset = 0,0
poweradd = 0

[State 53011, 1]
type = ChangeAnim2
Trigger1 = !Time
value = 53011

[State 53011, SelfState]
type = SelfState
trigger1 = AnimTime = 0
value = IfElse(Alive, 5120, 5150)
ctrl = 1

;---------------------------------------------------------------------------
; Shiten Shouda (P2)
[Statedef 53015]
type = S
movetype= H
physics = N
velset = 0,0
poweradd = 0

[State 53015, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 53015

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

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

[State 53015, SelfState]
type = SelfState
trigger1 = time = 150
value = 0