[Data]
life = 1000
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 60
airjuggle = 15
sparkno = 2
guard.sparkno = 40
KO.echo = 0
volume = 0
IntPersistIndex = 60
FloatPersistIndex = 40

[Size]
xscale = 1           ;Horizontal scaling factor.
yscale = 1           ;Vertical scaling factor.
ground.back = 15     ;Player width (back, ground)
ground.front = 16    ;Player width (front, ground)
air.back = 12        ;Player width (back, air)
air.front = 12       ;Player width (front, air)
height = 60          ;Height of player (for opponent to jump over)
attack.dist = 160    ;Default attack distance
proj.attack.dist = 90 ;Default attack distance for projectiles
proj.doscale = 0     ;Set to 1 to scale projectiles too
head.pos = -2, -48   ;Approximate position of head
mid.pos = -1, -24    ;Approximate position of midsection
shadowoffset = 0     ;Number of pixels to vertically offset the shadow
draw.offset = 0,0    ;Player drawing offset in pixels (x, y)

[Velocity]
walk.fwd  = 3.0     ;Walk forward
walk.back = -3.0     ;Walk backward
run.fwd  = 6.5, 0    ;Run forward (x, y)
run.back = -6.0,-3.8 ;Hop backward (x, y)
jump.neu = 0,-9.5    ;Neutral jumping velocity (x, y)
jump.back = -3.0    ;Jump back Speed (x, y)
jump.fwd = 3.0       ;Jump forward Speed (x, y)
runjump.back = -3.00,-8.1 ;Running jump speeds (opt)
runjump.fwd = 5,-6.5      ;.
airjump.neu = 0,-8.1      ;.
airjump.back = -2.55      ;Air jump speeds (opt)
airjump.fwd = 2.5         ;.

[Movement]
airjump.num = 0      ;Number of air jumps allowed (opt)
airjump.height = 35  ;Minimum distance from ground before you can air jump (opt)
yaccel = .44         ;Vertical acceleration
stand.friction = .85  ;Friction coefficient when standing
crouch.friction = .82 ;Friction coefficient when crouching

;---------------------------------------------------------------------------
; Variable usage:
; This is a record of the variables that KFM uses. Keeping a record of your
; variable usage helps you avoid careless mistakes later.
; var(1)  - Used in kfm.cmd for combo condition (updated every tick)
; var(2)  - Used in Kung Fu Throw (state 800) to remember if fwd was being
;           held (remembered from state 800 through state 810).


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

[state -2, Helper]
Type     = Helper
Trigger1 = !NumHelper(990)
PosType  = P1
Pos      = -48, -60
ID       = 990
StateNo  = 990
OwnPal   = 1
;pausemovetime = 99999
Name     = "Kyoob"

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

[State 0, 1]
type = ChangeAnim
trigger1 = Anim = 0
trigger1 = !animtime
value = random%2

[State 0, 1]
type = changeanim
triggerall = anim != 2 && anim != 5
trigger1 = enemynear,pos y <= -35
trigger2 = enemynear,const(size.head.pos.y) <= -120
trigger2 = enemynear,anim != [10,12]
trigger2 = enemynear,statetype != L
value = 2

[State 0, 1]
type = changeanim
triggerall = anim = 2
trigger1 = enemynear,pos y > -35
trigger1 = enemynear,const(size.head.pos.y) > -120
trigger2 = enemynear,anim = [10,12]
trigger2 = enemynear,const(size.head.pos.y) <= -120
trigger3 = enemynear,statetype = L
trigger3 = enemynear,const(size.head.pos.y) <= -120
value = 3

[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) < Const(movement.stand.friction.threshold)
trigger2 = Time = 4
x = 0

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

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

[State 40, 1]
type = VarSet
trigger1 = Time = 0
trigger2 = var(59)
trigger2 = p2bodydist x = [-10,10]
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdforward"
trigger2 = var(59)
trigger2 = p2bodydist x > 10
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdbackward"
trigger2 = var(59)
trigger2 = p2bodydist x < -10
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 = const(velocity.jump.y)

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

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

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

[state 1000]
type = playsnd
trigger1 = time = 0
value = S50,0
volumescale = 125

[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 1000]
type = changestate
triggerall = !var(59)
trigger1 = command = "holdbwd" && time > 15
value = 68
ctrl = 1

[state 1000]
type = changestate
triggerall = !var(59)
trigger1 = command = "holdup" && time > 15
value = 69
ctrl = 1

[State 50, 3]
type = ChangeAnim
trigger1 = Vel y > Const720p(-8)
trigger1 = SelfAnimExist(anim + 3)
trigger1 = anim >= 41 && anim <= 43
persistent = 0
value = Anim + 3

;BWD Float
[Statedef 68]
type    = A
physics = N
;ctrl = 0
anim = 51

[state 1000]
type = playsnd
trigger1 = time = 0
value = S150,0+random%2
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 3
trigger2 = animelem = 7
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 15
trigger6 = animelem = 19
trigger7 = animelem = 21
trigger8 = animelem = 23
trigger9 = animelem = 27
value = S3,1
volumescale = 125

[state 1000]
type = velset
trigger1 = 1
;x = 0.50
y = -3.5

[state 1000]
type = changestate
trigger1 = animtime = 0
trigger2 = command !="holdup"
value = 70

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


;FWD Float
[Statedef 69]
type    = A
physics = N
;ctrl = 0
anim = 50

[state 1000]
type = playsnd
trigger1 = time = 0
value = S150,0+random%2
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 3
trigger2 = animelem = 7
trigger3 = animelem = 9
trigger4 = animelem = 13
trigger5 = animelem = 15
trigger6 = animelem = 19
trigger7 = animelem = 21
trigger8 = animelem = 23
trigger9 = animelem = 27
value = S3,1
volumescale = 125

[state 1000]
type = velset
trigger1 = 1
;x = 0.50
y = -3.5

[state 1000]
type = changestate
trigger1 = animtime = 0
trigger2 = command !="holdup"
value = 70

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

;FWD Float Done
[Statedef 70]
type    = A
physics = A
;ctrl = 0

[state 1000]
type = changeanim
trigger1 = time = 0
value = 635

;BWD Float Done
[Statedef 71]
type    = A
physics = A
;ctrl = 0

[state 1000]
type = changeanim
trigger1 = time = 0
value = 636

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

[state 1000]
type = playsnd
trigger1 = time = 0
value = S100,1
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 4
value = S100,0
volumescale = 125

[state 1000]
type = gameMakeAnim
trigger1 = time = 0
pos = 0,0
value = 120
ignorehitpause = 1

[State 100, 1b]
type = VelSet
trigger1 = time > 3
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, Jump]
type = changestate
triggerall = time > 4
trigger1 = command = "holdup"
trigger1 = !var(59)
value = 40

[State 100, 4]
type = ChangeState
triggerall = time > 3
trigger1 = command != "holdforward"
trigger1 = !var(59)
trigger2 = p2bodydist X <= 24 || p2movetype = A
trigger2 = var(59)
value = 101

;Skidding
[Statedef 101]
type = S
movetype = I
physics = S
anim = 101
ctrl = 0
sprpriority = 1

[state 1000]
type = playsnd
trigger1 = time = 0
value = S101,0
volumescale = 125

[state 1000]
type = veladd
trigger1 = time = 0
x = 1.8

[state 1000]
type = gameMakeAnim
trigger1 = animelem = 1
trigger2 = animelem = 2
trigger3 = animelem = 3
pos = 0,0
value = 120
ignorehitpause = 1

[State 0, CtrlSet]
type = CtrlSet
trigger1 = time >= 5
value = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = time = 16
value = 102
ctrl = 1

;Get up
[Statedef 102]
type = S
movetype = I
physics = S
anim = 102
ctrl = 0
sprpriority = 1

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

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

[state 1000]
type = gameMakeAnim
trigger1 = time = 0
pos = 0,0
value = 120
ignorehitpause = 1

[state 1000]
type = nothitby
trigger1 = time = 0
time = 12
value = SCA
ignorehitpause = 1

[State 200, 2]
type = PlaySnd
trigger1 = animelem = 2
value = 100,0
volumescale = 125

[State 200, 2]
type = PlaySnd
trigger1 = animelem = 2
value = 150,0
volumescale = 125

[State 100, 1b]
type = VelSet
trigger1 = time > 1 && time < 21
x = const(velocity.run.back.x)

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

[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 0, ChangeState]
type = ChangeState
trigger1 = command = "holddown"
trigger1 = !animtime
value = 11
ctrl = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = command != "holddown"
trigger1 = !animtime
value = 0
ctrl = 1

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

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

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

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

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = !AILevel
trigger1 = command != "holddown"
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = S
physics = S

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

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

;---------------------------------------------------------------------------
; Stand guard (guarding)
[Statedef 130]
type    = S
physics = S

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

[State 130, Hi to Lo]
type = ChangeState
trigger1 = command = "holddown"
trigger1 = !AILevel
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
value = 131

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

;---------------------------------------------------------------------------
; Crouch guard (guarding)
[Statedef 131]
type    = C
physics = C

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

[State 131, Lo to Hi]
type = ChangeState
trigger1 = command != "holddown"
trigger1 = !AILevel
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = !AILevel
trigger1 = command != "holdbackward"
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 = "holdbackward" || (var(59)>0)
trigger1 = inguarddist
value = 130

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

[State 132, Stop Guarding]
type = ChangeState
trigger1 = !AILevel
trigger1 = command != "holdbackward"
trigger2 = !inguarddist
value = 140


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

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

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(StateType=C)

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = !AILevel
trigger1 = command != "holddown"
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = S
physics = S

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

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

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

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

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = !AILevel
trigger1 = command != "holddown"
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = S
physics = S

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

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

[State 152, 1]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(StateType=C)

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = !AILevel
trigger1 = command != "holddown"
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = S
physics = S

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

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

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

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

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel
trigger2 = (abs(P2Dist X)>120) || (P2MoveType=H) || (P2StateType=C)
trigger2 = P2StateType!=A
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = !AILevel
trigger1 = command != "holddown"
trigger2 = AILevel
trigger2 = p2statetype = A
trigger2 = abs(P2BodyDist X)<50
trigger2 = AIlevel = 3 && random <= 32 || AIlevel = 4 && random <= 64 || AIlevel = 5 && random <= 72 || AIlevel = 6 && random <= 94 || AIlevel = 7 && random <=250 || AIlevel = 8 && random <= 999
statetype = S
physics = S

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

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

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

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

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

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

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

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

[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
trigger1 = !AILevel
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, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdbackward" || var(59)>0
trigger1 = inguarddist
value = 130

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

;Counter!
[Statedef 160]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= -1000
ctrl = 0
velset = 0,0
anim = 1000
sprpriority = 2

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

[State 0, PalFX]
type = PalFX
trigger1 = time = 0
time = 2
add = 256,256,256
mul = 256,256,256
invertall = 0
color = 256
ignorehitpause = 1

[state 1000]
type = playsnd
trigger1 = time = 2
value = S60,4
volumescale = 125

[state 1000]
type = playsnd
trigger1 = time = 2
value = S200,2
volumescale = 125
channel = 3

[state 1000]
type = velset
trigger1 = time = 2
x = -12

[state 1000]
type = varadd
trigger1 = numhelper(1501)
var(20) = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
triggerall = var(20) <= 1
trigger1 = time = 2
helpertype = normal
name = "Kyoob Blast"
id = 1501
facing = 1
pos = 0,0
postype = p1
stateno = 1501
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 200, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Lose by Time Over
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

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

;---------------------------------------------------------------------------
; Win state decider
; CNS difficulty: basic
; CNS レベル: 基本
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = Time = 0
value = 181

;---------------------------------------------------------------------------
; Win pose 1 - Empty
[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 200, 1]
type = PlaySnd
trigger1 = animelem = 5
value = S180, 0
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 20
trigger1 = life < 800
value = S180,1
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 20
trigger1 = life >= 800
value = S180,2
volumescale = 125

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

;Intro decider
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

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

[State 0, ChangeState]
type = changestate
trigger1 = p2name = "FP2 Milla Basset"
value = 192
ctrl = 0

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

;---------------------------------------------------------------------------
; Introduction - Here we go
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

[State 191, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro

[state 1000]
type = playsnd
trigger1 = time = 0
value = S190,0
volumescale = 125

[state 1000]
type = playsnd
trigger1 = time = 0
value = S60,1
volumescale = 125

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 22
add = 84,84,84
sinadd = 92,92,92,5

[state 1000]
type = explod
trigger1 = !time
anim = 251
ontop = 0
pos = 0,0
postype = p1
removetime = 12
bindtime = -1
removeongethit = 1
ownpal = 1
sprpriority = -1
scale = 1.00,1.00
ID = 69

[State 0, Kyoob]
type = helper
trigger1 = time = 0
helpertype = normal
stateno = 1991
ID = 1991
name = "Kyoob"
postype = p1
pos = 0, -35
ownpal = 1

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = animtime = 0
value = 0

; Introduction - Mirror
[Statedef 192]
type = S
ctrl = 0
anim = 191
velset = 0,0

[State 191, 2] ;Assert this until you want "round 1, fight" to begin
type = AssertSpecial
trigger1 = 1
flag = Intro

[state -2, Helper]
Type     = Helper
Trigger1 = !NumHelper(990)
PosType  = P1
Pos      = -48, -60
ID       = 990
StateNo  = 990
OwnPal   = 1
;pausemovetime = 99999
Name     = "Kyoob"

[State 191, 3] ;Change to stand state when done
type = ChangeState
trigger1 = animtime = 0
value = 0
;---------------------------------------------------------------------------
;Fuckin' kyoob
[Statedef 1991]
type = A
ctrl = 0
anim = 7000

[state 1000]
type = velset
trigger1 = time = 0
x = 4.7
y = -1.8

[state 1000]
type = velset
trigger1 = time = 12
x = -3.5
y = -1.8

[state 1000]
type = velset
trigger1 = time = 28
x = 0
y = 0

[state 1000]
type = velset
trigger1 = time = 32
x = -4.7
y = 2.66

[state 1000]
type = destroyself
trigger1 = root, stateno != 191



;Weak Punch
[Statedef 200]
type    = S                      ;State-type: S-stand, C-crouch, A-air, L-liedown
movetype= A                      ;Move-type: A-attack, I-idle, H-gethit
physics = S                      ;Physics: S-stand, C-crouch, A-air
juggle  = 0                      ;Number of air juggle points move takes
;Commonly-used controllers:
velset = 0,0                     ;Set velocity (x,y) (Def: no change)
ctrl = 0                         ;Set ctrl (Def: no change)
anim = 200                       ;Change animation (Def: no change)
poweradd = 0                    ;Power to add (Def: 0)
sprpriority = 2                  ;Set p1's sprite layering priority to 2 (in front)

[State 200, 1]
type = HitDef
trigger1 = time = 0
attr = S, NA
damage = ceil(ifElse(fvar(11) * 16 < 7, 7, fvar(11) * 16)), 0
getpower = 72,36
givepower = 36,36
animtype = Light
guardflag = M
hitflag = MAF
pausetime = 7, 7
sparkNo = 0
guard.sparkNo = 40
sparkXY = -10,-40
hitsound = 5,0
guardsound = 6,0
ground.type = High
ground.slidetime = 10
ground.hittime  = 13
ground.velocity = -2
air.type = low
air.velocity = -2,-2
air.hittime = 15
yaccel = 0.5
ID = 200

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 210
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 210
ctrl = 0

[State 200, 1]
type = PlaySnd
trigger1 = animelem = 2
value = 0, 0
volumescale = 125

[State 200, 1]
type = PlaySnd
trigger1 = animelem = 2
value = S150, 0
volumescale = 125

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

;---------------------------------------------------------------------------
;Medium Kick
[Statedef 210]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 210
sprpriority = 2

[State 210, 1]
type = PlaySnd
trigger1 = animelem = 2
value = 0, 1
volumescale = 125

[State 200, 1]
type = PlaySnd
trigger1 = animelem = 2
value = S200, 1
volumescale = 125

[State 200, 1]
type = HitDef
trigger1 = time = 0
attr = S, NA
damage = ceil(ifElse(fvar(11) * 32 < 7, 7, fvar(11) * 32)), 0
getpower = 72,36
givepower = 36,36
animtype = Medium
guardflag = M
hitflag = MAF
pausetime = 8, 8
sparkNo = 1
guard.sparkNo = 40
sparkXY = -10,-20
hitsound = 5,1
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 17
ground.velocity = -2.5
air.type = low
air.velocity = -2.5,-2
air.hittime = 25
Air.fall = 0
fall.recover = 0
yaccel = 0.5
ID = 210

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 401
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 401
ctrl = 0

[State 210, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;Strong kick
[Statedef 230]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 230
sprpriority = 2

[state 1000]
type = veladd
trigger1 = 1
y = .42

[state 1000]
type = velset
trigger1 = time = 0
x = 1.5
y = -6.5

[State 210, 1]
type = PlaySnd
triggerall = anim = 230
trigger1 = animelem = 2
value = 0, 1
volumescale = 125

[State 200, 2]
type = playsnd
trigger1 = anim = 230
trigger1 = animelem = 2
value = S200,0 +random%3
volumescale = 125

[State 200, 1]
type = HitDef
triggerall = anim = 230
trigger1 = animelem = 2
trigger2 = animelem = 3
attr = S, SA
damage = ceil(ifElse(fvar(11) * 18 < 7, 7, fvar(11) * 18)), 0
getpower = 72,36
givepower = 36,36
animtype = diagup
guardflag = M
hitflag = MAF
priority = 4, hit
pausetime = 7, 7
sparkNo = 1
guard.sparkNo = 40
sparkXY = -10,-45
hitsound = 5,1
guardsound = 6,0
ground.type = low
ground.slidetime = 30
ground.hittime  = 40
ground.velocity = -2.5,-6.9
guard.ctrltime = 3
guard.velocity = -3
air.type = low
air.velocity = -2.5,-6.9
airguard.velocity = -3.5,-6.5
air.hittime = 40
fall = 1
air.fall = 1
fall.recover = 0
yaccel = 0.43
ID = 230

[state 1000]
type = changeanim
trigger1 = anim = 230
trigger1 = animtime = 0
value = 635

[State 0, ChangeState]
type = null
triggerall = !var(59)
triggerall = movecontact && time >= 8
triggerall = power >= 250
trigger1 = command = "BDP_x"
value = 1200
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = movecontact && time >= 8
trigger1 = command = "x"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 600
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = power >= 800
triggerall = movecontact && time >= 8
trigger1 = var(59)
trigger1 = random<var(50)*2.0
value = 1020
ctrl = 0

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

;Dodge
[Statedef 250]
type    = S
movetype= I
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 250
sprpriority = -1

[State 1120, Blink]
type = PalFX
trigger1 = anim = 250
trigger1 = Time = 0
time = 22
add = 84,84,84
sinadd = 92,92,92,5

[State 700, Voice]
type = Playsnd
trigger1 = time = 2
value = S2,0
volume = 255
channel = 0
volumescale = 125

[state 1000]
type = explod
trigger1 = !time
anim = 251
ontop = 0
pos = 0,0
postype = p1
removetime = 12
bindtime = -1
removeongethit = 1
ownpal = 1
sprpriority = -1
scale = 1.00,1.00
ID = 69

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

[State 700, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AT
time = 1

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

[Statedef 255]
type    = A
movetype= H
physics = N

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

[State 1026, Velocity]
type = VelSet
trigger1 = Time = 0
x = -14
y = -12

[State 1026, Gravity]
type = VelAdd
trigger1 = 1
y = .45

[State 1026, No scroll]
type = ScreenBound
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist < 65
trigger2 = FrontEdgeBodyDist < 65
value = 1
movecamera = 0,1

[State 1026, Hit wall]
type = ChangeState
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist <= 20
trigger2 = FrontEdgeBodyDist <= 20
value = 257

[State 1026, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

; Hit by Fast Kung Fu Palm - flying through the air
; (a custom gethit state)
[Statedef 256]
type    = A
movetype= H
physics = N

[State 1026, Velocity]
type = VelSet
trigger1 = Time = 0
x = -14
y = -12

[State 1026, Gravity]
type = VelAdd
trigger1 = 1
y = .45

[State 1026, No scroll]
type = ScreenBound
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist < 65
trigger2 = FrontEdgeBodyDist < 65
value = 1
movecamera = 0,1

[State 1026, Hit wall]
type = ChangeState
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist <= 20
trigger2 = FrontEdgeBodyDist <= 20
value = 257

[State 1026, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

;------------------
; Hit by Fast Kung Fu Palm - hit wall
; (a custom gethit state)
[Statedef 257]
type    = A
movetype= H
physics = N

[State 1027, Turn]
type = Turn
trigger1 = (Time = 0) && (FrontEdgeBodyDist <= 30)

[State 1027, Pos]
type = PosAdd
trigger1 = Time = 0
x = 15 - BackEdgeBodyDist

[State 1027, Stop moving]
type = PosFreeze
trigger1 = 1
x = 1
y = 1

[State 1027, No scroll]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,1

[State 1027, Spark]
type = Explod
trigger1 = Time = 0
anim = F72
pos = 0, floor (screenpos y) - 50
postype = back
sprpriority = 3

[State 1027, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 256

[State 1027, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,3
volumescale = 125

[state 1000]
type = envshake
trigger1 = time = 0
time = 10

[State 1027, State]
type = ChangeState
trigger1 = AnimTime = 0
value = 258

;------------------
; Hit by Fast Kung Fu Palm - bounce off wall
; (a custom gethit state)
[Statedef 258]
type    = A
movetype= H
physics = N

[State 1028, 1]
type = NotHitBy
trigger1 = 1
value = , NA, NP

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

[State 1028, Vel X]
type = VelSet
trigger1 = Time = 0
x = 0.4

[State 1028, Turn]
type = Turn
trigger1 = (Time = 0) && (BackEdgeDist < 30)

[State 1028, Gravity]
type = VelAdd
trigger1 = 1
y = .55

[State 1028, Anim 5050] ;Self falling animation
type = ChangeAnim
trigger1 = Time = 0
trigger1 = !SelfAnimExist(5052)
value = 5050

[State 1028, Anim 5052] ;Self falling animation (diagup type)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5052)
value = 5052

[State 1028, Anim 5060] ;Coming down - normal
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5050
trigger1 = SelfAnimExist(5060)
persistent = 0
value = 5060

[State 1028, Anim 5062] ;Coming down - diagup type
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5052
trigger1 = SelfAnimExist(5062)
persistent = 0
value = 5062

[State 1028, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

;Forward Dodge
[StateDef 260]
type = S
physics = N
moveType = I
anim = 260
ctrl = 0
velSet = 0,0
sprPriority = -1

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

[State 710, HitBy]
type = HitBy
trigger1 = AnimElemTime(11)<0
value = SCA,AT
time = 1

[State 710, Start Roll]
type = VelSet
trigger1 = AnimElem = 1
x = 5

[State 710, Start Roll]
type = VelSet
trigger1 = AnimElem = 9
x = 2.0

;[State 710, End Roll]
;type = VelSet
;trigger1 = AnimElem = 9
;x = 0

[State 1120, Blink]
type = PalFX
trigger1 = anim = 260
trigger1 = Time = 0
time = 22
add = 84,84,84
sinadd = 92,92,92,5

[State 700, Voice]
type = Playsnd
trigger1 = time = 2
value = S2,0
volume = 255
channel = 0
volumescale = 125

[state 1000]
type = explod
trigger1 = !time
anim = 251
ontop = 0
pos = 0,0
postype = p1
bindtime = -1
removetime = 12
removeongethit = 1
ownpal = 1
sprpriority = -1
scale = 1.00,1.00
ID = 69

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

;Backward Dodge
[StateDef 261]
type = S
physics = N
moveType = I
anim = 261
ctrl = 0
velSet = 0,0
sprPriority = -1

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

[State 710, HitBy]
type = HitBy
trigger1 = AnimElemTime(11)<0
value = SCA,AT
time = 1

[State 710, Start Roll]
type = VelSet
trigger1 = AnimElem = 1
x = -5

[State 710, Start Roll]
type = VelSet
trigger1 = AnimElem = 9
x = -2.0

;[State 710, End Roll]
;type = VelSet
;trigger1 = AnimElem = 9
;x = 0

[State 1120, Blink]
type = PalFX
trigger1 = anim = 261
trigger1 = Time = 0
time = 22
add = 84,84,84
sinadd = 92,92,92,5

[State 700, Voice]
type = Playsnd
trigger1 = time = 2
value = S2,0
volume = 255
channel = 0
volumescale = 125

[state 1000]
type = explod
trigger1 = !time
anim = 251
ontop = 0
pos = 0,0
postype = p1
bindtime = -1
removetime = 12
removeongethit = 1
ownpal = 1
sprpriority = -1
scale = 1.00,1.00
ID = 69

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

;Digging
[Statedef 450]
type    = C
movetype= A
physics = C
juggle  = 4
poweradd= 0
ctrl = 0
anim = 400
sprpriority = 2

[state 1000]
type = veladd
trigger1 = prevstateno = 100 && time = 0
x = 3

[State 400, 1]
type = PlaySnd
trigger1 = animelem = 2
value = S100, 0
volumescale = 125

[State 400, 1]
type = PlaySnd
trigger1 = animelem = 5
value = S100, 2
volumescale = 125

[State 200, 1]
type = HitDef
trigger1 = animelem = 2
trigger2 = animelem = 5
attr = C, NA
damage = ceil(ifElse(fvar(11) * 20 < 10, 10, fvar(11) * 20)), 0
getpower = 72,36
givepower = 36,36
animtype = Light
guardflag = L
hitflag = MAFD
pausetime = 5, 5
sparkNo = 0
guard.sparkNo = 40
sparkXY = -5,-10
hitsound = 5,0
guardsound = 6,0
ground.type = low
ground.slidetime = 10
ground.hittime  = 13
ground.velocity = -2
air.type = low
air.velocity = -2,-2
air.hittime = 15
down.velocity = -2,0
down.hittime = 20
yaccel = 0.42
ID = 400

[State 400, 4]
type = ChangeState
trigger1 = movecontact && time > 9
trigger1 = command = "x" && command != "holddown"
value = 200
ctrl = 0

[State 400, 4]
type = ChangeState
trigger1 = movecontact && time > 12
trigger1 = command = "x" && command = "holddown"
value = 400
ctrl = 0

[State 400, 4]
type = ChangeState
trigger1 = animtime = 0
value = 11
ctrl = 1

;Digging
[Statedef 450]
type    = C
movetype= A
physics = C
juggle  = 4
poweradd= 0
ctrl = 0
anim = 401
sprpriority = 2

[State 400, 1]
type = PlaySnd
trigger1 = animelem = 2
value = S100, 0
volumescale = 125

[State 400, 1]
type = PlaySnd
trigger1 = animelem = 5
value = S100, 2
volumescale = 125

[State 200, 1]
type = HitDef
trigger1 = animelem = 2
trigger2 = animelem = 5
attr = C, NA
damage = ceil(ifElse(fvar(11) * 16 < 7, 7, fvar(11) * 16)), 0
getpower = 72,36
givepower = 36,36
animtype = Light
guardflag = L
hitflag = MAFD
pausetime = 5, 5
sparkNo = 0
guard.sparkNo = 40
sparkXY = -5,-10
hitsound = 5,0
guardsound = 6,0
ground.type = low
ground.slidetime = 10
ground.hittime  = 13
ground.velocity = -2
air.type = low
air.velocity = -2,-2
air.hittime = 15
down.velocity = -2,0
down.hittime = 20
yaccel = 0.42
ID = 400

[State 400, 4]
type = ChangeState
trigger1 = movecontact && time > 9
trigger1 = command = "x" && command != "holddown"
value = 200
ctrl = 0

[State 400, 4]
type = ChangeState
trigger1 = animtime = 0
value = 11
ctrl = 1

;Get up, bitch!
[Statedef 400]
type    = C
movetype= A
physics = C
juggle  = 0
poweradd= 0
ctrl = 0
anim = 235
sprpriority = 2

[State 210, 1]
type = PlaySnd
trigger1 = animelem = 2
value = 0, 1
volumescale = 125

[State 200, 2]
type = playsnd
trigger1 = animelem = 2
value = S200,0 +random%3
volumescale = 125

[state 1000]
type = varadd
trigger1 = movehit
trigger1 = numtarget(400)
trigger1 = target(400),time = 0
var(20) = 1
ignorehitpause = 1

[State 200, 1]
type = HitDef
trigger1 = time = 0 && var(20)<=1
attr = C, NA
damage = ceil(ifElse(fvar(11) * 32 < 7, 7, fvar(11) * 32)), 0
getpower = 72,36
givepower = 36,36
animtype = hard
guardflag = M
hitflag = MAFD
;priority = 4, hit
pausetime = 8, 8
sparkNo = 1
guard.sparkNo = 40
sparkXY = -10,-45
hitsound = 5,1
guardsound = 6,0
ground.type = low
ground.slidetime = 30
ground.hittime  = 18
ground.velocity = -2.8,0
down.velocity = -1,-7
down.hittime = 20
air.type = low
air.velocity = -2.8,-2.5
air.hittime = 25
fall = 0
air.fall = 0
fall.recovertime = 30
yaccel = 0.58
ID = 400

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 210
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = movecontact
trigger1 = command = "x"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 210
ctrl = 0

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

;Get up, bitch!
[Statedef 401]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
anim = 235
sprpriority = 2

[state 1000]
type = velset
trigger1 = time = 0
x = 4

[State 210, 1]
type = PlaySnd
trigger1 = animelem = 2
value = 0, 1
volumescale = 125

[State 200, 2]
type = playsnd
trigger1 = animelem = 2
value = S200,0 +random%3
volumescale = 125

[State 200, 1]
type = HitDef
trigger1 = time = 0
attr = S, NA
damage = ceil(ifElse(fvar(11) * 32 < 7, 7, fvar(11) * 32)), 0
getpower = 72,36
givepower = 36,36
animtype = hard
guardflag = M
hitflag = MAF
priority = 4, hit
pausetime = 8, 8
sparkNo = 1
guard.sparkNo = 40
sparkXY = -10,-45
hitsound = 5,1
guardsound = 6,0
ground.type = High
ground.slidetime = 30
ground.hittime  = 18
ground.velocity = -2.8,0
down.velocity = -1,-7
down.hittime = 20
air.type = low
air.velocity = -2.8,-4.2
air.hittime = 25
fall = 0
air.fall = 0
fall.recovertime = 30
yaccel = 0.58
ID = 401

[State 0, ChangeState]
type = changestate
triggerall = movecontact && time > 10
trigger1 = random<var(50)*2.0
value = 230
ctrl = 0

[State 0, ChangeState]
type = null
triggerall = power >= 100
triggerall = movecontact  && time > 10
trigger1 = random<var(50)*2.0
value = 1000
ctrl = 0

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

;Air Razor B-Type - Prestate
[Statedef 600]
type    = A
movetype= A
physics = A
juggle  = 0
poweradd= 11
ctrl = 0
anim = 600
sprpriority = 2

[State 3050, hitvar]
type=varset
trigger1 = time = 0
var(14)=0

[state 1000]
type = changestate
trigger1 = time = 2
value = 601

;Air Razor B-Type
[Statedef 601]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 600
sprpriority = 2

[State 600, 1]
type = playsnd
trigger1 = anim = 600
trigger1 = animelem = 3
value = S3, 0
volumescale = 125

[State 200, 2]
type = playsnd
trigger1 = anim = 600
trigger1 = animelem = 3
value = S200,1
volumescale = 125

[state 1000]
type = veladd
trigger1 = 1
y = .42

[state 1000]
type = velset
trigger1 = time = 0
x = 2.7
y = -6.0

[State 3050, hitvar]
type=varset
trigger1 = anim != 600
var(14)=0

[State 3050, hitvar]
type=varadd
trigger1=anim=600&&(movehit=1||moveguarded=1||movereversed=1)
var(14)=1

[State 200, 1]
type = HitDef
trigger1=anim=600 && animelemtime(3)>=0
trigger1= timemod = 2,0 && var(14)<3
attr = A, NA
damage = ceil(ifElse(fvar(11) * 16 < 7, 7, fvar(11) * 16)), 0
getpower = 72,36
givepower = 36,36
animtype = medium
guardflag = HA
hitflag = MAF
pausetime = 4, 4
sparkNo = 1
guard.sparkNo = 40
sparkXY = -15,-36
hitsound = 5,1
guardsound = 6,0
ground.type = High
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -3.4,-4.6
air.type = low
air.velocity = -3.4,-4.9
air.hittime = 25
fall = 1
fall.recover = 0
yaccel = 0.5
ID = 600

[state 1000]
type = changestate
trigger1 = anim = 600
trigger1 = animtime = 0
value = 1016

[State 0, ChangeState]
type = changestate
triggerall = power >= 800
triggerall = movecontact
trigger1 = random<var(50)*2.0
trigger1 = var(59)
value = 1020
ctrl = 0

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

;Air Razor A-Type - Prestate
[Statedef 610]
type    = A
movetype= A
physics = A
juggle  = 0
poweradd= 11
ctrl = 0
anim = 600
sprpriority = 2

[State 3050, hitvar]
type=varset
trigger1 = time = 0
var(14)=0

[state 1000]
type = changestate
trigger1 = time = 2
value = 611

;Air Razor A-Type
[Statedef 611]
type    = A
movetype= A
physics = A
juggle  = 0
poweradd= 11
ctrl = 0
sprpriority = 2

[State 600, 1]
type = playsnd
trigger1 = anim = 600
trigger1 = animelem = 3
value = S3, 0
volumescale = 125

[State 200, 2]
type = playsnd
trigger1 = anim = 600
trigger1 = animelem = 3
value = S200,1
volumescale = 125

[State 3050, hitvar]
type=varset
trigger1 = anim != 600
var(14)=0

[State 3050, hitvar]
type=varadd
trigger1=anim=600&&(movehit=1||moveguarded=1||movereversed=1)
var(14)=1

[State 200, 1]
type = HitDef
trigger1=anim=600 && animelemtime(3)>=0
trigger1= timemod = 2,0 && var(14)<3
attr = A, NA
damage = ceil(ifElse(fvar(11) * 16 < 7, 7, fvar(11) * 16)), 0
getpower = 72,36
givepower = 36,36
animtype = light
guardflag = HA
hitflag = MAF
pausetime = 4, 4
sparkNo = 1
guard.sparkNo = 40
sparkXY = -15,-36
hitsound = 5,1
guardsound = 6,0
ground.type = High
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -2.4,0
air.type = low
air.velocity = -2.4,-2.8
air.hittime = 25
fall = 0
air.fall = 1
fall.recover = 0
;yaccel = 0.8
ID = 600

[state 1000]
type = changeanim
trigger1 = anim = 600
trigger1 = animtime = 0
value = 635

;---------------------------------------------------------------------------
;Air Dodge
[Statedef 650]
type    = A
movetype= I
physics = N
juggle  = 0
ctrl = 0
anim = 650
sprpriority = -1

[state 1000]
type = veladd
trigger1 = 1
y = .42

[State 1120, Blink]
type = PalFX
trigger1 = anim = 650
trigger1 = Time = 0
time = 22
add = 84,84,84
sinadd = 92,92,92,5

[State 700, Voice]
type = Playsnd
trigger1 = time = 2
value = S2,0
channel = 0
volumescale = 125

[state 1000]
type = explod
trigger1 = !time
anim = 251
ontop = 0
pos = 0,0
postype = p1
removetime = 12
bindtime = -1
removeongethit = 1
ownpal = 1
sprpriority = -1
scale = 1.00,1.00
ID = 69

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

[State 700, HitBy]
type = HitBy
trigger1 = 1
value = SCA,AT
time = 1

[State 700, Attack]
type = Changestate
trigger1 = animtime = 0
value = 1016
ctrl = 0

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

;Throw attack - Ech
[Statedef 800]
type    = S
movetype= A
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 800
sprpriority = 2

[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = S, NT          ;Attributes: Standing, Normal Throw
hitflag = M-          ;Affect only ground people who are not being hit
priority = 1, Miss    ;Throw has low priority, must be miss or dodge type.
sparkno = -1          ;No spark
p1sprpriority = 1     ;Draw p1's sprite in front of p2
                      ;p2's sprite priority is set to 0 by default
p1facing = 1
p2facing = 1          ;Force p2 to face KFM
p1stateno = 810       ;On success, KFM changes to state 810
p2stateno = 820       ;If hit, p2 changes to state 820 in KFM's cns
guard.dist = 0        ;This prevents p2 from going into a guard state if close
fall = 1              ;Force p2 into falling down
ID = 820
guardflag = 

[state 1000]
type = stateTypeSet
trigger1 = animelemtime(3) >= 0
movetype = I

[State 0, PalFX]
type = PalFX
trigger1 = time = 0
time = 2
add = 256,256,256
mul = 256,256,256
invertall = 0
color = 256
ignorehitpause = 1

[State 800, 2]
type = ChangeState
Trigger1 = AnimTime = 0
value = 0
ctrl = 1

;Throw attack - Ech
[Statedef 801]
type    = S
movetype= A
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 800
sprpriority = 2

[State 800, 1]
type = HitDef
Trigger1 = Time = 0
attr = S, NT          ;Attributes: Standing, Normal Throw
hitflag = M-          ;Affect only ground people who are not being hit
priority = 1, Miss    ;Throw has low priority, must be miss or dodge type.
sparkno = -1          ;No spark
p1sprpriority = 1     ;Draw p1's sprite in front of p2
                      ;p2's sprite priority is set to 0 by default
p1facing = 1
p2facing = 1          ;Force p2 to face KFM
p1stateno = 815       ;On success, KFM changes to state 810
p2stateno = 830       ;If hit, p2 changes to state 820 in KFM's cns
guard.dist = 0        ;This prevents p2 from going into a guard state if close
fall = 1              ;Force p2 into falling down
ID = 820
guardflag = 

[state 1000]
type = stateTypeSet
trigger1 = animelemtime(3) >= 0
movetype = I

[State 0, PalFX]
type = PalFX
trigger1 = time = 0
time = 2
add = 256,256,256
mul = 256,256,256
invertall = 0
color = 256
ignorehitpause = 1

[State 800, 2]
type = ChangeState
Trigger1 = AnimTime = 0
value = 0
ctrl = 1

[Statedef 810]
type    = S
movetype= A
physics = N
anim = 810
poweradd = 0

[state 1000]
type = varadd
trigger1 = time = 0
var(20) = 1
ignorehitpause = 1

[State 0, Turn]
type = null;Turn
trigger1 = command = "holdbackward"
trigger1 = time = 0

[State 0, TargetState]
type = null;TargetState
trigger1 = command = "holdbackward"
trigger1 = time = 0
value = 822
ID = 820

[State 0, Width]
type = Width
trigger1 = 1
edge = 40,0

[State 810, Grab Sound]
type = PlaySnd
trigger1 = time = 0
value = S9, 0
volumescale = 200

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = S60,4
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = F5,2
volumescale = 125

[State 810, Bind 1]
type = TargetBind
trigger1 = AnimElemTime(2) < 0
pos = 25, -30

[State 0, Hair]
type = Helper
trigger1 = animelem = 2
name = "blast thing"
ID = 840
stateno = 840
pos = 20,-6
postype = p1
facing = 1
keyctrl = 0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = animelem = 2
anim = F2
ID = 8052
pos = 35,-70
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
ontop = 1

[State 810, Hurt 11]
type = TargetLifeAdd
trigger1 = AnimElem = 2
value = -90

[State 810, Throw 11]
type = TargetState
trigger1 = AnimElem = 2
value = 256

[State 0, VarSet]
type = VarSet
trigger1 = 1
var(0) = 1

[State 0, VarSet]
type = VarSet
trigger1 = 1
var(4) = 1

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

[Statedef 815]
type    = S
movetype= A
physics = N
anim = 810
poweradd = 0

[state 1000]
type = varadd
trigger1 = time = 0
var(20) = 1
ignorehitpause = 1

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

[State 0, Width]
type = Width
trigger1 = 1
edge = 40,0

[State 810, Grab Sound]
type = PlaySnd
trigger1 = time = 0
value = S9, 0
volumescale = 200

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = S60,4
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = F5,2
volumescale = 125

[State 810, Bind 1]
type = TargetBind
trigger1 = AnimElemTime(2) < 0
pos = 25, -30

[State 0, Hair]
type = Helper
trigger1 = animelem = 2
name = "blast thing"
ID = 840
stateno = 840
pos = 20,-6
postype = p1
facing = 1
keyctrl = 0
ownpal = 0

[State 0, Explod]
type = Explod
trigger1 = animelem = 2
anim = F2
ID = 8052
pos = 35,-70
postype = p1  ;p2,front,back,left,right
facing = 1
vfacing = 1
bindtime = -1
ontop = 1

[State 810, Hurt 11]
type = TargetLifeAdd
trigger1 = AnimElem = 2
value = -90

[State 810, Throw 11]
type = TargetState
trigger1 = AnimElem = 2
value = 255

[State 0, VarSet]
type = VarSet
trigger1 = 1
var(0) = 1

[State 0, VarSet]
type = VarSet
trigger1 = 1
var(4) = 1

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

;Thrown by Kung Fu Throw
; (a custom gethit state)
; Description: This is the state that the opponent changes to after being
;     hit by KFM's throw HitDef. The important thing here is to use a
;     ChangeAnim2 controller. The difference between ChangeAnim2 and
;     ChangeAnim is that ChangeAnim2 changes the player's animation to
;     an action in the AIR file of the attacker (in this case, kfm.air),
;     whereas ChangeAnim always changes the player to an action in his
;     own AIR file. Look at Action 820 in kfm.air for some extra
;     comments.
[Statedef 820]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 0

[state 1000]
type = velset
trigger1 = time = 0
y = -2

[state 1000]
type = velset
trigger1 = time = 5
y = 0

[State 820, 1]
type = sprpriority
Trigger1 = 1
value = 5

[State 820, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 820

;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw - thrown into the air
[Statedef 821]
type    = A
movetype= H
physics = N
velset = -5,-8

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 0

[State 821, 1] ;Gravity
type = VelAdd
Trigger1 = 1
y = .6

[State 821, 4] ;Hit ground
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;Hit ground

;---------------------------------------------------------------------------
;Thrown by Kung Fu Throw
; (a custom gethit state)
; Description: This is the state that the opponent changes to after being
;     hit by KFM's throw HitDef. The important thing here is to use a
;     ChangeAnim2 controller. The difference between ChangeAnim2 and
;     ChangeAnim is that ChangeAnim2 changes the player's animation to
;     an action in the AIR file of the attacker (in this case, kfm.air),
;     whereas ChangeAnim always changes the player to an action in his
;     own AIR file. Look at Action 820 in kfm.air for some extra
;     comments.
[Statedef 822]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 0

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

[State 820, 1]
type = sprpriority
Trigger1 = 1
value = 5

[State 820, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 820

[Statedef 830]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 0

[state 1000]
type = velset
trigger1 = time = 0
y = -2

[state 1000]
type = velset
trigger1 = time = 5
y = 0

[State 820, 1]
type = sprpriority
Trigger1 = 1
value = 5

[State 820, 1]
type = ChangeAnim2
Trigger1 = Time = 0
value = 830

;Energy Blast (Throw helper)
[StateDef 840]
type = S
physics = S
moveType = I
ctrl = 0
anim = 1030
poweradd = 0
sprPriority = 6

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow;thehedgehog
ignorehitpause = 1

[state 1000]
type = angledraw
trigger1 = 1
value = 40
ignorehitpause = 1

[state 1000]
type = destroyself
trigger1 = animtime = 0

;Kyoob attack - Prototype part 1
[Statedef 1000]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 1000
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 0
value = S60,0
volumescale = 125
channel = 5

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1001
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 2
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1001
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1001
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

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

;Kyoob attack - Prototype part 2
[Statedef 1001]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 1005
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = animelem = 1
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = playsnd
trigger1 = animelem = 1
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1002
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 1
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1002
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1002
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

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

;Kyoob attack - Prototype part 3
[Statedef 1002]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 1005
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = animelem = 1
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = playsnd
trigger1 = animelem = 1
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1002
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 1
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = numhelper(1500)!= 1
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = time >= 7
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1050
ctrl = 0

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

;Kyoob Projectile Part 1
[Statedef 1005]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1003
poweradd = 0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 14
y = 0

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 1000, 5] ;Opponent near
type = hitdef
trigger1 = time = 0
attr = S, NP
animtype  = light
damage    = 20, 0
priority  = 5
getpower = 72,36
givepower = 36,36
guardflag = MAF
pausetime = 0,0
sparkno = 0
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,0
guardsound = 6,0
ground.type = High
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = -4.0,0
guard.ctrltime = 7
air.velocity = -3.0,-1.5
fall = 0
air.fall = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[state 1000]
type = changestate
trigger1 = movecontact
value = 1006

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

;Kyoob Projectile - Disappear
[Statedef 1004]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1004
poweradd = 0
velset = 0,0

[State 3050, hitvar]
type=varset
trigger1 = time = 0
var(14)=0

[state 1000]
type = posset
trigger1 = time = 0
y = 0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1210, Destroy]
type = DestroySelf
trigger1 = animtime = 0

;Kyoob Projectile - Disappear
[Statedef 1006]
type = A
movetype = I
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1004
poweradd = 0

[State 3050, hitvar]
type=varset
trigger1 = time = 0
var(14)=0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1008, End]
type = destroyself
trigger1 = animtime = 0

;Kyoob Alt.
[Statedef 1007]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1007
poweradd = 0

[state 1000]
type = angledraw
trigger1 = 1
scale = 1.30,1.30
ignorehitpause = 1

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 12.8
y = 10.5

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 3050, hit]
type=hitdef
trigger1= time = 0
attr = S, SP
animtype  = medium
damage    = 25, 0
priority  = 5
getpower = 0,0
givepower = 36,36
guardflag = MA
pausetime = 5,4
sparkno = 1
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,1
guardsound = 6,0
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-3
air.velocity = -3.0,-3
fall = 1
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

[State 1210, Destroy]
type = changestate
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 1004
ctrl = 0

;Kyoob Alt.
[Statedef 1008]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1007
poweradd = 0

[state 1000]
type = angledraw
trigger1 = 1
scale = 1.30,1.30
ignorehitpause = 1

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 14
y = 8

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 3050, hit]
type=hitdef
trigger1= time = 0
attr = S, SP
animtype  = medium
damage    = 25, 0
priority  = 5
getpower = 0,0
givepower = 36,36
guardflag = MA
pausetime = 5,4
sparkno = 1
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,1
guardsound = 6,0
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-3
air.velocity = -3.0,-3
fall = 1
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

[State 1210, Destroy]
type = changestate
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 1004
ctrl = 0

;Kyoob Alt.
[Statedef 1009]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1007
poweradd = 0

[state 1000]
type = angledraw
trigger1 = 1
scale = 1.30,1.30
ignorehitpause = 1

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 8
y = 10

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 3050, hit]
type=hitdef
trigger1= time = 0
attr = S, SP
animtype  = medium
damage    = 25, 0
priority  = 5
getpower = 0,0
givepower = 36,36
guardflag = MA
pausetime = 5,4
sparkno = 1
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,1
guardsound = 6,0
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-3
air.velocity = -3.0,-3
fall = 1
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

[State 1210, Destroy]
type = changestate
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 1004
ctrl = 0

; Jump Land from dive kick
[Statedef 1012]
type    = S
physics = S
ctrl = 0
anim = 1400

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

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

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

[State 52, Landing Dust Explod]
type = NULL
trigger1 = !Time
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

[State 0, ChangeState]
type = changestate
triggerall = time > 2
trigger1 = command = "x"
trigger1 = command = "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 400
ctrl = 0

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

; Jump Land from dive kick
[Statedef 1014]
type    = S
physics = S
ctrl = 0
anim = 1401

[state 1000]
type = nothitby
trigger1 = time = 0
time = 0
value = SCA
ignorehitpause = 1

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

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

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

[State 52, Landing Dust Explod]
type = NULL
trigger1 = !Time
anim = 8102
sprPriority = -3
posType = P1
scale = 0.5,0.5
pauseMoveTime = -1
superMoveTime = -1
ownPal = 1

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

;Dragon boost - State over
[Statedef 1016]
type    = A
movetype= A
physics = N
juggle  = 0
ctrl = 0
anim = 635
sprpriority = 2
poweradd = 0

[state 1000]
type = veladd
trigger1 = 1
y = .42

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

;Dead State
[Statedef 1018]
type = A
movetype= I
physics = N
ctrl = 0
;velset = 0,0
sprpriority = 4
movehitpersist = 1

[State 1014, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1
persistent = 1

[State 1014, Muteki]
type = NotHitBy
trigger1 = 1
value = SCA

[State 1014, End]
type = ChangeState
trigger1 = !AnimTime
value = 1019

[State 1014, End]
type = DestroySelf
trigger1 = Root,MoveType=H

;Wait
[StateDef 1019]
type = A
physics = N
moveType = I
anim = 19999
ctrl = 0
velSet = 0,0

[State 1015, AfterImageTime]
type = AfterImageTime
trigger1 = 1 
time = 0
ignorehitpause = 1 

[State 1015, DestroySelf]
type = DestroySelf
trigger1 = !NumTarget
trigger2 = NumTarget
trigger2 = Target, Time <= 1 && !(Target, HitShakeOver)

;Kyoob attack (Air Type)
[Statedef 1020]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 1006
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 0
value = S60,0
volumescale = 125
channel = 5

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = veladd
trigger1 = 1
y = .16

[state 1000]
type = velset
trigger1 = time = 0
y = -2

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1001
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = time = 3
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = !var(59)
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command != "holddown"
value = 1021
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = !var(59)
triggerall = power >= 500
triggerall = time >= 7
trigger1 = command = "b"
trigger1 = command != "holddown"
value = 1051
ctrl = 0

[State 0, ChangeState]
type = changestate
trigger1 = var(59)
trigger1 = time >= 7
value = 1021
ctrl = 0

[State 1100, 5]
type = ChangeState
trigger1 = time = 18
value = 635
ctrl = 0

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

;Kyoob attack (Air Type)
[Statedef 1021]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 1006
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = veladd
trigger1 = 1
y = .16

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1001
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = time = 3
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = !var(59)
triggerall = time >= 7
trigger1 = command = "a"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1022
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = !var(59)
triggerall = power >= 500
triggerall = time >= 7
trigger1 = command = "b"
trigger1 = command != "holddown"
value = 1051
ctrl = 0

[State 0, ChangeState]
type = changestate
trigger1 = var(59)
trigger1 = time >= 7
value = 1022
ctrl = 0

[State 1100, 5]
type = ChangeState
trigger1 = time = 18
value = 635
ctrl = 0

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

;Kyoob attack (Air Type)
[Statedef 1022]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 1006
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = veladd
trigger1 = 1
y = .16

[state 1000]
type = playsnd
trigger1 = time = 3
value = S60,3
volumescale = 125
channel = 7

[state 1000]
type = explod
trigger1 = time = 0
anim = 1001
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1

[State 2500, 0]
type = Helper
trigger1 = time = 3
helpertype = normal
name = "Kyoob"
id = 1005
facing = 1
pos = 15,-39
postype = p1
stateno = 1005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 0, ChangeState]
type = changestate
triggerall = !var(59)
triggerall = power >= 500
triggerall = time >= 7
trigger1 = command = "b"
trigger1 = command != "holddown"
value = 1051
ctrl = 0

[State 0, ChangeState]
type = changestate
triggerall = power >= 500
triggerall = var(59)
trigger1 = time >= 7
value = 1051
ctrl = 0

[State 1100, 5]
type = ChangeState
trigger1 = time = 18
value = 635
ctrl = 0

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

;Kyoob Rush
[Statedef 1200]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 1200
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 0
value = S50,0
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 4
value = S60,3
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 2
value = S1000,0
volumescale = 125

[state 1000]
type = veladd
trigger1 = 1
y = .42

[state 1000]
type = veladd
trigger1 = prevstateno = 230 && time = 0
x = 0.5

[state 1000]
type = velset
trigger1 = prevstateno = 230 && time = 0
y = -8.5

[state 1000]
type = velset
trigger1 = prevstateno != 230 && time = 0
y = -10
x = -1.0

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 4
helpertype = normal
name = "Kyoob"
id = 1008
facing = 1
pos = -20,-30
postype = p1
stateno = 1008
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 4
helpertype = normal
name = "Kyoob"
id = 1007
facing = 1
pos = -24,-32
postype = p1
stateno = 1007
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

[State 2500, 0]
type = Helper
trigger1 = AnimElem = 4
helpertype = normal
name = "Kyoob"
id = 1009
facing = 1
pos = -20,-30
postype = p1
stateno = 1009
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

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

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

;Falling State
[Statedef 635]
type    = A
movetype= A
physics = N
juggle  = 1
poweradd= 0
ctrl = 0
anim = 635
sprpriority = 2

[State 0, ChangeState]
type = changestate
triggerall = time >= 8
triggerall = power >= 500
trigger1 = command = "b"
trigger1 = command != "holddown"
trigger2 = var(59)
trigger2 = random<var(50)*2.0
value = 1051
ctrl = 0

[state 1000]
type = veladd
trigger1 = 1
y = .42

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

;Kyoob Blast
[Statedef 1050]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 1050
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 5
value = S60,4
volumescale = 125

[state 1000]
type = playsnd
trigger1 = time = 5
value = S200,2
volumescale = 125
channel = 3

[state 1000]
type = velset
trigger1 = time = 5
x = -12

[state 1000]
type = poweradd
trigger1 = time = 5
value = -500

[State 2500, 0]
type = Helper
trigger1 = time = 5
helpertype = normal
name = "Kyoob Blast"
id = 1500
facing = 1
pos = 0,0
postype = p1
stateno = 1500
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

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

;Kyoob Blast (Air)
[Statedef 1051]
type    = A
movetype= A
physics = N
juggle  = 0
poweradd= 0
ctrl = 0
anim = 1006
sprpriority = 2

[state 1000]
type = playsnd
trigger1 = time = 2
value = S60,4
volumescale = 125

[state 1000]
type = playsnd
trigger1 = time = 2
value = S200,2
volumescale = 125
channel = 3

[state 1000]
type = veladd
trigger1 = 1
y = .42

[state 1000]
type = velset
trigger1 = time = 2
x = -6
y = -2

[state 1000]
type = poweradd
trigger1 = time = 2
value = -500

[State 2500, 0]
type = Helper
trigger1 = time = 2
helpertype = normal
name = "Kyoob Blast"
id = 1500
facing = 1
pos = 0,0
postype = p1
stateno = 1500
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1

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

;Energy Blast (Helper)
[StateDef 1500]
type = S
physics = N
moveType = A
ctrl = 0
anim = 1020
poweradd = 0
sprPriority = 4

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow;thehedgehog
ignorehitpause = 1

[state 1000]
type = nothitby
trigger1 = 1
value = SCA
ignorehitpause = 1

[State 3055, Anim]
type = changeanim
trigger1 = !time && !prevstateno
value = 1020

[state 1000]
type = bindtoroot
trigger1 = 1
pos = 0,0

[State 1035, VarAdd]
type = VarAdd
trigger1 = !Time
var(2) = 1

[State 1035, Counter Flag]
type = VarSet
trigger1 = NumEnemy
trigger1 = moveContact != 1
var(9) = (EnemyNear, MoveType = A)

[State 1035, Dampener]
type = VarSet
trigger1 = 1
fvar(11) = (Root, fvar(10)) * ifElse(var(9), 1.2, 1)

[State 1035, Miss]
type = HitDef
trigger1 = 1
attr = S,SP
hitFlag =
sparkXY = -10,0

[State 1035, Hit 1]
type = HitDef
trigger1 = animelem = 1
trigger2 = animelem = 2
trigger3 = animelem = 3
attr = S, SP
hitFlag = MAF
guardFlag = MAF
damage = 30, 1
getpower = 0,0
givePower = 10, 10
pauseTime = 1,1
guard.pauseTime = 1,1
animType = Hard
air.animType = Back
fall.animType = Back
ground.type = High
ground.hitTime = 18
ground.slideTime = 18
guard.hitTime = 18
air.hitTime = 30
ground.velocity = -8.0, -2
ground.cornerPush.velOff = 0
guard.velocity = -8.0
guard.cornerPush.velOff = 0
air.velocity = -6.0, -2
air.cornerPush.velOff = 0
airGuard.velocity = -5, 0
airGuard.cornerPush.velOff = 0
fall = 1
air.fall = 1
fall.recover = 0
hitSound = 5,1
guardSound = 6,0
sparkNo = 1
guard.SparkNo = 40
sparkXY = 0, -35

[State 1006, HitCount]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(13) = 1
persistent = 0

[State 1006, Juggle Points]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(15) = 1
persistent = 0

[State 1006, ProjContact]
type = VarSet
trigger1 = MoveContact && NumTarget
var(18) = 1
persistent = 0

[State 1006, ProjContact]
type = ParentVarSet
trigger1 = MoveContact && NumTarget
trigger1 = Root, StateNo = [1050,1051] 
var(18) = 1
persistent = 0

[State 1035, ChangeState]
type = ChangeState
trigger1 = MoveReversed
value = 1018
ignoreHitPause = 1

[State 1035, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 1018
ignoreHitPause = 1

[State 1035, End]
type = DestroySelf
trigger1 = root, movetype = H 


;Energy Blast (Helper)
[StateDef 1501]
type = S
physics = N
moveType = A
ctrl = 0
anim = 1020
poweradd = 0
sprPriority = 4

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow;thehedgehog
ignorehitpause = 1

[state 1000]
type = nothitby
trigger1 = 1
value = SCA
ignorehitpause = 1

[State 3055, Anim]
type = changeanim
trigger1 = !time && !prevstateno
value = 1020

[state 1000]
type = bindtoroot
trigger1 = 1
pos = 0,0

[State 1035, VarAdd]
type = VarAdd
trigger1 = !Time
var(2) = 1

[State 1035, Counter Flag]
type = VarSet
trigger1 = NumEnemy
trigger1 = moveContact != 1
var(9) = (EnemyNear, MoveType = A)

[State 1035, Dampener]
type = VarSet
trigger1 = 1
fvar(11) = (Root, fvar(10)) * ifElse(var(9), 1.2, 1)

[State 1035, Miss]
type = HitDef
trigger1 = 1
attr = S,SP
hitFlag =
sparkXY = -10,0

[State 1035, Hit 1]
type = HitDef
trigger1 = animelem = 1
trigger2 = animelem = 2
trigger3 = animelem = 3
attr = S, SP
hitFlag = MAF
guardFlag = MAF
damage = 30, 1
getPower = 0, 0
givePower = 10, 10
pauseTime = 1,1
guard.pauseTime = 1,1
animType = Hard
air.animType = Back
fall.animType = Back
ground.type = High
ground.hitTime = 18
ground.slideTime = 18
guard.hitTime = 18
air.hitTime = 30
ground.velocity = -8.0, 0
ground.cornerPush.velOff = 0
guard.velocity = -8.0
guard.cornerPush.velOff = 0
air.velocity = -6.0, -2
air.cornerPush.velOff = 0
airGuard.velocity = -5, 0
airGuard.cornerPush.velOff = 0
fall = 1
air.fall = 1
fall.recover = 0
hitSound = 5,1
guardSound = 6,0
sparkNo = 1
guard.SparkNo = 40
sparkXY = 0, -35

[State 1006, HitCount]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(13) = 1
persistent = 0

[State 1006, Juggle Points]
type = ParentVarAdd
trigger1 = !Time
trigger1 = MoveContact && NumTarget
var(15) = 1
persistent = 0

[State 1006, ProjContact]
type = VarSet
trigger1 = MoveContact && NumTarget
var(18) = 1
persistent = 0

[State 1006, ProjContact]
type = ParentVarSet
trigger1 = MoveContact && NumTarget
trigger1 = Root, StateNo = 160
var(18) = 1
persistent = 0

[State 1035, ChangeState]
type = ChangeState
trigger1 = MoveReversed
value = 1018
ignoreHitPause = 1

[State 1035, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 1018
ignoreHitPause = 1

[State 1035, End]
type = DestroySelf
trigger1 = root, movetype = H 

;Cube Phallanx
[Statedef 3000]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 3000
sprpriority = 2

[State 3000, Super A]
type = SuperPause
triggerall = anim = 3000
trigger1 = AnimElem = 1
pos = 0, 0
anim = -1
sound = -1
time = 16
movetime = 16
poweradd = -1000
p2defmul = 1
darken = 0

[State 1120, Blink]
type = PalFX
triggerall = anim = 3000
trigger1 = Time = 0
time = 16
add = 84,84,84
sinadd = 92,92,92,4

[state 1000]
type = explod
triggerall = anim = 3000
trigger1 = time = 0
anim = F100
pos = 20,-39
ontop = 1
postype = p1
bindtime = -1
removeongethit = 1
ignorehitpause = 1
supermovetime = 16
pausemovetime = 16

[state 1000]
type = nothitby
triggerall = anim = 3000
trigger1 = time = 0
value = SCA
time = 16
ignorehitpause = 1

[state 1000]
type = changeanim
triggerall = anim = 3000 
trigger1 = animtime = 0
value = 3002

[state 1000]
type = playsnd
triggerall = anim = 3000
trigger1 = time = 0
value = S3000,0
volumescale = 125

[state 1000]
type = velset
triggerall = anim = 3002
trigger1 = 1
x = -0.5

[state 1000]
type = velset
triggerall = anim = 3003
trigger1 = time = 0
x = -1.0

[state 1000]
type = playsnd
triggerall = anim = 3002
trigger1 = animelem = 2 
value = S60,2
volumescale = 125
channel = 6

[state 1000]
type = playsnd
triggerall = anim = 3002
trigger1 = animelem = 2 
value = S60,3
volumescale = 125
channel = 6

[State 2500, 0]
type = Helper
triggerall = anim = 3002
trigger1 = animelem = 2
helpertype = normal
name = "Kyoob"
id = 3001
facing = 1
pos = 15,-39
postype = p1
stateno = 3001
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1
persistent = 1

[State 2500, 0]
type = Helper
triggerall = anim = 3002
trigger1 = animelem = 2
helpertype = normal
name = "Kyoob"
id = 3002
facing = 1
pos = 15,-39
postype = p1
stateno = 3002
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1
persistent = 1

[State 2500, 0]
type = Helper
triggerall = anim = 3002
trigger1 = animelem = 2
helpertype = normal
name = "Kyoob"
id = 3003
facing = 1
pos = 15,-39
postype = p1
stateno = 3003
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1
persistent = 1

[State 2500, 0]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "Hol up"
id = 3005
facing = 1
pos = 0,0
postype = p1
stateno = 3005
keyctrl = 0
ownpal = 1
size.xscale = 1
size.yscale = 1
persistent = 1

[state 1000]
type = explod
triggerall = anim = 3002
trigger1 = animelem = 2
anim = 3001
ontop = 1
postype = p1
pos = 0,0
bindtime = -1
removeongethit = 1
ignorehitpause = 1
persistent = 1

[state 1000]
type = changeanim
trigger1 = time = 76
value = 3003

[state 1000]
type = changestate
trigger1 = anim = 3003
trigger1 = animtime = 0
value = 0
ctrl = 1

;Kyoob Projectile Part 1
[Statedef 3001]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1003
poweradd = 0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 14
y = 0

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 1000, 5] ;Opponent near
type = hitdef
trigger1 = time = 0
attr = S, HP
animtype  = hard
damage    = 4, 1
priority  = 5
getpower = 0,0
givepower = 1,1
guardflag = MA
pausetime = 0,0
sparkno = 0
sparkxy = 0,0
guard.sparkno = 40
hitsound   = -1
guardsound = -1
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-0.8
air.velocity = -3.0,-0.8
fall = 0
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[state 1000]
type = changestate
trigger1 = movecontact
value = 1006

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

;Kyoob Projectile Part 2
[Statedef 3002]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1003
poweradd = 0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 14
y = -1.5

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 1000, 5] ;Opponent near
type = hitdef
trigger1 = time = 0
attr = S, HP
animtype  = hard
damage    = 5, 1
priority  = 5
getpower = 0,0
givepower = 1,1
guardflag = MA
pausetime = 0,0
sparkno = 0
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,0
guardsound = 6,0
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-0.8
air.velocity = -3.0,-0.8
fall = 0
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[state 1000]
type = changestate
trigger1 = movecontact
value = 1006

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

;Kyoob Projectile Part 2
[Statedef 3003]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 1003
poweradd = 0

[state 1000]
type = assertspecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[state 1000]
type = velset
trigger1 = 1
x = 14
y = 1.5

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA, NA, SA, HA, NT, ST, HT
time = 1

[State 1210, HitBy]
type = HitBy
trigger1 = 1
value = SCA, NP, SP, HP
time = 1

[State 1210, HitOverride]
type = HitOverride
trigger1 = Time <= 0
time = -1
attr = SCA, NP, SP, HP
slot = 0
stateno = 1006

[State 1000, 5] ;Opponent near
type = hitdef
trigger1 = time = 0
attr = S, HP
animtype  = hard
damage    = 5, 1
priority  = 5
getpower = 0,0
givepower = 1,1
guardflag = MA
pausetime = 0,0
sparkno = 0
sparkxy = 0,0
guard.sparkno = 40
hitsound   = 5,0
guardsound = 6,0
ground.type = high
ground.slidetime = 20
ground.hittime  = 20
ground.velocity = -4.0,-0.8
air.velocity = -3.0,-0.8
fall = 0
air.fall = 1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
fall.recover = 0

[state 1000]
type = changestate
trigger1 = movecontact
value = 1006

[State 1210, Destroy]
type = changestate
trigger1 = BackEdgeBodyDist <= -100
trigger2 = FrontEdgeBodyDist <= -100
value = 1006
ctrl = 0

;Controller
[Statedef 3005]
type    = S
movetype= I
physics = S
poweradd= 0
ctrl = 0
velset = 0,0
anim = 19999

[state 1000]
type = changestate
trigger1 = root, stateno != 3000
value = 3006
ctrl = 0

;Controller End
[Statedef 3006]
type    = S
movetype= I
physics = S
poweradd= 0
ctrl = 0
velset = 0,0
anim = 19999

[State 1008, End]
type = DestroySelf
trigger1 = time = 30

;Muder Sphere
[Statedef 3500]
type    = S
movetype= A
physics = S
juggle  = 0
poweradd= 0
ctrl = 0
velset = 0,0
anim = 3500
sprpriority = 2

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

[State 3000, Super A]
type = SuperPause
trigger1 = AnimElem = 1
pos = 0, 0
anim = -1
sound = -1
time = 54
movetime = 54
poweradd = -3000
p2defmul = 1
darken = 0

[State 1120, Blink]
type = PalFX
trigger1 = Time = 0
time = 20
add = 84,84,84
sinadd = 92,92,92,4

[state 1000]
type = explod
trigger1 = time = 0
anim = F102
pos = 1,-31
ontop = 1
postype = p1
bindtime = -1
removeongethit = 1
ignorehitpause = 1
supermovetime = 25
pausemovetime = 25

[State 0, Hair]
type = Helper
trigger1 = animelem = 20
helpertype = normal
name = "Sphere"
ID = 13305
stateno = 13305
pos = 0,0
postype = p1   ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 1

[state 1000]
type = envshake
trigger1 = animelem = 20
time = 10
freq = 70
ampl = -6
phase = 90

[state 1000]
type = nothitby
trigger1 = 1
value = SCA
time = 1
ignorehitpause = 1

[state 1000]
type = playsnd
trigger1 = time = 0
value = S3000,0
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 6
value = S150,1
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 16
value = S1000,0
volumescale = 125

[state 1000]
type = playsnd
trigger1 = animelem = 20
value = S60,5
volumescale = 250

[state 1000]
type = changestate
trigger1 = animelem = 37
value = 3501
ctrl = 0

[Statedef 3501]
type    = S
movetype= I
physics = S
juggle  = 4
poweradd= 0
ctrl = 0
velset = 0,0
sprpriority = 2

[state 1000]
type = changestate
trigger1 = animtime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;Tail Helper
[Statedef 6000]
type    = S
movetype= I
physics = N
ctrl = 0
sprpriority = 0

[State 0, BindToRoot]
type = BindToRoot
trigger1 = 1 
time = 1
pos = 0,0
ignorehitpause = 1

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = root,anim != 0 
trigger1 = root,anim != 1
trigger1 = root,anim != 2
trigger1 = root,anim != 3
;trigger1 = root,anim != 4
trigger1 = root,anim != 5
;trigger1 = root,anim != 6
;trigger1 = root,anim != 10
;trigger1 = root,anim != 11
;trigger1 = root,anim != 12
;trigger1 = root,anim != 20
;trigger1 = root,anim != 21
;trigger1 = root,anim != 41
;trigger1 = root,anim != 42
;trigger1 = root,anim != 43
;trigger1 = root,anim != 44
;trigger1 = root,anim != 45
;trigger1 = root,anim != 46
;trigger1 = root,anim != 100
;trigger1 = root,anim != 101
;trigger1 = root,anim != 105
trigger1 = root,anim != 110
trigger1 = root,anim != 111
trigger1 = root,anim != 115
trigger1 = root,anim != 116
;trigger1 = root,anim != 191 && root,anim != 194 && root,anim != [1910,1911]
;trigger1 = root,anim != 195 && root,anim != [1950,1951]
trigger1 = root,anim != 240
trigger1 = root,anim != 241
trigger1 = root,anim != 400
trigger1 = root,anim != 410
trigger1 = root,anim != 411
trigger1 = root,anim != 600
trigger1 = root,anim != 640
;trigger1 = root,anim != 1000  
;trigger1 = root,anim != 1011
;trigger1 = root,anim != 1015
;trigger1 = root,anim != 1016
trigger1 = root,anim != 3001
trigger1 = root,anim != 3010
trigger1 = root,anim != 3300 
trigger1 = root,anim != 1100
trigger1 = root,anim != 3011
trigger1 = root,anim != 3310
trigger1 = root,anim != 3311
trigger1 = root,anim != 3312
trigger1 = root,anim != 5120
trigger1 = root,anim != 1920
;trigger1 = root,anim != 5120
trigger1 = root,anim != 5300 && root,anim != 5500
trigger2 = root,anim = 1100
trigger2 = root,time > 3
trigger3 = root,anim = 3011
trigger3 = root,time > 40
trigger4 = root,anim = 400
trigger4 = root,time > 3
;trigger5 = root,anim = 105
;trigger5 = root,time > 2 && root,time <= 20
value = 19999
ignorehitpause = 1

[State 0, Turn]
type = Turn
trigger1 = facing = -1
trigger1 = root,facing = 1
trigger2 = facing = 1
trigger2 = root,facing = -1
ignorehitpause = 1

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = anim != 9991
trigger1 = root,anim = 0
trigger2 = root,anim = 1
trigger3 = root,anim = 2
trigger5 = root,anim = 3
value = 9991
ignorehitpause = 1

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = anim != 10005
trigger1 = root,anim = 101
value = 10005
ignorehitpause = 1

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = anim != 10006
trigger1 = root,anim = 5
value = 10006
ignorehitpause = 1

[State 0, ChangeAnim]
type = ChangeAnim
triggerall = anim != 10009
trigger1 = root,anim = 1016
value = 10009
ignorehitpause = 1

;Kyoob -not in use-
[Statedef 7000]
type = A
physics = N
movetype = I
velset = 0, 0
sprpriority = -2

[State 10000, oops]
type = destroyself
trigger1 = numhelper(7000) > 1

[State 10000, Anim]
type = changeanim
trigger1 = anim != 1010
value = 1010

[State 10000, projcontact]
type = varset
trigger1 = 1
var(18) = 0

[State 10000, Pos]
type = posadd
trigger1 = abs(rootdist x) < abs(vel x)
x = rootdist x

[State 10000, Pos]
type = posadd
trigger1 = abs(ifelse((root, movetype = H), -42 -pos y, rootdist y -42)) < abs(vel y)
y = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, X]
type = varset
trigger1 = 1
fvar(1) = rootdist x

[State 10000, Y]
type = varset
trigger1 = 1
fvar(2) = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, / ]
type = varset
trigger1 = 1
fvar(3) = (fvar(1) ** 2 + fvar(2) ** 2) ** 0.5

[State 10000, accel]
type = varadd
trigger1 = (fvar(1) || fvar(2)) && fvar(3) && fvar(4) < 5.0
fvar(4) = 2.0

[State 10005, accel]
type = varset
trigger1 = fvar(4) < 0.0
trigger2 = !fvar(1) && !fvar(2)
fvar(4) = 0

[State 10005, accel]
type = varset
trigger1 = fvar(4) > 5.0
fvar(4) = 4.8

[State 10000, Vel]
type = velset
trigger1 = 1
x = 0
y = 0

[State 10000, Vel]
type = velset
trigger1 = fvar(3)
x = (fvar(1) / fvar(3)) * fvar(4);1.33
y = (fvar(2) / fvar(3)) * fvar(4);1.33

[State 10000, Rest Var]
type = varset
trigger1 = 1
var(50) = 1

[State 10000, Rest Var]
type = varset
trigger1 = !time
trigger2 = rootdist x || (root, facing != facing)
trigger3 = root, movetype = H || roundstate != 2
trigger4 = root, stateno != 0 || (root, anim != [0, 1])
var(50) = 0

;Kyoob - Smol - Unused
[Statedef 7001]
type = A
physics = N
movetype = I
velset = 0, 0
sprpriority = -2

[State 10000, oops]
type = destroyself
trigger1 = numhelper(7000) > 1

[State 10000, Anim]
type = changeanim
trigger1 = anim != 1010
value = 1010

[state 1000]
type = angleDraw
trigger1 = 1
scale = 0.80,0.80

[State 10000, projcontact]
type = varset
trigger1 = 1
var(18) = 0

[State 10000, turn]
type = null
trigger1 = facing != root, facing

[State 10000, Pos]
type = posadd
trigger1 = abs(rootdist x) < abs(vel x)
x = rootdist x

[State 10000, Pos]
type = posadd
trigger1 = abs(ifelse((root, movetype = H), -42 -pos y, rootdist y -42)) < abs(vel y)
y = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, X]
type = varset
trigger1 = 1
fvar(1) = rootdist x

[State 10000, Y]
type = varset
trigger1 = 1
fvar(2) = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, / ]
type = varset
trigger1 = 1
fvar(3) = (fvar(1) ** 2 + fvar(2) ** 2) ** 0.5

[State 10000, accel]
type = varadd
trigger1 = (fvar(1) || fvar(2)) && fvar(3) && fvar(4) < 5.0
fvar(4) = 2.0

[State 10005, accel]
type = varset
trigger1 = fvar(4) < 0.0
trigger2 = !fvar(1) && !fvar(2)
fvar(4) = 0
[State 10005, accel]
type = varset
trigger1 = fvar(4) > 5.0
fvar(4) = 4.8

[State 10000, Vel]
type = velset
trigger1 = 1
x = 0
y = 0
[State 10000, Vel]
type = velset
trigger1 = fvar(3)
x = (fvar(1) / fvar(3)) * fvar(4);1.33
y = (fvar(2) / fvar(3)) * fvar(4);1.33

[State 10000, Rest Var]
type = varadd
trigger1 = 1
var(50) = 1

[State 10000, Rest Var]
type = varset
trigger1 = !time
trigger2 = rootdist x || (root, facing != facing)
trigger3 = root, movetype = H || roundstate != 2
trigger4 = root, stateno != 0 || (root, anim != [0, 1])
var(50) = 0

;Kyoob - Smol 2x - Unused
[Statedef 7002]
type = A
physics = N
movetype = I
velset = 0, 0
sprpriority = -2

[State 10000, oops]
type = destroyself
trigger1 = numhelper(7000) > 1

[State 10000, Anim]
type = changeanim
trigger1 = anim != 1010
value = 1010

[state 1000]
type = angleDraw
trigger1 = 1
scale = 0.80,0.80

[State 10000, projcontact]
type = varset
trigger1 = 1
var(18) = 0

[State 10000, turn]
type = null
trigger1 = facing != root, facing

[State 10000, Pos]
type = posadd
trigger1 = abs(rootdist x) < abs(vel x)
x = rootdist x

[State 10000, Pos]
type = posadd
trigger1 = abs(ifelse((root, movetype = H), -42 -pos y, rootdist y -42)) < abs(vel y)
y = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, X]
type = varset
trigger1 = 1
fvar(1) = rootdist x

[State 10000, Y]
type = varset
trigger1 = 1
fvar(2) = ifelse((root, movetype = H), -42 -pos y, rootdist y -42)

[State 10000, / ]
type = varset
trigger1 = 1
fvar(3) = (fvar(1) ** 2 + fvar(2) ** 2) ** 0.5

[State 10000, accel]
type = varadd
trigger1 = (fvar(1) || fvar(2)) && fvar(3) && fvar(4) < 5.0
fvar(4) = 2.0

[State 10005, accel]
type = varset
trigger1 = fvar(4) < 0.0
trigger2 = !fvar(1) && !fvar(2)
fvar(4) = 0
[State 10005, accel]
type = varset
trigger1 = fvar(4) > 5.0
fvar(4) = 4.8

[State 10000, Vel]
type = velset
trigger1 = 1
x = 0
y = 0
[State 10000, Vel]
type = velset
trigger1 = fvar(3)
x = (fvar(1) / fvar(3)) * fvar(4);1.33
y = (fvar(2) / fvar(3)) * fvar(4);1.33

[State 10000, Rest Var]
type = varadd
trigger1 = 1
var(50) = 1
[State 10000, Rest Var]
type = varset
trigger1 = !time
trigger2 = rootdist x || (root, facing != facing)
trigger3 = root, movetype = H || roundstate != 2
trigger4 = root, stateno != 0 || (root, anim != [0, 1])
var(50) = 0

[state 1000]
type = changestate
trigger1 = power > 500 && root, stateno = 250
value = 7000

[State 10000, oops]
type = destroyself
trigger1 = power = 0

;Shield
[Statedef 8800]
type = S
physics = S
movetype = I
velset = 0, 0
sprpriority = 5

[state 1000]
type = playsnd
trigger1 = root, stateno = 130 && time = 1 
value = S3,0
volumescale = 125

[state 1000]
type = bindtoroot
trigger1 = 1
pos = 0,0
ignorehitpause = 1

[state 1000]
type = changeanim
trigger1 = !time
value = 160

[state 1000]
type = destroyself
trigger1 = root, anim != [120,150]


;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
[statedef -2]

[State 0, Hair]
type = Helper
trigger1 = !numhelper(6000)
name = "Hair"
ID = 6000
stateno = 6000
pos = 0,0
postype = p1   ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0

[State -2, 2a]
type = PlaySnd
triggerall = alive
triggerall = Random < 500
trigger1 = stateno = 5120
trigger1 = time = 1
value = 5120, 0+random%2
channel = 0
Volumescale = 150

[State -2, 2a]
type = PlaySnd
triggerall = alive
triggerall = Random < 500
trigger1 = (stateno = 5000) || (stateno = 5010) || (stateno = 5020) || (stateno = 5070) || (stateno = 45000)
trigger1 = time = 0
trigger2 = (stateno != 5000) && (stateno != 5010) && (stateno != 5020) && (stateno != 5070) && (stateno != 45000)
trigger2 = stateno != [120,160]
trigger2 = gethitvar(damage)
value = 5000, 0+random%3
channel = 0
Volumescale = 125

[state -2]
type = varset
triggerall = p2stateno = 5080
trigger1 = movehit
trigger1 = p2statetype = L && p2movetype = H
trigger1 = time = 0
var(20) = 0
ignorehitpause = 1

[state -2]
type = varset
trigger1 = !p2movetype = H
var(20) = 0
ignorehitpause = 1

[State -2, Hit Detection]
type = VarSet
trigger1 = MoveContact = 1 && var(30) < 0
var(30) = HitPauseTime
ignoreHitPause = 1

[State -2, Hit Detection]
type = VarSet
trigger1 = 1
var(30) = -1

[State -2, Hit Detection]
type = VarRangeSet
trigger1 = MoveType = I
trigger2 = MoveType = H && Time
first = 30
last = 36
value = -1
ignoreHitPause = 1

[State -2, Hit Count]
type = VarAdd
trigger1 = MoveHit = 1
trigger1 = !(HitDefAttr = SCA, AT)
var(13) = 1

[State -2, Hit Count Reset]
type = VarSet
trigger1 = NumEnemy && var(13)
trigger1 = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300)
var(13) = 0
ignoreHitPause = 1

[State -2, Juggle Count]
type = VarAdd
trigger1 = MoveHit = 1
trigger1 = !(HitDefAttr = SCA,AT)
var(15) = 1

[State -2, Juggle Reset Single]
type = VarSet
triggerAll = NumEnemy = 1 && var(15)
trigger1 = (Enemy, StateType != A) && (Enemy, StateNo != [5100,5109]) && (Enemy, Time >= 1)
trigger2 = (Enemy, MoveType != H) || (Enemy, StateNo = [120,155]) || (Enemy, Ctrl)
var(15) = 0
ignoreHitPause = 1

[State -2, Juggle Reset Simul]
type = VarSet
triggerAll = NumEnemy >= 2 && var(15)
trigger1 = (EnemyNear(0), StateType != A) && (EnemyNear(0), Time >= 1)
trigger2 = (EnemyNear(0), MoveType != H) || (EnemyNear(0), StateNo = [120,155]) || (EnemyNear(0), Ctrl)
trigger3 = (EnemyNear(1), StateType != A) && (EnemyNear(0), Time >= 1)
trigger4 = (EnemyNear(1), MoveType != H) || (EnemyNear(0), StateNo = [120,155]) || (EnemyNear(0), Ctrl)
var(15) = 0
ignoreHitPause = 1

[State -2, Free Juggling]
type = VarSet
trigger1 = RoundState != 2
var(15) = 0
ignoreHitPause = 1

[State -2, Juggle Flag]
type = VarSet
trigger1 = NumEnemy && !var(16)
trigger1 = (EnemyNear, StateNo = 5040) && !(EnemyNear, Ctrl)
var(16) = 1
ignorehitpause = 1

[State -2, Juggle Flag Reset Single]
type = VarSet
triggerAll = NumEnemy = 1 && var(16)
trigger1 = (Enemy, MoveType != H) && (Enemy, StateNo != 5040)
trigger2 = !(Enemy, HitShakeOver) || (Enemy, StateType = L) || (Enemy, Ctrl)
var(16) = 0
ignoreHitPause = 1

[State -2, Juggle Flag Reset Simul]
type = VarSet
triggerAll = NumEnemy >= 2 && var(16)
trigger1 = (EnemyNear(0), MoveType != H) && (EnemyNear(0), StateNo != 5040)
trigger2 = !(EnemyNear(0), HitShakeOver) || (EnemyNear(0), StateType = L) || (EnemyNear(0), Ctrl)
trigger3 = (EnemyNear(1), MoveType != H) && (EnemyNear(1), StateNo != 5040)
trigger4 = !(EnemyNear(1), HitShakeOver) || (EnemyNear(1), StateType = L) || (EnemyNear(1), Ctrl)
var(16) = 0
ignoreHitPause = 1

[State -2, Counter Flag] 
type = VarSet
trigger1 = NumEnemy
fvar(8) = (EnemyNear, MoveType = A)
ignoreHitPause = 1
 
;Damage Dampener Variable (by POTS)
[State -2, Hit Count] 
type = VarAdd 
trigger1 = !IsHelper
trigger1 = MoveHit = 1 
trigger1 = !HitPauseTime 
trigger1 = !(HitDefAttr = SCA, AT) 
fvar(13) = 1 
 
[State -2, Hit Count Reset] 
type = VarSet 
trigger1 = NumEnemy && fvar(13) 
trigger1 = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300) 
fvar(13) = 0 
ignoreHitPause = 1

[State -2, Dampener] 
type = VarSet 
trigger1 = 1 
fvar(10) = ifElse(fvar(13) < 3, 24, ifElse(fvar(13) >= 23, 1, 24 - fvar(13))) / 24.0 
ignoreHitPause = 1 
 
[State -2, Dampener Limit] 
type = VarSet 
trigger1 = fvar(10) < 0 
fvar(10) = 0 
ignoreHitPause = 1 
 
[State -2, Root Dampener] 
type = VarSet 
trigger1 = 1 
fvar(11) = fvar(10) * ifElse(fvar(8), 1.2, 1) 
ignoreHitPause = 1

[State -1, AI ON]  ; Turn the AI on when
Type = VarSet
TriggerAll = Var(59) < 1 ; it is not on yet and
TriggerAll = RoundState=2 ; the fight has started and is not over yet and
Trigger1 = AILevel>0 ; the computer is playing the character
v = 59
value= 1 ; value of 1 will mean the AI is on
Ignorehitpause=1

[State -1, AI OFF] ; Turn the AI off when
Type=VarSet
Triggerall=var(59)>0  ; it is on and
Trigger1=RoundState!=2  ; the round is not started yet or is already over or
Trigger2=AILevel=0  ; the computer is not in control
v=59
value=0 ; value of 0 will mean the AI is off. values other than 0 and 1 are not used in this example, we have only one AI mode, the normal one.
Ignorehitpause=1

[State -1, AI go easeh on meh!]
Type=VarSet
Trigger1=1
var(50)=(AILevel=1)*6+(AILevel=2)*12+(AILevel=3)*32+(AILevel=4)*64+(AILevel=5)*90+(AILevel=6)*128+(AILevel=7)*200+(AILevel=8)*300

[State -2, Debug]
type = displaytoclipboard
trigger1 = 1
text = "AI = %d KyoobPoints = %i"
params = AIlevel, var(40)
ignorehitpause = 1

[Statedef -3]

[State -3, Pause]
type = Helper
triggerall = (!AILevel) && !(NumHelper(8000)) && (RoundState = 2)
triggerall = teamside = 1
trigger1 = command = "start" && (!HitPauseTime || HitPauseTime = 1) && !NumHelper(6002)
helpertype = normal 
name = "Pause Menu"
ID = 8000
stateno = 8000
pos = 0,0
postype = left
facing = 1
keyctrl = 1
ownpal = 1
pausemovetime = 9999
ignorehitpause = 1

[State -3, Level 1 Super AfterImage]
type = AfterImage
trigger1 = StateNo = 3000 && Time = 16
trigger2 = StateNo = 3005 && Time = 16
time = 2
timegap = 1
framegap = 4
length = 16
palbright = 200, 200, 250
palcontrast = 0, 100,150
palcolor = 0
trans = add

[State -3, Level 1 Super AfterImage]
type = AfterImage
trigger1 = StateNo = 3500 && Time = 1
time = 2
timegap = 1
framegap = 4
length = 16
palbright = 250, 0, 0
palcontrast = 250, 0,0
palcolor = 0
trans = add

[State -3, AfterImage Persist]
type = AfterImageTime
;trigger1 = StateNo = 50 || (StateNo = [600,699])
;trigger1 = (var(3) = 2 || var(3) = 3) && vel y < -1
;trigger2 = var(20)
;trigger3 = StateNo = [700,715]
trigger1 = StateNo = [3000,3501]
time = 2
ignorehitpause = 1

[State -3, AfterImage Off]
type = AfterImageTime
triggerAll = Time <= 1
trigger1 = StateNo = 3000 || StateNo = 3500
;trigger2 = StateNo = 3300
time = 0
ignorehitpause = 1

;This controller plays a sound everytime KFM lands from a jump, or
;from his back-dash.
[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
trigger3 = stateno = 1012
trigger4 = stateno = 1014
value = 40, 0
volumescale = 125
