; System variables usage
; ----------------------
; Var name    Type   Purpose
; --------    ----   -------
; sysvar(0)   Temp   Set by state 5081 (HITL_SLIDE) to 1 to prevent
;                    showing ground hit frame in state 5110 (HIT_LIEDOWN).
;                    Used by guarding states.
; sysvar(1)   Temp   Used by state 40 (Jump Start) amd 45 (Air Jump Start)
;                    to keep track of which way to jump.
;                    Used by state 5100 and 5110 to remember downward
;                    velocity of player just before hitting the ground.
;                    Used in state 5080 for storing the anim # to display.
; sysvar(4)   Perm   Current round state
;                    -1: Next round
;                    -2: Versus screen
;                    -3: Ready...FIGHT!
;                    -4: Match in progress
;                    -5: DOWN...FIGHT!
;                    -6: KO
;                    -7: Winscreen
;                    -8: Round is over
;                    -9: Demo Mode
;                    -10: Training mode
; Var(50)     Perm   Round timer. Starts at 99 and decreases
; Var(51)     Perm   Timer rate: decreases every tick.
; var(52)     Perm   Am I P1 or P2?
; var(53)     Perm   UVVWXYZZ -U: Max life stocks
;                             -VV: Max time (00 = Infinite)
;                             -W: Timer Speed
;                             -X: Life stocks
;                             -Y: Max Power Stocks (0 = 99)
;                             -ZZ: Number of Power stocks
; var(54)     Perm   ---VWXYZ -V: Number of times won w/right super?
;                             -W: Have continued/lost a life?
;                             -X: Is training data menu on? 
;                             -Y: Is training mode menu active?
;                             -Z: Is training mode?
; var(55)     Temp   Type of hit for cornerpush purposes
; var(56)     Temp   Countdown till cornerpush ends
; var(57)     Temp   Apply cornerpush if need be?
; var(58)     Temp   Recoverable life
; var(59)     Temp   Recoverable life timer
;
; slidetime          WWVVVXYZ -WW: Recoverable life damage(guarding)
; fall.recovertime            -VVV: Recoverable life damage
;                             -X: 0 - Ground attack, 1 - Aerial attack
;                             -Y: 0 - Facing left, 1 - Facing right
;                             -Z: Hit strength

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

[State 0, Block]
type = ChangeState
trigger1 = command = "holdback"
trigger1 = InGuardDist
value = 120
ctrl = 1

[State -2]
type = ChangeState
trigger1 = sysvar(4) = 6
value = 180
ctrl = 0

[State 0, -1]
type = ChangeState
trigger1 = Sysvar(4) < 4
value = 6000
ctrl = 0

[State 0, 1]
type = ChangeState
triggerall = command = "holddown"
trigger1 = Time = 0
trigger1 = PrevStateNo = 52
trigger2 = Anim = 47
value = 10
ctrl = 1

[State 0, 1]
type = ChangeAnim
trigger1 = P2Dist X >= 0
trigger1 = Time = 0
trigger1 = PrevStateNo = 52
value = 47

[State 0, 1]
type = ChangeState
trigger1 = command = "holdup"
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 2
value = 40

[State 0, 1]
type = ChangeState
trigger1 = (command = "holdfwd") || (command = "holdback")
trigger1 = (name = "Jedah") || (name = "Dimitri")
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 4
value = 20
ctrl = 1

[State 0, 1]
type = ChangeState
trigger1 = (command = "holdfwd") || (command = "holdback")
trigger1 = (name = "BBH")
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 5
value = 20
ctrl = 1

[State 0, 1]
type = ChangeState
trigger1 = (command = "holdfwd") || (command = "holdback")
trigger1 = (name = "Felicia") || (name = "Q-Bee") || (name = "Talbain") || (name = "Dark Talbain")
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 6
value = 20
ctrl = 1

[State 0, 1]
type = ChangeState
trigger1 = (command = "holdfwd") || (command = "holdback")
trigger1 = (name = "Morrigan") || (name = "Sasquatch") || (name = "Raptor") || (name = "Rikuo") || (name = "Bishamon") || (name = "Victor")
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 7
value = 20
ctrl = 1

[State 0, 1]
type = ChangeState
trigger1 = (command = "holdfwd") || (command = "holdback")
trigger1 = (name = "Hsien-Ko")
trigger1 = PrevStateNo = 52
trigger1 = Anim != [5,6]
trigger1 = Time > 10
value = 20
ctrl = 1

[State 0, 1]
type = CtrlSet
trigger1 = P2Dist X < 0
trigger1 = Anim = 47
trigger2 = Anim = 0
value =  1

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5 && Anim != 47 && Anim != 5040
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
trigger3 = Anim = 47 && AnimTime = 0
value = 0

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

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

[State -2]
type = ChangeState
trigger1 = sysvar(4) = 6
value = 180
ctrl = 0

[State 10, 0]
type = AssertSpecial
trigger1 = Time = 0
flag = NoAutoTurn

[State 10, 3]
type = ChangeState
trigger1 = Time = 0
value = 11

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

[State -2]
type = ChangeState
trigger1 = sysvar(4) = 6
value = 12

[State 12, 1]
type = ChangeAnim
triggerall = Anim = 12
trigger1 = Name = "Felicia"
trigger2 = Name = "Amingo"
trigger3 = Name = "Hsien-Ko"
value = 10
elem = 3 - AnimElemNo(0)

[State 10, 0]
type = ChangeAnim
trigger1 = PrevStateNo = 10
trigger1 = Time = 0
value = 10

[State 10, 0]
type = AssertSpecial
trigger1 = Time = 0
flag = NoAutoTurn

[State 10, 0]
type = AssertSpecial
trigger1 = Time = 0
flag = NoWalk

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

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

[State 12, 0]
type = AssertSpecial
trigger1 = Time = 0
flag = NoWalk

[State 12, 1]
type = ChangeAnim
triggerall = Anim = 10
trigger1 = Name = "Felicia"
trigger2 = Name = "Amingo"
trigger3 = Name = "Hsien-Ko"
value = 12
elem = 3 - AnimElemNo(0)

[State 12, 1]
type = ChangeAnim
trigger1 = Anim !=12
value = 12

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

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

[State -2]
type = ChangeState
trigger1 = sysvar(4) = 6
value = 180
ctrl = 0

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

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

[State 20, 3]
type = ChangeAnim
triggerall = command = "holdfwd"
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimElemNo(0) > 1
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = command = "holdback"
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimElemNo(0) > 1
value = 21

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1
velset = 0,0
facep2 = 1

[State -2]
type = ChangeState
trigger1 = sysvar(4) = 6
value = 180
ctrl = 0

[State 40, 1]
type = VarSet
trigger1 = Time < 2
sysvar(1) = ifelse(command = "holdfwd", 1, ifelse(command = "holdback", -1, 0))

[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 = ifelse(sysvar(1)=0, const(velocity.jump.y), ifelse(sysvar(1)=1, const(velocity.airjump.down.x), const(velocity.airjump.up.x)))

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

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0

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

[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

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

[State 45, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 45, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 2
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 = 2
value = 50
ctrl = 1

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

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

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

[State 50, 3]
type = VelAdd
trigger1 = Time > 0
X = ifelse((vel x)=0, 0, ifelse((vel x)>0, -1*const(velocity.run.up.x), const(velocity.run.up.x)))
Y = const(velocity.run.up.y)

[State 50, 4]
type = ChangeState
trigger1 = Time > 2
trigger1 = Pos Y + Vel Y >= 0
value = 52

;---------------------------------------------------------------------------
; Jump Land
[Statedef 51]
type    = A
physics = N
ctrl = 0

[State 50, 3]
type = VelAdd
trigger1 = Time > 0
X = ifelse((vel x)=0, 0, ifelse((vel x)>0, -1*const(velocity.run.up.x), const(velocity.run.up.x)))
Y = const(velocity.run.up.y)

[State 50, 4]
type = ChangeState
trigger1 = Time > 2
trigger1 = Pos Y + Vel Y >= 0
value = 52

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

[State 50, 1]
type = PlaySnd
trigger1 = Time = 0
value = F47,0

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

[State 52, 5]
type = ChangeState
trigger1 = Time = 0
value = 0
ctrl = 0

;---------------------------------------------------------------------------
; Run forward
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1

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

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

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

;---------------------------------------------------------------------------
; Hop backwards
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = 105
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State 105, 2]
type = CtrlSet
trigger1 = Time = 2
value = 1

[State 105, 3]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 106

;---------------------------------------------------------------------------
; Hop backwards (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 = MakeDust
trigger1 = Time = 2
pos = 0, 0
spacing = 1

[State 106, 4]
type = VelSet
trigger1 = abs(vel x) < Const(movement.stand.friction.threshold)
x = 0

[State 106, 5]
type = ChangeState
trigger1 = Time = 7
value = 0
ctrl = 1

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

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

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

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

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

[State 50, 3]
type = VelAdd
trigger1 = StateType = A
X = ifelse((vel x)=0, 0, ifelse((vel x)>0, -1*const(velocity.run.up.x), const(velocity.run.up.x)))
Y = const(velocity.run.up.y)

[State 50, 4]
type = ChangeState
trigger1 = Time
trigger1 = StateType = A
trigger1 = Pos Y + Vel Y >= 0
value = 52

[State 120, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

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

[State 120, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; 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
trigger1 = command = "holddown"
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; 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
trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; Air guard (guarding)
[Statedef 132]
type    = A
physics = N

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

[State 50, 3]
type = VelAdd
trigger1 = 1
X = ifelse((vel x)=0, 0, ifelse((vel x)>0, -1*const(velocity.run.up.x), const(velocity.run.up.x)))
Y = const(velocity.run.up.y)

[State 50, 4]
type = ChangeState
trigger1 = StateType = A
trigger1 = Pos Y + Vel Y >= 0
value = 52

[State 132, 3]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y + 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
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

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

[State 50, 3]
type = VelAdd
trigger1 = StateType = A
X = ifelse((vel x)=0, 0, ifelse((vel x)>0, -1*const(velocity.run.up.x), const(velocity.run.up.x)))
Y = const(velocity.run.up.y)

[State 50, 4]
type = ChangeState
trigger1 = StateType = A
trigger1 = Pos Y + Vel Y >= 0
value = 52

[State 140, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
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

;---------------------------------------------------------------------------
; Stand guard hit (shaking)
[Statedef 150]
type    = S
movetype= H
physics = N
velset = 0,0
facep2 = 1

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(gethitvar(slidetime)/1000))%10)

[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
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 3

;---------------------------------------------------------------------------
; Stand guard hit (knocked back)
[Statedef 151]
type    = S
movetype= H
physics = N
anim = 150
facep2 = 1

[State 151,0]
type = VarSet
trigger1 = Time = 0
var(59) = 59

;---------------
;Light Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = [0,3]
trigger1 = gethitvar(slidetime)%10 = 1
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 1
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 1
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [8,10]
trigger1 = gethitvar(slidetime)%10 = 1
X = -1

;Medium Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = [1,3]
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 4
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = [5,6]
trigger1 = gethitvar(slidetime)%10 = 2
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 2
X = -2

;Heavy Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 1
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 2
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 3
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 3
X = -8

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 11
trigger1 = gethitvar(slidetime)%10 = 3
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 12
trigger1 = gethitvar(slidetime)%10 = 3
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [13,19]
trigger1 = gethitvar(slidetime)%10 = 3
X = -1
;--------------

[State 151, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 151, 4]
type = ChangeState
trigger1 = HitOver
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; Crouch guard hit (shaking)
[Statedef 152]
type    = C
movetype= H
physics = N
velset = 0,0
facep2 = 1

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(gethitvar(slidetime)/1000))%10)

[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
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 152, 4]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; Crouch guard hit (knocked back)
[Statedef 153]
type    = C
movetype= H
physics = N
anim = 151
facep2 = 1

[State 151,0]
type = VarSet
trigger1 = Time = 0
var(59) = 59

;---------------
;Light Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = [0,3]
trigger1 = gethitvar(slidetime)%10 = 1
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 1
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 1
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [8,10]
trigger1 = gethitvar(slidetime)%10 = 1
X = -1

;Medium Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = [1,3]
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 4
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = [5,6]
trigger1 = gethitvar(slidetime)%10 = 2
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 2
X = -2

;Heavy Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 1
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 2
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 3
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 3
X = -8

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 11
trigger1 = gethitvar(slidetime)%10 = 3
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 12
trigger1 = gethitvar(slidetime)%10 = 3
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [13,19]
trigger1 = gethitvar(slidetime)%10 = 3
X = -1
;--------------

[State 153, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 153, 4]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1

;---------------------------------------------------------------------------
; Air guard hit (shaking)
[Statedef 154]
type    = A
movetype= H
physics = N
velset = 0,0
facep2 = 1

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(abs(gethitvar(xvel))/1000))%10)

[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

;---------------------------------------------------------------------------
; Air guard hit (knocked away)
[Statedef 155]
type    = A
movetype= H
physics = N
anim = 152
facep2 = 1

[State 151,0]
type = VarSet
trigger1 = Time = 0
var(59) = 59

[State 155, 0]
type = VelSet
trigger1 = Time = 0
X = -6
Y = -1

[State 155, 1]
type = VelAdd
trigger1 = Time
Y = 0.40625

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

[State 155, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 155, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 155, 7]
type = ChangeState
trigger1 = Pos Y + Vel Y >= 0
value = 52

;---------------------------------------------------------------------------
; Lose (time over)
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 181, 0]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(6210) = 0
trigger1 = Enemy, NumExplod(6210) = 0
anim = F6210
ID = 6210
postype = left
pos = 192,0
bindtime = -1
ontop = 1
ownpal = 1

[State 170, 1]
type = ChangeState
trigger1 = Life = Enemy, Life
trigger1 = (Floor(Enemy, Var(53)/1000)%10) = (Floor(Var(53)/1000)%10)
value = 175

[State 170, 2]
type = ChangeState
trigger1 = (Floor(Enemy, Var(53)/1000)%10) < (Floor(Var(53)/1000)%10)
trigger2 = (Floor(Enemy, Var(53)/1000)%10) = (Floor(Var(53)/1000)%10)
trigger2 = Life > Enemy, Life
value = 180

[State 170, GTFO]
type = ChangeState
trigger1 = Enemy, StateNo = 6200
trigger1 = Enemy, Time > 99
value = 5150

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

;---------------------------------------------------------------------------
; Draw game (time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 181, 0]
type = Explod
trigger1 = sysvar(0) < 120
trigger1 = NumExplod(6211) = 0
trigger1 = NumExplod(6210) = 0
trigger1 = Enemy, NumExplod(6210) = 0
trigger1 = Enemy, NumExplod(6211) = 0
trigger1 = PrevStateno != 5150
anim = F6211
ID = 6211
postype = left
pos = 192,0
bindtime = -1
ontop = 1
ownpal = 1
persistent = 0

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

[State 175, 0]
type = VarAdd
trigger1 = Enemy, StateNo = 175
sysvar(0) = 1

[State 175, 2]
type = ChangeAnim
trigger1 = SelfAnimExist(175)
trigger1 = Time = 0
trigger1 = PrevStateno != 5150
value = 175

[State 181, 1]
type = ChangeState
trigger1 = sysvar(0) = 280
;trigger2 = AILevel = 0
;trigger2 = Time >= 122
;trigger2 = (command = "x") || (command = "y") || (command = "z") || (command = "a") || (command = "b") || (command = "c")
trigger2 = Enemy, StateNo = 5700
value = 5700;5150

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

;---------------------------------------------------------------------------
; Win state decider
; CNS difficulty: basic
[Statedef 180]
type = S
anim = 0
velset = 0,0

[State 5055, You Win/Lose]
type = Explod
trigger1 = Sysvar(0) = 8
anim = F6202 + (AILevel != 0)
ID = 6202
postype = left
pos = 192,0
ontop = 1
bindtime = -1
;sprpriority = 21

[State 180, 0]
type = VarSet
trigger1 = PrevStateNo != 180
trigger1 = Time = 0
sysvar(0) = 0

[State 180, 0]
type = VarAdd
trigger1 = Enemy, StateNo = 5150
sysvar(0) = 1

[State 180, 1]
type = ChangeState
trigger1 = Sysvar(0) = 9
trigger2 = PrevStateNo = 170
value = 181

;---------------------------------------------------------------------------
; Win pose 1 - Bow
; CNS difficulty: basic
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 5055, You Win/Lose]
type = Explod
trigger1 = Time = 82
trigger1 = Enemy, StateNo = 170
anim = F6202 + (AILevel != 0)
ID = 6202
postype = left
pos = 192,0
ontop = 1
bindtime = -1
;sprpriority = 21

[State 181, 0]
type = RemoveExplod
trigger1 = Time = 188
ID = 6202

[State 181, 0]
type = Explod
trigger1 = Time = 102 + 86*(Enemy, StateNo = 170)
trigger1 = NumExplod(6203) = 0
triggerall = AILevel = 0
anim = F6205 - (Life = LifeMax)
ID = 6203
postype = left
pos = 192,0
bindtime = -1
ontop = 1;sprpriority = 21
removetime = 98

[State 181, 1]
type = ChangeState
trigger1 = Time = 280
trigger2 = AILevel = 0
trigger2 = Time >= 122
trigger2 = (command = "x") || (command = "y") || (command = "z") || (command = "a") || (command = "b") || (command = "c")
value = 6200

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

;---------------------------------------------------------------------------
; Pre-intro
[Statedef 190]
type = S
ctrl = 0
velset = 0,0
anim = 190

[State 190, Facing]
type = VarSet
trigger1 = Time = 0
var(52) = Facing

[State -2, Timer1]
type = Explod
trigger1 = Facing = -1
trigger1 = Time = 171
trigger1 = NumExplod(6020) = 0
ID = 6020
postype = left
trans = addalpha
alpha = 256,128
pos = 192
bindtime = -1
anim = F6020
sprpriority = -91
ownpal = 1
removetime = -1

[State 191, 0]
type = VarSet
trigger1= Time = 170
var(50) = Floor(Var(53)/100000) % 100

[State 191, 0]
type = VarSet
triggerall = Time = 170
trigger1 = Power = PowerMax
trigger1 = Enemy, Power = PowerMax
trigger2 = Floor(Var(53)/100000) % 100 = 0
trigger3 = sysvar(4) = 10
var(50) = 101

[State 191, 0]
type = VarAdd
trigger1= Time = 170
trigger1 = Floor(Var(53)/10000000) % 100 = 0
var(53) = 2000

[State 191, 0]
type = VarSet
trigger1 = Time = 180
var(51) = 109

[State 191, 0]
type = VarSet
trigger1 = Time = 180
trigger1 = sysvar(4) != 9
trigger1 = sysvar(4) != 10
Sysvar(4) = 4

[State 191, 0]
type = VarSet
trigger1 = Power = PowerMax
trigger1 = Enemy, Power = PowerMax
trigger1 = Time = 129
trigger1 = sysvar(4) != 9
sysvar(4) = 10

[State 191, 0]
type = VarSet
trigger1 = sysvar(4) = 10
var(53) = var(53) - (var(53) % 100) + 99

[State 191, READY]
type = PlaySnd
trigger1 = Time = 98
trigger1 = Facing = 1
value = F190, 0

[State 191, READY]
type = Explod
trigger1 = Time = 98
trigger1 = NumExplod(1190) = 0
trigger1 = Facing = 1
anim = F190
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0

[State 191, LIFEBAR]
type = Explod
trigger1 = Time = 120
trigger1 = NumExplod(3033) = 0
anim = F3033
ID = 3033
sprpriority = 17
bindtime = -1
postype = back
pos = 192,0

[State 191, READY]
type = Explod
trigger1 = Time = 101
trigger1 = NumExplod(3032) = 0
trigger1 = Facing = 1
anim = F3032
ID = 3032
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0

[State 191, READY]
type = Explod
trigger1 = Time = 101
trigger1 = NumExplod(9004) = 0
trigger1 = Facing = 1
anim = 9004
ID = 9004
sprpriority = -255
bindtime = -1
postype = back
pos = 136,18

[State 191, READY]
type = Explod
trigger1 = Time = 101
trigger1 = NumExplod(9002) = 0
anim = 9002
ID = 9002
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0

[State 191, READY-CLICK]
type = PlaySnd
trigger1 = Time = 102
trigger1 = Facing = 1
value = F190, 2

[State 191, FIGHT!]
type = PlaySnd
trigger1 = Time = 172
trigger1 = Facing = 1
value = F190, 1

[State 191, FIGHT!]
type = Explod
trigger1 = Time = 172
trigger1 = NumExplod(1191) = 0
trigger1 = Facing = 1
anim = F191
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0

[State 191, 1]
type = ChangeAnim
trigger1 = Anim != 0
trigger1 = AnimTime = 0
value = 0

[State 6100, FLASH_X2]
type = AllPalFX
trigger1 = Time = 180
add = 256,256,256
mul = 256,256,256
time = 1

[State 191,0]
type = AssertSpecial
trigger1 = Time < 130
flag = Nobardisplay

[State 191,0]
type = Explod
trigger1 = Time = 130
trigger1 = NumExplod(180) = 0
trogger1 = Facing = 1
ID = 180
anim = F180
sprpriority = -240
postype = back
pos = 192,0
removetime = -1
bindtime = -1

[State 191,0]
type = Explod
trigger1 = Time = 130
trigger1 = NumExplod(181) = 0
trogger1 = Facing = 1
ID = 181
anim = F181
sprpriority = -240
postype = back
pos = 192,0
removetime = -1
bindtime = -1

[State 191, Life Counters]
type = Explod
trigger1 = (Floor(Var(53)/1000)%10) > 0
trigger1 = time = 130
trigger1 = sysvar(4) != 10
ID = 6800
anim = F6800
postype = back
pos = 20,26
removetime = -1
bindtime = -1

[State 191, Life Counters]
type = Explod
trigger1 = (Floor(Var(53)/1000)%10) > 1
trigger1 = time = 130
trigger1 = sysvar(4) != 10
ID = 6801
anim = F6800
postype = back
pos = 46,26
removetime = -1
bindtime = -1

[State 191, Life Counters]
type = Explod
trigger1 = (Floor(Var(53)/1000)%10) > 2
trigger1 = time = 130
trigger1 = sysvar(4) != 10
ID = 6802
anim = F6800
postype = back
pos = 72,26
removetime = -1
bindtime = -1

[State 191, Life Counters]
type = Explod
trigger1 = (Floor(Var(53)/1000)%10) > 3
trigger1 = time = 130
trigger1 = sysvar(4) != 10
ID = 6803
anim = F6800
postype = back
pos = 98,26
removetime = -1
bindtime = -1

[State 191, FIGHT!]
type = Explod
trigger1 = Time = 116
trigger1 = NumExplod(3030) = 0
trigger1 = Facing = 1
anim = F3030
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0
ontop = 1

[State 191, FIGHT!]
type = Explod
trigger1 = Time = 116
trigger1 = NumExplod(3031) = 0
trigger1 = Facing = 1
anim = F3031
sprpriority = 16
bindtime = -1
postype = back
pos = 192,0
ontop = 1

[State 191, 2]
type = ChangeState
trigger1 = Time = 180
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0
facep2 = (((Floor(gethitvar(slidetime)/100))%10 = 0) && (gethitvar(fall) = 0))
movehitpersist = 1

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(gethitvar(slidetime)/1000))%10)

[State 200, 1]
type = VarSet
trigger1 = PrevStateNo = 200
trigger1 = MoveContact = 1
var(56) = 11
ignorehitpause = 1

[State 200, 1]
type = VarSet
trigger1 = PrevStateNo = 200
trigger1 = MoveContact = 1
var(55) = 1
ignorehitpause = 1

[State 5000, 0]
type = ChangeState
trigger1 = Life = 1
trigger1 = sysvar(4) != 10
value = 5055

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

[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 = Anim < 5030
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, 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

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

[State 5030, 5]
type = ChangeState
triggerall = HitShakeOver
trigger1 = HitFall
trigger2 = HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
trigger3 = !Alive
value = 5050 ;HITA_FALL

[State 5030, 4]
type = ChangeState
triggerall = HitShakeOver
trigger1 = !HitFall
trigger2 = !HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
value = 5040 ;HITA_RECOV

;---------------------------------------------------------------------------
; Stand get-hit (knocked back)
[Statedef 5001]
type    = S
movetype= H
physics = N

;---------------
;Light Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = [0,3]
trigger1 = gethitvar(slidetime)%10 = 1
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10  = 1
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 1
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [8,10]
trigger1 = gethitvar(slidetime)%10 = 1
X = -1

;Medium Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 2
X = -3


[State 5001, 1]
type = PosAdd
trigger1 = Time = [1,3]
trigger1 = gethitvar(slidetime)%10 = 2
X = -4


[State 5001, 1]
type = PosAdd
trigger1 = Time = 4
trigger1 = gethitvar(slidetime)%10 = 2
X = -5


[State 5001, 1]
type = PosAdd
trigger1 = Time = [5,6]
trigger1 = gethitvar(slidetime)%10 = 2
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 2
X = -2

;Heavy Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 1
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 2
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 3
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 3
X = -8

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 11
trigger1 = gethitvar(slidetime)%10 = 3
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 12
trigger1 = gethitvar(slidetime)%10 = 3
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [13,19]
trigger1 = gethitvar(slidetime)%10 = 3
X = -1
;--------------

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

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

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Crouch get-hit (shaking)
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0
facep2 = (((Floor(gethitvar(slidetime)/100))%10 = 0) && (gethitvar(fall) = 0))
movehitpersist = 1

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(gethitvar(slidetime)/1000))%10)

[State 200, 1]
type = VarSet
trigger1 = PrevStateNo = 200
trigger1 = MoveContact = 1
var(56) = 11
ignorehitpause = 1

[State 200, 1]
type = VarSet
trigger1 = PrevStateNo = 200
trigger1 = MoveContact = 1
var(55) = 1
ignorehitpause = 1

[State 5000, 0]
type = ChangeState
trigger1 = Life = 1
trigger1 = sysvar(4) != 10
value = 5055

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

[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 ;Crouch get-hit (knocked back)

[State 5030, 5]
type = ChangeState
triggerall = HitShakeOver
trigger1 = HitFall
trigger2 = HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
trigger3 = !Alive
value = 5050 ;HITA_FALL

[State 5030, 4]
type = ChangeState
triggerall = HitShakeOver
trigger1 = !HitFall
trigger2 = !HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
value = 5040 ;HITA_RECOV

[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

;---------------------------------------------------------------------------
; Crouch get-hit (knocked back)
[Statedef 5011]
type    = C
movetype= H
physics = N

;---------------
;Light Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = [0,3]
trigger1 = gethitvar(slidetime)%10 = 1
X = -4


[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 1
X = -3


[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 1
X = -2


[State 5001, 1]
type = PosAdd
trigger1 = Time = [8,10]
trigger1 = gethitvar(slidetime)%10 = 1
X = -1

;Medium Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 2
X = -3


[State 5001, 1]
type = PosAdd
trigger1 = Time = [1,3]
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 4
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = [5,6]
trigger1 = gethitvar(slidetime)%10 = 2
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 2
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 2
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 2
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 2
X = -2

;Heavy Gethit
[State 5001, 1]
type = PosAdd
trigger1 = Time = 0
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 1
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 2
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 3
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = [4,6]
trigger1 = gethitvar(slidetime)%10 = 3
X = -8

[State 5001, 1]
type = PosAdd
trigger1 = Time = 7
trigger1 = gethitvar(slidetime)%10 = 3
X = -7

[State 5001, 1]
type = PosAdd
trigger1 = Time = 8
trigger1 = gethitvar(slidetime)%10 = 3
X = -6

[State 5001, 1]
type = PosAdd
trigger1 = Time = 9
trigger1 = gethitvar(slidetime)%10 = 3
X = -5

[State 5001, 1]
type = PosAdd
trigger1 = Time = 10
trigger1 = gethitvar(slidetime)%10 = 3
X = -4

[State 5001, 1]
type = PosAdd
trigger1 = Time = 11
trigger1 = gethitvar(slidetime)%10 = 3
X = -3

[State 5001, 1]
type = PosAdd
trigger1 = Time = 12
trigger1 = gethitvar(slidetime)%10 = 3
X = -2

[State 5001, 1]
type = PosAdd
trigger1 = Time = [13,19]
trigger1 = gethitvar(slidetime)%10 = 3
X = -1
;--------------

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

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

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

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Air get-hit (shaking)
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 200, 0]
type = VarSet
trigger1 = Time = 0
var(59) = 58

[State 200, 0]
type = VarAdd
trigger1 = Time = 0
var(58) = -1*((Floor(gethitvar(fall.recovertime)/1000))%10)

[State 5000, 0]
type = ChangeState
trigger1 = Life = 1
trigger1 = sysvar(4) != 10
value = 5055

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

[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 5030, 5]
type = ChangeState
triggerall = HitShakeOver
trigger1 = HitFall
trigger2 = HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
trigger3 = !Alive
value = 5050 ;HITA_FALL

[State 5030, 4]
type = ChangeState
triggerall = HitShakeOver
trigger1 = !HitFall
trigger2 = !HitFall
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y + Vel Y >= 0
value = 5040 ;HITA_RECOV

[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

;---------------------------------------------------------------------------
; Bookkeeping
[Statedef 5030]
type    = A
movetype= H
physics = N

[State 5030, 0]
type = ChangeState
trigger1 = 1
value = 5050

;---------------------------------------------------------------------------
; Air get-hit (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= H
physics = N

[State 5040, 1]
type = VarSet
trigger1 = Time = 0
Sysvar(1) = 0

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050

[State 5040, 2]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != 5040
value = 5040

[State 5040, 4]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5071, 1]
type = VelSet
trigger1 = Time = 0
x = -2.96875
y = -7.53125

[State 5071, 2]
type = VelAdd
trigger1 = Time > 0
x = 0.03125
y = 0.46875

[State 5040, 6]
type = PosSet
trigger1 = Vel Y + Pos Y >= 0
trigger1 = Vel Y > 0
Y = 0

[State 5040, 6]
type = VelSet
trigger1 = Vel Y + Pos Y >= 0
trigger1 = Vel Y > 0
X = 0
Y = 0

[State 5040, 6]
type = VarAdd
trigger1 = Time > 1
trigger1 = Vel Y = 0
Sysvar(1) = 1

[State 5040, 6]
type = ChangeAnim
trigger1 = SysVar(1) = 1
value = 0

[State 5040, 6]
type = ChangeState
trigger1 = SysVar(1) = 2
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Air get-hit (falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

[State 170, 1]
type = NotHitBy
trigger1 = sysvar(4) = 6
value = SCA
time = 1

[State 5050, 1]
type = VarSet
trigger1 = Time = 0
Sysvar(0) = 0

[State 5050, 1]
type = VarSet
;triggerall = Floor(gethitvar(slidetime)/100)% 10 = 0
trigger1 = Floor(gethitvar(slidetime)/10)% 10 = 0
trigger1 = Facing = 1
trigger2 = Floor(gethitvar(slidetime)/10)% 10 = 1
trigger2 = Facing = -1
Sysvar(0) = -1

[State 5050, 1]
type = VarSet
trigger1 = Sysvar(0) != -1
Sysvar(0) = 1

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = Time = 0     ;If no transition anim
trigger1 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5071, 1]
type = VelSet
trigger1 = Time = 0
x = -2.96875*Sysvar(0)
y = -7.53125

[State 5071, 2]
type = VelAdd
trigger1 = Time > 0
x = 0.03125*Sysvar(0)
y = 0.46875

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= Const(movement.air.gethit.groundrecover.ground.threshold)
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;Air get-hit (fall recovery on ground)

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > Const(movement.air.gethit.airrecover.threshold)
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;Air get-hit (fall recovery in air)

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, Const(movement.air.gethit.groundlevel))
value = 5100 ;Downed get-hit (hit ground from fall)

;---------------------------------------------------------------------------
; Falling get-hit (KO)
[Statedef 5055]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5055, 0]
type = RemoveExplod
trigger1 = Time = 0
ID = 6799 + (Floor(Var(53)/1000)%10)

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

[State 5055, 1]
type = ChangeAnim
trigger1 = Time < 7
value = anim
elem = animelemno(0)

[State 5055, KO snd]
type = PlaySnd
triggerall = Time = 2
trigger1 = Enemy, Sysvar(4) < 6
trigger2 = Sysvar(4) = 6
trigger2 = Floor(Enemy, Var(53)/1000)%10 > 0
trigger3 = Sysvar(4) = 6
trigger3 = Floor(Enemy, Var(53)/1000)%10 = 0
trigger3 = Floor(Var(53)/1000)%10 = 0
trigger3 = TeamSide = 1
trigger4 = Enemy, StateNo = 5055
trigger4 = TeamSide = 1
value = F5055,0 + ((Floor(Var(53)/1000)%10) > 0)

[State 5055, 1]
type = VarAdd
trigger1 = Floor(Var(53)/1000)%10 > 0
trigger1 = Time = 0
var(53) = -1000

[State 5055, KO snd]
type = Explod
triggerall = Time = 2
triggerall = Floor(Var(53)/1000)%10 = 0
trigger1 = Floor(Enemy, Var(53)/1000)%10 > 0
anim = F6200
postype = left
pos = 192,0
bindtime = -1
ontop = 1

[State 5055, KO snd]
type = Explod
triggerall = Time = 2
triggerall = Floor(Var(53)/1000)%10 = 0
trigger1 = Floor(Enemy, Var(53)/1000)%10 > 0
anim = F6201
postype = left
pos = 192,0
bindtime = -1
ontop = 1

[State 5055, KO snd]
type = Explod
triggerall = Time = 2
trigger1 = Enemy, Life = 1
trigger1 = Floor(Enemy, Var(53)/1000)%10 = 0
trigger1 = Floor(Var(53)/1000)%10 = 0
anim = F6212
postype = left
pos = 192,0
bindtime = -1
ontop = 1

[State 5055, 1]
type = VarSet
trigger1 = Floor(Var(53)/1000)%10 = 0
sysvar(4) = 6

[State 5055, 1]
type = ChangeAnim
trigger1 = Time = 7
value = 5010

[State 5055, 2]
type = PlaySnd
trigger1 = Time = 38
trigger1 = Floor(Var(53)/1000)%10 = 0
value = 11,1

[State 5055, 1]
type = Helper
trigger1 = Time = 0
stateno = 5056
ID = 5056
name = "Bat"

[State 5055, 2]
type = ChangeState
trigger1 = Time = 38
value = 5050

[Statedef 5056]
type = S
anim = 1

[State 5055]
type = Turn
trigger1 = Time = 0
trigger1 = Parent, Var(52) != Facing

[State 5050, BAT]
type = Explod
trigger1 = Time = 0
anim = F6900
ID = 5056
postype = back
pos = 24+16*(Floor((parent, Var(53))/1000)%10),22
vel = 8.8125,-2.75
accel = -0.1875,0.25
removetime = 35
ontop = 1

[State 5050, BAT]
type = Explod
trigger1 = Time = 35
anim = F6901
ID = 5056
postype = back
pos = 204+16*(Floor((parent, Var(53))/1000)%10),92
vel = -2,4.75
accel = -1,-0.25
removetime = 35
ontop = 1

[State 5050, End]
type = DestroySelf
trigger1 = Time = 36

;---------------------------------------------------------------------------
; Tripped get-hit (shaking)
[Statedef 5070]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5050, 1]
type = VarSet
trigger1 = Time = 0
Sysvar(0) = 0

[State 5050, 1]
type = VarSet
;triggerall = Floor(gethitvar(slidetime)/100)% 10 = 0
trigger1 = Floor(gethitvar(slidetime)/10)% 10 = 0
trigger1 = Facing = 1
trigger2 = Floor(gethitvar(slidetime)/10)% 10 = 1
trigger2 = Facing = -1
Sysvar(0) = -1

[State 5050, 1]
type = VarSet
trigger1 = Sysvar(0) != -1
Sysvar(0) = 1

[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

;---------------------------------------------------------------------------
; Tripped get-hit (knocked away)
[Statedef 5071]
type    = A
movetype= H
physics = N

[State 5071, 1]
type = VelSet
trigger1 = Time = 0
x = -2.96875*Sysvar(0)
y = -7.53125

[State 5071, 2]
type = VelAdd
trigger1 = Time > 0
x = 0.03125*Sysvar(0)
y = 0.46875

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

;---------------------------------------------------------------------------
; Downed get-hit (shaking)
[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 ;Downed get-hit (knocked back)

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;Air get-hit (knocked away)

;---------------------------------------------------------------------------
; Downed get-hit (knocked back)
[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 ;Downed get-hit (lying down)

;---------------------------------------------------------------------------
; Downed get-hit (hit ground from fall)
[Statedef 5100]
type    = L
movetype= H
physics = N
velset = 0,0

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

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

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

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

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > Const720p(20)) + (sysvar(1) > Const720p(56))

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

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

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

;---------------------------------------------------------------------------
; Downed get-hit (bounce off ground)
[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]
type = VelSet
trigger1 = Time = 0
x = -2.625*Sysvar(0)
y = -2.0625

[State 5101, 6] ;Acceleration
type = VelAdd
trigger1 = Time > 0
x = 0.03125*Sysvar(0)
y = 0.375

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

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

[State 5110, ChangeState]
type = ChangeState
trigger1 = Time = 0
value = 5111

[Statedef 5111]
type    = L
movetype= H
physics = N
velset = 0,0

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

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

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

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

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

[State 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, 15]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

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

[State 5110, 14]
type = ChangeState
trigger1 = sysvar(4) > 4
trigger1 = Floor(Var(53)/1000)%10 = 0
value = 5150

[State 5110, 14]
type = ChangeState
trigger1 = Time = 8
value = 5120

;---------------------------------------------------------------------------
; Downed get-hit (getting up)
[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, 0]
type = PlaySnd
trigger1 = Time = 0
trigger1 = Life = 1
trigger1 = sysvar(4) = 4
value = F190,1

[State 5800, FLASH_X2]
type = AllPalFX
trigger1 = Time = 0
trigger2 = Life = 1
add = 256,256,256
mul = 256,256,256
time = 1

[State 5055, 0]
type = Explod
trigger1 = Time = 1
trigger1 = Life = 1
trigger1 = sysvar(4) = 4
anim = F6850 + (var(52) = -1)
postype = left
pos = ifelse(var(52) = 1, 16, 208),0
ontop = 1
ownpal = 1

[State 5120, 7]
type = VarSet
trigger1 = Time = 1
trigger1 = Life = 1
var(58) = 145

[State 5120, 7]
type = LifeSet
trigger1 = Time = 1
trigger1 = Life = 1
value = LifeMax

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

;---------------------------------------------------------------------------
; Downed get-hit (lying defeated)
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3

[State 181, 1]
type = ChangeState
trigger1 = Enemy, StateNo = 5150
trigger2 = Enemy, StateNo = 175
value = 175

[State 5900, 1]
type = ChangeState
trigger1 = Enemy, StateNo = 5700
trigger1 = AILevel = 0
trigger1 = Enemy, AILevel != 0
trigger1 = PrevStateNo != 5700
value = 5700

[State 5150, 1]
type = LifeSet
trigger1 = PrevStateNo = 175
value = 0

[State 5150, 1] ;Normal anim
type = ChangeAnim
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
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
;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
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 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

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

;---------------------------------------------------------------------------
; Air get-hit (fall recovery on ground; 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 >= Const(movement.air.gethit.groundrecover.groundlevel)
value = 5201

;---------------------------------------------------------------------------
; Air get-hit (fall recovery on 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 < Const720p(-20)

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = Const(velocity.air.gethit.groundrecover.x)
y = Const(velocity.air.gethit.groundrecover.y)

[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 = Explod
trigger1 = Time = 0
anim = F60
pos = 0, -floor(vel y)
sprpriority = -10

;---------------------------------------------------------------------------
; Air get-hit (fall recovery in air)
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128

[State 5210, 1]
type = PosFreeze
trigger1 = Time < 4

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < Const720p(-80)

[State 5210, 1.0 behavior 1]
type = VelMul
trigger1 = Time = 4
x = Const(velocity.air.gethit.airrecover.mul.x)
y = Const(velocity.air.gethit.airrecover.mul.y)

[State 5210, 1.0 behavior 2]
type = VelAdd
trigger1 = Time = 4
x = Const(velocity.air.gethit.airrecover.add.x)
y = Const(velocity.air.gethit.airrecover.add.y)

[State 5210, 2002.04.14 behavior 1]
type = null;VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 2002.04.14 behavior 2]
type = null;VelAdd
trigger1 = Time = 4
x = 0 
y = -4.5

[State 5210, 2002.04.14 behavior 3]
type = null;VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 2002.04.14 behavior 4]
type = null;VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 2002.04.14 behavior 5]
type = null;VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = Const(velocity.air.gethit.airrecover.up)

[State 5210, 2] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = Const(velocity.air.gethit.airrecover.down)

[State 5210, 2] ;Go fwd
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = Const(velocity.air.gethit.airrecover.fwd)

[State 5210, 2] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = Const(velocity.air.gethit.airrecover.back)

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd
trigger1 = Time >= 4
y = Const(movement.air.gethit.airrecover.yaccel)

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;Jump land
ctrl = 1

;---------------------------------------------------------------------------
; Core system helper/spawn point
[Statedef 5500]
type = S
ctrl = 0
anim = 1
velset = 0,0

;----------------
;Training Menu
[State 5500, 1]
type = Explod
trigger1 = NumExplod(7000) = 0
trigger1 = Parent, Sysvar(4) = 10
trigger1 = Facing = 1
ID = 7000
postype = back
pos = 200,12
anim = F7000
sprpriority = -21
removetime = -1
bindtime = -1

[State 5500, 1]
type = Explod
trigger1 = NumExplod(7001) = 0
trigger1 = Parent, Sysvar(4) = 10
trigger1 = Facing = 1
ID = 7001
postype = back
pos = 200,12
anim = F7001
sprpriority = -20
removetime = -1
bindtime = -1

;----------------
;Power management
[State -2, 0]
type = RemoveExplod
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 < 99
trigger2 = Parent, sysvar(4) = 7
ID = 6500
ignorehitpause = 1
[State -2, 0]
type = RemoveExplod
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 < 99
trigger2 = Parent, var(53) % 100 < 10
trigger3 = Parent, sysvar(4) = 7
ID = 6501
ignorehitpause = 1
[State -2, 0]
type = RemoveExplod
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 < 99
trigger2 = Parent, var(53) % 100 < 10
trigger3 = Parent, sysvar(4) = 7
ID = 6502
ignorehitpause = 1

[State -2, 0]
type = ParentVarAdd
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 < 99
v = 53
value = 1
ignorehitpause = 1

[State -2, 0]
type = PowerAdd
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 < 99
trigger1 = (Parent, sysvar(4) = [4,6]) || ((Parent, StateNo = 190) && (Parent, Time > 129) && (Parent, sysvar(4) != 10))
value = -144
ignorehitpause = 1

[State -2, 0]
type = PowerSet
trigger1 = Parent, Power > 144
trigger1 = Parent, var(53) % 100 = 99
trigger1 = (Parent, sysvar(4) = [4,6]) || ((Parent, StateNo = 190) && (Parent, Time > 129) && (Parent, sysvar(4) != 10))
value = 144
ignorehitpause = 1

[State -2, 0]
type = Explod
trigger1 = NumExplod(6500) = 0
trigger1 = (Parent, sysvar(4) = [4,6]) || (Parent, sysvar(4) = 10) || ((Parent, StateNo = 190) && (Parent, Time > 129))
trigger1 = Parent, var(53) % 100 < 10
trigger1 = Parent, sysvar(4) != [7,9]
anim = F6500 + (Parent, var(53) % 10)
ID = 6500
postype = back
pos = 14 + 11*(Facing = -1),206
ontop = 1
facing = Facing
bindtime = -1
removetime = -1
ignorehitpause = 1

[State -2, 0]
type = Explod
trigger1 = NumExplod(6501) = 0
trigger1 = (Parent, sysvar(4) = [4,6]) || (Parent, sysvar(4) = 10) || ((Parent, StateNo = 190) && (Parent, Time > 129))
trigger1 = Parent, var(53) % 100 > 9
trigger1 = Parent, sysvar(4) != [7,9]
anim = F6500 + (Parent, var(53) % 10)
postype = back
pos = 18 + 11*(Facing = -1),206
ID = 6501
ontop = 1
facing = Facing
bindtime = -1
removetime = -1
ignorehitpause = 1

[State -2, 0]
type = Explod
trigger1 = NumExplod(6502) = 0
trigger1 = (Parent, sysvar(4) = [4,6]) || (Parent, sysvar(4) = 10) || ((Parent, StateNo = 190) && (Parent, Time > 129))
trigger1 = Parent, var(53) % 100 > 9
trigger1 = Parent, sysvar(4) != [7,9]
anim = F6500 + (Floor(Parent, var(53)/10) % 10)
postype = back
pos = 7 + 11*(Facing = -1),206
ID = 6502
ontop = 1
facing = Facing
bindtime = -1
removetime = -1
ignorehitpause = 1
;----------------

[State 5500, 1]
type = StopSnd
trigger1 = Parent, StateNo = 6200
trigger1 = Parent, Time > 30
trigger2 = Enemy, StateNo = 6200
trigger2 = Enemy, Time > 30
trigger3 = Parent, StateNo = 5700
trigger4 = Enemy, StateNo = 5700
channel = 3

;---------------------------------------------------------------------------
; Continue?
[Statedef 5700]
StateType = S
ctrl = 0

[State 5700, 1]
type = Varset
trigger1 = Time = 0
sysvar(1) = 10

[State 5700, 1]
type = Varset
triggerall = sysvar(1) != 0
trigger1 = Time = 0
sysvar(0) = 200

[State 5700, 2]
type = Varadd
trigger1 = Time >= 31
trigger1 = sysvar(1) != 0
sysvar(0) = -1

[State 5700, 1]
type = Varset
triggerall = Time > 40
triggerall = sysvar(1) != 0
triggerall = AILevel = 0
trigger1 = (command = "x") || (command = "y") || (command = "z") || (command = "a") || (command = "b") || (command = "c")
trigger2 = (Enemy, command = "x") || (Enemy, command = "y") || (Enemy, command = "z") || (Enemy, command = "a") || (Enemy, command = "b") || (Enemy, command = "c")
trigger2 = Enemy, AILevel = 0
sysvar(0) = 0

[State 5700, 3]
type = Varadd
trigger1 = sysvar(0) = 0
trigger1 = sysvar(1) > 0
sysvar(1) = -1

[State 5700, 1]
type = Varset
triggerall = sysvar(1) != 0
trigger1 = sysvar(0) = 0
sysvar(0) = 200

[State 5900, FADE_TO_BLACK]
type = Explod
trigger1 = PrevStateNo = 175
trigger1 = Time = 4
trigger2 = PrevStateNo != 175
trigger2 = Time = 0
anim = F3019
pos = 192,0
ID = 5807
postype = left
removetime = ifelse(PrevStateNo = 175, 40, -1)
sprpriority = 16

[State 5900, FADE_FROM_RED]
type = Explod
triggerall = PrevStateNo = 175
trigger1 = Time = 30
anim = F3021
pos = 192,0
postype = left
sprpriority = 18
ontop = 1

[State 6100, FLASH_X2]
type = AllPalFX
triggerall = PrevStateNo = 175
trigger1 = Time = 24
trigger2 = Time = 22
add = 256,256,256
mul = 256,256,256
time = 1

[State 6100, BANNER1]
type = Explod
triggerall = PrevStateNo = 175
trigger1 = Time = 0
anim = F195
bindtime = -1
pos = 192,0
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER1]
type = Explod
triggerall = PrevStateNo = 175
trigger1 = Time = 0
anim = F195
bindtime = -1
facing = -1
pos = 192,112
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER2]
type = Explod
triggerall = PrevStateNo = 175
trigger1 = Time = 31
anim = F196
bindtime = -1
pos = 192,112
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER2]
type = Explod
triggerall = PrevStateNo = 175
trigger1 = Time = 31
anim = F196
bindtime = -1
facing = -1
pos = 192,0
postype = left
sprpriority = 17
ontop = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
trigger1 = Time > 31
trigger1 = PrevStateNo = 175
anim = F5800
ID = 5800
bindtime = -1
pos = 192,0
postype = left
sprpriority = 13
removetime = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
trigger1 = Time > 31
trigger1 = PrevStateNo = 175
anim = F5810 + sysvar(1) -1
bindtime = -1
ID = 5801
pos = 276,104 + ifelse(Time < 30, 60 - Time*2, 0)
scale = ifelse(sysvar(1) = 10, 1, ifelse(sysvar(0) > 175, .04*(25 - (sysvar(0) - 176)), 1)), ifelse(sysvar(1) = 10, 1, ifelse(sysvar(0) > 175, .04*(25 - (sysvar(0) - 176)), 1))
postype = left
sprpriority = 13
removetime = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
trigger1 = PrevStateNo != 175
anim = F5800
ID = 5800
bindtime = -1
pos = 192,0 + ifelse(Time < 30, 90 - Time*3, 0)
postype = left
sprpriority = 20
removetime = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
trigger1 = PrevStateNo != 175
anim = F5810 + sysvar(1) -1
bindtime = -1
ID = 5801
pos = 276,104 + ifelse(Time < 30, 90 - Time*3, 0)
postype = left
scale = ifelse(sysvar(1) = 10, 1, ifelse(sysvar(0) > 175, .04*(25 - (sysvar(0) - 176)), 1)), ifelse(sysvar(1) = 10, 1, ifelse(sysvar(0) > 175, .04*(25 - (sysvar(0) - 176)), 1))
sprpriority = 20
removetime = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
trigger1 = Time = 31
anim = F3000
ID = 5802
bindtime = -1
pos = 192,0
postype = left
sprpriority = 12
removetime = -1

[State 6100, NoLifeBar]
type = AssertSpecial
trigger1 = 1
flag = NoBarDisplay

[State 5055, 1]
type = VarSet
trigger1 = 1
sysvar(4) = 7

[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6800)
ID = 6800
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6801)
ID = 6801
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6802)
ID = 6802
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6803)
ID = 6803
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(180)
ID = 180
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(181)
ID = 181
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(9004)
ID = 9004
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(6020)
ID = 6020
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(180)
ID = 180
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(181)
ID = 181
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(9004)
ID = 9004
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6203)
ID = 6203

[State 5500, 1]
type = VarSet
trigger1 = Sysvar(0) < 0
sysvar(0) = 0

[State 5500, 1]
type = LifeSet
trigger1 = AILevel = 0
trigger1 = Sysvar(1) = 0
value = 0

[State 5500, 1]
type = CtrlSet
trigger1 = Enemy, Life = 0
value = 1

[State 5500, 1]
type = ChangeState
trigger1 = command = "start"
trigger1 = AILevel = 0
trigger2 = Enemy, AILevel = 0
trigger2 = Enemy, command = "start"
value = 5800

[State 5500, 1]
type = ChangeState
trigger1 = Life = 0
trigger1 = AILevel = 0
value = 5150

[State 5700, 1]
type = StopSnd
trigger1 = Time = 0
channel = 0

[State 5700, 1]
type = AssertSpecial
trigger1 = 1
flag = NoFG

[State 5700, 1]
type = PlaySnd
triggerall = Time = (31 - 31*(PrevStateNo != 175))
trigger1 = Enemy, StateNo != 5700
trigger2 = Enemy, StateNo = 5700
trigger2 = TeamSide = 1
value = F5700, 0
loop = 1
persistent = 0
channel = 0

;---------------------------------------------------------------------------
; Restart round
[Statedef 5800]
type = S
ctrl = 0
velset = 0,0

[State 5800, FLASH_X2]
type = AllPalFX
trigger1 = Time = 0
trigger2 = Time = 2
add = 256,256,256
mul = 256,256,256
time = 1

[State 5800, YAY!]
type = PlaySnd
trigger1 = AILevel = 0
trigger1 = Time = 15
value = 11,2

[State 5900, 1]
type = LifeSet
trigger1 = Time = 0
value = LifeMax

[State 5900, 1]
type = PowerSet
trigger1 = Time = 0
value = 0

[State 5700, 1]
type = StopSnd
trigger1 = Time = 0
channel = 0

[State 6100, BG]
type = Explod
trigger1 = 1
anim = F5800
ID = 5800
bindtime = -1
pos = 192,0
postype = left
sprpriority = 20
removetime = 1

[State 6100, BG]
type = Explod
trigger1 = AILevel = 0
anim = F5810 + sysvar(1) -1
bindtime = -1
ID = 5801
pos = 276,104
postype = left
sprpriority = 20
removetime = 1

[State 6100, NoLifeBar]
type = AssertSpecial
trigger1 = 1
flag = NoBarDisplay

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

[State 5800, 1]
type = VarAdd
trigger1 = Time
trigger1 = Enemy, StateNo = 5800
sysvar(0) = 1

[State 5900, 0]
type = PlayerPush
trigger1 = 1
value = 0

[State 5900, 1]
type = Turn
trigger1 = Time = 0
trigger1 = NumHelper(5500)
trigger1 = Facing != (Helper(5500), Facing)

[State 5900, 0]
type = Width
trigger1 = Facing = -1
trigger1 = Pos X > 88
trigger2 = Facing = 1
trigger2 = Pos X < -88
value = 0, 16 + const(size.ground.back) + (abs(pos x) - 88)

[State 5900, 1]
type = PosAdd
trigger1 = NumHelper(5500)
trigger1 = (Helper(5500), parentdist x) != 0
X = -1*(Helper(5500), parentdist x)
Y = 0

[State 5500, 1] ;Use continue animation if available
type = ChangeState
trigger1 = sysvar(0) = 40
trigger2 = Enemy, sysvar(0) = 40
value = 5900

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5700, 1]
type = Varset
trigger1 = Time = 0
var(58) = Life

[State 6100, NoLifeBar]
type = AssertSpecial
trigger1 = 1
flag = NoBarDisplay

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5800

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5801

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5807

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5806

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5805

[State 5900, X]
Type = RemoveExplod
trigger1 = Time = 0
ID = 5802

[State 5900, 1]
type = PosAdd
trigger1 = NumHelper(5500)
trigger1 = (Helper(5500), parentdist x) != 0
X = Pos X - Helper(5500), parentdist x
Y = 0

[State 5900, 1]
type = PowerSet
trigger1 = Time = 0
trigger1 = TeamMode != Turns
value = 0

[State 5900, 1]
type = varset
trigger1 = NumHelper(5500)
trigger1 = Time = 0
sysvar(4) = 0

;-----------------------
;Mode set

[State 5900, COnfig]
type = VarSet
trigger1 = Time = 0
var(53) = 29902000

[State 5900, Demo Mode?]
type = VarSet
trigger1 = roundno = 1
trigger1 = AILevel != 0
trigger1 = Enemy, AILevel != 0
Sysvar(4) = 9

[State 5900, Versus human?]
type = VarSet
trigger1 = roundno = 1
trigger1 = AILevel = 0
trigger1 = Enemy, AILevel = 0
Sysvar(4) = 2

;-----------------------
[State 5900, PRESS START BUTTON]
type = Explod
trigger1 = SysVar(4) = 9
trigger1 = Facing = 1
trigger1 = NumExplod(2010) = 0
ontop = 1
ID = 2010
anim = F2010
pos = 192,0
postype = back
removetime = -1
bindtime = -1

[State 5900, Versus CPU?]
type = VarSet
triggerall = roundno = 1
trigger1 = sysvar(4) = 0
Sysvar(4) = 1

[State 5900, 4] ;Intro for demo
type = ChangeState
trigger1 = SysVar(4) = 9
value = 0

[State 5900, 5] ;All other rounds
type = ChangeState
trigger1 = Sysvar(4) = 1
value = 6000

[State 5900, 5] ;All other rounds
type = ChangeState
trigger1 = Sysvar(4) = 2
value = 6100

;---------------------------------------------------------------------------
; VERSUS! I
[Statedef 6000]
type = S
anim = 1
ctrl = 0

[State 5900, 1]
type = AssertSpecial
trigger1 = 1
flag = NoFG
flag2 = NoWalk
flag3 = Nobardisplay

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1000) = 0
trigger1 = AILevel = 0
sprpriority = 15
ID = 1000
anim = 0 + 2*(MatchNo = 1)
pos = 64,208
postype = back
removetime = -1
bindtime = -1

;----
[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Felicia"
sprpriority = 16
ID = 1001
anim = F4000
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Demitri"
sprpriority = 16
ID = 1001
anim = F4001
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Victor"
sprpriority = 16
ID = 1001
anim = F4002
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Jedah"
sprpriority = 16
ID = 1001
anim = F4003
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Talbain"
sprpriority = 16
ID = 1001
anim = F4004
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Raptor"
sprpriority = 16
ID = 1001
anim = F4005
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Sasquatch"
sprpriority = 16
ID = 1001
anim = F4006
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Hsien-Ko"
sprpriority = 16
ID = 1001
anim = F4007
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Q-Bee"
sprpriority = 16
ID = 1001
anim = F4008
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "BBH"
sprpriority = 16
ID = 1001
anim = F4009
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Anakaris"
sprpriority = 16
ID = 1001
anim = F4010
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Bishamon"
sprpriority = 16
ID = 1001
anim = F4011
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Lilith"
sprpriority = 16
ID = 1001
anim = F4012
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Rikuo"
sprpriority = 16
ID = 1001
anim = F4013
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Rikuo"
sprpriority = 16
ID = 1001
anim = F4014
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Huitzil"
sprpriority = 16
ID = 1001
anim = F4015
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Talbain"
sprpriority = 16
ID = 1001
anim = F4016
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Pyron"
sprpriority = 16
ID = 1001
anim = F4017
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Hsien-Ko"
sprpriority = 16
ID = 1001
anim = F4018
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Donovan"
sprpriority = 16
ID = 1001
anim = F4019
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "BBH"
sprpriority = 16
ID = 1001
anim = F4020
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Huitzil"
sprpriority = 16
ID = 1001
anim = F4021
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Raptor"
sprpriority = 16
ID = 1001
anim = F4022
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Morrigan"
sprpriority = 16
ID = 1001
anim = F4023
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Amingo"
sprpriority = 16
ID = 1001
anim = F4024
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Wraith"
sprpriority = 16
ID = 1001
anim = F4025
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(1001) = 0
trigger1 = AILevel = 0
trigger1 = Name = "Crystal"
sprpriority = 16
ID = 1001
anim = F4026
pos = 64,208
postype = back
facing = facing
removetime = -1
bindtime = -1
;----

[State 5900, RED BG]
type = Explod
trigger1 = Time = 5
trigger1 = NumExplod(3015) = 0
trigger1 = Facing = 1
sprpriority = 12
ID = 3015
anim = F3015
pos = 192,0
postype = back
removetime = -1
bindtime = -1

[State 5900, RED BG ALPHA]
type = Explod
trigger1 = Time = 5
trigger1 = NumExplod(3017) = 0
trigger1 = Facing = 1
sprpriority = 11
ID = 3017
anim = F3017
pos = 192,0
postype = back
bindtime = -1

[State 5900, RED BG]
type = Explod
trigger1 = Time = 5
trigger1 = NumExplod(3016) = 0
trigger1 = Facing = 1
sprpriority = 12
ID = 3016
anim = F3015
pos = 192,223
postype = back
removetime = -1
bindtime = -1
vfacing = -1
facing = -1

[State 5900, RED BG ALPHA]
type = Explod
trigger1 = Time = 5
trigger1 = NumExplod(3018) = 0
trigger1 = Facing = 1
sprpriority = 11
ID = 3018
anim = F3017
pos = 192,223
postype = back
bindtime = -1
vfacing = -1
facing = -1

[State 5900, VS BG]
type = Explod
trigger1 = Time = 64
trigger1 = NumExplod(3001) = 0
trigger1 = Facing = 1
sprpriority = 10
ID = 3001
anim = F3001
pos = 192,0
postype = back
removetime = -1
bindtime = -1

[State 5900, NEXT MATCH FACE BG]
type = Explod
trigger1 = Time = 64
trigger1 = NumExplod(3002) = 0
trigger1 = AILevel != 0
trigger1 = Facing = 1
sprpriority = 10
ID = 3002
anim = 9003
pos = 123,56
postype = back
removetime = -1
bindtime = -1
[State 5900, NEXT MATCH FACE BG]
type = Explod
trigger1 = Time = 64
trigger1 = NumExplod(3002) = 0
trigger1 = AILevel != 0
trigger1 = Facing = -1
sprpriority = 10
ID = 3002
anim = 9003
pos = 123,56
postype = front
removetime = -1
bindtime = -1
[State 5900, NEXT MATCH FACE NAME]
type = Explod
trigger1 = Time = 64
trigger1 = NumExplod(3003) = 0
trigger1 = AILevel != 0
trigger1 = Facing = 1
sprpriority = 12
ID = 3003
anim = 9005
pos = 123,56
postype = back
removetime = -1
bindtime = -1
[State 5900, NEXT MATCH FACE NAME]
type = Explod
trigger1 = Time = 64
trigger1 = NumExplod(3003) = 0
trigger1 = AILevel != 0
trigger1 = Facing = -1
sprpriority = 12
ID = 3003
anim = 9005
pos = 123,56
postype = front
removetime = -1
bindtime = -1

[State 5900, 1]
type = VarSet
triggerall = Time >= 3
triggerall = AILevel = 0
trigger1 = command = "start"
trigger2 = command = "x"
trigger3 = command = "y"
trigger4 = command = "z"
trigger5 = command = "a"
trigger6 = command = "b"
trigger7 = command = "c"
Sysvar(4) = 2

[State 5900, VS BG]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(3000) = 0
trigger1 = Facing = 1
sprpriority = 9
ID = 3000
anim = F3000
pos = 192,0
postype = back
removetime = -1
bindtime = -1

[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 1000
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 1001
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3001
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3002
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3003
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3015
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3016
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
trigger9 = enemy, 
ID = 3017
[State 6100, 0]
type = RemoveExplod
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
ID = 3018

[State 6100, 0]
type = ChangeState
trigger1 = Time = 184
trigger2 = Sysvar(4) = 2
trigger3 = Enemy, Sysvar(4) = 2
value = 6100

[State 5900, 0]
type = PlaySnd
trigger1 = Time = 0
value = F6000, (MatchNo = 1)
channel = 0
loop = 1

;---------------------------------------------------------------------------
; VERSUS! II
[Statedef 6100]
type = S
anim = 1
ctrl = 0

[State 5900, Timer]
type = VarSet
trigger1 = Time = 0
Sysvar(3) = 0

[State 5900, Timer]
type = VarAdd
trigger1 = 1
Sysvar(3) = 1

[State 5900, RED BG]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(3015) = 0
trigger1 = Facing = 1
sprpriority = 12
ID = 3015
anim = F3018
pos = 192,0
postype = back
bindtime = -1

[State 5900, RED BG]
type = Explod
trigger1 = Time = 0
trigger1 = NumExplod(3016) = 0
trigger1 = Facing = 1
sprpriority = 12
ID = 3016
anim = F3018
pos = 192,223
postype = back
bindtime = -1
vfacing = -1
facing = -1

[State 5900, 0]
type = PlaySnd
trigger1 = SysVar(3) = 1
value = F6010, 0
channel = 0

[State 5900, 1]
type = VarSet
trigger1 = Time = 0
Sysvar(4) = 2

[State 5900, 1]
type = AssertSpecial
trigger1 = SysVar(3) < 228
flag = NoFG
flag2 = NoWalk

[State 5900, 1]
type = AssertSpecial
trigger1 = 1
flag = Nobardisplay

[State 5900, Portrait]
type = Explod
trigger1 = SysVar(3) = 9
trigger1 = NumExplod(9001) = 0
sprpriority = 10
ID = 9001
anim = 9001
pos = 32,32
postype = back
removetime = -1

;----
[State 5900, Portrait]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Felicia"
sprpriority = 11
ID = 9002
anim = F4000
pos = 96,184
postype = back
facing = Facing
removetime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Demitri"
sprpriority = 11
ID = 9002
anim = F4001
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Victor"
sprpriority = 11
ID = 9002
anim = F4002
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Jedah"
sprpriority = 11
ID = 9002
anim = F4003
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Talbain"
sprpriority = 11
ID = 9002
anim = F4004
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Raptor"
sprpriority = 11
ID = 9002
anim = F4005
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Sasquatch"
sprpriority = 11
ID = 9002
anim = F4006
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Hsien-Ko"
sprpriority = 11
ID = 9002
anim = F4007
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Q-Bee"
sprpriority = 11
ID = 9002
anim = F4008
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "BBH"
sprpriority = 11
ID = 9002
anim = F4009
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Anakaris"
sprpriority = 11
ID = 9002
anim = F4010
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Bishamon"
sprpriority = 11
ID = 9002
anim = F4011
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Lilith"
sprpriority = 11
ID = 9002
anim = F4012
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Rikuo"
sprpriority = 11
ID = 9002
anim = F4013
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Rikuo"
sprpriority = 11
ID = 9002
anim = F4014
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Huitzil"
sprpriority = 11
ID = 9002
anim = F4015
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Talbain"
sprpriority = 11
ID = 9002
anim = F4016
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Pyron"
sprpriority = 11
ID = 9002
anim = F4017
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Hsien-Ko"
sprpriority = 11
ID = 9002
anim = F4018
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Donovan"
sprpriority = 11
ID = 9002
anim = F4019
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "BBH"
sprpriority = 11
ID = 9002
anim = F4020
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Huitzil"
sprpriority = 11
ID = 9002
anim = F4021
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Null;Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Raptor"
sprpriority = 11
ID = 9002
anim = F4022
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Morrigan"
sprpriority = 11
ID = 9002
anim = F4023
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Amingo"
sprpriority = 11
ID = 9002
anim = F4024
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Wraith"
sprpriority = 11
ID = 9002
anim = F4025
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1

[State 5900, P1/P2]
type = Explod
trigger1 = SysVar(3) = 64
trigger1 = NumExplod(9002) = 0
trigger1 = Name = "Crystal"
sprpriority = 11
ID = 9002
anim = F4026
pos = 96,184
postype = back
facing = facing
removetime = -1
bindtime = -1
;----

[State 5900, VS BG]
type = Explod
trigger1 = Time = 0
trigger1 = Facing = 1
trigger1 = NumExplod(3000) = 0
sprpriority = 9
ID = 3000
anim = F3000
pos = 192,0
postype = back
removetime = -1
bindtime = -1

[State 5900, VS BG]
type = Explod
trigger1 = Time = 0
trigger1 = Facing = 1
trigger1 = NumExplod(3020) = 0
sprpriority = 10
ID = 3020
anim = F3020
pos = 192,0
postype = back
bindtime = -1

[State 5900, V]
type = Explod
trigger1 = Time = [30,49]
trigger1 = Facing = 1
ID = 3010
anim = F3010
pos = 192,112
postype = back
scale = .05*(Time - 29),.05*(Time - 29)
removetime = 1
bindtime = -1
sprpriority = 15

[State 5900, S]
type = Explod
trigger1 = Time = [30,49]
trigger1 = Facing = 1
ID = 3011
anim = F3011
pos = 192,112
postype = back
scale = .05*(Time - 29),.05*(Time - 29)
removetime = 1
bindtime = -1
sprpriority = 15

[State 5900, V]
type = Explod
trigger1 = SysVar(3) = 50
trigger1 = Facing = 1
ID = 3010
anim = F3010
pos = 192,112
postype = back
removetime = 130
bindtime = -1
sprpriority = 15

[State 5900, S]
type = Explod
trigger1 = SysVar(3) = 50
trigger1 = Facing = 1
ID = 3011
anim = F3011
pos = 192,112
postype = back
removetime = 130
bindtime = -1
sprpriority = 15

[State 5900, V]
type = Explod
trigger1 = SysVar(3) = 180
trigger1 = Facing = 1
ID = 3010
anim = F3010
pos = 192,112
postype = back
removetime = 20
vel = -12,0
sprpriority = 15

[State 5900, S]
type = Explod
trigger1 = SysVar(3) = 180
trigger1 = Facing = 1
ID = 3011
anim = F3011
pos = 192,112
postype = back
removetime = 20
vel = 12,0
sprpriority = 15

[State 5900, FADE_TO_BLACK]
type = Explod
trigger1 = SysVar(3) = 203
trigger1 = Facing = 1
ID = 3019
anim = F3019
pos = 192,0
postype = back
removetime = -1
sprpriority = 16

[State 5900, FADE_FROM_RED]
type = Explod
trigger1 = SysVar(3) = 229
trigger1 = Facing = 1
anim = F3021
pos = 192,0
postype = back
sprpriority = 18
ontop = 1

[State 6100, FLASH_X2]
type = AllPalFX
triggerall = Facing = 1
trigger1 = SysVar(3) = 223
trigger2 = SysVar(3) = 221
add = 256,256,256
mul = 256,256,256
time = 1

[State 6100, BANNER1]
type = Explod
trigger1 = Facing = 1
trigger1 = SysVar(3) = 199
anim = F195
bindtime = -1
pos = 192,0
postype = back
sprpriority = 18
ontop = 1

[State 6100, BANNER1]
type = Explod
trigger1 = Facing = 1
trigger1 = SysVar(3) = 199
anim = F195
bindtime = -1
facing = -1
pos = 192,112
postype = back
sprpriority = 18
ontop = 1

[State 6100, BANNER2]
type = Explod
trigger1 = Facing = 1
trigger1 = SysVar(3) = 230
anim = F196
bindtime = -1
pos = 192,112
postype = back
sprpriority = 18
ontop = 1

[State 6100, BANNER2]
type = Explod
trigger1 = Facing = 1
trigger1 = SysVar(3) = 230
anim = F196
bindtime = -1
facing = -1
pos = 192,0
postype = back
sprpriority = 18
ontop = 1

[State 6100, 0]
type = VarSet
trigger1 = SysVar(3) = 280
Sysvar(4) = 3

[State 6100, 0]
type = RemoveExplod
trigger1 = SysVar(3) = 228
ID = 3000
[State 6100, 0]
type = RemoveExplod
trigger1 = SysVar(3) = 228
ID = 3019
[State 6100, 0]
type = RemoveExplod
trigger1 = SysVar(3) = 228
ID = 9001
[State 6100, 0]
type = RemoveExplod
trigger1 = SysVar(3) = 228
ID = 9002

[State 5900, 3] ;Create spawn point!
type = Helper
trigger1 = SysVar(3) = 226
trigger1 = NumHelper(5500) = 0
ID = 5500
stateno = 5500
name = "spawn_point"
pausemovetime = 999999
ownpal = 1
supermovetime = 999999

[State 6100, 0]
type = ChangeState
trigger1 = SysVar(3) = 280
value = 190

[Statedef 6200]
StateType = S
ctrl = 0

[State 5900, 1]
type = ChangeState
trigger1 = Time = 431
trigger1 = AILevel != 0
trigger1 = Enemy, AILevel = 0
value = 5700

[State 5900, 1]
type = CtrlSet
trigger1 = Time = 435
trigger2 = Enemy, Life = 0
value = 1

[State 5900, FADE_TO_BLACK]
type = Explod
trigger1 = Time = 4
ID = 3019
anim = F3019
pos = 192,0
postype = left
removetime = 40
sprpriority = 16

[State 5900, FADE_FROM_RED]
type = Explod
trigger1 = Time = 30
anim = F3021
pos = 192,0
postype = left
sprpriority = 18
ontop = 1

[State 6100, FLASH_X2]
type = AllPalFX
trigger1 = Time = 24
trigger2 = Time = 22
add = 256,256,256
mul = 256,256,256
time = 1

[State 6100, BANNER1]
type = Explod
trigger1 = Time = 0
anim = F195
bindtime = -1
pos = 192,0
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER1]
type = Explod
trigger1 = Time = 0
anim = F195
bindtime = -1
facing = -1
pos = 192,112
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER2]
type = Explod
trigger1 = Time = 31
anim = F196
bindtime = -1
pos = 192,112
postype = left
sprpriority = 17
ontop = 1

[State 6100, BANNER2]
type = Explod
trigger1 = Time = 31
anim = F196
bindtime = -1
facing = -1
pos = 192,0
postype = left
sprpriority = 17
ontop = 1

[State 6100, BG]
type = Explod
trigger1 = Time = 31
anim = F3000
bindtime = -1
pos = 192,0
ID = 5800
postype = left
sprpriority = 12
removetime = -1

[State 5700, 1]
type = StopSnd
trigger1 = Time = 31
channel = 3

[State 6200, Winner is you]
type = PlaySnd
trigger1 = Time = 31
value = 6200,0
loop = 1
channel = 0

[State 5700, 1]
type = AssertSpecial
trigger1 = Time >= 31
flag = NoFG

[State 6100, Portrait]
type = Explod
trigger1 = Time = 31
anim = 6200
bindtime = -1
ID = 5805
pos = 192,0
postype = left
sprpriority = 13
removetime = -1

[State 6100, Winquote BG]
type = Explod
trigger1 = Time = 31
anim = F3002
bindtime = -1
pos = 192,0
ID = 5806
postype = left
sprpriority = 14
removetime = -1

[State 6100, NoLifeBar]
type = AssertSpecial
trigger1 = 1
flag = NoBarDisplay

[State 5055, 1]
type = VarSet
trigger1 = 1
sysvar(4) = 7

[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(6020)
ID = 6020

[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6203)
ID = 6203

[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6800)
ID = 6800
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6801)
ID = 6801
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6802)
ID = 6802
[State 5055, 1]
type = RemoveExplod
trigger1 = NumExplod(6803)
ID = 6803
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(180)
ID = 180
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(181)
ID = 181
[State -2, Remove]
type = RemoveExplod
trigger1 = NumExplod(9004)
ID = 9004

[State 5055, 2]
type = VarSet
triggerall = AILevel = 0
triggerall = Time > 100
trigger1 = command = "x"
trigger2 = command = "y"
trigger3 = command = "z"
trigger4 = command = "a"
trigger5 = command = "b"
trigger6 = command = "c"
sysvar(4) = 8

[State 5055, 2]
type = VarSet
triggerall = Enemy, AILevel = 0
triggerall = AILevel
triggerall = Time > 100
trigger1 = Enemy, command = "x"
trigger2 = Enemy, command = "y"
trigger3 = Enemy, command = "z"
trigger4 = Enemy, command = "a"
trigger5 = Enemy, command = "b"
trigger6 = Enemy, command = "c"
sysvar(4) = 8