;---------------------------------------------------------------------------
; 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 = [5110,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    = S
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
elem = IfElse(PrevStateNo = 50811, 3, 1)
;---------------------------------------------------------------------------
; Opponent Thrown
[Statedef 50802]
type = A
movetype= H
physics = N
poweradd = 0

[State 50802, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.5

[State 50802, end] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0 && Vel Y + Pos Y >= 0
value = 5100
;---------------------------------------------------------------------------
; Opponent Grabbed
[Statedef 50811]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 50801, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 50811
;---------------------------------------------------------------------------
; Tenshin Enbu
[Statedef 51026]
type    = S
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

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

[State 51026, end] ;Hit ground
type = SelfState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;--------------------------------------------------------------
[Statedef 53000]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 53000, HitBy]
type = HitBy
trigger1 = 1
value = SCA,HA,HP

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

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

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

[State 53000, ChangeAnim2]
type = ChangeAnim
trigger1 = time = 0
value = 5002

[State 53000, ChangeAnim]
type = ChangeAnim
trigger1 = anim = 5002 && !animtime
value = 5007

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