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

[State -1]
type = destroyself
trigger1 = ishelper
ignorehitpause = 1
supermovetime = 9999
pausemovetime = 9999

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

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

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

[State 10, 2]
type = ChangeState
triggerall = command = "ハイジャンプ"
trigger1 = time = 0
trigger2 = AnimElemTime(4) < 0
value = 290

[State 10, 2]
type = ChangeState
triggerall = command != "ハイジャンプ"
trigger1 = command = "UF"
trigger2 = command = "UB"
trigger3 = command = "↑"
value = 40

[State 10, 2]
type = ChangeState
triggerall = command = "ハイジャンプ"
trigger1 = AnimElemTime(4) >= 0
value = 40

[State 100, 1]
type = ChangeState
trigger1 = enemynear,MoveType = A
trigger1 = InGuardDist
trigger1 = Command = "holdback"
value = 120

[State 10, 2]
type = ChangeState
trigger1 = command != "D離"
trigger1 = command = "←" || command = "→"
trigger2 = command = "前進" || command = "後進"
value = 20
ctrl = 1

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

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

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
ctrl = 1
anim = 11

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

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

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

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

[State 52, 4]
type = null;Turn
trigger1 = Facing = 1 && enemynear,Facing = 1|| Facing = -1 && enemynear,Facing = -1
persistent = 0

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

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

[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

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0

[State 40, 1]
type = NotHitBy
trigger1 = 1
value = ,AT

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

[State 40, 2]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdfwd"
Trigger2 = var(59) > 0
Trigger2 = EnemyNear,StateType != L || P2BodyDist X >= 30
Trigger2 = EnemyNear,MoveType = H || Random <= 333 || EnemyNear,StateType = L
sysvar(1) = 1

[State 40, 3]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdback"
Trigger2 = var(59) > 0
Trigger2 = EnemyNear,StateType != L
Trigger2 = EnemyNear,MoveType != H
Trigger2 = BackEdgeBodyDist > 60
Trigger2 = Random <= 500
sysvar(1) = -1

[State 40, 4]
type = VelSet
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 = null;VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 100, 1]
type = StateTypeSet
triggerall = var(13) = 1
trigger1 = time = 0
physics = N

[State 100, 1]
type = VelSet
triggerall = var(13) = 1
trigger1 = time = 0
x = const(velocity.run.fwd.x)

[State 100, 1]
type = Turn
trigger1 = time = 0
trigger1 = p2dist x < 0

[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
;------------------------------Exシールド
[State ,100]
type = Helper
triggerall = time = 0
trigger1 = prevstateno = [3022,3023]
helpertype = normal
name = "Reverse_Beat"
ID = 500
pos = 0,0
postype = p1
stateno = 4002
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
;------------------------------
[State 50, 1]
type = VarAdd
trigger1 = time = 0
var(11) = 1

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

[State 45, 2]
type = ChangeAnim
triggerall = Time = 0
trigger1 = command = "holdfwd"
trigger2 = command = "holdup"
value = 41

[State 45, 2]
type = ChangeAnim
trigger1 = command = "holdback"
trigger1 = Time = 0
value = 43

[State 45, 3]
type = VarSet
trigger1 = Time = 0
trigger1 = var(12) = [1,2]
var(12) = 4

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

[State 45, 4]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdfwd"
Trigger2 = var(59) > 0
Trigger2 = EnemyNear,StateType != L || P2BodyDist X >= 25
Trigger2 = EnemyNear,MoveType = H || Random <= 333 || EnemyNear,StateType = L
sysvar(1) = 1

[State 45, 5]
type = VarSet
Trigger1 = var(59) = 0
Trigger1 = command = "holdback"
Trigger2 = var(59) > 0
Trigger2 = EnemyNear,StateType != L
Trigger2 = EnemyNear,MoveType != H
Trigger2 = BackEdgeBodyDist > 60
Trigger2 = Random <= 500
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 0
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 = 1
value = 50
ctrl = 0
;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
physics = A

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

[State 50, 1]
type = VarAdd
trigger1 = time = 0
var(11) = 1

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

[State 45, 6]
type = VelAdd
triggerall = sysvar(1) = 0
triggerall = AnimElemTime(6) >= 0
triggerall = AnimElemTime(8) < 0
trigger1 = command = "holdfwd"
x = 0.125

[State 45, 6]
type = VelAdd
triggerall = sysvar(1) = 0
triggerall = AnimElemTime(6) >= 0
triggerall = AnimElemTime(8) < 0
trigger1 = command = "holdback"
x = -0.125

[State 100, 1]
type = VelSet
triggerall = var(13) = 1
triggerall = Pos Y >= -30
triggerall = command != "holdfwd"
triggerall = command != "holdback"
trigger1 = command = "holdup"
trigger1 = time = 0
x = const(velocity.airjump.fwd.x)

[State 100, 1]
type = VelSet
triggerall = var(13) = 1
triggerall = Pos Y >= -30
trigger1 = command = "holdfwd"
trigger1 = time = 0
x = const(velocity.run.fwd.x)/2

[State 100, 1]
type = ChangeState
trigger1 = enemynear,MoveType = A
trigger1 = InGuardDist
trigger1 = Command = "holdback"
value = 120

[State 45, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim = 41
trigger1 = Pos Y <= -30
value = 41
elem = 2

[State ,100]
type = Explod
triggerall = NumExplod(6) = 0 
triggerall = stateno != 266
triggerall = Pos Y <= -30
trigger1 = Anim = 41 || Anim = 42
trigger1 = AnimElemTime(2) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
anim = 626
ID = 6
pos = 0,-20
postype = p1
scale = 0.5,0.5
sprpriority = -2
shadow = 0,0,0
ownpal = 1

[State 190, 0]
type = PlaySnd
trigger1 = Anim = 43
trigger1 = AnimElemTime(8) = 0
value = s21,3
channel = 2

[State -1, 偽JB]
type = ChangeState
triggerall = time < 4
triggerall = command = "A+B"
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
value = 311

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

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

[State 100, 4]
type = null;ChangeState
triggerall = Pos Y <= -32
triggerall = var(12) != [1,4]
trigger1 = command = "ダッシュ前"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdfwd"
value = 260

[State 100, 4]
type = null;ChangeState
triggerall = Pos Y <= -32
triggerall = var(12) != [1,4]
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"
value = 261

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

[State 100, 2] 
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

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

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

[State -2, 1]
type = VarRangeSet
trigger1 = time = 0
value = 0
first = 11
last = 14

[State 190, 0]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
value = s20,1

[State ,100]
type = Explod
trigger1 = NumExplod(4) = 0 
trigger1 = AnimElemTime(1) = 0
anim = 615
ID = 4
pos = 0,0
postype = p1
scale = 0.5,0.5
sprpriority = -2
shadow = 0,0,0
ownpal = 1

[State 100, 1]
type = ChangeState
trigger1 = enemynear,MoveType = A
trigger1 = InGuardDist
trigger1 = Command = "holdback"
value = 120

[State 52, 4]
type = ChangeState
trigger1 = p2dist X < -5
trigger1 = AnimTime = 0
value = 53
ctrl = 1

[State 52, 4]
type = ChangeState
trigger1 = p2dist X > -5
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[State ,100]
type = VarSet
triggerall = Facing = 1 && enemynear,Facing = 1|| Facing = -1 && enemynear,Facing = -1
trigger1 = command = "ダッシュ前"
trigger2 = command = "ダッシュ後"
trigger3 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger3 = command = "holdfwd"
trigger4 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger4 = command = "holdback"
var(17) = 1

[State 52, 4]
type = Turn
triggerall = Time > 0
triggerall = Facing = 1 && enemynear,Facing = 1|| Facing = -1 && enemynear,Facing = -1
trigger1 = command = "ダッシュ前"
trigger2 = command = "ダッシュ後"
trigger3 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger3 = command = "holdfwd"
trigger4 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger4 = command = "holdback"

[State -1, 地上後方ダッシュ]
type = ChangeState
value = 105
triggerall = Time > 0
triggerall = var(17) = 1
trigger1 = command = "ダッシュ前"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdfwd"

[State -1, 地上前方ダッシュ]
type = ChangeState
value = 100
triggerall = Time > 0
triggerall = var(17) = 1
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"

[State -1, 地上前方ダッシュ]
type = ChangeState
value = 100
triggerall = Time > 0
triggerall = var(17) = 0
trigger1 = command = "ダッシュ前"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdfwd"

[State -1, 地上後方ダッシュ]
type = ChangeState
value = 105
triggerall = Time > 0
triggerall = var(17) = 0
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"

[State 10, 2]
type = ChangeState
triggerall = Time > 0
trigger1 = command = "hold↓" || command = "holdDF" || command = "holdDB"
value = 10
ctrl = 0

[State 10, 2]
type = ChangeState
triggerall = Time > 0
trigger1 = command = "hold←" || command = "hold→"
value = 20
ctrl = 1

[State 10, 2]
type = ChangeState
triggerall = Time > 0
trigger1 = command = "hold↑" || command = "holdUF" || command = "holdUB"
value = 40
ctrl = 0
;---------------------------------------------------------------------------
[Statedef 53]
type    = S
physics = S
ctrl = 1
anim = 5

[State 52, 4]
type = Turn
trigger1 = time = 0

[State 52, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
physics = N
anim = 100
ctrl = 0

[State 190, 0]
type = VarSet
trigger1 = time = 0
var(13) = 1

[State 10, 2]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = command = "ハイジャンプ"
value = 290

[State 10, 2]
type = ChangeState
trigger1 = Var(59) > 0
trigger1 = NumHelper(32) = 0
trigger1 = !(EnemyNear,Anim = [502,503])
trigger1 = !(P2StateNo = 430 && EnemyNear,Anim = 5050)
trigger1 = P2BodyDist X > 150
trigger1 = command = "ハイジャンプ"
value = 290

[State 190, 0]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
channel = 13
value = s20,2

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

[State ,100]
type = Explod
trigger1 = AnimElemTime(4) = 0
trigger2 = AnimElemTime(7) = 0
trigger3 = AnimElemTime(10) = 0
trigger4 = AnimElemTime(13) = 0
anim = 605
ID = 5
pos = 20,0
postype = p1
scale = 0.5,0.5
sprpriority = 2
shadow = 0,0,0
ownpal = 1

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(15) = 0
x = 0

[State 100, 1]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = Command = "holdup"
trigger1 = AnimElemTime(3) >= 0
value = 40

[State 100, 1]
type = ChangeState
trigger1 = Var(59) > 0
trigger1 = NumHelper(32) = 0
trigger1 = !(EnemyNear,Anim = [502,503])
trigger1 = !(P2StateNo = 430 && EnemyNear,Anim = 5050)
trigger1 = Command = "holdup"
trigger1 = AnimElemTime(3) >= 0
value = 40

[State 100, 1]
type = ChangeState
triggerall = AnimElemTime(3) >= 0
trigger1 = EnemyNear,MoveType = A
trigger1 = InGuardDist
trigger1 = Command = "holdback"
value = 120

[State 100, 1]
type = ChangeState
triggerall = Var(59) = 0
triggerall = AnimElemTime(3) >= 0
triggerall = AnimElemTime(15) < 0
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"
value = 250

[State 100, 1]
type = ChangeState
triggerall = Var(59) > 0
triggerall = NumHelper(31) = 0
triggerall = NumHelper(32) = 0
triggerall = !(EnemyNear,Anim = [502,503])
triggerall = !(P2StateNo = 430 && EnemyNear,Anim = 5050)
triggerall = AnimElemTime(3) >= 0
triggerall = AnimElemTime(15) < 0
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"
value = 250

[State 100, 1]
type = ChangeState
triggerall = Var(59) = 0
triggerall = AnimElemTime(15) >= 0
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"
value = 105

[State 100, 1]
type = ChangeState
triggerall = Var(59) > 0
triggerall = NumHelper(31) = 0
triggerall = NumHelper(32) = 0
triggerall = !(EnemyNear,Anim = [502,503])
triggerall = !(P2StateNo = 430 && EnemyNear,Anim = 5050)
triggerall = AnimElemTime(15) >= 0
trigger1 = command = "ダッシュ後"
trigger2 = command = "クイック2" || command = "A+B" || command = "弱" && command =  "中"
trigger2 = command = "holdback"
value = 105

[State 190, 0]
type = VarSet
trigger1 = AnimElemTime(15) = 0
var(13) = 0

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

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

[State 190, 0]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
channel = 13
value = s20,2

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

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(5) = 0
x = const(velocity.run.back.x)+1

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

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(7) = 0
x = const(velocity.run.back.x)+3

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(8) = 0
x = const(velocity.run.back.x)+4

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(9) = 0
x = const(velocity.run.back.x)+5

[State 100, 1]
type = VelSet
trigger1 = AnimElemTime(10) = 0
x = 0

[State 100, 1]
type = HitBy
trigger1 = AnimElemTime(9) < 0
value = ,AT
time = 1

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

[State 100, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; RUN_BACK2 (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 47

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

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

[State 106, 3]
type = null;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]
type    = S
physics = N

[State 110, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 110, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 110, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 110, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = -7

[State 110, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 110, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 110, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 110, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; RUN_DOWN
[Statedef 115]
type    = S
physics = N

[State 115, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 115, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 115, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 115, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = 7

[State 115, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 115, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 115, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 115, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

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

[State -1, AI]
Type = ChangeState
Value = 105
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2MoveType = A
Trigger1 = P2StateType != A
Trigger1 = EnemyNear,HitDefAttr = SCA, NT, ST, HT
Trigger1 = Time = 0

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

[State 120, 2]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = Time = 0 && statetype = S
physics = S

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
StateType = S
Physics = S
IgnoreHitPause = 1

[State 120, 3]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = Time = 0 && statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
StateType = C
Physics = C
IgnoreHitPause = 1

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 100, 1]
type = ChangeState
triggerall = statetype = A
triggerall = var(11) = [0,1]
trigger1 = Command = "holdup"
value = 45

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

[State 120, Stop Guarding]
type = ChangeState
triggerall = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State -1, AI]
Type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType != A
Trigger1 = Enemy,MoveType != A
Trigger1 = P2BodyDist X < 0
Trigger1 = !InguardDist
Trigger2 = P2BodyDist X >= 0
Trigger2 = !InguardDist
Value = 140
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; 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
triggerall = Var(59) = 0
trigger1 = command = "holddown"
value = 131

[State -1, AI]
type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType = A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
Value = 131

[State 130, Stop Guarding]
type = ChangeState
triggerall = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State -1, AI]
Type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType != A
Trigger1 = Enemy,MoveType != A
Trigger1 = P2BodyDist X < 0
Trigger1 = !InguardDist
Trigger2 = P2BodyDist X >= 0
Trigger2 = !InguardDist
Value = 140
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; 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
triggerall = Var(59) = 0
trigger1 = command != "holddown"
value = 130

[State -1, AI]
type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType = A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
Value = 130

[State 131, Stop Guarding]
type = ChangeState
triggerall = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State -1, AI]
Type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType != A
Trigger1 = Enemy,MoveType != A
Trigger1 = P2BodyDist X < 0
Trigger1 = !InguardDist
Trigger2 = P2BodyDist X >= 0
Trigger2 = !InguardDist
Value = 140
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; 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
triggerall = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State -1, AI]
Type = ChangeState
TriggerAll = Var(59) > 0
TriggerAll = EnemyNear,MoveType != A
Trigger1 = Enemy,MoveType != A
Trigger1 = P2BodyDist X < 0
Trigger1 = !InguardDist
Trigger2 = P2BodyDist X >= 0
Trigger2 = !InguardDist
Value = 140
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; 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
triggerall = Var(59) = 0
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
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
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
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
StateType = S
Physics = S
IgnoreHitPause = 1

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
StateType = C
Physics = C
IgnoreHitPause = 1

[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
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
StateType = C
Physics = C
IgnoreHitPause = 1

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
StateType = S
Physics = S
IgnoreHitPause = 1

[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
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
StateType = C
Physics = C
IgnoreHitPause = 1

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
StateType = S
Physics = S
IgnoreHitPause = 1

[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
triggerall = Var(59) = 0
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = C
Trigger2 = P2StateType = S
Trigger2 = Random = [500,999]
StateType = C
Physics = C
IgnoreHitPause = 1

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = 0
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(59) > 0
TriggerAll = StateType != A
Trigger1 = P2StateType = A
Trigger2 = P2StateType = S
Trigger2 = Random = [0,499]
StateType = S
Physics = S
IgnoreHitPause = 1

[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

;---------------------------------------------------------------------------
[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 = 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 181, ランダム]
type = VarRandom
trigger1 = Time = 0
v = 10
range = 0,9

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 0
trigger1 = AnimElemTime(2) = 0
value = s19,0
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 1
trigger1 = AnimElemTime(2) = 0
value = s19,1
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 2
trigger1 = AnimElemTime(2) = 0
value = s19,2
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 3
trigger1 = AnimElemTime(2) = 0
value = s19,3
persistent = 0

[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, 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 = 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, 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, 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 181, ランダム]
type = VarRandom
trigger1 = Time = 0
v = 10
range = 0,9

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 0
trigger1 = AnimElemTime(2) = 0
value = s19,0
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 1
trigger1 = AnimElemTime(2) = 0
value = s19,1
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 2
trigger1 = AnimElemTime(2) = 0
value = s19,2
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 3
trigger1 = AnimElemTime(2) = 0
value = s19,3
persistent = 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 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
triggerall = Command = "holdup"
trigger1 = Command = "弱"
trigger2 = Command = "中"
trigger3 = Command = "強"
trigger4 = Command = "A+B+C"
trigger5 = Command = "A+D"
trigger6 = Command = "A+B"
trigger7 = Command = "start"
var(14) = 1

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
triggerall = Command = "holdUF" || Command = "hold→"
trigger1 = Command = "弱"
trigger2 = Command = "中"
trigger3 = Command = "強"
trigger4 = Command = "A+B+C"
trigger5 = Command = "A+D"
trigger6 = Command = "A+B"
trigger7 = Command = "start"
var(14) = 2

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
triggerall = Command = "holdUB" || Command = "hold←"
trigger1 = Command = "弱"
trigger2 = Command = "中"
trigger3 = Command = "強"
trigger4 = Command = "A+B+C"
trigger5 = Command = "A+D"
trigger6 = Command = "A+B"
trigger7 = Command = "start"
var(14) = 3

[State 5050, 4] 
type = ChangeState
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = CanRecover
triggerall = AnimElemTime(3) < 0
trigger1 = var(14) = 1
trigger2 = var(14) = 2
trigger3 = var(14) = 3
value = 5210

[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
triggerall = anim != 5051
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 2] ;Coming down anim
type = ChangeAnim
triggerall = anim = 5051
trigger1 = Time = 0 
value = 5062
persistent = 0

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

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Var(59) <= 0
triggerall = Anim = 5062 && Pos Y <= -30 || Anim = 5060 && Pos Y <= -2 || Anim = 5061 && Pos Y <= -30 
;値を大きくすると、有効範囲が上になる = 一定の高さまで下がるとリカバーできなくなる
;5061 = 頭落下
;5060 = 背中落下
triggerall = Alive
triggerall = CanRecover
triggerall = GetHitVar(fall.recover) = 1
triggerall = Command = "holdup" || Command ="holdUF" || Command = "hold→" || Command = "holdUB" || Command = "hold←"
trigger1 = Command = "弱"
trigger2 = Command = "中"
trigger3 = Command = "強"
trigger4 = Command = "A+B+C"
trigger5 = Command = "A+D"
trigger6 = Command = "A+B"
trigger7 = Command = "start"
value = 5210

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Var(59) > 0
triggerall = Anim = 5062 && Pos Y <= -30 || Anim = 5060 && Pos Y <= -2 || Anim = 5061 && Pos Y <= -30 
triggerall = Alive
triggerall = CanRecover
triggerall = GetHitVar(fall.recover) = 1
trigger1 = P2MoveType != A
trigger1 = P2BodyDist X = [-80,80]
trigger1 = P2BodyDist Y + (EnemyNear,Vel Y * 5) != [-80,80]
trigger1 = Random = [650,999]
trigger2 = InGuardDist
trigger2 = P2MoveType = A
trigger2 = P2BodyDist X = [-60,60]
trigger2 = P2BodyDist Y + (EnemyNear,Vel Y * 5) != [-100,100]
trigger2 = Random = [400,700]
trigger3 = P2BodyDist X - (EnemyNear,Vel X * 5) != [-75,75]
trigger3 = Random = [100,400]
value = 5210

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

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall = Anim = 5062 || Anim = 5090 || Anim = 5061
triggerall = Vel Y > 0
triggerall = Pos Y >= -30;値を高くすれば受身が楽に
trigger1 = Command = "UF"
trigger2 = Command = "→"
var(14) = 1

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall = Anim = 5062 || Anim = 5090 || Anim = 5061
triggerall = Vel Y > 0
triggerall = Pos Y >= -30
trigger1 = Command = "UB"
trigger2 = Command = "←"
var(14) = 2

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall = Anim = 5062 || Anim = 5090 || Anim = 5061
triggerall = Vel Y > 0
triggerall = Pos Y >= -30
trigger1 = Command = "↑"
var(14) = 3

[State 5050, 6]
type = ChangeState
triggerall = Anim = 5062 || Anim = 5061
trigger1 = Vel Y > 0
trigger1 = Pos Y >= -15
value = 6010

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall =  Anim = 5050 || Anim = 5060 || Anim = 5080
triggerall = Vel Y > 0
triggerall = Pos Y >= 10;値を低くすれば受身が楽に
trigger1 = Command = "UF"
trigger2 = Command = "→"
var(14) = 1

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall =  Anim = 5050 || Anim = 5060 || Anim = 5080
triggerall = Vel Y > 0
triggerall = Pos Y >= 10
trigger1 = Command = "UB"
trigger2 = Command = "←"
var(14) = 2

[State -2,0]
type = VarSet
triggerall = Var(59) <= 0
triggerall = CanRecover
triggerall =  Anim = 5050 || Anim = 5060 || Anim = 5080
triggerall = Vel Y > 0
triggerall = Pos Y >= 10
trigger1 = Command = "↑"
var(14) = 3

[State 5050, 6]
type = ChangeState
triggerall =  Anim = 5050 || Anim = 5060
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 35 ;値を高くすると床にめり込む
value = 6000

[State 5050, 6]
type = ChangeState
triggerall = Anim = 5080
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 6000

[State 5050, 6]
type = ChangeState
triggerall = Anim = 5062 || Anim = 5090 && AnimElemTime(8) > 0 || Anim = 5061
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
trigger2 = Vel Y > 0
trigger2 = Pos Y >= 0
value = 5100 ;HIT_BOUNCE

[State 5050, 6]
type = ChangeState
triggerall = Anim = 5035 || Anim = 5090 && AnimElemTime(9) < 0
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
trigger2 = Vel Y > 0
trigger2 = Pos Y >= 0
value = 6000
;---------------------------------------------------------------------------
; 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 , 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 181, ランダム]
type = VarRandom
trigger1 = Time = 0
v = 10
range = 0,9

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 0
trigger1 = AnimElemTime(2) = 0
value = s19,0
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 1
trigger1 = AnimElemTime(2) = 0
value = s19,1
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 2
trigger1 = AnimElemTime(2) = 0
value = s19,2
persistent = 0

[State 190, 0]
type = PlaySnd
triggerall = var(10) = 3
trigger1 = AnimElemTime(2) = 0
value = s19,3
persistent = 0

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

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

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 15
type = ChangeState
value = 6005

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

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

[State 5100, 12]
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5061,5062]
trigger2 = anim = 5070
value =  5101 ;うつ伏せ

[State 5100, 12]
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5030,5035]
trigger2 = anim = [5050,5060]
trigger3 = anim = 5080
trigger4 = anim != [5030,5035] ;	trigger4は不具合防止用
trigger4 = anim != [5050,5060] ;	仮にアニメが5101と201以外だと不具合が起きてしまうので、
trigger4 = anim != 5080 ;		トリガで指定したアニメ以外だとしたら強制的に201に変更します
trigger4 = anim != [5061,5062]
trigger4 = anim != 5070
trigger4 = anim != 5090
trigger4 = anim != 5101
value =  201 ;仰向け

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

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

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

[State -2, 1]
type = VarRangeSet
trigger1 = time = 0
value = 0
first = 11
last = 14

[State ,100]
type = Explod
trigger1 = time = 0
anim = 630
ID = 8
pos = 0,floor(Pos Y)+10
postype = p1
facing = 1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -2
ownpal = 1 

[State ,100]
type = PlaySnd
trigger1 = time = 0
value = s20,14
channel = 14

[State ,100]
type = EnvShake
trigger1 = time = 0
time = 7
freq = 60
ampl = 7

[State 5050, 4]
type = VarSet
triggerall = Var(59) > 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = P2BodyDist X = [-80,80]
trigger1 = InGuardDist || EnemyNear,Vel X > 5.0 || BackEdgeDist < 30
trigger1 = Random = [350,650]
var(14) = 4

[State 5050, 4]
type = VarSet
triggerall = Var(59) > 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = InGuardDist || BackEdgeDist > 60
trigger1 = Random > 750
var(14) = 5

[State 5050, 4]
type = VarSet
triggerall = Var(59) > 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = P2MoveType != A
trigger1 = P2BodyDist X = [-85,85]
trigger1 = Random < 100
trigger2 = InGuardDist
trigger2 = P2MoveType = A
trigger2 = P2BodyDist X = [-75,75]
trigger2 = Random < 100
trigger3 = P2BodyDist X - (EnemyNear,Vel X * 5) != [-75,75]
trigger3 = Random < 200
var(14) = 6

[State 5050, 4]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UF"
trigger2 = Command = "→"
var(14) = 4

[State 5050, 4]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UB"
trigger2 = Command = "←"
var(14) = 5

[State 5050, 4]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "↑"
var(14) = 6

[State 5050, 4] 
type = ChangeState
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(4) < 0
trigger1 = var(14) = 1
trigger2 = var(14) = 2
trigger3 = var(14) = 3
trigger4 = var(14) = 4
trigger5 = var(14) = 5
trigger6 = var(14) = 6
value = 275

[State 5100, 1]
type = null;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, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

[State 5100, 12]
type = ChangeState
trigger1 = anim =  201
trigger1 = AnimTime = 0
value = 6001

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5101 && AnimTime = 0
value =  5160

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5160 && AnimTime = 0
value =  5170

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5170 && AnimTime = 0
value =  5110

[State 5100, 12]
type = ChangeState
trigger1 = anim =  5110 && AnimElemTime(1) = 18
value =  5120

[State 5100, 12]
type = ChangeState
triggerall = !alive
trigger1 = anim = 201
trigger2 = anim = 5101
value =  5150
;---------------------------------------------------------------------------
; 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, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5101, 6] ;Hit ground
trigger1 = AnimTime = 0
type = ChangeState
value = 5110

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

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

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

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

[State 5110, 1]
type = ChangeAnim
trigger1 = anim = 200
trigger2 = anim = 5060
trigger3 = anim = 5170
value = 201

[State 5110, 1]
type = ChangeState
trigger1 = anim =  201
trigger1 = AnimTime = 0
value = 6001

[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, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

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

[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 = null;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, 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

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = !alive
trigger1 = anim = 201 && AnimTime = 0
value = 202
persistent = 0

[State 5100, 12]
type = ChangeAnim
triggerall = !alive
trigger1 = anim =  5101 && AnimTime = 0
value =  5160

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5160 && AnimTime = 0
value =  5170

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5170 && AnimTime = 0
value =  5110

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = !alive
trigger1 = anim = 5100
trigger2 = anim = 204
value = 5110
persistent = 0

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = alive
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
triggerall = alive
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
triggerall = alive
;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
triggerall = alive
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 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 = null;GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

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

[State 45, 3]
type = VarSet
trigger1 = Time = 0
trigger1 = var(12) = [1,2]
var(12) = 4

[State -2, 1]
type = VarSet
trigger1 = time = 0
var(14) = 0

[State 115, 1]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Time = 0
triggerall = Command != "hold↑"
trigger1 = Command = "hold→"
trigger2 = Command = "holdUF"
var(8) = 1

[State 115, 1]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Time = 0
triggerall = Command != "hold↑"
trigger1 = Command = "hold←"
trigger2 = Command = "holdUB"
var(8) = 2

[State 115, 1]
type = VarSet
triggerall = Var(59) <= 0
triggerall = Time = 0
triggerall = Command != "holdUF"
triggerall = Command != "holdUB"
trigger1 = Command = "hold↑"
var(8) = 3

[State 115, 1]
type = VarSet
triggerall = Var(59) > 0
triggerall = Time = 0
trigger1 = BackEdgeBodyDist <= 80
trigger1 = P2BodyDist X = [-20,20]
trigger1 = Random = [300,999]
trigger2 = FrontEdgeBodyDist <= 5
trigger2 = Pos X < 0
trigger2 = Random = [500,999]
var(8) = 1

[State 115, 1]
type = VarSet
triggerall = Var(59) > 0
triggerall = Time = 0
triggerall = Random = [500,999]
trigger1 = FrontEdgeBodyDist <= 5
trigger1 = Pos X > 0
var(8) = 2

[State 115, 1]
type = VarSet
triggerall = Var(59) > 0
triggerall = Time = 0
trigger1 = BackEdgeBodyDist <= 80
trigger1 = P2BodyDist X = [-20,20]
trigger1 = Random = [0,299]
trigger2 = BackEdgeBodyDist > 80
var(8) = 3

[State 115, 1]
type = VelSet
triggerall = time = 0
trigger1 = var(8) = 1
x = 3
y = -9

[State 115, 1]
type = VelSet
triggerall = time = 0
trigger1 = var(8) = 2
x = -2
y = -7.5

[State 115, 1]
type = VelSet
triggerall = time = 0
trigger1 = var(8) = 3
trigger2 = var(8) = 0
x = -2
y = -4

[State 115, 1]
type = PalFX
triggerall = var(8) = 1
trigger1 = time = 0
trigger2 = time = 2
trigger3 = time = 4
trigger4 = time = 6
trigger5 = time = 8
trigger6 = time = 10
trigger7 = time = 12
time = 1
add = 256,256,256

[State 115, 1]
type = PalFX
triggerall = var(8) = 2
trigger1 = time = 0
trigger2 = time = 2
trigger3 = time = 4
trigger4 = time = 6
trigger5 = time = 8
trigger6 = time = 10
trigger7 = time = 12
trigger8 = time = 14
trigger9 = time = 16
trigger10 = time = 18
trigger11 = time = 20
time = 1
add = 256,256,256

[State 115, 1]
type = PalFX
triggerall = var(8) = 3 || var(8) = 0
trigger1 = time = 0
trigger2 = time = 2
trigger3 = time = 4
trigger4 = time = 6
trigger5 = time = 8
trigger6 = time = 10
trigger7 = time = 12
trigger8 = time = 14
trigger9 = time = 16
time = 1
add = 256,256,256

[State 181, ランダム]
type = VarRandom
trigger1 = Time = 0
v = 10
range = 0,4

[State 115, 1]
type = PlaySnd
triggerall = var(10) = 0
trigger1 = AnimElemTime(1) = 0
value = s2,0
channel = 0

[State 115, 1]
type = PlaySnd
triggerall = var(10) = 1
trigger1 = AnimElemTime(1) = 0
value = s2,1
channel = 0

[State 115, 1]
type = PlaySnd
triggerall = var(10) = 2
trigger1 = AnimElemTime(1) = 0
value = s2,2
channel = 0

[State 115, 1]
type = NotHitBy
triggerall = var(8) = 1
trigger1 = AnimElemTime(5) < 0
value = SCA

[State 115, 1]
type = NotHitBy
triggerall = var(8) != 1
trigger1 = AnimElemTime(6) < 0
value = SCA

[State 115, 1]
type = CtrlSet
trigger1 = AnimElemTime(6) = 0
value = 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 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190
;---------------------------------------------------------------------------
[Statedef 6000]
type = L
movetype= H
physics = S
ctrl = 0
velset = 0,0
anim = 201

[State 5900, 2]
type = PosFreeze
trigger1 = 1

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

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

[State -2, 1]
type = VarRangeSet
trigger1 = time = 0
value = 0
first = 11
last = 14

[State ,100]
type = Explod
trigger1 = time = 0
anim = 630
ID = 8
pos = 0,floor(Pos Y)+10
postype = p1
facing = 1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -2
ownpal = 1 

[State ,100]
type = PlaySnd
trigger1 = time = 0
value = s20,14
channel = 14

[State ,100]
type = EnvShake
trigger1 = time = 0
time = 7
freq = 60
ampl = 7

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UF"
trigger2 = Command = "→"
var(14) = 4

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UB"
trigger2 = Command = "←"
var(14) = 5

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "↑"
var(14) = 6

[State 5050, 4] 
type = ChangeState
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(4) < 0
trigger1 = var(14) = 1
trigger2 = var(14) = 2
trigger3 = var(14) = 3
trigger4 = var(14) = 4
trigger5 = var(14) = 5
trigger6 = var(14) = 6
value = 275

[State 5900, 3]
type = ChangeState
trigger1 = !alive
trigger1 = AnimTime = 0
value = 5150

[State 5900, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 6001
;---------------------------------------------------------------------------
[Statedef 6001]
type = L
movetype= H
physics = N
ctrl = 0
velset = 0,0
anim = 202

[State 5900, 3]
type = ChangeState
trigger1 = Time = 17
value = 6002
;---------------------------------------------------------------------------
[Statedef 6002]
type = L
movetype= H
physics = N
ctrl = 0
velset = 0,0
anim = 203

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

[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
---------------------------------------------------------------------------
[Statedef 6005]
type = L
movetype = H
physics = S
ctrl = 0
anim = 204

[State 5900, 2]
type = PosFreeze
trigger1 = 1

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

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

[State -2, 1]
type = VarRangeSet
trigger1 = time = 0
value = 0
first = 11
last = 14

[State ,100]
type = Explod
trigger1 = time = 0
anim = 630
ID = 8
pos = 0,floor(Pos Y)+10
postype = p1
facing = 1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -2
ownpal = 1 

[State ,100]
type = PlaySnd
trigger1 = time = 0
value = s20,14
channel = 14

[State ,100]
type = EnvShake
trigger1 = time = 0
time = 8
freq = 60
ampl = 7

[State 5900, 3]
type = ChangeState
trigger1 = !alive
trigger1 = AnimTime = 0
value = 5150

[State 5900, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 6006
---------------------------------------------------------------------------
[Statedef 6006]
type = L
movetype = H
physics = N
ctrl = 0
anim = 5110

[State 5900, 3]
type = ChangeState
trigger1 = Time = 22
value = 5120
---------------------------------------------------------------------------
[Statedef 6010] ;頭から地面激突
type    = L
movetype= H
physics = N
anim =  5101

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

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

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

[State -2, 1]
type = VarRangeSet
trigger1 = time = 0
value = 0
first = 11
last = 14

[State ,100]
type = Explod
trigger1 = time = 0
anim = 630
ID = 8
pos = 0,floor(Pos Y)+10
postype = p1
facing = 1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5,0.5
sprpriority = -2
ownpal = 1 

[State ,100]
type = PlaySnd
trigger1 = time = 0
value = s20,14
channel = 14

[State ,100]
type = EnvShake
trigger1 = time = 0
time = 7
freq = 60
ampl = 7

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UF"
trigger2 = Command = "→"
var(14) = 4

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "UB"
trigger2 = Command = "←"
var(14) = 5

[State 5050, 4] 
type = VarSet
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(3) < 0
trigger1 = Command = "↑"
var(14) = 6

[State 5050, 4] 
type = ChangeState
triggerall = alive
triggerall = GetHitVar(fall.recover) = 1
triggerall = AnimElemTime(4) < 0
trigger1 = var(14) = 1
trigger2 = var(14) = 2
trigger3 = var(14) = 3
trigger4 = var(14) = 4
trigger5 = var(14) = 5
trigger6 = var(14) = 6
value = 275

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

[State 5900, 3]
type = ChangeState
trigger1 = !alive
trigger1 = AnimTime = 0
value = 5150

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5101 && AnimTime = 0
value =  5160

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5160 && AnimTime = 0
value =  5170

[State 5100, 12]
type = ChangeAnim
trigger1 = anim =  5170 && AnimTime = 0
value =  5110

[State 5100, 12]
type = ChangeState
trigger1 = anim =  5110 && AnimElemTime(1) = 18
value =  5120
