;---------------------------------------------------------------------------
; Rouge Flight ;Air jump
[Statedef 1006]
type    = A
movetype= I
physics = A
ctrl = 0
anim = 1006

[state 1005]
type = velset
trigger1 = time > 0
y = 0.1

[state 1005]
type = velset
trigger1 = vel X>= 2
x = 2

[state 1005]
type = velset
trigger1 = vel X<= -2
x = -2

[state 1005]
type = veladd
trigger1 = command = "holdfwd" && vel X<= 2
x = 0.3

[state 1005]
type = veladd
trigger1 = command = "holdback" && vel X>= -2
x = -0.3

[state 1005]
type = velset
trigger1 = command != "holdback" && command != "holdfwd"
x = 0

[state 1005]
type = turn
trigger1 = p2dist X< -30

[state 1005]
type = changestate
triggerall = time > 20
trigger1 = Pos Y >= -30
trigger2 = command = "holdup"
trigger3 = winko
value = 8000
ctrl = 0

[statedef 8000]
type = A
movetype = I
physics = A
anim = anim
ctrl = 0

[state 8000]
type = playsnd
trigger1 = time = 0
value = F65,2
volume = 255

[state 8000]
type = changestate
trigger1 = time = 1
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Rouge kick
[Statedef 230]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
velset = 0,0
anim = 230

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[State 230, 2]
type = HitDef
trigger1 = AnimElem = 2
attr = S, NA
animtype  = light
damage    = 10,5
guardflag = MA
pausetime = 3,11
sparkno = 0
sparkxy = 3,-18
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = low
ground.slidetime = 3
ground.hittime  = 20
ground.velocity = -2
air.velocity = -2.2,-3.2
getpower = 30,0
givepower = 0,30

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

; Rouge s Kick
[Statedef 231]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
velset = 0,0,0
anim = 231

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[State 231, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = S, NA
animtype  = light
damage    = 15
guardflag = MA
pausetime = 3,11
sparkno = 0
sparkxy = 2,-19
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = low
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1.5
air.velocity = -2.2,-3.2
getpower = 40,0
givepower = 0,40

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

; Rouge Sobat
[Statedef 232]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
velset = 0,0,0
anim = 232

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[State 232, 2]
type = HitDef
trigger1 = time = 0
attr = S, NA
animtype  = light
damage    = 20
guardflag = MA
sparkno = 0
sparkxy = -1,-10
pausetime = 3,11
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = low
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -1.5
air.velocity = -2.2,-3.2
getpower = 50,0
givepower = 0,50

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

;---------------------------------------------------------------------------
; Charlie Kick
[Statedef 233]
type    = S
movetype= A
physics = S
juggle  = 8
ctrl = 0
anim = 233

[State 233, ]
type = Explod
trigger1 = animelem = 3
anim = F150
ID = 150 
pos = 0,0
removetime = -2
sprpriority = 1
ontop = 1
ignorehitpause = 1
persistent = 1

[state 233]
type = playsnd
trigger1 = animelem = 2
value = F65,1
volume = 255

[State 233, 2]
type = HitDef
trigger1 = animelem = 3
attr = S, NA
animtype  = back
hitflag = MAF
damage    = 25
guardflag = MA
pausetime = 3,11
sparkxy = -4,-12
sparkno = 1
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 4,3)
guardsound = 6,0
ground.type = low
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -6,-8
air.velocity = -6,-8
p2stateno = 6025
p2getp1state = ifelse(p2name = "Robotnik and G-mel by Cyanide", 0, 1)
fall = 1
getpower = 60,0
givepower = 0,60

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


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

;---------------------------------------------------------------------------
; Secret Kick
[Statedef 234]
type    = S
movetype= A
physics = S
juggle  = 6
ctrl = 0
anim = 234

[State 410, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 1
volume = 255

[State 234, 2]
type = HitDef
trigger1 = Time = 0
attr = S, NA
damage    = 20
animtype  = up
hitflag = MAF
guardflag = MA
pausetime = 3,12
sparkxy = 0,-30
sparkno = 1
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = low
ground.slidetime = 10
ground.hittime  = 20
air.hittime = 30
ground.velocity = -0.2,-6.5
air.velocity = -1.3,-3
down.velocity = -4,0
down.hittime = 20
getpower = 50,0
givepower = 0,50

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

[State 234, 4]
type = ChangeState
trigger1 = command = "holdup" && (command != "holdfwd" || command != "holdback")
trigger1 = (movecontact)
value = 40
ctrl = 1

;---------------------------------------------------------------------------
; Agent eagle
[Statedef 618]
type    = A
movetype= A
physics = N
juggle  = 6
velset = 0,0
ctrl = 0
anim = 602

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[state 618]
type = velset
trigger1 = time > 14
trigger2 = movecontact > 10
y = -4

[state 618]
type = posset
trigger1 = pos Y< -100
y = -100

[State 618, 2]
type = HitDef
trigger1 = animelem = 2
attr = A, NA
damage    = 30
animtype  = light
hitflag = MAF
guardflag = MA
pausetime = 0,0
sparkxy = 0,-10
sparkno = 0
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = high
ground.slidetime = 4
ground.hittime  = 15
ground.velocity = -4,3
air.velocity = -1.3,3
down.velocity = -1.3,3
down.hittime = 20
air.fall = 1
fall = 0
getpower = 30,0
givepower = 0,30

[State 618, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 1006
ctrl = 0

;---------------------------------------------------------------------------
; Secret Spear
[Statedef 619]
type    = A
movetype= A
physics = N
juggle  = 6
velset = 5, -0.3
ctrl = 0
anim = 615

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[state 619]
type = velset
trigger1 = time > 0
x = 7

[state 619]
type = velset
trigger1 = time > 15
y = 0.3

[state 619, 2]
type = HitDef
trigger1 = animelem = 2
attr = S, NA
damage    = 30
animtype  = back
hitflag = MAF
guardflag = M
pausetime = 10,12
sparkxy = 0,-10
sparkno = 0
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = high
ground.slidetime = 4
ground.hittime  = 15
ground.velocity = -5
air.velocity = -4,-3
down.velocity = -4,0
down.hittime = 20
fall = 1
getpower = 30,0
givepower = 0,30

[State 619, 4]
type = ChangeState
trigger1 = Time = 30
value = 50
ctrl = 0

;---------------------------------------------------------------------------
;Homing cutter
[Statedef 620]
type    = A
movetype= A
physics = A
juggle  = 6
ctrl = 0
velset = 0,0
anim = 602

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F30, 8
volume = 200

[state 620]
type = velset
trigger1 = 1
x = 0
y = 0

[State 620, 2]
type = HitDef
trigger1 = animelem = 2
attr = A, NA
damage    = 30
animtype  = light
hitflag = MAF
guardflag = MA
pausetime = 3,3
sparkxy = 0,-5
sparkno = 0
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 1,0)
guardsound = 6,0
ground.type = high
ground.slidetime = 4
ground.hittime  = 15
ground.velocity = -2, 9
air.velocity = -2,9
down.velocity = -2,9
down.hittime = 20
fall = 1
air.fall = 1
down.bounce = 1
getpower = 20,0
givepower = 20,0

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

;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Beauty shock
[Statedef 1360]
type    = S
movetype= A
physics = S
juggle  = 2
ctrl = 0
velset = 0,0
anim = 1270

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1360, 0)

[state 1360]
type = helper
trigger1 = animelem = 6
helpertype = normal
name = "Shock"
ID = 1361
pos = 9,-10
stateno = 1361

[state 1360]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;Shock Ball
[statedef 1361]
type = S
movetype = A
physics = S
ctrl = 0
anim = 6000

[state 1010]
type = playsnd
trigger1 = uniqhitcount = 1 && (movehit)
trigger1 = parent, var(20) > 0
trigger1 = numexplod(410) = 0
value = F31,2
volume = 200
persistent = 0

[state 1010]
type = Explod
trigger1 = movehit
trigger1 = numexplod(410) = 0
trigger1 = parent, var(20) > 0
anim = F410
ID = 410 
pos = 0,-10
postype = p2
facing = -1
bindtime = -1
removetime = -2
sprpriority = 1
ontop = 1
ignorehitpause = 1
persistent = 0

[state 1361]
type = attackmulset
trigger1 = parent, var(20) = 1360
value = 2

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 5
volume = 255

[state 1361]
type = explod
trigger1 = time = 0
removetime = -2
removeongethit = 1
bindtime = -1
ID = 309
pos = 0,-7
anim = F309
ontop = 1
;vel = 2,0
;accel = 0.2,0

[state 1361]
type = velset
trigger1 = time >= 0
x = 1.2

[State 1361, 2]
type = HitDef
trigger1 = time = 0
attr = S, SP
damage    = 40
animtype  = back
hitflag = MA
guardflag = MA
pausetime = 0,12
sparkxy = 0,-15
sparkno = 1
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 4,3)
guardsound = 6,0
ground.type = high
ground.slidetime = 10
ground.hittime  = 10
ground.velocity = 0,-6
air.velocity = 0,-6
down.velocity = -4,0
down.hittime = 20
getpower = ifelse(parent, var(20) > 0, 150,70),0
givepower = 0,ifelse(parent, var(20) > 0, 300,70)

[state 1361]
type = destroyself
trigger1 = numexplod(309) = 0

;---------------------------------------------------------------------------
; Air B Shock
[Statedef 1370]
type    = A
movetype= A
physics = A
juggle  = 2
ctrl = 0
velset = 0, 0
anim = 1280

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1360, 0)

[state 1370]
type = helper
trigger1 = animelem = 5
helpertype = normal
name = "Shock"
ID = 1361
pos = 5, -10
stateno = 1361

[state 1370]
type = velset
trigger1 = time > 0
y = 0.1

[state 1370]
type = statetypeset
trigger1 = animelem = 11
statetype    = A
movetype= I
physics = A

[state 1370]
type = changestate
trigger1 = animtime = 0
trigger2 = Pos Y = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;Silent Size
[statedef 1380]
type = S
movetype = A
physics = S
juggle = 6
anim = 1300
velset = 0,0
ctrl = 0

[state 1010]
type = playsnd
trigger1 = uniqhitcount = 1 && (movehit)
trigger1 = var(20) > 0
trigger1 = numexplod(410) = 0
value = F31,2
volume = 200
persistent = 0

[state 1010]
type = Explod
trigger1 = movehit
trigger1 = numexplod(410) = 0
trigger1 = var(20) > 0
anim = F410
ID = 410 
pos = 0,-10
postype = p2
facing = -1
bindtime = -1
removetime = -2
sprpriority = 1
ontop = 1
ignorehitpause = 1
persistent = 0

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1380, 0)

[state 1380]
type = attackmulset
trigger1 = power >= 1000
value = 2

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 3
volume = 255

[State 1380, 2]
type = HitDef
trigger1 = time = 5
attr = S, HA
damage    = 40
animtype  = up
hitflag = MAF
guardflag = MA
pausetime = 0,12
sparkxy = 0,-15
sparkno = 1
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 4,3)
guardsound = 6,0
ground.type = trip
ground.slidetime = 10
ground.hittime  = 10
ground.velocity = -8,-6
air.velocity = -8,-6
down.velocity = -4,0
down.hittime = 20
fall = 1
p2stateno = 6025
p2getp1state = ifelse(p2name = "Robotnik and G-mel by Cyanide", 0, 1)
getpower = ifelse(var(20) > 0, 150,70),0
givepower = 0,ifelse(var(20) > 0, 300,70)

[State 1380, ]
type = Explod
trigger1 = animelem = 2
anim = F310
ID = 310
pos = -25,0
removetime = -2
removeongethit = 1
sprpriority = 1
ontop = 1
ignorehitpause = 1
persistent = 1

[state 1380]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Spiral Dive
[statedef 1390]
type = A
movetype = A
Physics = A
anim = 1290
ctrl = 0

[state 1010]
type = playsnd
trigger1 = uniqhitcount = 1 && (movehit)
trigger1 = var(20) > 0
trigger1 = numexplod(410) = 0
value = F31,2
volume = 200
persistent = 0

[state 1010]
type = Explod
trigger1 = movehit
trigger1 = numexplod(410) = 0
trigger1 = var(20) > 0
anim = F410
ID = 410 
pos = 0,-10
postype = p2
facing = -1
bindtime = -1
removetime = -2
sprpriority = 1
ontop = 1
ignorehitpause = 1
persistent = 0

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1390, 0)

[state 1390]
type = attackmulset
trigger1 = power >= 1000
value = 2

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 3
volume = 255

[state 1390]
type = velset
trigger1 = time > 4
x = 0
y = 4

[state 1390]
type = playerpush
trigger1 = 1
value = 0

[State 1390, 2]
type = HitDef
trigger1 = time = 12
attr = A, HA
damage    = 40
animtype  = up
hitflag = MAF
guardflag = MA
pausetime = 0,12
sparkxy = 0,-15
sparkno = 1
hitsound   = ifelse(enemy, animexist(7997), 8,5),ifelse(enemy, animexist(7996), 4,3)
guardsound = 6,0
ground.type = trip
ground.slidetime = 10
ground.hittime  = 10
ground.velocity = -1,-7
air.velocity = -1.3,-7
down.velocity = -4,0
down.hittime = 20
fall = 1
getpower = ifelse(var(20) > 0, 150,70),0
givepower = 0,ifelse(var(20) > 0, 300,70)

[state 1390]
type = changestate
trigger1 = Pos Y >= -2
value = 50
ctrl = 0

;---------------------------------------------------------------------------
;Bat cracker
[statedef 1400]
type = S
movetype = A
physics = S
anim = 1270
velset = 0,0
ctrl = 0

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1400, 0)

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 4
volume = 255

[state 1400]
type = helper
trigger1 = animelem = 7
helpertype = normal
name = "Robat"
ID = 1401
pos = 5,-25
stateno = 1401
keyctrl = 0
ownpal = 1

[state 1400]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1

;Air b Cracker
[statedef 1410]
type = A
movetype = A
physics = N
anim = 1280
ctrl = 0
velset = 0,0

[state 1360]
type = poweradd
trigger1 = time = 1
value = ifelse(power >= 1000, -1000, -50)

[state 1360]
type = varset
trigger1 = time = 0
v = 20
value = ifelse(power >= 1000, 1400, 0)

[state 1410]
type = velset
trigger1 = time > 0
y = 0.2

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F65, 4
volume = 255

[state 1410]
type = helper
trigger1 = animelem = 7
helpertype = normal
name = "Robat"
ID = 1401
pos = 5,-25
stateno = 1401
keyctrl = 0
ownpal = 1

[state 1410]
type = changestate
trigger1 = animtime = 0
trigger2 = Pos Y> 0
value = 50
ctrl = 0

;Robat/bat cracker
[statedef 1401]
type = S
movetype = I
physics = S
ctrl = 0
anim = 1281
velset = 0,0

[state 1401]
type = varset
trigger1 = parent, var(20) = 1400
v = 21
value = 1

[state 1401]
type = varset
trigger1 = parent, var(20) != 1400
v = 21
value = 0

[state 1341]
type = hitoverride
trigger1 = 1
attr = SCA, AA, AP, AT
stateno = 1056

[state 1401]
type = velset
trigger1 = pos Y< -70
y = 1

[state 1401]
type = velset
trigger1 = pos Y> -70
y = -1

[state 1401]
type = velset
trigger1 = pos Y= -70
y = 0

[state 1401]
type = velset
trigger1 = p2bodydist X> -31
x = 1

[state 1401]
type = turn
trigger1 = p2bodydist X< -30

[state 1341]
type = changestate
trigger1 = p2dist X< 20 && p2dist X> -20
trigger1 = p2dist Y< 20 && p2dist Y> -10
trigger2 = parent, time < 5 && (parent, stateno = 1400 || parent, stateno = 1410)
value = 1056
ctrl = 0

;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 60100]
type    = A
physics = A
anim = 60100
sprpriority = 1

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F21, 0
volume = 255

[State 60100, 3]
type = Explod
trigger1 = time = 0
anim = F170
ID = 170
pos = 0,5
bindtime = 1
removetime = -2
ontop = 1
ownpal = 1
supermove = 1

[State 60100, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.fwd.x) + 3
y = const(velocity.run.fwd.y) - 1

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

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

; RUN_BACK
[Statedef 60105]
type    = A
physics = A
ctrl = 0
anim = 60105
sprpriority = 1

[State 230, 2]
type = PlaySnd
trigger1 = Time = 1
value = F21, 0
volume = 255

[State 60105, 3]
type = Explod
trigger1 = time = 0
anim = F171
ID = 171
pos = 0,5
bindtime = 1
removetime = -2
ontop = 1
ownpal = 1
supermove = 1

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

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

[State 60100, 3]
type = AssertSpecial
trigger1 = 1
flag = NoAirguard

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

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