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

[State 0, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 0, 2]
type = ChangeAnim
trigger1 = Anim != 0 && (Anim != [5,6])
trigger2 = Anim = 6 && AnimTime = 0
trigger3 = Anim = 5 && AnimTime = 0
value = 0

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

[State 0, 4]
type = PlayerPush
trigger1 = roundstate >= 3
value = 0

[State 0, 5]
type = ChangeState
triggerall = time = 0
triggerall = var(6) != 0
trigger1 = prevstateno = [200+var(40),209+var(40)]
trigger2 = prevstateno = 500
trigger3 = prevstateno = 524
trigger4 = prevstateno = 1000
value = var(6)

[State 0, 6] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

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

[State 10, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 10, 2]
type = AssertSpecial
trigger1 = Time <= 1
flag = NoAutoTurn

[State 10, 3]
type = ChangeState
trigger1 = PrevStateNo = 101
value = 101

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

[State 10, 5]
type = PosSet
trigger1 = 1
y = 0

[State 10, 6]
type = ChangeState
trigger1 = Time = 1
value = 11

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
sprpriority = 0

[State 11, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 11, 2]
type = ChangeState
trigger1 = PrevStateNo = 101
value = 101

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

[State 11, 4]
type = PosSet
trigger1 = 1
y = 0

[State 11, 5]
type = ChangeAnim
trigger1 = Anim != 0 && (Anim != [5,6])
trigger2 = Anim = 6 && AnimTime = 0
trigger3 = Anim = 5 && AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
velset = 0,0

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

[State 12, 2]
type = ChangeState
trigger1 = Time = 0
value = 0

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

[State 20, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 20, 2]
type = PosSet
trigger1 = 1
y = 0

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

[State 20, 4]
type = VelSet
trigger1 = command = "holdback"
x = ifelse(var(40)=0,const(velocity.walk.back.x),-4.0)

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

[State 20, 6]
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 = N
anim = 40
ctrl = 0
velset = 0,0
sprpriority = 1

[State 40, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 40, 2]
type = PosSet
trigger1 = 1
y = 0

[State 40, AI]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = Time = 0
triggerall = !(EnemyNear(Var(55)),HitDefAttr = SCA, NT, ST, HT)
trigger1 = !(Var(59) >= 7 && Var(56) = 3 && Helper(6001),Var(10) <= 85)
trigger1 = EnemyNear(Var(55)),MoveType = H
trigger1 = EnemyNear(Var(55)),StateNo = [232,239]
trigger2 = !(Var(59) >= 7 && Var(50) = 1 && (Power >= 1000 || Var(16) != 0))
trigger2 = EnemyNear(Var(55)),StateNo = 721
trigger2 = EnemyNear(Var(55)),Anim = [5050,5099]
trigger3 = P2BodyDist X > 90
trigger3 = EnemyNear(Var(55)),StateNo = [59200,59204]
trigger4 = EnemyNear(Var(55)),MoveType = H
trigger4 = EnemyNear(Var(55)),StateNo = [77000,77006]
trigger5 = EnemyNear(Var(55)),MoveType = H
trigger5 = EnemyNear(Var(55)),StateNo = 88100
trigger5 = EnemyNear(Var(55)),Pos Y + (EnemyNear(Var(55)),Vel Y * 10) <= -20
trigger6 = EnemyNear(Var(55)),MoveType = H
trigger6 = EnemyNear(Var(55)),StateNo = [88510,88523]
value = 0
ctrl = 1

[State 40, AI]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = Var(56) = 0
triggerall = Time = 0
triggerall = EnemyNear(Var(55)),StateNo != 721
triggerall = EnemyNear(Var(55)),StateNo != 59100
triggerall = EnemyNear(Var(55)),StateNo != 59204
triggerall = EnemyNear(Var(55)),StateNo != 88210
triggerall = EnemyNear(Var(55)),StateNo != [232,239]
triggerall = EnemyNear(Var(55)),StateNo != [77000,77006]
triggerall = EnemyNear(Var(55)),StateNo != [88510,88523]
triggerall = !(EnemyNear(Var(55)),HitDefAttr = SCA, NT, ST, HT)
trigger1 = EnemyNear(Var(55)),StateType = A
trigger1 = Random <= Var(59) * Var(59) * 10
trigger2 = EnemyNear(Var(55)),StateType != L
trigger2 = P2BodyDist X <= 75
trigger2 = Random <= Var(59) * Var(59) * 10
trigger3 = EnemyNear(Var(55)),StateType != A
trigger3 = !(BackEdgeDist < 5 && EnemyNear(Var(55)),StateNo = [5110,5120])
trigger3 = Random <= ((300 - P2BodyDist X) * 0.35) * Var(59)
value = 0
ctrl = 1

[State 40, 3]
type = VarSet
trigger1 = Time = 0
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),StateNo = 721 || EnemyNear(Var(55)),StateNo = 59204
trigger2 = P2BodyDist X < IfElse(EnemyNear(Var(55)),StateType = A, 40, 50)
trigger3 = Var(59) > 0
trigger3 = EnemyNear(Var(55)),StateType = L
trigger3 = EnemyNear(Var(55)),StateNo = [5110,5120]
trigger3 = EnemyNear(Var(55)),BackEdgeDist <= 5
trigger3 = P2BodyDist X <= 75
trigger4 = Var(59) > 0
trigger4 = Var(56) = 2
trigger4 = Var(40) != 0
trigger4 = EnemyNear(Var(55)),MoveType = H
trigger4 = EnemyNear(Var(55)),BackEdgeDist <= 10
sysvar(1) = 0

[State 40, 4]
type = VarSet
trigger1 = Var(59) = 0
trigger1 = command = "holdfwd"
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),StateNo != 721
trigger2 = EnemyNear(Var(55)),StateNo != [5110,5120]
trigger2 = EnemyNear(Var(55)),StateType != L || P2BodyDist X >= 60
trigger2 = EnemyNear(Var(55)),MoveType = H || Random <= 250 || EnemyNear(Var(55)),StateType = L
trigger3 = Var(59) > 0
trigger3 = EnemyNear(Var(55)),StateType = L
trigger3 = EnemyNear(Var(55)),StateNo = [5110,5120]
trigger3 = Random <= 750 - ((BackEdgeDist > 10 && P2BodyDist X <= 50) * 550)
trigger4 = Var(59) > 0
trigger4 = EnemyNear(Var(55)),StateNo = 721
trigger4 = P2BodyDist X >= IfElse(EnemyNear(Var(55)),StateType = A, 40, 50)
trigger5 = Var(59) > 0
trigger5 = P2BodyDist X >= 50
trigger5 = EnemyNear(Var(55)),StateNo = 59100 || EnemyNear(Var(55)),StateNo = 59204 || EnemyNear(Var(55)),StateNo = 88210
sysvar(1) = 1

[State 40, 5]
type = VarSet
trigger1 = Var(59) = 0
trigger1 = command = "holdback"
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),MoveType != H
trigger2 = EnemyNear(Var(55)),StateType != L
trigger2 = EnemyNear(Var(55)),StateNo != 721
trigger2 = EnemyNear(Var(55)),StateNo != 59100
trigger2 = EnemyNear(Var(55)),StateNo != 59204
trigger2 = EnemyNear(Var(55)),StateNo != 88210
trigger2 = BackEdgeBodyDist > 60
trigger2 = Random <= 500
trigger3 = Var(59) > 0
trigger3 = EnemyNear(Var(55)),StateType = L
trigger3 = EnemyNear(Var(55)),StateNo = [5110,5120]
trigger3 = Random >= 950
sysvar(1) = -1

[State 40, 6]
type = VelSet
trigger1 = Var(59) = 0
trigger1 = command = "holdup"
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, 7]
type = VelSet
trigger1 = Var(59) = 0
trigger1 = command != "holdup"
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)-1, const(velocity.jump.back.x)+1))
y = const(velocity.jump.y)*0.8

[State 40, 8]
type = VelSet
triggerall = Var(59) > 0
triggerall = AnimTime = 0
trigger1 = P2BodyDist X < 150
trigger2 = SysVar(1) != 1
trigger2 = Random%2 = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)-1, const(velocity.jump.back.x)+1))
y = const(velocity.jump.y)*0.8

[State 40, AI]
type = VelSet
triggerall = Var(59) > 0
triggerall = AnimTime = 0
trigger1 = P2BodyDist X >= 150
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, AI]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 9]
type = PlaySnd
trigger1 = Time = 3
value = s6,0

[State 40, 10]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

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

[State 50, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

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

[State 50, 3]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel Y)=-11, 41, 45)

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

[State 50, 5]
type = ChangeState
trigger1 = time = 0
trigger1 = var(6) = 220+var(40)
value = var(6)

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

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

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = N
ctrl = 0
anim = 47
velset = 0,0
sprpriority = 1

[State 52, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 52, 2]
type = NotHitBy
trigger1 = AnimTime < 0
value = SCA
time = 1

[State 52, 3]
type = PosSet
trigger1 = 1
y = 0

[State 52, 4]
type = PlaySnd
trigger1 = Time = 0
value = s6,1

[State 52, 5]
type = Explod
trigger1 = Time = 0
anim = 10103
pos = 25,0
vel = 0,0
ownpal = 1
sprpriority = 2

[State 52, 6]
type = Explod
trigger1 = Time = 0
anim = 10104
pos = -25,0
vel = 0,0
ownpal = 1
sprpriority = 2

[State 52, 7]
type = CtrlSet
trigger1 = Time = 0
value = 1

[State 52, 8]
type = ChangeState
trigger1 = Time = 0
trigger1 = P2Dist X < 0
value = 0
ctrl = 1

[State 52, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; ダッシュ
[Statedef 100]
type    = S
movetype = A
physics = N
anim = 100
sprpriority = 1
ctrl = 0

[State 100, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 100, 2]
type = AttackDist
trigger1 = 1
value = 0

[State 100, 3]
type = PosSet
trigger1 = 1
y = 0

[State 100, 4]
type = AfterImage
trigger1 = Time = 0
time = -1
palcolor = 256
palbright = 0,0,64
palcontrast = 162,162,256
paladd = 0,0,0
palmul = 1,1,1
length = 4
timegap = 2
framegap = 1
trans = none

[State 100, 5]
type = PlaySnd
trigger1 = AnimElem = 1
value = s6,2
channel = 2

[State 100, 6]
type = VelSet
trigger1 = AnimElem = 1
x = 4.0

[State 100, 7]
type = VelSet
trigger1 = AnimElem = 2, >= 0
x = const(velocity.run.fwd.x)

[State 100, 8]
type = Explod
trigger1 = AnimElem = 3
trigger2 = AnimElem = 5
trigger3 = AnimElem = 9
trigger4 = AnimElem = 11
anim = 10106
pos = 15,0
vel = -1,0
ownpal = 1
sprpriority = 2

[State 100, 9]
type = Explod
trigger1 = AnimElem = 7
trigger2 = AnimElem = 13
anim = 10104
id = 100
pos = -30,0
vel = -1,0
ownpal = 1
sprpriority = 2

[State 100, 10]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = AnimElem = 2, >= 0
trigger1 = command = "holdup"
value = 102

[State 100, 11]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = AnimElem = 2, >= 0
trigger1 = command != "holdfwd"
value = 101

[State 100, AI]
type = ChangeState
triggerall = Var(59) > 0
triggerall = AnimElem = 2, >= 0
triggerall = EnemyNear(Var(55)),StateNo != 721
triggerall = EnemyNear(Var(55)),StateNo != 59100
triggerall = EnemyNear(Var(55)),StateNo != 59204
triggerall = EnemyNear(Var(55)),StateNo != 88210
triggerall = EnemyNear(Var(55)),StateNo != [233,235]
trigger1 = RoundState > 2 || FrontEdgeDist <= 0
trigger2 = EnemyNear(Var(55)),StateType = L
trigger2 = P2Dist X <= 70 + (Var(59) * 5)
trigger2 = Random < Var(59) * 50
trigger3 = InGuardDist
trigger3 = EnemyNear(Var(55)),MoveType = A || P2BodyDist X >= 150
trigger3 = Random < (Var(59) * (Helper(6001),Var(15) * 20)) + Floor(P2BodyDist X * 2)
value = 101

[State 100, AI]
type = ChangeState
triggerall = Var(59) > 0
triggerall = AnimElem = 2, >= 0
triggerall = P2BodyDist X <= 50 - (Var(59) * 5)
triggerall = Random < Var(59) * 100
trigger1 = EnemyNear(Var(55)),StateNo = 721
trigger2 = EnemyNear(Var(55)),StateNo = 88210
trigger3 = EnemyNear(Var(55)),StateNo = [233,235]
value = 101

[State 100, AI]
type = ChangeState
triggerall = Var(59) > 0
triggerall = AnimElem = 2, >= 0
triggerall = P2BodyDist X <= 50
triggerall = Random < Var(59) * 100
trigger1 = EnemyNear(Var(55)),StateNo = 59100
trigger2 = EnemyNear(Var(55)),StateNo = [59202,59204]
value = 101

;---------------------------------------------------------------------------
; ダッシュ停止
[Statedef 101]
type    = S
movetype= I
physics = N
ctrl = 1
sprpriority = 1

[State 101, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 101, 2]
type = ChangeAnim
trigger1 = Anim != 101
value = 101

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

[State 101, 4]
type = PosSet
trigger1 = 1
y = 0

[State 101, 5]
type = AfterImage
trigger1 = Time = 0
time = -1
palcolor = 256
palbright = 0,0,64
palcontrast = 162,162,256
paladd = 0,0,0
palmul = 1,1,1
length = 4
timegap = 2
framegap = 1
trans = none

[State 101, 6]
type = VelSet
trigger1 = AnimElem = 1
x = 2

[State 101, 7]
type = VelAdd
trigger1 = Vel X >= 0
x = -0.12

[State 101, 8]
type = VelSet
trigger1 = Vel X <= 0
trigger2 = Time > 0
trigger2 = P2Dist X < 0
x = 0

[State 101, 9]
type = PlaySnd
trigger1 = AnimElem = 3
value = s6,1

[State 101, 10]
type = Explod
trigger1 = AnimElem = 1
anim = 10105
pos = 65,0
vel = 1,0
facing = -1
ownpal = 1
sprpriority = 2

[State 101, 11]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = Time > 0
trigger2 = P2Dist X < 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; ダッシュジャンプ開始
[Statedef 102]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 102, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 102, 2]
type = PosSet
trigger1 = 1
y = 0

[State 102, 3]
type = VelSet
trigger1 = 1
x = 0

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

[State 102, 5]
type = VarSet
trigger1 = Var(59) = 0
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 102, 6]
type = VarSet
trigger1 = Var(59) = 0
trigger1 = command = "holdback"
sysvar(1) = -1

[State 102, 7]
type = VarSet
trigger1 = Var(59) = 0
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
sysvar(1) = 0

[State 102, AI]
type = VarSet
trigger1 = Var(59) > 0
trigger1 = EnemyNear(Var(55)),StateType != L || P2BodyDist X >= 40
trigger1 = EnemyNear(Var(55)),MoveType = H || Random <= 350 || EnemyNear(Var(55)),StateType = L
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),StateType = L
trigger2 = EnemyNear(Var(55)),StateNo = 5120
sysvar(1) = 1

[State 102, AI]
type = VarSet
trigger1 = Var(59) > 0
trigger1 = EnemyNear(Var(55)),StateType != L
trigger1 = EnemyNear(Var(55)),MoveType != H
trigger1 = BackEdgeBodyDist > 60
trigger1 = Random >= 750
sysvar(1) = -1

[State 102, 8]
type = VelSet
trigger1 = Var(59) = 0
trigger1 = command = "holdup"
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 102, 9]
type = VelSet
trigger1 = Var(59) = 0
trigger1 = command != "holdup"
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)*0.75

[State 102, AI]
type = VelSet
trigger1 = Var(59) > 0
trigger1 = AnimTime = 0
trigger1 = P2BodyDist X < 150
trigger1 = Random = [0,499]
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)*0.75

[State 102, AI]
type = VelSet
trigger1 = Var(59) > 0
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 102, 10]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 102, 11]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = sysvar(1) = -1
trigger1 = prevstateno = 102
x = const(velocity.jump.back.x)

[State 102, 12]
type = PlaySnd
trigger1 = Time = 3
value = s6,0

[State 102, 13]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

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

[State 105, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 105, 2]
type = NotHitBy
trigger1 = AnimTime < 0
value = SCA
time = 1

[State 105, 3]
type = AfterImage
trigger1 = Time = 0
time = -1
palcolor = 256
palbright = 0,0,64
palcontrast = 162,162,256
paladd = 0,0,0
palmul = 1,1,1
length = 4
timegap = 2
framegap = 1
trans = none

[State 105, 4]
type = PlaySnd
trigger1 = AnimElem = 1
value = s6,3

[State 105, 5]
type = Explod
trigger1 = AnimElem = 1
trigger2 = AnimElem = 3
trigger3 = AnimElem = 5
trigger4 = AnimElem = 7
anim = 10105
pos = 20,0
vel = 1,0
ownpal = 1
sprpriority = 2

[State 105, 6]
type = VelSet
trigger1 = AnimElemTime(6) < 0
x = const(velocity.run.back.x)

[State 105, 7]
type = VelSet
trigger1 = AnimElemTime(6) = 0
x = -6.25

[State 105, 8]
type = VelAdd
trigger1 = AnimElemTime(6) >= 0
trigger1 = Vel X <= 0
x = 0.375

[State 105, 9]
type = VelSet
trigger1 = AnimElemTime(6) >= 0
trigger1 = Vel X >= 0
x = 0

[State 105, 10]
type = AfterImageTime
trigger1 = time >= 30
time = 0

[State 105, 11]
type = ChangeState
trigger1 = AnimTime = 0
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 = VelSet
trigger1 = Time = 0
x = 0
z = -7

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

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

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

[State 110, 6]
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 = VelSet
trigger1 = Time = 0
x = 0
z = 7

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

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

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

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

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

[State 120, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

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

[State 120, 2]
type = StateTypeSet
trigger1 = anim = 120 && statetype = L
statetype = S

[State 120, 3]
type = StateTypeSet
trigger1 = anim = 121 && statetype = L
statetype = C

[State 120, 4]
type = StateTypeSet
trigger1 = anim = 122 && statetype = L
statetype = A

[State 120, 5]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 6]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

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

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = FVar(39) != 1
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
statetype = C
physics = C

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = FVar(39) != 1
triggerall = StateType != A
triggerall = P2StateType != A
trigger1 = Var(47) = 0 || Var(48) = 0 || Var(49) = 0
trigger2 = !(Var(47) = 0 || Var(48) = 0 || Var(49) = 0)
trigger2 = EnemyNear(Var(55)),StateNo != Var(47)
trigger2 = EnemyNear(Var(55)),StateNo != Var(48)
trigger2 = EnemyNear(Var(55)),StateNo != Var(49)
statetype = C
physics = C

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = -1
statetype = C
physics = C

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

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = EnemyNear(Var(55)),StateNo != Var(51)
triggerall = EnemyNear(Var(55)),StateNo != Var(52)
triggerall = EnemyNear(Var(55)),StateNo != Var(53)
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
trigger4 = FVar(39) = 1
statetype = S
physics = S

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = 1
statetype = S
physics = S

[State 120, 8]
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 120, Stop Guarding]
type = ChangeState
triggerall = Var(59) = [1,10]
trigger1 = Var(59) < 8
trigger1 = !InGuardDist
trigger2 = Var(59) > 7
trigger2 = NumHelper(6000) > 0
trigger2 = !InGuardDist
trigger2 = !Helper(6000),InGuardDist
trigger3 = Var(59) < 6
trigger3 = P2BodyDist X < 0
trigger3 = Random <= (6 - Var(59)) * 70
value = 140

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type    = S
physics = S

[State 130, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 130, 2]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

[State 130, Hi to Lo]
type = ChangeState
trigger1 = var(59) = 0
trigger1 = command = "holddown"
value = 131

[State 130, Hi to Lo]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = FVar(39) != 1
triggerall = NumHelper(6001) > 0
triggerall = Helper(6001),Var(9) < 2
triggerall = EnemyNear(Var(55)),MoveType = A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
value = 131

[State 130, Hi to Lo]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = FVar(39) != 1
triggerall = NumHelper(6001) > 0
triggerall = Helper(6001),Var(9) < 2
triggerall = EnemyNear(Var(55)),MoveType = A
triggerall = P2StateType = C
triggerall = Random <= Var(59) * Var(59) * 5
trigger1 = Var(47) = 0 || Var(48) = 0 || Var(49) = 0
trigger2 = !(Var(47) = 0 || Var(48) = 0 || Var(49) = 0)
trigger2 = EnemyNear(Var(55)),StateNo != Var(47)
trigger2 = EnemyNear(Var(55)),StateNo != Var(48)
trigger2 = EnemyNear(Var(55)),StateNo != Var(49)
value = 131

[State 130, Hi to Lo]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = FVar(39) != 1
triggerall = EnemyNear(Var(55)),MoveType = A
triggerall = P2StateType != A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(9) >= 2
trigger1 = Helper(6001),Var(9) >= Helper(6001),Var(8)
trigger1 = EnemyNear(Var(55)),StateNo != Var(47)
trigger1 = EnemyNear(Var(55)),StateNo != Var(48)
trigger1 = EnemyNear(Var(55)),StateNo != Var(49)
value = 131

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

[State 130, Stop Guarding]
type = ChangeState
triggerall = Var(59) = [1,10]
trigger1 = Var(59) < 8
trigger1 = !InGuardDist
trigger2 = Var(59) > 7
trigger2 = NumHelper(6000) > 0
trigger2 = !InGuardDist
trigger2 = !Helper(6000),InGuardDist
trigger3 = Var(59) < 6
trigger3 = P2BodyDist X < 0
trigger3 = Random <= (6 - Var(59)) * 70
value = 140

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type    = C
physics = C

[State 131, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 131, 2]
type = ChangeAnim
trigger1 = Anim != 131
value = 131

[State 131, Lo to Hi]
type = ChangeState
trigger1 = var(59) = 0
trigger1 = command != "holddown"
value = 130

[State 131, Lo to Hi]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = EnemyNear(Var(55)),MoveType = A
triggerall = EnemyNear(Var(55)),StateNo != Var(51)
triggerall = EnemyNear(Var(55)),StateNo != Var(52)
triggerall = EnemyNear(Var(55)),StateNo != Var(53)
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
trigger4 = FVar(39) = 1
value = 130

[State 131, Lo to Hi]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = EnemyNear(Var(55)),MoveType = A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = 1
value = 130

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

[State 131, Stop Guarding]
type = ChangeState
triggerall = Var(59) = [1,10]
trigger1 = Var(59) < 8
trigger1 = !InGuardDist
trigger2 = Var(59) > 7
trigger2 = NumHelper(6000) > 0
trigger2 = !InGuardDist
trigger2 = !Helper(6000),InGuardDist
trigger3 = Var(59) < 6
trigger3 = P2BodyDist X < 0
trigger3 = Random <= (6 - Var(59)) * 70
value = 140

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type    = A
physics = N

[State 132, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 132, 2]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

[State 132, 3]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 132, 4]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 132, 5]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, 6]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, 7]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) = 0
trigger1 = command = "holdback"
trigger2 = var(59) > 0
value = 130

[State 132, 8]
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 132, Stop Guarding]
type = ChangeState
triggerall = Var(59) = [1,10]
trigger1 = Var(59) < 8
trigger1 = !InGuardDist
trigger2 = Var(59) > 7
trigger2 = NumHelper(6000) > 0
trigger2 = !InGuardDist
trigger2 = !Helper(6000),InGuardDist
trigger3 = Var(59) < 6
trigger3 = P2BodyDist X < 0
trigger3 = Random <= (6 - Var(59)) * 70
value = 140

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, 1]
type = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 140, 2]
type = NotHitBy
trigger1 = PrevStateNo = [150,159]
value = ,AT
time = 6

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

[State 140, 4]
type = StateTypeSet
trigger1 = anim = 140 && statetype = L
statetype = S

[State 140, 5]
type = StateTypeSet
trigger1 = anim = 141 && statetype = L
statetype = C

[State 140, 6]
type = StateTypeSet
trigger1 = anim = 142 && statetype = L
statetype = A

[State 140, 7]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 8]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 9]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 140, Hi to Lo]
type = StateTypeSet
triggerall = StateType = S
trigger1 = var(59) = 0
trigger1 = command = "holddown"
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),StateType != A
trigger2 = Random <= Var(59) * Var(59) * 10
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
triggerall = StateType = C
trigger1 = var(59) = 0
trigger1 = command != "holddown"
trigger2 = Var(59) > 0
trigger2 = EnemyNear(Var(55)),StateType = A
trigger2 = Random <= Var(59) * Var(59) * 10
statetype = S
physics = S

;[State 140, 9] ;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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 150, 2]
type = PlaySnd
trigger1 = Time = 0
value = s5,0+random%2
channel = 8
persistent = 0
ignorehitpause = 1

[State 150, 3]
type = ChangeAnim
trigger1 = StateType = S
value = 150

[State 150, 4]
type = ChangeAnim
trigger1 = StateType = C
value = 151

[State 150, 5]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 6

[State 150, 6]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*ifelse((var(59)=0),(command = "holddown"),(EnemyNear(var(55)),StateType=C))

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

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
statetype = C
physics = C

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(9) >= 2
trigger1 = Helper(6001),Var(9) >= Helper(6001),Var(8)
trigger1 = EnemyNear(Var(55)),StateNo != Var(47)
trigger1 = EnemyNear(Var(55)),StateNo != Var(48)
trigger1 = EnemyNear(Var(55)),StateNo != Var(49)
statetype = C
physics = C

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

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
statetype = S
physics = S

[State 150, 7]
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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 151, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 151, 3]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 6

[State 151, 4]
type = ChangeAnim
trigger1 = StateType = S
value = 150

[State 151, 5]
type = ChangeAnim
trigger1 = StateType = C
value = 151

[State 151, 6]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 151, 7]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

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

[State 151, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
statetype = C
physics = C

[State 151, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(9) >= 2
trigger1 = Helper(6001),Var(9) >= Helper(6001),Var(8)
trigger1 = EnemyNear(Var(55)),StateNo != Var(47)
trigger1 = EnemyNear(Var(55)),StateNo != Var(48)
trigger1 = EnemyNear(Var(55)),StateNo != Var(49)
statetype = C
physics = C

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

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
statetype = S
physics = S

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = 1
statetype = S
physics = S

[State 151, 8]
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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 152, 2]
type = PlaySnd
trigger1 = Time = 0
value = s5,0+random%2
channel = 8
persistent = 0
ignorehitpause = 1

[State 152, 3]
type = ChangeAnim
trigger1 = statetype = S
value = 150

[State 152, 4]
type = ChangeAnim
trigger1 = statetype = C
value = 151

[State 152, 5]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 6

[State 152, 6]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*ifelse((var(59)=0),(command = "holddown"),(EnemyNear(var(55)),StateType!=A))

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

[State 152, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
statetype = C
physics = C

[State 152, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(9) >= 2
trigger1 = Helper(6001),Var(9) >= Helper(6001),Var(8)
trigger1 = EnemyNear(Var(55)),StateNo != Var(47)
trigger1 = EnemyNear(Var(55)),StateNo != Var(48)
trigger1 = EnemyNear(Var(55)),StateNo != Var(49)
statetype = C
physics = C

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

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
statetype = S
physics = S

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = 1
statetype = S
physics = S

[State 152, 7]
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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 153, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 153, 3]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 6

[State 153, 4]
type = ChangeAnim
trigger1 = StateType = S
value = 150

[State 154, 5]
type = ChangeAnim
trigger1 = StateType = C
value = 151

[State 155, 6]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 153, 7]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 156, Hi to Lo]
type = StateTypeSet
triggerall = StateType = S
trigger1 = var(59) = 0
trigger1 = command = "holddown"
statetype = C
physics = C

[State 153, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(51) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(51)
trigger2 = Var(52) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(52)
trigger3 = Var(53) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(53)
statetype = C
physics = C

[State 153, Hi to Lo]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(9) >= 2
trigger1 = Helper(6001),Var(9) >= Helper(6001),Var(8)
trigger1 = EnemyNear(Var(55)),StateNo != Var(47)
trigger1 = EnemyNear(Var(55)),StateNo != Var(48)
trigger1 = EnemyNear(Var(55)),StateNo != Var(49)
statetype = C
physics = C

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

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
triggerall = Random <= Var(59) * Var(59) * 10
trigger1 = Var(47) > 0
trigger1 = EnemyNear(Var(55)),StateNo = Var(47)
trigger2 = Var(48) > 0
trigger2 = EnemyNear(Var(55)),StateNo = Var(48)
trigger3 = Var(49) > 0
trigger3 = EnemyNear(Var(55)),StateNo = Var(49)
statetype = S
physics = S

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = Var(59) = [1,10]
triggerall = StateType != A
trigger1 = P2StateType = A
trigger1 = NumHelper(6001) > 0
trigger1 = Helper(6001),Var(6) = 1
statetype = S
physics = S

[State 153, 8]
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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 154, 2]
type = PlaySnd
trigger1 = Time = 0
value = s5,0+random%2
channel = 8
persistent = 0
ignorehitpause = 1

[State 154, 3]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 6

[State 154, 4]
type = ChangeAnim
trigger1 = 1
value = 152

[State 154, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 155 ;AGUARDHIT2

[State 154, 6]
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 = RemoveExplod
trigger1 = Time = 0
id = 2000

[State 155, 2]
type = NotHitBy
trigger1 = Time < GetHitVar(ctrltime)
value = ,AT
time = 1

[State 155, 3]
type = NotHitBy
trigger1 = Time >= GetHitVar(ctrltime)
value = SCA,AA,AT,AP
time = 1

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

[State 155, 5]
type = VelAdd
trigger1 = 1
y = 0.75

[State 155, 6]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 155, 7]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 155, 8]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 155, 9]
type = ChangeState
triggerall = sysvar(0)
triggerall = inguarddist
trigger1 = var(59) = 0
trigger1 = command = "holdback"
trigger2 = var(59) > 0
value = 130

[State 155, 10]
type = NotHitBy
trigger1 = sysvar(0)
value2 = ,AT
time = 6
ignorehitpause = 1

[State 155, 11]
type = VelSet
trigger1 = sysvar(0)
x = 0

[State 155, 12]
type = ChangeState
trigger1 = sysvar(0)
value = 52
ctrl = 1

;---------------------------------------------------------------------------
; LOSE (Time over)
[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 5020, 2] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [4,5]
value = 5051

[State 5000, 4] ;Freeze anim
type = null;ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;HITG_SLIDE

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

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

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

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = Anim = 5012
trigger2 = Anim = 5002
trigger3 = Anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5001]
type    = S
movetype= H
physics = S

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

[State 5001, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5000,5009]
trigger1 = Anim != [5010,5019]
value = 5000

[State 5001, 2]
type = ChangeAnim
trigger1 = GetHitVar(hittime) < 9
trigger1 = Anim != [5005,5009]
trigger1 = Anim != [5015,5019]
value = anim +5

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = NotHitBy
trigger1 = HitOver
value = ,AT
time = 6

[State 5001, 6]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 7]
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 5020, 2] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [4,5]
value = 5051

[State 5010, 4] ;Freeze anim
type = null;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 5001, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5020,5029]
value = 5020

[State 5001, 2]
type = ChangeAnim
trigger1 = GetHitVar(hittime) < 8
trigger1 = Anim != [5025,5029]
value = anim + 5

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = NotHitBy
trigger1 = HitOver
value = ,AT
time = 6

[State 5011, 7]
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_BACK
type = ChangeAnim
trigger1 = Time = 0
value = 5030

[State 5020, 2] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [4,5]
value = 5051

[State 5020, 3] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 4]
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, 1]
type = NotHitBy
triggerall = !HitFall
trigger1 = Var(20) = 1
value = SCA,AA,AT,AP
time = 1

[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 5030, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

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

[State 5030, 1]
type = NotHitBy
triggerall = !HitFall
trigger1 = Var(20) = 1
value = SCA,AA,AT,AP
time = 1

[State 5030, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

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

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = NotHitBy
triggerall = !HitFall
trigger1 = Var(20) = 1
value = SCA,AA,AT,AP
time = 1

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

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

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

[State 5040, 1]
type = NotHitBy
trigger1 = Var(20) = 1
value = SCA,AA,AT,AP
time = 1

[State 5040, 0]
type = SelfState
trigger1 = PrevStateno != 5040
trigger1 = Time = 0
value = 5040

[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 = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5040, 4]
type = null;ChangeState
trigger1 = alive
trigger1 = Command = "recovery"
value = 5210

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

[State 5050, 1]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != [5090,5091]
value = 5050

[State 5050, 2]
type = ChangeAnim
trigger1 = Anim = [5050,5059]
trigger1 = Vel Y >= IfElse(Anim = 5050, 1, -2)
trigger1 = SelfAnimExist(Anim+10)
value = anim+10
persistent = 0

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

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100

;---------------------------------------------------------------------------
; 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 5070, 3]
type = ForceFeedback
trigger1 = Time = 0
time = 12
waveform = sinesquare
ampl = 140
;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type    = A
movetype= H
physics = N

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

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

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

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

[State 5080, 1] ;Set default anim
type = PosSet
trigger1 = Time = 0
Y = 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]) || Anim = 5161
trigger1 = SelfAnimExist(SysVar(2) + 1)
sysvar(2) = 1

[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 = Time = 0
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 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
var(9) = 1

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

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 5110 ;HIT_LIEDOWN

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

[State 5100, 1]
type = NotHitBy
trigger1 = Var(21) = 1
value = SCA,AA,AT,AP
time = 1

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

[State 5100, shake]
type = EnvShake
trigger1 = Time = 0
time = 5
freq = 120
ampl = 6
phase = -1

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = Vel Y != 0
anim = 10104
pos = -35,5
ownpal = 1
sprpriority = 5

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = Vel Y != 0
anim = 10103
pos = 35,5
ownpal = 1
sprpriority = 5

[State 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = Vel X > 1
x = 1

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

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

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = Time = 0
trigger1 = (Anim != [5051,5059]) && (Anim != [5061,5069]) ;&& Anim != 5091
trigger2 = !SelfAnimExist(5100 + (Anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (Anim = [5051,5059]) || (Anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (Anim % 10))
value = 5100 + (anim % 10)

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 0
trigger1 = Vel Y != 0
value = s6,4

[State 5100, 5]
type = varSet
trigger1 = Time = 0
fvar(12) = Vel X*0.75

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

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

[State 5100, 7]
type = ChangeState
triggerall = Time = 0
trigger1 = Anim = 5101
trigger2 = Anim = 5161
value = 5105

[State 5100, 8]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

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

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

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

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

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1]
type = NotHitBy
trigger1 = var(21) = 1
value = SCA,AA,AT,AP
time = 1

[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 5100, 5]
type = VelSet
trigger1 = Time = 0
x = fvar(12)

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

[State 5101, 4]
type = null;PosSet
trigger1 = Time = 0
y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .5

[State 5101, 6] ;Hit ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5110

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5105]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5105, 1]
type = NotHitBy
trigger1 = Var(21) = 1
value = SCA,AA,AT,AP
time = 1

[State 5105, 1]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 0
trigger1 = Vel Y != 0
value = s6,4

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = Vel Y != 0
anim = 10104
pos = -35,5
ownpal = 1
sprpriority = 5

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = Vel Y != 0
anim = 10103
pos = 35,5
ownpal = 1
sprpriority = 5

[State 5105, 3]
type = Changeanim
trigger1 = Anim != 5161
trigger1 = Time = 6
value = 5161

[State 5105, 3]
type = ChangeState
trigger1 = Anim = 5161
trigger1 = AnimTime = 0
value = 5110

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

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

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 0
trigger1 = Vel Y != 0
value = s6,4

[State 5100, shake]
type = EnvShake
trigger1 = Time = 0
trigger1 = Vel Y != 0
time = 5
freq = 120
ampl = 6
phase = -1

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = PrevStateNo = [5070,5071]
trigger1 = Vel Y != 0
anim = 10104
pos = -35,5
ownpal = 1
sprpriority = 5

[State 5110, exp]
type = Explod
trigger1 = Time = 0
trigger1 = PrevStateNo = [5070,5071]
trigger1 = Vel Y != 0
anim = 10103
pos = 35,5
ownpal = 1
sprpriority = 5

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

[State 5110, 1] ;For hit trip type(from state 5071)
type = ChangeAnim
persistent = 0
trigger1 = Anim = 5070
value = 5170

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = Anim = 5091 || Anim = 5101 || Anim = 5161
trigger2 = Anim = [5081,5089]
trigger2 = Animtime = 0
value = 5110 + (anim % 10)

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = Time = 0
triggerall = Anim != 1251
triggerall = Anim != 5091
triggerall = Anim != 5081
triggerall = Anim != 5101
triggerall = Anim != 5170
triggerall = Anim != [5110,5119] ;Not already changed anim
trigger1 = Anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (Anim % 10))
value = 5110

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = Time = 0
triggerall = Anim != 1251
triggerall = Anim != 5091
triggerall = Anim != 5081
triggerall = Anim != 5101
triggerall = Anim != 5170
triggerall = Anim != [5110,5119] ;Not already changed anim
trigger1 = Anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (Anim % 10))
value = 5110 + (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 = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 5110, 8] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = Anim = [5170,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, 9]
type = ChangeAnim
persistent = 0
triggerall = Anim = 1251 || (Anim = [5111,5119])||(Anim = 5101)
triggerall = Anim != 5113
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5111

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = anim != 1251
triggerall = (Anim != [5111,5119]) || Anim = 5113
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
triggerall = Anim != 5113
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

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

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

[State 5110, 14]
type = ForceFeedback
trigger1 = Alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !Alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5120]
type    = L
movetype= I
physics = N

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = Time = 0
trigger1 = (Anim != [5111,5119]) && Anim != 5950
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]) || Anim = 5950
trigger1 = SelfAnimExist(5120 + (Anim % 10))
value = 5121

[State 5120, 2]
type = changestate;前移動起き上がり
triggerall = Time = [0,1]
triggerall = Anim = 5121 || Anim = 5120
trigger1 = Var(59) = 0
trigger1 = Command = "holdfwd"
value = 5121

[State 5120, 2]
type = changestate;後移動起き上がり
triggerall = Time = [0,1]
triggerall = Anim = 5121 || Anim = 5120
trigger1 = Var(59) = 0
trigger1 = Command = "holdback"
value = 5122

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

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = Var(11) = 0
value = SCA,AA
time = 4

[State 5120, 5]
type = VarSet
trigger1 = Var(11) = 0
var(26) = 3

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = Var(11) = 1
value = SCA,AA
time = 4

[State 5120, 5]
type = VarSet
trigger1 = Var(11) = 1
var(26) = 3

[State 5120, 5] ;Can't be thrown right after getting up
type = VarSet
trigger1 = Time = 0
var(11) = 0

[State 5120, 5] ;Can't be thrown right after getting up
type = VarSet
triggerall = Var(59) = 0
trigger1 = Command = "holddown"
trigger2 = Command = "holdup"
trigger3 = Command = "holdfwd"
trigger4 = Command = "holdback"
trigger5 = Command = "a"
trigger6 = Command = "b"
trigger7 = Command = "c"
trigger8 = Command = "x"
trigger9 = Command = "y"
trigger10= Command = "z"
trigger11= Command = "start"
var(11) = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = VarSet
triggerall = Var(59) > 0
trigger1 = Time = 0
trigger1 = Random <= 1000 - (Var(59) * 90)
var(11) = 1

[State 200, 5]
type = Turn
trigger1 = P2Dist X < 0
trigger1 = AnimTime >= -4
trigger1 = Var(6) != 0

[State 200, 5]
type = ChangeState
trigger1 = AnimTime >= -4
trigger1 = Var(6) != 0
value = var(6)

[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5121]
type    = L
movetype= I
physics = N

[State 5121, 1] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP
time = 4

[State 5121, 2] ;Get up anim (normal)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim = 5120
value = 5122

[State 5121, 3] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim = 5121
value = 5123

[State 5121, 4]
type = VelSet
trigger1 = Time = 0
x = 6
y = -3

[State 5121, 5]
type = VelAdd
trigger1 = Time > 0
trigger1 = Pos Y < 0
y = 0.25

[State 5121, 6]
type = PlayerPush
trigger1 = Time <= 16
value = 0

[State 5121, 7]
type = Turn
trigger1 = Time = 16
trigger1 = P2Dist X < 0

[State 5121, 8]
type = PosSet
trigger1 = Time >= 24
y = 0

[State 5121, 9]
type = VelSet
trigger1 = Time >= 24
x = 0
y = 0

[State 5121, 10]
type = CtrlSet
trigger1 = Time >= 24
value = 1

[State 5121, 11]
type = Turn
trigger1 = Time >= 24
trigger1 = P2Dist X < 0
trigger1 = Var(6) != 0

[State 5121, 12]
type = ChangeState
trigger1 = Time >= 24
trigger1 = Var(6) != 0
value = var(6)

[State 5121, 13]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5122]
type    = L
movetype= I
physics = N

[State 5122, 1] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP
time = 4

[State 5122, 2] ;Get up anim (normal)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim = 5120
value = 5122

[State 5122, 3] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim = 5121
value = 5123

[State 5122, 4]
type = VelSet
trigger1 = Time = 0
x = -6
y = -3

[State 5122, 5]
type = VelAdd
trigger1 = Time > 0
trigger1 = Pos Y < 0
y = 0.25

[State 5122, 6]
type = PlayerPush
trigger1 = Time <= 16
value = 0

[State 5122, 7]
type = Turn
trigger1 = Time = 16
trigger1 = P2Dist X < 0

[State 5122, 8]
type = PosSet
trigger1 = Time >= 24
y = 0

[State 5122, 9]
type = VelSet
trigger1 = Time >= 24
x = 0
y = 0

[State 5122, 10]
type = CtrlSet
trigger1 = Time >= 24
value = 1

[State 5122, 11]
type = Turn
trigger1 = Time >= 24
trigger1 = P2Dist X < 0
trigger1 = Var(6) != 0

[State 5122, 12]
type = ChangeState
trigger1 = Time >= 24
trigger1 = Var(6) != 0
value = var(6)

[State 5122, 13]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -2

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

[State 5150, 2]
type = VelSet
trigger1 = 1
y = 0
x = 0

[State 5150, 3]
type = ChangeAnim
triggerall = Time = 0
trigger1 = Anim != 5101
trigger1 = Anim != 5111
trigger1 = Anim != 5141
trigger1 = Anim != 5161
trigger1 = Anim != [5950,5952]
trigger1 = Anim != [5220,5229]
value = 5140

[State 5150, 4]
type = ChangeAnim
triggerall = Time = 0
trigger1 = Anim != 5140
trigger1 = Anim != [5220,5229]
value = 5141

[State 5150, 5];Drawアニメ
type = ChangeAnim
triggerall = DrawGame
triggerall = RoundState = 4
triggerall = time >= 20
trigger1 = Anim != [5220,5229]
trigger1 = Anim = [5140,5141]
value = ifelse(Anim=5141, 5221, 5220)

[State 5150, 6];敗北アニメ
type = ChangeAnim
triggerall = MatchOver = 0
triggerall = RoundState = 4
triggerall = Time >= 20
trigger1 = Anim != [5220,5229]
trigger1 = Anim = [5140,5141]
value = ifelse(Anim=5141, 5221, 5220)

[State 5150, 7]
type = PlaySnd
trigger1 = Anim = 5220
trigger1 = AnimElem = 29
trigger2 = Anim = 5221
trigger2 = AnimElem = 31
value = s23,5

[State 5150, 8]
type = Turn
triggerall = P2Dist X < 0
trigger1 = Anim = 5220
trigger1 = AnimElem = 26
trigger2 = Anim = 5221
trigger2 = AnimElem = 28

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

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

;---------------------------------------------------------------------------
; 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]
type = Helper
trigger1 = Time = 0
name = "Kagami_Config"
stateno = 50000
id = 50000
pos = 0,0
postype = p1
sprpriority = -7
supermovetime = 999999999
pausemovetime = 999999999

[State 5900, 4] ;Intro for round 1
type = ChangeState
trigger1 = Time = 0
value = 190

;---------------------------------------------------------------------------
[Statedef 5200]
type    = A
movetype= I
physics = N
anim = 5200
velset = -4.5,-6
ctrl = 0

[State 5200, 1] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP
time = 4

[State 5200, 2] ;Get up anim (normal)
type = ChangeAnim
trigger1 = Time = 0
value = 5122

[State 5200, 3]
type = VelSet
trigger1 = Time = 0
x = -6
y = -5

[State 5200, 4]
type = PlayerPush
trigger1 = 1
value = 0

[State 5200, 5]
type = Turn
trigger1 = P2Dist X < 0
trigger1 = Time = 16

[State 5200, 6]
type = VelAdd
trigger1 = 1
y = 0.4

[State 5200, 7]
type = PosSet
trigger1 = AnimTime = 0
y = 0

[State 5200, 8]
type = VelSet
trigger1 = AnimTime = 0
y = 0

[State 5200, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
[Statedef 5201]
type    = A
movetype= I
physics = N
anim = 5200
velset = -4.5,-6
ctrl = 0

[State 5201, 1] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = 1
value = SCA,AA,AP
time = 4

[State 5201, 2] ;Get up anim (normal)
type = ChangeAnim
trigger1 = Time = 0
value = 5122

[State 5201, 3]
type = VelSet
trigger1 = Time = 0
x = -6
y = -5

[State 5201, 4]
type = PlayerPush
trigger1 = 1
value = 0

[State 5201, 5]
type = Turn
trigger1 = P2Dist X < 0
trigger1 = Time = 16

[State 5201, 6]
type = VelAdd
trigger1 = 1
y = 0.4

[State 5201, 7]
type = PosSet
trigger1 = AnimTime = 0
y = 0

[State 5201, 8]
type = VelSet
trigger1 = AnimTime = 0
y = 0

[State 5201, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

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

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

;---------------------------------------------------------------------------
[Statedef 5211]
type    = S
physics = N
ctrl = 0
anim = 47
velset = 0,0

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

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

[State 5211, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
