;---------------------------------------------------------------------------
; Format:
; [Statedef STATENO]
; type = ?      S/C/A/L  stand/crouch/air/liedown
; movetype = ?  I/A/H    idle/attack/gethit
; physics = ?   S/C/A/N  stand/crouch/air/none
; juggle = ?             air juggle points move requires
;
; [State STATENO, ?]     ? - any number you choose
; type = ?
; ...
; Initialize (at the start of the round)
[Statedef 5900]
type = S

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

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

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


; WIN1
[Statedef 180]
type = S
ctrl = 0
velset = 0,0,0

[State 0, 1]
type = ChangeState
trigger1 = 1
value = 181 +(random%4)

; Winner is me!
[Statedef 181]
type = S
ctrl = 0

[State 0, 1]
type = ChangeAnim
trigger1 = 1
value = Anim
elem = animelemno(0)

[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

[State 180, 1]
type = PlaySND
trigger1 = !Time 
value = 0,2+(random%2)

[State 180, 1]
type = AssertSpecial
trigger1 = time = [0,250]
flag = RoundNotOver

; Winner is.... DAMMIT, ARTURO!
[Statedef 182]
type = S
ctrl = 0

[State 0, 1]
type = ChangeAnim
trigger1 = 1
value = Anim
elem = animelemno(0)

[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

[State 180, 1]
type = PlaySND
trigger1 = !Time
value = 0,2+(random%2)
channel = 0

[State 180, 1]
type = PlaySND
trigger1 = Time = 100
value = 3,2
channel = 0
volume = 255

[State 180, 1]
type = AssertSpecial
trigger1 = time = [0,250]
flag = RoundNotOver

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 182
ID = 181
pos = 160,120
postype = left
bindtime = -1
scale = .5,.5
ontop = 1
sprprority = 10

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = time > 200
ID = 181
pos = 0,0
scale = .5+((time-200)*.5),.5+((time-200)*.5)

; You wish you had swag like this
[Statedef 183]
type = S
ctrl = 0

[State 0, 1]
type = ChangeAnim
trigger1 = 1
value = Anim
elem = animelemno(0)

[State 0, SuperPause FX]
type = helper
trigger1 = !time
helpertype = normal
stateno = 187
ID = 187
name = "AC FX"
postype = p1
pos = 0,0
ownpal = 1
size.xscale = const(size.xscale)*.5
size.yscale = const(size.yscale)*.5

[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

[State 180, 1]
type = PlaySND
trigger1 = !Time
value = 3,4
channel = 0
loop = 1

[State 180, 1]
type = AssertSpecial
trigger1 = time = [0,500]
flag = RoundNotOver

; Party Rock is in the house tonight
[Statedef 184]
type = S
ctrl = 0

[State 0, 1]
type = ChangeAnim
trigger1 = time < 119
value = Anim
elem = animelemno(0)

[State 0, 1]
type = ChangeAnim
trigger1 = time = 119
value = 184

;[State 0, SuperPause FX]
;type = helper
;trigger1 = !time
;helpertype = normal
;stateno = 188
;ID = 188
;name = "Pooka"
;postype = p1
;pos = 40,0
;ownpal = 1

;[State 0, SuperPause FX]
;type = helper
;trigger1 = !time
;helpertype = normal
;stateno = 189
;ID = 189
;name = "Fygar"
;postype = p1
;pos = -40,0
;ownpal = 1

[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = NoMusic

[State 180, 1]
type = PlaySND
trigger1 = !Time
value = 3,1
channel = 0


[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 4
range = 0,255
;ignorehitpause =
;persistent =

[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 5
range = 0,255
;ignorehitpause =
;persistent =

[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 6
range = 0,255
;ignorehitpause =
;persistent =

[State 0, 1]
type = BGPalFX
triggerall = time >= 119
trigger1 = Time%56=0
time = 56
add = var(4),var(5),var(6)
ignorehitpause = 1

[State 180, 1]
type = AssertSpecial
trigger1 = time = [0,1000]
flag = RoundNotOver

;LOL Epilepsy
[Statedef 187]
type    = A
movetype= I
physics = N
anim = 187
ctrl = 0
sprpriority = 5

[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 0,255
;ignorehitpause =
;persistent =

[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 2
range = 0,255
;ignorehitpause =
;persistent =

[State 0, VarRandom]
type = VarRandom
trigger1 = 1
v = 3
range = 0,255
;ignorehitpause =
;persistent =

[State 0, BindToParent]
type = BindToParent
trigger1 = 1
facing = 0
pos = 0,ifelse(time < 122, -244+(time*2)-(9*parent,const(size.xscale)),-(9*parent,const(size.xscale)))
;ignorehitpause =
;persistent =

[State 0, 1]
type = BGPalFX
triggerall = time > 122
trigger1 = Time%4=0
time = 3
add = var(1),var(2),var(3)
ignorehitpause = 1

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

[State 0, ]
type = AssertSpecial
trigger1 = time > 122
flag= noFG
flag2 = NoBarDisplay

[State 3510, 4]
type = explod
trigger1 = time = 122
anim = 186
pos = 160,90
ID = 9999
postype = left
sprpriority = 5
ontop = 1
supermove = 1
bindtime = 9999
removetime = 999
ignorehitpause = 1
ownpal = 0
scale = .5,.5


; Intro
[Statedef 190]
type = S
ctrl = 0
anim = 20

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


[State 0, PosAdd]
type = PosAdd
trigger1 = !time
x = 450

[State 0, Turn]
type = Turn
trigger1 = !time
trigger2 = time = 300
;ignorehitpause =
;persistent =

[State 0, VelSet]
type = VelSet
trigger1 = time < 300
x = 1.5
;ignorehitpause =
;persistent =
[State 0, VelSet]
type = VelSet
trigger1 = time = 300
x = 0


[State 0, 1]
type = ChangeAnim
trigger1 = time >= 300
value = Anim
elem = animelemno(0)


[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = NoMusic
flag2 = NoBarDisplay
flag3 = GlobalNoShadow


[State 180, 1]
type = PlaySND
triggerall = !(var(56) && Teamside = 2)
trigger1 = !Time 
value = 0,0+(random%2)
channel = 0
abspan = 0

[State 180, 1]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 4]
type = ChangeState
trigger1 = time = 350
value = 0

;Pump (Throw Out Line)
[Statedef 200]
type = S
movetype = A
physics = S
ctrl = 0
anim = 200
velset = 0,0

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = time = 1
value = 2,0
volume = 255
channel = 1

[State 1000, Helper]
type = Helper
trigger1 = !IsHelper(201)
trigger1 = time = 1
postype = p1
pos = 0,0
stateno = 201
bindtime = 1
ownpal = 1
name = "Pump line"
ID = 201

[State 1000, ChangeState]
type = ChangeState
trigger1 = NumHelper(201)
trigger1 = helper(201), movehit
value = 210

[State 1000, ChangeState]
type = ChangeState
trigger1 = time > 2 && !NumHelper(201)
value = 0
ctrl = 1

;Pump Line
[Statedef 201]
type = A
movetype = A
physics = N
velset = 2*const(size.xscale),0
sprpriority = -1
juggle = 2
ctrl = 0
anim = 201


[State 4001, 1]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 4001, 2]
type = PlayerPush
trigger1 = Time >= 0
value = 0
ignorehitpause = 1

[State 4001, HitDef]
type = HitDef
trigger1 = !time
trigger1 = p2stateno != 5070
trigger1 = p2stateno != 5071
attr = S, SP
animtype = DiagUp
damage = 0
hitflag = MAF
guardflag = M
pausetime = 0, 3
sparkno = -1
sparkxy = 0,0
hitsound = -1
guardsound = 6,0
ground.type = High
ground.slidetime = 13
ground.hittime = 26
ground.velocity = -6,-5
guard.velocity = -6
air.velocity = -6,-5
airguard.velocity = -6,-1
down.velocity = -6,-6
down.hittime = 26
getpower = 0,0
fall = 1
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
p1stateno = 205
p2stateno = 215
kill = 0
ID = 5

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NA, SA, HA, NT, ST, HT, NP
ignorehitpause = 1

[State 4001, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 202
attr = SCA, SP, HP
ignorehitpause = 1

[State 4001, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, SP, HP
time = 1
ignorehitpause = 1

[State 4001, ChangeState]
type = ChangeState
trigger1 = parent, movetype = H
value = 202

[State 4001, DestroySelf]
type = DestroySelf
trigger1 = time >= 22
trigger2 = moveguarded

;Pump Line Hit Override
[Statedef 202]
type = A
movetype = A
physics = N
velset = 0,0

[State 4001, 1]
type = AssertSpecial
trigger1 = 1
flag = NoShadow
ignorehitpause = 1

[State 4001, 2]
type = PlayerPush
trigger1 = Time >= 0
value = 0
ignorehitpause = 1


[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA
ignorehitpause = 1

[State 4001, DestroySelf]
type = DestroySelf
trigger1 = time >= 0

;Pump Connects
[Statedef 205]
type = S
physics = N
movetype = A
ctrl = 0
velset = 0, 0
sprpriority = 1

[State 2,anim ]
type = ChangeAnim
trigger1 = 1
value = anim
elem = animelemno(0)
ignorehitpause = 1

[State 4101, Push]
type = playerpush
trigger1 = 1
value = 0

[State 4101, nothitby]
type = nothitby
trigger1 = 1
value = SCA
time = 1

[State 4101, spr]
type = sprpriority
trigger1 = 1
value = -1

[State 0, TargetState]
type = TargetState
trigger1 = parent, stateno = 211 && parent, time = 1
trigger1 = target(5), stateno = 217
value = 218
ID = 5

[State 0, TargetState]
type = TargetState
trigger1 = parent, stateno = 211 && parent, time = 1
trigger1 = target(5), stateno = 216
value = 217
ID = 5

[State 0, TargetState]
type = TargetState
trigger1 = parent, stateno = 211 && parent, time = 1
trigger1 = target(5), stateno = 215
value = 216
ID = 5
;ignorehitpause =
;persistent =

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = target(5), stateno = 218
trigger1 = target(5), time = 1
value = 2,2
volume = 255
channel = 1


[State 4101, End]
type = DestroySelf
trigger1 = !NumTarget(5)
trigger2 = parent, movetype = H
value = 4011


;Standby
[Statedef 210]
type = S
movetype = A
physics = S
ctrl = 0
anim = 210
velset = 0,0

[State 1000, ChangeState]
type = ChangeState
triggerall = NumHelper(201)
trigger1 = command = "a"
trigger2 = command = "hold_a" && time >= 30
value = 211

[State 1000, ChangeState]
type = ChangeState
trigger1 = time > 2 && !NumHelper(201)
value = 0
ctrl = 1

;Pumping
[Statedef 211]
type = S
movetype = A
physics = S
ctrl = 0
anim = 211
velset = 0,0

[State 1000, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 2,1
volume = 255
channel = 1

[State 1000, ChangeState]
type = ChangeState
trigger1 = !Animtime
value = 210

[State 1000, ChangeState]
type = ChangeState
trigger1 = time > 2 && !NumHelper(201)
value = 0
ctrl = 1


[Statedef 215]
type = A
movetype = H
physics = N
velset = 0, 0
sprpriority = 0
anim = 5010


[State 1114102, End]
type = selfstate
trigger1 = time >=90
value = 52

[Statedef 216]
type = A
movetype = H
physics = N
velset = 0, 0
sprpriority = 0
anim = 5010

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 1.75,1.5


[State 1114102, End]
type = changestate
trigger1 = time >=90
value = 215

[Statedef 217]
type = A
movetype = H
physics = N
velset = 0, 0
sprpriority = 0
anim = 5010

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 3,2


[State 1114102, End]
type = changestate
trigger1 = time >=90
value = 216

[Statedef 218]
type = A
movetype = H
physics = N
velset = 0, 0
sprpriority = 0
anim = 5000

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale = 3.3,2

[State YOU DED]
type = LifeSet
trigger1 = 1
value = 0
;ignorehitpause =
;persistent =

[State 0, Explod]
type = Explod
trigger1 = !time
anim = f3
ID = 3
pos = 0,-50
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 2,2
sprpriority = 6
ontop = 1
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State 0, Explod]
type = Explod
trigger1 = time = 10
anim = f3
ID = 3
pos = 0,-50
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 4,4
sprpriority = 6
ontop = 1
shadow = 0,0,0
ownpal = 0
removeongethit = 0

[State 1114102, End]
type = changestate
trigger1 = time >=20
value = 219

;Dead
[Statedef 219]
type = S
movetype = H
physics = N
ctrl = 0

[State PosSet]
type = PosSet
trigger1 = !time
y = 5000

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

[State SelfState]
type = SelfState
trigger1 = time = 1
value = 5150

;Jackhammer
[Statedef 250]
type = S
movetype = A
physics = N
ctrl = 0
anim = 250+(random%2)
velset = 0,0


[State 0, VelSet]
type = VelSet
trigger1 = command = "holdfwd"
x = 1

[State 0, VelSet]
type = VelSet
trigger1 = command = "holdback"
x = -1

[State 0, VelSet]
type = VelSet
trigger1 = command != "holdfwd" && command != "holdback"
x = 0


[State 1000, PlaySnd]
type = PlaySnd
trigger1 = time%6=0
value = 2,3
volume = 255
channel = 1

[State 0, EnvShake]
type = EnvShake
trigger1 = time%6=0
time = 4
freq = 60
ampl = -4
phase = 90

[State 1000, Helper]
type = Helper
trigger1 = time %6 = 0
trigger1 = random < 333
postype = back
pos = (random%320),-200
stateno = ifelse(random<10,253,ifelse((random=[10,100]),252,251))
bindtime = 1
ownpal = 1
name = "Pump line"
ID = 250

;[State 1000, ChangeState]
;type = ChangeState
;trigger1 = NumHelper(201)
;trigger1 = helper(201), movehit
;value = 210

[State 1000, ChangeState]
type = ChangeState
trigger1 = command != "hold_b"
value = 0
ctrl = 1

;Rock
[Statedef 251]
type = A
movetype = A
physics = N
anim = 252
ctrl = 0
velset = 0, 4*const(size.yscale)
hitdefpersist = 1

[State 0, ]
type = HitDef
trigger1 = !time
attr = S, NP
hitflag = MAFP
damage = 100
pausetime = 0, 0
sparkno = 3
sparkxy = 0, 0
hitsound = 5,4
ground.slidetime = 20
ground.hittime = 20
guard.velocity = -8.2
ground.velocity = -8.2
air.velocity = -6,-5.5
airguard.velocity = -1.5
air.fall = 1
fall.recover = 0

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NT, ST, HT
ignorehitpause = 1

[State 4001, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, AA, AP
time = 1
ignorehitpause = 1

[State 4001, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 256
attr = SCA, AA, AP
ignorehitpause = 1

[State 4001, DestroySelf]
type = ChangeState
trigger1 = Pos Y >=0 || movehit
value = 256

;Pooka
[Statedef 252]
type = A
movetype = A
physics = N
anim = 253
ctrl = 0
velset = 0, 2*const(size.yscale)
hitdefpersist = 1

[State 0, ]
type = HitDef
trigger1 = !time
attr = S, NP
hitflag = MAFP
damage = 300
pausetime = 0, 0
sparkno = 3
sparkxy = 0, 0
hitsound = 5,4
ground.slidetime = 20
ground.hittime = 20
guard.velocity = -8.2
ground.velocity = -8.2
air.velocity = -6,-5.5
airguard.velocity = -1.5
air.fall = 1
fall.recover = 0

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NT, ST, HT
ignorehitpause = 1

[State 4001, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, AA, AP
time = 1
ignorehitpause = 1

[State 4001, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 257
attr = SCA, AA, AP
ignorehitpause = 1

[State 4001, DestroySelf]
type = ChangeState
trigger1 = Pos Y >=0 || movehit
value = 258

;Fygar
[Statedef 253]
type = A
movetype = A
physics = N
anim = 253
ctrl = 0
velset = 0, 4*const(size.yscale)
hitdefpersist = 1

[State 0, ]
type = HitDef
trigger1 = !time
attr = S, NP
hitflag = MAFP
damage = 300
pausetime = 0, 0
sparkno = 3
sparkxy = 0, 0
hitsound = 5,4

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NT, ST, HT
ignorehitpause = 1

[State 4001, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, AA, AP
time = 1
ignorehitpause = 1

[State 4001, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 257
attr = SCA, AA, AP
ignorehitpause = 1

[State 4001, DestroySelf]
type = ChangeState
trigger1 = Pos Y >=0 || movehit
value = 258

;Rock
[Statedef 256]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
anim = 257

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA
ignorehitpause = 1

[State 4001, DestroySelf]
type = DestroySelf
trigger1 = !Animtime

;Rock
[Statedef 257]
type = A
movetype = I
physics = N
ctrl = 0
velset = -2*const(size.xscale),-2*const(size.yscale)
anim = 259

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


[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA
ignorehitpause = 1

[State 4001, DestroySelf]
type = DestroySelf
trigger1 = time = 60

;Pooka Bounces
[Statedef 258]
type = A
movetype = I
physics = N
ctrl = 0
velset = .5*const(size.xscale),-2*const(size.yscale)
anim = 253

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA
ignorehitpause = 1

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

[State 4001, DestroySelf]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 259

;Pooka Runs Away
[Statedef 259]
type = S
movetype = I
physics = N
ctrl = 0
velset = .5*const(size.xscale),0
anim = 258

[State 0, PosSet]
type = PosSet
trigger1 = !time
y = 0
;ignorehitpause =
;persistent =


[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA
ignorehitpause = 1

[State 4001, DestroySelf]
type = DestroySelf
trigger1 = FrontEdgeBodyDist < -70


;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------

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

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

[State 0, 1]
type = ChangeAnim
trigger1 = Anim = 20 
value = Anim
elem = animelemno(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 = 9997

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



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

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

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

[State 11, 1] ;Change from turning animation
type = ChangeState
trigger1 = 1
value = 0

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

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

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

[State 20, Turn]
Type = Turn
Trigger1 = Var(59) = 0
Trigger1 = Command != "holdfwd"
Trigger1 = Command  = "holdback"

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


[State 20, 3]
type = ChangeAnim
trigger1 = Anim != 20 
value = 20

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

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


; RUN_FWD
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1
ctrl = 0

[State 0, ]
type = NotHitBy
trigger1 = 1
value = SCA

[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 = time >= 20
value = 0
ctrl= 1

; RUN_FWD
[Statedef 105]
type    = S
physics = S
anim = 105
sprpriority = 1
ctrl = 0



[State 0, ]
type = NotHitBy
trigger1 = 1
value = SCA

[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 = time >= 20 || BackEdgeDist <= 10
value = 0
ctrl= 1

; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0


[State 5000, 6]
type = ChangeState
trigger1 = !alive && time = 2
value = 5150

[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

; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = 2
velset= 0,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 0, PlaySnd]
type = PlaySnd
trigger1 = anim != 5150
value = 10,0
volume = 255
channel = 1

[State 0, 1]
type = Pause
trigger1 = !time 
time = 120
movetime = 120

[State 9999, change]
type = changeanim
trigger1 = anim != 5150
value = 5150


[State 9999, change]
type = changeanim
trigger1 = time >= 140
value = 5150
elem = 6


[State 5150, 8]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------

[Statedef -2]

[State -3, 2]
type = hitoverride
trigger1 = 1
time = 1
attr = SCA, AA, AP
stateno = 9997
ignorehitpause = 1 

[State -3, 2]
type = assertspecial
trigger1 = 1
flag = nostandguard
flag2= Noairguard
flag3 = nocrouchguard
ignorehitpause = 1

[State -3, 2]
type = assertspecial
trigger1 = 1
flag = nokoslow
flag2 = NoAutoTurn
flag3 = NoMusic
ignorehitpause = 1

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

[State 9999, nothit]
type = hitby ;hitoverride
trigger1 = 1
value = SCA,AA, AP

[State 0, 1]
type = StopSND
trigger1 = roundstate = 2 
channel = 0

[State 0, Helper]
type = Helper
trigger1 = roundstate = 2 && !NumHelper(9995)
trigger1 = stateno !=[9997,10009]
helpertype = normal ;player
name = "Music Box"
ID = 9995
stateno = 9995
pos = 0,400
postype = back    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 99999999999999999999999999999999
pausemovetime = 99999999999999999999999999999999

[State 9999, 2]
type = changestate
trigger1 = !alive && stateno !=5150 && stateno !=9997 && stateno !=5000
value = 5150

;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

;[Statedef -3]

;Music Box
[Statedef 9995]
anim = 9010
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !time
value = S1,0
volume = 255
channel = 0
;lowpriority = -1
freqmul = 1.0
loop = 1
pan = 0
abspan = 0
;ignorehitpause =
;persistent =

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 0, StopSnd]
type = StopSnd
trigger1 = parent, stateno = 9997
trigger2 = roundstate > 3
channel = 0

[State 0, DestroySelf]
type = DestroySelf
trigger1 = parent, stateno = 9997
trigger2 = roundstate > 3
;ignorehitpause =
;persistent =


;Dead
[Statedef 9997]
anim = 5150
sprpriority = 2

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 0, StopSnd]
type = StopSnd
trigger1 = !time
channel = -1

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 10,0
volume = 255
channel = 1

[State 9999, nothit]
type = posfreeze
trigger1 = 1
value = 1


[State 9999, nothit]
type = nothitby ;hitoverride
trigger1 = 1
value = SCA,AA,AP
time = 7
;stateno = var(25)
ignorehitpause = 1

[State 9999, life]
type = lifeadd
trigger1 = !time 
value = -1

[State 0, 1]
type = Pause
trigger1 = !TIME
time = 120
movetime = 120
pausebg = 1

[State 9999, 2]
type = changestate
trigger1 = !animtime
trigger1 = !alive 
value = 5150

[State 9999, 2]
type = changestate
trigger1 = !animtime
trigger1 = alive 
value = 10000+(random%5)

;Player Spawn - Mario Bros.
[Statedef 10000]
type    = A
movetype= I
physics = N
anim = 0
ctrl = 0
velset = 0,0

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

[State 0, Helper]
type = Helper
trigger1 = !time
helpertype = normal ;player
name = "Platform"
ID = 1
stateno = 10015
pos = 0,0
postype = p1    ;p2,front,back,left,right
ownpal = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, PosSet]
type = PosSet
trigger1 = !time
x = 0
y = -1*(ScreenPos Y)
;ignorehitpause =
;persistent =

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

[State 0, VelSet]
type = VelSet
trigger1 = time < 60
y = 1

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

[State 0, ChangeState]
type = ChangeState
triggerall = time >= 60
trigger1 = command = "holdfwd" || command = "holdback"
trigger2 = time >= 240
value = 10010
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

;Player Spawn - Mega Man
[Statedef 10001]
type    = A
movetype= I
physics = N
anim = 352
ctrl = 0
velset = 0,0

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale =.75,.75

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

[State 0, Explod]
type = Explod
trigger1 = !time
anim = 351
pos = 160,100
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 90
ontop = 1
ownpal = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, PosSet]
type = PosSet
trigger1 = time <90
x = 0
y = -300
;ignorehitpause =
;persistent =

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

[State 0, ChangeState]
type = ChangeState
trigger1 = Pos Y >= 0  && Vel Y > 0
value = 10011
ctrl = 0
;anim =
;ignorehitpause =
;persistent =

;Player Spawn - Pac & Pal
[Statedef 10002]
type    = A
movetype= I
physics = N
anim = 354
ctrl = 0
velset = 0,0

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

[State 0, Turn]
type = Turn
trigger1 = !time && Random < 500
;ignorehitpause =
;persistent =

[State 0, PosAdd]
type = PosAdd
trigger1 = !time
x = FrontEdgeBodyDist + 50



[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 10
flag = invisible

[State 0, Helper]
type = Helper
trigger1 = !time
helpertype = normal ;player
name = "Miru"
ID = 1
stateno = 10016
pos = -60,0
postype = p1    ;p2,front,back,left,right
ownpal = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

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

[State 0, VelSet]
type = VelSet
trigger1 = time > 1
x = -2
;ignorehitpause =
;persistent =

[State 0, ChangeState]
type = ChangeState
triggerall = time >= 60
trigger1 = command = "a" || command = "b"
trigger2 = BackEdgeBodyDist <= 0
value = 0
ctrl = 1
;anim =
;ignorehitpause =
;persistent =

;Player Spawn - Balloon Kid
[Statedef 10003]
type    = A
movetype= I
physics = N
anim = 356
ctrl = 0
velset = 0,0

[State 0, ScreenBound]
type = ScreenBound
trigger1 = time < 10
value = 0
movecamera = 0,0
;ignorehitpause =
;persistent =

[State 0, Turn]
type = Turn
trigger1 = !time && Random < 500
;ignorehitpause =
;persistent =

[State 0, PosAdd]
type = PosAdd
trigger1 = !time
x = (-1*(BackEdgeBodyDist)) - 50
y = -120

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time < 5
flag = invisible

[State 0, Helper]
type = Helper
trigger1 = !time
helpertype = normal ;player
name = "Soundtrack"
ID = 1
stateno = 10017
pos = 0,0
postype = p1    ;p2,front,back,left,right
ownpal = 1

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

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

[State 0, VelSet]
type = VelAdd
trigger1 = command = "holdfwd"
x = .1

[State 0, VelSet]
type = VelAdd
trigger1 = AnimElemNo(0)=1
y = -.2

[State 0, VelSet]
type = VelSet
trigger1 = Vel X > 5
x = 5

[State 0, VelSet]
type = VelSet
trigger1 = Vel Y < -5
y = -5

[State 0, VelSet]
type = VelMul
trigger1 = command != "holdfwd"
x = .975

[State 0, VelSet]
type = VelAdd
trigger1 = 1
y = .05

[State 0, ChangeState]
type = ChangeAnim
triggerall = AnimElemtime(2) > 0
trigger1 = command = "a"
value = 356
elem = 1

[State 0, Offset]
type = PalFX
trigger1 = time >= 720 && time%4= 0
add = 255,-255, -255
time = 2

[State 20, Turn]
Type = Turn
Trigger1 = Var(59) = 0
Trigger1 = Command != "holdfwd"
Trigger1 = Command  = "holdback"

[State 0, ChangeState]
type = ChangeState
triggerall = time >= 30
trigger1 = command = "b"
trigger2 = time >= 800
value = 10010


[State 0, ChangeState]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >=0
value = 0
ctrl = 1

;Player Spawn - Altered Beast
[Statedef 10004]
type = A
movetype = A
physics = N
anim = 358
ctrl = 0
velset = 0, 0

[State 0, Turn]
type = Turn
trigger1 = facing = -1 && teamside = 1
trigger2 = facing && teamside = 2
;ignorehitpause =
;persistent =

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, PosSet]
type = PosSet
trigger1 = !time
x = ifelse(teamside = 2,70,-70)
y = -300
;ignorehitpause =
;persistent =

[State 0, VelSet]
type = VelSet
trigger1 = !time
y = 20

[State 0, ]
type = HitDef
trigger1 = !time
attr = S, NP
hitflag = MAFP
damage = 100
pausetime = 0, 0
sparkno = 3
sparkxy = 0, 0
hitsound = 5,4
ground.slidetime = 20
ground.hittime = 20
guard.velocity = -8.2
ground.velocity = -3.2,-20
air.velocity = -3.2,-20
airguard.velocity = -1.5
fall = 1
fall.recover = 0
yaccel = .49
kill = 0

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = Time >= 0
time = 1
value = SCA, NT, ST, HT
ignorehitpause = 1

[State 4001, HitBy]
type = HitBy
trigger1 = Time >= 0
value = SCA, AA, AP
time = 1
ignorehitpause = 1

[State 4001, HitOverride]
type = HitOverride
trigger1 = Time >= 0
slot = 1
time = 1
stateno = 256
attr = SCA, AA, AP
ignorehitpause = 1

[State 4001, DestroySelf]
type = ChangeState
trigger1 = Pos Y >=0
value = 10012

;Falling
[Statedef 10010]
type    = A
movetype= I
physics = A
anim = 41
ctrl = 0

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, Turn]
type = Turn
trigger1 = !time && Command = "holdback"

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

;Materialize
[Statedef 10011]
type    = S
movetype= I
physics = N
anim = 353
ctrl = 0
velset = 0,0



[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
scale =.75,.75

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

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

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

[State 0, ChangeState]
type = ChangeState
trigger1 = !Animtime
value = 0
ctrl = 1
;anim =
;ignorehitpause =
;persistent =

;Grave rising and all that jazz
[Statedef 10012]
type    = S
movetype= I
physics = N
anim = 358
ctrl = 0
velset = 0,0

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

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

[State 0, Explod]
type = Explod
trigger1 = !time
anim = 357
ID = 357
pos = 160,80
postype = left
removetime = 100
bindtime = -1
ontop = 1
sprpriority = 9
trans = addalpha
alpha = 128,128
ownpal = 1

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = time >= 0
ID = 357
scale = .75+(.15*sin(0.25*(time))),   .75+(.15*sin(0.25*(time)))
trans = addalpha
alpha = 128,128

[State 0, PosAdd]
type = PosAdd
triggerall = time >= 20
trigger1 = time%2=0
x = -2

[State 0, PosAdd]
type = PosAdd
triggerall = time >= 20
trigger1 = time%2=1
x = 2

[State 0, Offset]
type = PalFX
trigger1 = time >= 20 && time%4= 0
add = 255,255, -255
time = 2

[State 0, Explod]
type = Explod
trigger1 = time = 20
anim = 359
pos = 0,0
postype = p1
trans = addalpha
alpha = 128,128
ownpal = 1
removetime = 80
scale = const(size.xscale), const(size.yscale)

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

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

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 360
pos = 0,0
postype = p1
ownpal = 1
removetime = 60
sprpriority = 4
velocity = -3,-5
accel = 0, .5
scale = const(size.xscale), const(size.yscale)

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 361
pos = 0,0
postype = p1
ownpal = 1
removetime = 60
sprpriority = 4
velocity = 3,-5
accel = 0, .5
scale = const(size.xscale), const(size.yscale)

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 362
pos = 0,0
postype = p1
ownpal = 1
removetime = 60
sprpriority = 4
velocity = -5,-3
accel = 0, .5
scale = const(size.xscale), const(size.yscale)

[State 0, Explod]
type = Explod
trigger1 = time = 100
anim = 363
pos = 0,0
postype = p1
ownpal = 1
removetime = 60
sprpriority = 4
velocity = 5,-3
accel = 0, .5
scale = const(size.xscale), const(size.yscale)

[State 0, ChangeState]
type = ChangeState
trigger1 = time = 100
value = 0
ctrl = 1
;anim =
;ignorehitpause =
;persistent =

;Platform
[Statedef 10015]
type    = A
movetype= I
physics = N
anim = 350
ctrl = 0

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, BindToParent]
type = BindToParent
trigger1 = 1
time = 2
;facing = 0
pos = 0,0
;ignorehitpause =
;persistent =

[State 0, Offset]
type = PalFX
trigger1 = time >= 180 && time%4= 0
add = 255,-255, -255
time = 2


[State 0, DestroySelf]
type = DestroySelf
trigger1 = time >= 240
trigger2 = time > 45 && parent, stateno != 10000
;ignorehitpause =
;persistent =

;Miru Pulling Dig-Dug
[Statedef 10016]
type    = S
movetype= I
physics = N
anim = 355
ctrl = 0
sprpriority = -1

[State 0, Turn]
type = Turn
trigger1 = time = 1 && facing = (parent, facing)
;ignorehitpause =
;persistent =

[State 0, BindToParent]
type = BindToParent
trigger1 = parent, stateno = 10002
time = 1
facing = -1
pos = -7*const(size.xscale),0
;ignorehitpause =
;persistent =

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

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA
;value2 = S,NA
time = 1
;ignorehitpause =
;persistent =

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time > 60
trigger1 = FrontEdgeBodyDist < -70

;Music Box
[Statedef 10017]
anim = 9010
sprpriority = 2

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 3,6
volume = 255
channel = 0
;lowpriority = -1
freqmul = 1.0
loop = 1
pan = 0
abspan = 0
;ignorehitpause =
;persistent =

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nomusic

[State 0, StopSnd]
type = StopSnd
trigger1 = parent, stateno != 10003
trigger2 = roundstate > 3
channel = 0

[State 0, DestroySelf]
type = DestroySelf
trigger1 = parent, stateno != 10003
trigger2 = roundstate > 3
;ignorehitpause =
;persistent =

;-------------------
;MEE Template Files
;   provided by
;  Kitsune Sniper
;       ***
; Thanks, Kitsune!
;-------------------
