;---------------------------------------------------------------------------
; Common States File
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; 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.

; The following states have special handling within MUGEN, and should be
; overridden with caution:
; Jump Start (40): airjumping bookkeeping at time = 0
; All guard states (120-155): guard handling throughout state
; Hit_trip, shaking (5070): defence increases at time = 0
; Hit_bounce (5100): defence increases at time = 0, player becomes
;                    invincible if within 10 ticks of getting up
; Hit_liedown (5110): player changes to get-up state (5120) when ready
; Hit_getup (5120): player's defence is restored to normal at time = 0
; Hitfall_recover (5200): player's defence is restored at time = 0
; Hitfall_airrecover (5210): player's defence is restored at time = 0
;var(20) = hitcrushcounter
;var(2) = dizzy counter

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

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

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

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

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

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

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

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

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

[State 0, VelSet]
type = VelSet
trigger1 = time = 0
x = 0
y = 0
;ignorehitpause =
;persistent =


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

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

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

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



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

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

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

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

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

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

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

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

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = ifelse(prevstateno = 260,-14,const(velocity.jump.y))

[State 50, 1]
type = VarSet
trigger1 = AnimTime = 0 && prevstateno = 260
var(4) = 1

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 || Var(55) ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1
;---------------------------------------------------------------------------

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

[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 = Turn
trigger1 = p2dist X < -4
trigger1 = Time = 0

[State 45, End]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1

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



[State 0, 1]
type = PlayerPush
trigger1 = enemynear, statetype !=A
value = 0
;ignorehitpause = 0
;persistent = 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 = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 0, 1]
type = VelAdd
triggerall = (Var(4) = 1) && (Vel X <= const(velocity.jump.fwd.x)) && (Time >= 10)
trigger1 = Command = "holdfwd"
x = 0.45

[State 0, 2]
type = VelAdd
triggerall = (Var(4) = 1) && (Vel X >= const(velocity.jump.back.x)) && (Time >= 10)
trigger1 = Command = "holdback"
x = -0.35

[State 0, 3]
type = VelAdd
trigger1 = (Var(4) = 1)
y = -0.1

[State 0, 4]
type = Turn
trigger1 = (Var(4) = 1) && (P2Dist X < -5)

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

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

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

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

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

[State 52]
type = Turn
trigger1 = P2dist X < -30

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

[state 1051, land explod]
type = helper
trigger1 = time = 0 & numhelper(8010) = 0
name = "land explod"
id = 77010
stateno = 77010
postype = p1
pos = 0,0
sprpriority = -1
bindtime = 1
ownpal = 1
ignorehitpause = 1
persistent = 0

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

;---------------------------------------------------------------------------
;dust land explod
[statedef 77010]
type = a
movetype = i
physics = n
anim = 9999
velset = 0,0
sprpriority = -1

[state 8010]
type = explod
trigger1 = time = 0
pausemovetime = 100
supermovetime = 100
removetime = 20
bindtime = -1
anim = 8005
pos = 10, 5
scale = 0,0
sprpriority = -5
id = 8005
removeongethit = 1

[state 8010]
type = modifyexplod
trigger1 = 1
id = 8005
scale = ifelse(time<=6,time/6.0,1+(time-4)/30.0),ifelse(time<=6.0,time/9.0,0.5+(time-4)/30.0)

[state 8010,1]
type = palfx
trigger1 = time = 0
time = 5
add = 0,0,0
color = 0

[state 8010,1]
type = palfx
trigger1 = time = [5,20]
time = 1
add = ceil(-time/7.0*100),ceil(-time/7.0*100),ceil(-time/7.0*100)
color = 0

[state 8080, remove]
type = Destroyself
trigger1 = time >= 20
;---------------------------------------------------------------------------
; Air Attack Falling
;---------------------------------------------------------------------------
[Statedef 70]
type    = A
movetype= I
physics = A
anim = 70
sprpriority = 1
ctrl = 1

[State 70, 1]
type = Turn
trigger1 = P2Dist X < -5

[State 70, 2]
type = VelSet
trigger1 = FrontEdgeBodyDist <= 0
x = 0

[State 70, End]
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 52
;---------------------------------------------------------------------------

; Run Forward
[Statedef 100]
type    = S
physics = N
velset = 7,0
ctrl = 1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Animelem = 3
trigger2 = Animelem = 6
value = S55,2



[State 105 , 1]
type = AssertSpecial
trigger1 = 1
flag=NoWalk

[State 105 , 1]
type = ChangeAnim
trigger1 = Time = 0 && Anim != 100
value = 100

[State 105 , 2]
type = ChangeState
trigger1 = time = 20
value = 101

; Run Backward
[Statedef 101]
type    = S
physics = N

[State 410, 1]
type = VelSet
trigger1 = !time
x = 0


[State 105 , 1]
type = AssertSpecial
trigger1 = 1
flag=NoWalk

[State 105 , 1]
type = ChangeAnim
trigger1 = Time = 0 && Anim != 101
value = 101


[State 105 , 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; Run Backwards 2 (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 = -5,-2
spacing = 1

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

;Web Swing FWD
[Statedef 107]
type    = A
physics = N
velset = 0,-5
ctrl = 0
anim = 107

[State 0, 1]
type = PlaySnd
trigger1 = !time
value = 0, 3
volume = 0

[State 0, 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 2,ifelse(random<499,1,70)
volume = 255
channel = 0

[State 0, 1]
type = VelAdd
trigger1 = Animelemtime(2) < 9
y = .45
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = VelAdd
trigger1 = Animelemtime(1) > 8 &&  AnimElemtime(3) < 0
x = .53

[State 0, 3]
type = VelAdd
trigger1 = Animelemtime(2) >= 4 && AnimElemtime(3) <7
y = -.55
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = VelSet
trigger1 = Animelem = 3
x = 7.5
y = -4.5

[State 0, 1]
type = Gravity
trigger1 = Animelemtime(3) > 3
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = PlayerPush
trigger1 = 1
value = 0
;ignorehitpause = 0
;persistent = 1

[State 105 , 1]
type = AssertSpecial
trigger1 = 1
flag=NoWalk

[State 9999, 0]
type = Helper
trigger1 = time = 0
pos = 55,-175
postype = p1
stateno = 109
helpertype = normal
name = "Webbing"
keyctrl = 0
ownpal = 1
ID =109

[State 105 , 2]
type = ChangeState
trigger1 = Animtime = 0
value = 50
ctrl = 1
;-----------------------------------------------------------------

;Web Swing BWD
[Statedef 108]
type    = A
physics = N
velset = 0,-5
ctrl = 0
anim = 107

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

[State 0, 1]
type = PlaySnd
trigger1 = !time
value = 0, 3
volume = 0

[State 0, 1]
type = PlaySnd
trigger1 = AnimElem = 3
value = 2,ifelse(random<499,1,70)
volume = 255
channel = 0

[State 0, 1]
type = VelAdd
trigger1 = Animelemtime(2) < 9
y = .45
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = VelAdd
trigger1 = Animelemtime(1) > 8 &&  AnimElemtime(3) < 0
x = .53

[State 0, 3]
type = VelAdd
trigger1 = Animelemtime(2) >= 4 && AnimElemtime(3) <7
y = -.55
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = VelSet
trigger1 = Animelem = 3
x = -7.5
y = -4.5

[State 0, 1]
type = Gravity
trigger1 = Animelemtime(3) > 3
;ignorehitpause = 0
;persistent = 1

[State 0, 2]
type = PlayerPush
trigger1 = 1
value = 0
;ignorehitpause = 0
;persistent = 1

[State 105 , 1]
type = AssertSpecial
trigger1 = 1
flag=NoWalk

[State 9999, 0]
type = Helper
trigger1 = time = 0
pos = 55,-175
postype = p1
stateno = 109
helpertype = normal
name = "Webbing"
keyctrl = 0
ownpal = 1
ID =109

[State 0, Turn]
type = Turn
trigger1 = time = 31

[State 105 , 2]
type = ChangeState
trigger1 = Animtime = 0
value = 50
ctrl = 1
;-------------------------------------------------------

; Webrope
[Statedef 109]
type = S
ctrl = 0
anim = 109
velset = 0,0

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

[State 0, 1]
type = PosFreeze
trigger1 = 1
value = 1
;ignorehitpause = 0
;persistent = 1

[State 0, 1]
type = DestroySelf
trigger1 = Animtime = 0 || parent, stateno !=[107,108]
;ignorehitpause = 0
;persistent = 1



[Statedef 105]
type    = S
physics = N
velset = -7,0
ctrl = 1

[State 105 , 1]
type = AssertSpecial
trigger1 = 1
flag=NoWalk

[State 105 , 1]
type = ChangeAnim
trigger1 = Time = 0 && Anim != 105
value = 105

[State 105 , 2]
type = ChangeState
trigger1 = time = 20
value = 101

;---------------------------------------------------------------------------

;---------------------------------------------------------------------------

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

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

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

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

[State 120, End]
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, 2]
type = ChangeState
trigger1 = command = "holddown"
value = 131

[State 130, End]
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, 2]
type = ChangeState
trigger1 = command != "holddown"
value = 130

[State 131, End]
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 132, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

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

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

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

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

[State 132, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, End]
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 = A

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

[State 140, End]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

;---------------------------------------------------------------------------
; STANDING GUARDHIT (shaking)
; SGUARDHIT (shaking)
[Statedef 150]
type    = S
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = ChangeAnim
trigger1 = (Anim != 160) && Anim != 130
value = 130

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151

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


;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Time = 0 && (Anim = 160)
x = 0
y = 0

[State 0, 5]
type = Changestate
triggerall = (Anim != 160)
trigger1 = command = "recovery"
value = 950


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 160) && Animtime = 0
value = 130



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 160) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 160) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1



;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type    = S
movetype= H
physics = S

[State 150, 1]
type = ChangeAnim
trigger1 = Anim != 160 && Anim != 161 && Anim != 130
value = 130

[State 151, 1]
type = HitVelSet
trigger1 = Time = 0 && (Anim != [160,161])
x = 1

[State 151, 2]
type = VelSet
triggerall = (Anim != [160,161])
trigger1 = Time = GetHitVar(slidetime)
trigger2 = Time >= GetHitVar(hittime)
x = 0

[State 151, 3]
type = CtrlSet
trigger1 = (Time = GetHitVar(ctrltime)) && (Anim != [160,161])
value = 1

[State 151, 4]
type = ChangeState
trigger1 = (Time >= GetHitVar(hittime)) && (Anim != [160,161])
value = 130
ctrl = 1

;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Time = 0 && (Anim = [160,161])
x = 0
y = 0

[State 0, 5]
type = ChangeAnim
triggerall = (Anim != 160)
trigger1 = command = "recovery"
value = 160


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 160) && Animtime = 0
value = 130



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 160) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 160) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1
;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type    = C
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = ChangeAnim
trigger1 = Anim != 160 && Anim != 161 && Anim != 131
value = 131

[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 153

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

;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Time = 0 && (Anim = 161)
x = 0
y = 0

[State 0, 5]
type = Changestate
triggerall = (Anim != 161)
trigger1 = command = "recovery"
value = 951


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 161) && Animtime = 0
value = 131



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 161) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 161) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type    = C
movetype= H
physics = C


[State 150, 1]
type = ChangeAnim
trigger1 = Anim != 160 && Anim != 161 && Anim != 131
value = 131

[State 153, 1]
type = HitVelSet
trigger1 = Time = 0 && (Anim != 161)
x = 1

[State 153, 2]
type = VelSet
triggerall = (Anim != 161)
trigger1 = Time = GetHitVar(slidetime)
trigger2 = Time >= GetHitVar(hittime)
x = 0

[State 153, 3]
type = CtrlSet
trigger1 = (Time = GetHitVar(ctrltime)) && (Anim != [160,161])
value = 1

[State 153, 4]
type = ChangeState
trigger1 = (Time >= GetHitVar(hittime)) && (Anim != [160,161])
value = 131
ctrl = 1

;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Time = 0 && (Anim = 161)
x = 0
y = 0

[State 0, 5]
type = Changestate
triggerall = (Anim != 161)
trigger1 = command = "recovery"
value = 951


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 161) && Animtime = 0
value = 131



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 161) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 161) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1
;---------------------------------------------------------------------------
; AGUARDHIT (shaking)
[Statedef 154]
type    = A
movetype= H
physics = N
velset = 0,0

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

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

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

;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Time = 0 && (Anim != 162)
trigger2 = Anim = 162
x = 0
y = 0

[State 0, 5]
type = Changestate
trigger1 = (Anim != 162)
trigger1 = command = "recovery"
value = 952


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 162) && Animtime = 0
value = 132



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 162) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 162) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1


;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type    = A
movetype= H
physics = N

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

[State 155, VelSet 2]
type = VelSet
trigger1 = (Anim = 162) && (AnimTime = 0)
x = -5


[State 155, 1]
type = HitVelSet
trigger1 = Time = 0 && (Anim != 162)
x = 1
y = 1

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

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

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

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

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

[State 155, 7]
type = ChangeState
triggerall = (Anim != 162)
trigger1 = sysvar(0)
trigger1 = command != "holdback"
value = 52

[State 155, 8]
type = ChangeState
trigger1 = sysvar(0) && (Anim != 162)
value = 130

;Guard Push
[State 0, 4]
type = VelSet
trigger1 = Anim = 162
x = 0
y = 0

[State 0, 5]
type = Changestate
triggerall = (Anim != 162)
trigger1 = command = "recovery"
value = 952


[State 0, 5]
type = ChangeAnim
trigger1 = (Anim = 162) && Animtime = 0
value = 132



[State 0, 1]
type = PlaySnd
trigger1 = (Anim = 162) && Animelemtime(1)=1
value = 6,2
volume = 255

[State 154, Guard Push Spark]
type = Explod
trigger1 = (Anim = 162) && Animelemtime(1)=1
anim = 911
ID = 161
postype = p1
pos = 52,-76
bindtime = -1
sprpriority = 2
ownpal = 1

[State 0,6]
type = Helper
triggerall = NumHelper(160) = 0
trigger1 = command = "recovery"
ID = 160
name = "Guard_Push"
pos = 0, 0
postype = p1
stateno = 940
helpertype = normal
keyctrl = 0
ownpal = 1
size.height = 300
size.ground.back = 30
size.ground.front = 30
ignorehitpause = 1

;---------------------------------------------------------------------------
; LOSE (Time over)
;---------------------------------------------------------------------------
;lose by time over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0



[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; DRAW GAME (Time over)
;---------------------------------------------------------------------------
[Statedef 175]
type = S
ctrl = 0
velset = 0,0
anim = ifelse(random<499,170,171)

[State 175, End]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------

; Win state decider

[Statedef 180]
type = S
velset = 0,0

[state 180]
type = AssertSpecial
trigger1 = Time >= 0
flag = NoBarDisplay

[State 180, 0]
type = PosSet
trigger1 = Time = 0
y = 0


[State 180]
type = Width
trigger1 = Time = 0
value = 50,50


[State 180]
type = ChangeState
trigger1 = Time = 1
;trigger1 = WinTime
value = ifelse(random<499,181,182)


;[State 180]
;type = ChangeState
;trigger1 = Time >= 1
;trigger1 = WinKO
;value = 181+random%2

;---------------------------------------------------------------------------
; Win pose 1 - Time Over

[Statedef 189]
type = S
ctrl = 0
anim = 181
velset = 0,0
sprpriority = 0

[State 181]
type = AssertSpecial
trigger1 = Time >= 0
flag = NoBarDisplay

[State 0,PlaySnd]
type = PlaySnd
trigger1 = animelem =2
value = 2,3
volume = 50

[State 0, Explod]
type = Explod
trigger1 = animelem =3
anim = 197
pos = 0,-110
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = -1
scale = .5,.5
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 189]
type = PlaySnd
trigger1 = AnimElem = 2
value = 0, 6

[State 181]
type = AssertSpecial
trigger1 = Time < 200
flag = roundnotover

;---------------------------------------------------------------------------
; Win pose 1 - Reveal Eddie

[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0
sprpriority = 0

[State 181]
type = AssertSpecial
trigger1 = Time >= 0
flag = NoBarDisplay

[State 0,PlaySnd]
type = PlaySnd
trigger1 = animelem =2
value = 2,3
volume = 50

[State 0, Explod]
type = Explod
trigger1 = animelem =3
anim = 197
pos = 0,-110
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = -1
scale = .5,.5
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 189]
type = PlaySnd
trigger1 = AnimElem = 2
value = 0, 6

[State 181]
type = AssertSpecial
trigger1 = Time < 200
flag = roundnotover
;------------------------------------------------

; Win pose 2 - In your nightmares
[Statedef 182]
type = S
ctrl = 0
anim = 182
velset = 0,0
sprpriority = 0

[State 181]
type = AssertSpecial
trigger1 = Time >= 0
flag = NoBarDisplay

[State 0,PlaySnd]
type = PlaySnd
trigger1 = time = 10
value = 1,3
volume = 50

[State 0, Explod]
type = Explod
trigger1 = time = 0
anim = 183
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
;vfacing = -1
scale = 1,1
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 184
pos = 0,0
postype = right  ;p2,front,back,left,right
facing = 1
;vfacing = -1
scale = 50,50
sprpriority = 3
ontop = 0
shadow = 0,0,0
ownpal = 0


[State 181]
type = AssertSpecial
trigger1 = Time < 350
flag = roundnotover

; PREINTRO
[Statedef 190]
type = S
movetype = I
physics = S
ctrl = 0
velset = 0,0


[State 190, End] ;Go straight to intro.
type = ChangeState
triggerall = p2name = "Carnage_MMV" || p2name = "Scream" || p2name = "Agony" || p2name ="Spider-Man" || p2name = "Spiderman"
trigger1 = Time = 0
value = 193

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

[State 190, End] ;Go straight to intro.
type = ChangeState
trigger1 = Time = 0
value = 191
;---------------------------------------------------------------------------

;Face intro
[Statedef 191]
type = S
movetype = I
physics = S
ctrl = 0
velset = 0,0
anim = 190
sprpriority = 1

[State 192, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 0, Explod]
type = Explod
trigger1 = time = 234
anim = 193
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
scale = 1,1
sprpriority = 2
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = time = 234
anim = 197
pos = -40,-20
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = -1
scale = .5,.5
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Black Swirly]
type = Explod
trigger1 = time = 234
anim = 197
pos = 10,-20
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
scale = .5,.5
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, White Swirly]
type = Explod
trigger1 = time = 280
anim = 198
pos = 10,-100
postype = p1  ;p2,front,back,left,right
facing = -1
vfacing = 1
scale = .4,.4
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = time = 260
anim = 197
pos = 12,-80
postype = p1  ;p2,front,back,left,right
facing = -1
vfacing = -1
scale = .75,.75
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = time = 310
anim = 197
pos = 5,-120
postype = p1  ;p2,front,back,left,right
facing = -1
vfacing = -1
scale = .5,.5
sprpriority = 4
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0,PlaySnd]
type = PlaySnd
trigger1 = animelem =1
value = 1,0
volume = 50
channel = 2

[State 0, ]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 0

;------------------------------------------------------------------

;Old intro
[Statedef 192]
type = S
movetype = I
physics = S
ctrl = 0
velset = 0,0
anim = 191

[State 192, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 0, Explod]
type = Explod
trigger1 = animelem =2
anim = 192
pos = 0,0
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
scale = 1,1
sprpriority = 3
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = animelem =2
anim = 197
pos = 0,-20
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
scale = .75,.75
sprpriority = 3
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = animelem =2
anim = 197
pos = 0,-120
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
scale = .8,.8
sprpriority = 3
ontop = 1
shadow = 0,0,0
ownpal = 0

[State 0,PlaySnd]
type = PlaySnd
trigger1 = animelem =2
value = 0,6
volume = 50

[State 0,PlaySnd]
type = PlaySnd
trigger1 = time = 75
value = 2,0
volume = 50

[State 0,PlaySnd]
type = PlaySnd
trigger1 = animelem =5
value = 1,15
volume = 50

[State 0, ]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 0

;Carnage intro
[Statedef 193]
type = S
movetype = I
physics = S
ctrl = 0
velset = 0,0
anim = 189
sprpriority = 1

[State 192, 2]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = p2name = "Carnage_MMV" || p2name = "Scream" || p2name = "Agony"
trigger1 = time = 0
value = 189

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = p2name = "Spider-Man" || p2name = "Spiderman"
trigger1 = time = 0
value = 188

[State 0,PlaySnd]
type = PlaySnd
triggerall = p2name = "Carnage_MMV" || p2name = "Scream" || p2name = "Agony"
trigger1 = animelem =1
value = 0,17
volume = 50
channel = 4

[State 0,PlaySnd]
type = PlaySnd
triggerall = p2name = "Spider-Man" || p2name = "Spiderman"
trigger1 = animelem =1
value = 0,18
volume = 50
channel = 4

[State 0, ]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 0

;------------------------------------------------------------------

;Point Taunt
[Statedef 195]
type = S
ctrl = 0
anim = 195
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 192, 2]
type = PlaySnd
trigger1 = AnimElem = 1
value = 1,ifelse(random<499,2,13)
volume = 255
channel = 1

[State 0, 1]
type = ChangeState
trigger1 = Animtime = 0
value = 0
ctrl = 1
;--------------------------------------------
; HITG_SHAKE
;---------------------------------------------------------------------------
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1]
type = VarSet
trigger1 = time = 0
v = 3
value = GetHitVar(damage)

[State 5000, 2] ;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, 3] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 4] ;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, 5] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 6] ;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, 7]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;HITG_SLIDE

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

[State 5000, 9]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

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

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

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

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HITC_SHAKE
;---------------------------------------------------------------------------
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1]
type = VarSET
trigger1 = time = 0
v = 3
value = GetHitVar(damage)

[State 5010, 2] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 3] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 4] ;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, 5] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 6] ;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,7]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;HITC_SLIDE

[State 5010, 8]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5010, 9]
type = ForceFeedback
trigger1 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, 10]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, End]
type = ForceFeedback
trigger1 = anim = 5022
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITC_SLIDE
;---------------------------------------------------------------------------
[Statedef 5011]
type    = C
movetype= H
physics = C

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HITA_SHAKE
;---------------------------------------------------------------------------
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1]
type = VarSet
trigger1 = time = 0
v = 3
value = GetHitVar(damage)

[State 5020, 2] ;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, 3] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 4] ;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, 5] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 6]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5020, 7]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, 8]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, End]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
;---------------------------------------------------------------------------
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VarSET
trigger1 = time = 0
v = 3
value = GetHitVar(damage)

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

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

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

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

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

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

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 5035, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5035, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5035, End]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;HITA_FALL

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

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

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

[State 5040, 3]
type = CtrlSet
trigger1 = HitOver
value = 1

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

[State 5040, 5]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5040, End]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMPLAND

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

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

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

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

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

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

[State 5050, End]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

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

[State 5070, 1]
type = ChangeAnim
trigger1 = 1
value = 5070

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, End]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
;---------------------------------------------------------------------------
[Statedef 5071]
type    = A
movetype= H
physics = N

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

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

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

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

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, End]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

;---------------------------------------------------------------------------
; HITL_SLIDE
;---------------------------------------------------------------------------
[Statedef 5081]
type    = L
movetype= H
physics = C

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

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

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

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

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

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

[State 5100, 1]
type = ChangeState
triggerall = alive
trigger1 = var(8) >= 1
value = 5999

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

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

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
;trigger1 = GetHitVar(fall.yvel) = 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, 5]
type = VelSet
trigger1 = Time = 0
y = 0

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

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

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
;value = 61
;pos = 0, 0
;under = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 10


[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
;value = F7, 0 ;Hit ground
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

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

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

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

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

[State 5101, 1] ;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, 3]
type = HitFallVel
trigger1 = Time = 0

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

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

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

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

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

[State 5110, 2] ;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, 3] ;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, 4] ;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, 5]
type = HitFallDamage
trigger1 = Time = 0

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

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

[State 5110, 8]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

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

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

[State 5110, 11] ;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, 12] ;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, 13] ;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, 14]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

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

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

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

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

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

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

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

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

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

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

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

[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, 2] ;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, 3] ;Match over anim
type = ChangeAnim
persistent = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 4] ;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, 5] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 6] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

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

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
;---------------------------------------------------------------------------
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

[State 5200, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5200, End]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 10
value = 5201

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (on the ground)
;---------------------------------------------------------------------------
[Statedef 5201]
type    = A
movetype= H
physics = A
anim = 5200

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

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -.15
y = -3.5

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

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

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5201, End]
type = GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
;---------------------------------------------------------------------------
[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 ;256,256,256

[State 5210, 2]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 3] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

[State 5210, 4]
type = VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 5]
type = VelAdd
trigger1 = Time = 4
y = -4.5

[State 5210, 6]
type = VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 7]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 8]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 9] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

[State 5210, 10] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = 1.5

[State 5210, 11] ;Go fwd
type = VelMul
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = 1

[State 5210, 12] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = -1

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

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

[State 5210, 15]
type = VelAdd;Gravity
trigger1 = Time >= 4
y = .35

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

;---------------------------------------------------------------------------
; Continue?
;---------------------------------------------------------------------------
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, End] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

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

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
last = 50
value = 0

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

[State 5900, End] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
trigger1 = random < 500
value = 190

[State 5900, End] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
trigger1 = random < 500
value = 192

;---------------------------------------------------------------------------
; Guard Push (Stand)
;---------------------------------------------------------------------------
[Statedef 6300]
type    = S
movetype= I
physics = N
poweradd= 0
velset = 10,0
ctrl = 0
anim = 160
sprpriority = 2

[State 6300, 1]
type = VelMul
trigger1 = 1
x = 0.75

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

[State 6300, 3]
type = Width
trigger1 = 1
value = 10,0

[State 6300, 4]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 25

[State 6300, 5]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 6350
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 6300, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Guard Push (Crouch)
;---------------------------------------------------------------------------
[Statedef 6310]
type    = C
movetype= I
physics = N
poweradd= 0
velset = 10,0
ctrl = 0
anim = 161
sprpriority = 2

[State 6310, 1]
type = VelMul
trigger1 = 1
x = 0.75

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

[State 6310, 3]
type = Width
trigger1 = 1
value = 10,0

[State 6310, 4]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 25

[State 6310, 5]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 6350
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 6310, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Guard Push (air)
;---------------------------------------------------------------------------
[Statedef 6320]
type    = S
movetype= I
physics = N
poweradd= 0
velset = 10,0
ctrl = 0
anim = 162
sprpriority = 2

[State 6320, 1]
type = VelMul
trigger1 = 1
x = 0.75

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

[State 6320, 3]
type = Width
trigger1 = 1
value = 10,0

[State 6320, 4]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 25

[State 6320, 5]
type = Helper
trigger1 = Time = 0
helpertype = Normal
name = "GuardPush"
postype = P1
pos = -50,0
stateno = 6350
ownpal = 1
size.height = 200
size.ground.back = 30
size.ground.front = 30

[State 6320, End]
type = ChangeState
trigger1 = AnimTime = 0
value = 51
ctrl = 1

;---------------------------------------------------------------------------
; Guard Push (Helper)
;---------------------------------------------------------------------------
[Statedef 6350]
type    = S
movetype= I
physics = N
poweradd= 0
ctrl = 0
anim = 165
sprpriority = -4

[State 6350, 1]
type = PlayerPush
trigger1 = Time >= 0
value = 1

[State 6350, 2]
type = VelSet
trigger1 = Time = [0,10]
x = 30

[State 6350, 3]
type = VelSet
trigger1 = Time = [11,13]
x = 20

[State 6350, 4]
type = VelSet
trigger1 = Time >= 14
x = 10

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

[State 6350, End]
type = DestroySelf
trigger1 = Time >= 18

;---------------------------------------------------------------------------
; Super Jump
;---------------------------------------------------------------------------
[statedef 700]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1


[State 700, 1]
type = VelSet
trigger1 = !Animtime
y = const(velocity.jump.y)*1.50

[State 700,end]
type = ChangeState
trigger1 = AnimTime = 0
value = 701
ctrl = 1


[statedef 701]
type = A
physics = A
anim = 41

[State 0,PlaySnd]
type = PlaySnd
trigger1 = Time = 2
value = 9999,7

[state 700,blur]
type = afterimage
trigger1 = time = 1
length = 30;100
PalBright   =  0,0,0;320, 320, 320
PalContrast =  120,120,220;0, 0, 0
PalAdd      =  0,0,0;80,80,100
PalMul      = 1,1,1;.50,.50,.50
TimeGap  = 1
FrameGap = 5
Trans = Add
time = 20

[State 0,super jump]
type = Explod
trigger1 =!time
anim = 8004
ID = 8004
pos = 0,20
postype = p1
bindtime = 1
removetime = 26
supermove = 26
pausemovetime = 26
removeongethit = 1
sprpriority = 3
ownpal = 1

[State 7001, VelAdd]
type = VelAdd
triggerall = Vel X >= -2
trigger1 = command = "holdback"
trigger1 = Anim != 43
x = -1.60

[State 7001, VelAdd]
type = VelAdd
triggerall = Vel X <= 2.5
trigger1 = command = "holdfwd"
trigger1 = Anim != 42
x = 1.60

[State 7001, VelSet]
type = VelSet
trigger1 = Anim = 42
trigger1 = Time = [0,5]
x = 4

[State 7001, VelSet]
type = VelSet
trigger1 = Anim = 43
trigger1 = Time = [0,5]
x = -3.5

[state 701, noturn]
type = assertspecial
trigger1 = 1
flag = noautoturn




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

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

[State 7711]
type = turn
trigger1 = p2dist x < -5
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Dodge Roll
;---------------------------------------------------------------------------
[Statedef 7010]
type    = C
physics = N
ctrl = 0

[State 7010, 1]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,NP,SP,NT,ST,HT

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

[State 7010, 3]
type = ChangeAnim
trigger1 = !time
trigger1 = command != "holdback"
value = 7010

[State 7010, 4]
type = ChangeAnim
trigger1 = !time
trigger1 = command = "holdback"
value = 7011

[State 7010, 5]
type = velset
trigger1 = 1
trigger1 = anim = 7010
x = 4

[State 7010, 6]
type = velset
trigger1 = 1
trigger1 = anim = 7011
x = -4

[State 7010, End]
type = ChangeState
trigger1 = animtime =0 
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Dizzy
;---------------------------------------------------------------------------
[StateDef 5300]
type = S
movetype= H
physics = S
velset = 0,0
ctrl = 0
anim = 5300

[State 5300, 1]
type = VarSet
trigger1 = !time
v = 1
value = 0

[State 5300, End]
type = selfState
trigger1 = time > 120
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Guard Crush Stand
;---------------------------------------------------------------------------
[StateDef 5350]
type = S
movetype= I
physics = S
velset = 0,0
ctrl = 0
anim = 5350

[State 5350, 1]
type = PosSet
trigger1 = !time
y = 0

[State 5350, 2]
type = VarSet
trigger1 = !time;fv = 10
v = 2
value = 0

[State 5350, End]
type = selfState
trigger1 = time > 40
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Guard Crush Stand2
;---------------------------------------------------------------------------
[StateDef 5351]
type = C
movetype= I
physics = C
velset = 0,0
ctrl = 0
anim = 5350

[State 5351, 1]
type = PosSet
trigger1 = !time
y = 0

[State 5351, 2]
type = VarSet
trigger1 = !time
v = 2
value = 0

[State 5351, End]
type = selfState
trigger1 = time > 40
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Finish Hit Explod (based on FlowaGirl and Ethan Lives codes)
; (taken with permission from McCready's StrongGuy char)
[Statedef 8900]
type = S
movetype = I
physics = N
anim = 8930

[State 0, PalFXWiz]
type = PalFX
trigger1 =1
time = 10
add = 100,0,100
mul = 120,20,124
sinadd = 85,110,55,10
invertall = 0
color = 0
ignorehitpause = 0

[state 8900, a1]
type = assertspecial
trigger1 = 1
flag = NoBarDisplay
flag2 = Noshadow

;[State 8900, 1]
;type = Pause
;trigger1 = (!Time)
;time = 12
;movetime = 12

[State 8900, 1]
type = EnvShake
trigger1 = (!Time)
time = 12
freq = 120;10
ampl = -3;2
phase = 90

[State 8901, 2]
type = Explod
triggerall = (NumExplod(8900) < 1)
trigger1 = !time
anim = 8901
id = 8901
pos = 0,0
postype = back
;facing = 1
bindtime = -1
supermovetime = 999
pausemovetime= 999
sprpriority = 20
removetime = -2
ignorehitpause = 1
scale = 1,1
removeongethit = 1
ownpal = 1

[State 8900, 2]
type = Explod
triggerall = (NumExplod(8900) < 1)
trigger1 = Time = 0
persistent = 0
anim = 8900
ID = 8900
pos = 0,0
postype = back
;facing = 1
bindtime = -1
supermovetime = 999
pausemovetime= 999
sprpriority = 20
removetime = -2
ignorehitpause = 1
scale = .5,.5
removeongethit = 1
ownpal = 1

[State 8900, 3]
type = PlaySnd
trigger1 = (NumExplod(8900) != 0)
value = 9999, 4
persistent = 0
supermovetime = 1000
pausemovetime = 1000
ignorehitpause = 1

[State 8900, done]
type = DestroySelf
trigger1 = RoundState = 4

; END
