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

[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, VelAdd]
type = VelAdd
trigger1 = Vel Y != 0
y = 0.5

[State 50802, end] ;Hit ground
type = ChangeState
trigger1 = Vel Y > 0 && Vel Y + Pos Y >= 0
value = 55100

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

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

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

[State 53002, ChangeAnim2]
type = ChangeAnim2
trigger1 = !Time
value = 53002

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

;---------------------------------------------------------------------------
; EX Shin Ya Otome 1
[Statedef 53006]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

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

;---------------------------------------------------------------------------
; EX Shin Ya Otome 2
[Statedef 53007]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

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

;---------------------------------------------------------------------------
; EX Shin Ya Otome 3
[Statedef 53008]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

[State 53008, 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 53008, VelSet]
type = VelSet
trigger1 = AnimElem = 2
x = 4.5
y = -7.5
 
[State 53008, VelAdd]
type = VelAdd
trigger1 = AnimElemTime(2) >= 0
y = 0.5

[State 53008, 1]
type = ChangeState
Trigger1 = Vel Y > 0 && Vel Y + Pos Y >= 0
value = 55100
;---------------------------------------------------------------------------
; Downed get-hit (bounce off ground)
[Statedef 55101]
type    = L
movetype= H
physics = N

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

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

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

[State 55101, 4]
type = PosSet
trigger1 = Time = 0
y = Const(movement.down.bounce.offset.y)

[State 55101, 5]
type = PosAdd
trigger1 = Time = 0
x = Const(movement.down.bounce.offset.x)

[State 55101, 6] ;Acceleration
type = VelAdd
trigger1 = 1
y = Const(movement.down.bounce.yaccel)

[State 55101, 7] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= Const(movement.down.bounce.groundlevel)
type = ChangeState
value = 5110
;---------------------------------------------------------------------------
; Yami Doukoku 1
[Statedef 53011]
type    = A
movetype= H
physics = N
velset = 0,0
poweradd = 0

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

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

;---------------------------------------------------------------------------
; Yami Doukoku 2
[Statedef 53012]
type    = A
movetype= H
physics = N
velset = -4.5,-7.5
poweradd = 0

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

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

[State 53012, SelfState]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos Y >= 0
value = 5100

;---------------------------------------------------------------------------
; Fuujin Ibuki 1
[Statedef 53016]
type    = A
movetype= H
physics = N
velset = 0, -10.8
poweradd = 0

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

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

[State 53016, VelAdd]
type = VelAdd
trigger1 = 1
y = 0.4

[State 53015, ChangeState]
type = ChangeState
trigger1 = Vel Y > 0 && Vel Y + Pos Y >= 0
value = 55110

;---------------------------------------------------------------------------
; Fuujin Ibuki 2
[Statedef 53017]
type    = L
movetype= H
physics = N
velset = 0,0
poweradd = 0
anim = 5110

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

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

[State 53017, ChangeState]
type = SelfState
trigger1 = Time = 60
value = IfElse(Alive, 5120, 5150)
;---------------------------------------------------------------------------
; Downed get-hit (hit ground from fall)
[Statedef 55100]
type    = L
movetype= H
physics = N

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

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

[State 55100, 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 55100, 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 55100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

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

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

[State 55100, 7]
type = SelfState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;Downed get-hit (lying down)

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

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

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

[State 55100, 12]
type = SelfState
trigger1 = AnimTime = 0
value = 5101 ;Downed get-hit (bounce off ground)

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

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

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

[State 55110, 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 55110, 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 55110, 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(5171)
value = 5171

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

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

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

[State 55110, 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 55110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 55110, 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 55110, 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 55110, 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 55110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

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

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

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

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

[State 15110, SelfState]
type = ChangeState
trigger1 = Time = 30
value = 5120
ctrl = 0