;------------------------------------------------------------
;Combo Start
[StateDef 3500]
type = S
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 3500
poweradd = 20
sprpriority = 2

[State 2999, SuperPause]
type = SuperPause
trigger1 = time = 0
time = 22
anim = 100
sound = S500, 0
pos = 0,-20
move = 0
darken = 3
p2defmul = 0
poweradd = -1000
unhittable = 1

[State 3000, Helper]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "6000"
ID = 6000
stateno = 6000
pos = 0,-250
postype = back
facing = 1
ownpal = 0
size.xscale = 1
size.yscale = 1
pausemovetime = 9999
supermovetime = 9999
persistent = 0

[State 2999, Explod]
type = Explod
trigger1 = time = 0
anim = 4050
ID = 4050
pos = 0,0
postype = left
facing = 1
bindtime = -1
removetime = 90
sprpriority = -7
ownpal = 1
supermovetime = 40
removeongethit = 1

[State 3000, Hyper Background]
type = Explod
trigger1 = time = 0
id = 8506
anim = 8506
pos = 0,0
postype = back
sprpriority = -4
removeongethit = 1
removetime = 200
bindtime = -1
supermove = 1
ownpal = 1
removeongethit = 1

[State 3500, VelSet]
type = VelSet
trigger1 = animelem = 2
x = 25

[State 3500, 1]
type = HitDef
trigger1 = AnimElem = 2
attr = S, NA
damage = 1
animtype = Light
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 10, 10
sparkno = 3
sparkxy = -10, -6
hitsound = 5, 0
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = -4
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
p1stateno = 3501
p2facing = 1
getpower = 0



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

[State 3500, end]
type = ChangeState
trigger1 = moveguarded
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Combo
[StateDef 3501]
type = S
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 3501
poweradd = 20
sprpriority = 2

[State 3501, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = S3000,0
volume = 99999999999999999
channel = -1

[State 3000, 1]
type = Explod
trigger1 = Time = 0
id = 8507
anim = 8507
pos = 0,0
postype = back
sprpriority = -3
removeongethit = 1
removetime = 285
bindtime = -1
supermove = 1
ownpal = 1
removeongethit = 1

[State 3000, 1]
type = AssertSpecial
trigger1=numexplod(8507)
flag = noBG
flag2= globalnoshadow
pausemove=99999
supermove=99999
ignorehitpause=1

[State 0, VelSet]
type = VelSet
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
trigger3 = AnimElem = 6
trigger4 = AnimElem = 8
trigger5 = AnimElem = 10
trigger6 = AnimElem = 12
trigger7 = AnimElem = 14
trigger8 = AnimElem = 16
trigger9 = AnimElem = 18
trigger10 = AnimElem = 20
trigger11 = AnimElem = 22
trigger12 = AnimElem = 24
trigger13 = AnimElem = 26
trigger14 = AnimElem = 28
trigger15 = AnimElem = 30
trigger16 = AnimElem = 32
trigger17 = AnimElem = 34
trigger18 = AnimElem = 36
trigger19 = AnimElem = 38
trigger20 = AnimElem = 40
x = 3
y = 0


[State 3501, 1]
type = HitDef
trigger1 = AnimElem = 2
trigger2 = AnimElem = 4
trigger3 = AnimElem = 6
trigger4 = AnimElem = 8
trigger5 = AnimElem = 10
trigger6 = AnimElem = 12
trigger7 = AnimElem = 14
trigger8 = AnimElem = 16
trigger9 = AnimElem = 18
trigger10 = AnimElem = 20
trigger11 = AnimElem = 22
trigger12 = AnimElem = 24
trigger13 = AnimElem = 26
trigger14 = AnimElem = 28
trigger15 = AnimElem = 30
trigger16 = AnimElem = 32
trigger17 = AnimElem = 34
trigger18 = AnimElem = 36
trigger19 = AnimElem = 38
trigger20 = AnimElem = 40
attr = S, NA
damage = 16,3
animtype = medium
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 10, 10
sparkno = 3
sparkxy = -10, -6
hitsound = S5, 5
guardsound = 6, 0
ground.type = High
ground.slidetime = 0
ground.hittime  = 12
ground.velocity = 0
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
getpower = 0

[State 3501, 1]
type = HitDef
trigger1 = AnimElem = 40
attr = S, NA
damage = 25,3
animtype = Low
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 10, 10
sparkno = s8003
sparkxy = -10, -6
hitsound = S5, 5
guardsound = 6, 0
ground.type = High
ground.slidetime = 5
ground.hittime  = 12
ground.velocity = -4,-5
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 12
fall = 1
fall.animtype = HaRd
getpower = 0

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

[StateDef 4500]
type = S
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 70
poweradd = 20
sprpriority = 2

[State 2999, SuperPause]
type = SuperPause
trigger1 = time = 0
time = 88
anim = 100
sound = S500, 0
pos = 0,-20
move = 0
darken = 3
p2defmul = 0
poweradd = -1000
unhittable = 1
[State 0, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S4500,2
[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 2
value = S4500,0
[State 3000, Helper]
type = Helper
trigger1 = animelem = 2
helpertype = normal
name = "ok"
ID = 623
stateno = 4501
pos = random%10,random%10
postype = p1
facing = 1
ownpal = 0
size.xscale = 0.3
size.yscale = 0.3
persistent = 0
[State 3000, Helper]
type = Helper
trigger1 = animelem = 2
helpertype = normal
name = "ok"
ID = 623
stateno = 4501
pos = random%10,random%10
postype = p1
facing = 1
ownpal = 0
size.xscale = 0.3
size.yscale = 0.3
persistent = 0
[State 3000, Helper]
type = Helper
trigger1 = animelem = 2
helpertype = normal
name = "ok"
ID = 623
stateno = 4501
pos = random%10,random%10
postype = p1
facing = 1
ownpal = 0
size.xscale = 0.3
size.yscale = 0.3
persistent = 0
[State 3000, Helper]
type = Helper
trigger1 = animelem = 2
helpertype = normal
name = "ok"
ID = 623
stateno = 4501
pos = random%10,random%10
postype = p1
facing = 1
ownpal = 0
size.xscale = 0.3
size.yscale = 0.3
persistent = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = animtime = 0
value = 0
ignorehitpause = 1
ctrl = 1
;mini
[StateDef 4501]
type = A
physics = N
movetype = A
juggle  = 1
velset = 0,0
ctrl = 0
anim = 2023
poweradd = 20
sprpriority = 2

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
;value2 = S,NA
time = 1
ignorehitpause = 1
[State 240, 2]
type = HitDef
trigger1 = 1
attr = A, HA
animtype  = Medium
damage    = 12,6
guardflag = MA
pausetime = 0,11 ; 12,12
sparkno = 1
sparkxy = -10,-60
hitsound   = s1,6
guardsound = 6,0
ground.type = Low
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -6
air.velocity = -2.2,-3.2

[State 0, Turn]
type = Turn
trigger1 = random = 800
ignorehitpause = 1
[State 0, VelSet]
type = VelSet
trigger1 = !time
x = 20+random%5
y = -20-random%5
[State 6997]
type = velmul
trigger1 = frontedgebodydist <= 0
trigger2 = backedgebodydist <= 0
x = -1
[State 6997]
type = velmul
trigger1 = pos y > -vel y
trigger2 = screenpos y <= 40
y = -1

[State 0, DestroySelf]
type = DestroySelf
trigger1 = time = 200
ignorehitpause = 1
;---------------------------------------------------------------------------
; Smash Kung Fu Upper (hyper)
; CNS difficulty: medium
; Description: This is very similar to KFM's Strong and Light Kung Fu Uppers.
;     There is just one HitDef, for a screen-shaking hit. The envshake
;     parameters are used to make this effect. You can find out more about
;     each parameter in the CNS documentation.
;     The fall.recover parameter is set at 0, meaning that p2 cannot recover
;     from the fall by entering his recovery command (for KFM, that is x+y).
;     This gives the attacking KFM a chance to follow up with another attack,
;     such as the Fast Kung Fu Palm.
;     Note that there is a ChangeState controller used to make KFM change to
;     a success state if he hits. The success state has KFM hold his arm
;     up longer for a dramatic effect.
[Statedef 3052]
type    = S
movetype= A
physics = S
juggle  = 4
velset = 0,0
anim = 1
ctrl = 0
sprpriority = 2

[State 3050, Width]
type = Width
trigger1 = AnimElemTime(3) >= 0 && AnimElemTime(16) < 0
value = 5,0

[State 3050, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S190,0

[State 3050, Helper]
type = Helper
trigger1 = AnimElem = 6
ID = 3054
pos = 0,-25
postype = p1
stateno = 3054
helpertype = normal
name = "Rock"
keyctrl = 0
ownpal = 1
supermovetime = 1

[State 3050, RemoveExplod]
type = RemoveExplod
trigger1 = WinKO
trigger2 = AnimTime = 0
id = 752

[State 3000, Explod]
type = Explod
trigger1 = time = 0
anim = 4050
ID = 4050
pos = 0,0
postype = left
facing = 1
bindtime = -1
removetime = 90
sprpriority = -7
ownpal = 1
supermovetime = 40
removeongethit = 1

[State 3000, Hyper Background]
type = Explod
trigger1 = AnimElem = 6
id = 8507
anim = 8507
pos = 0,0
postype = back
sprpriority = -4
removeongethit = 1
removetime = 200
bindtime = -1
supermove = 1
ownpal = 1
removeongethit = 1

[State 3000, Helper]
type = Helper
trigger1 = time = 0
helpertype = normal
name = "6000"
ID = 6000
stateno = 6000
pos = 0,-250
postype = back
facing = 1
ownpal = 0
size.xscale = 1
size.yscale = 1
pausemovetime = 9999
supermovetime = 9999
persistent = 0

[State 3050, PlaySnd2]
type = PlaySnd
trigger1 = AnimElem = 6
value = S1,0

[State 3050, Super A]
type = SuperPause
trigger1 = time = 0
pos = -5, -55
anim = 100
sound = S9000,1
poweradd = -2000

[State 3050, Super B]
type = AfterImage
trigger1 = AnimElem = 3
time = 2

[State 3050, Super C]
type = AfterImageTime
trigger1 = AnimElemTime(3) >= 0
time = 2

[State 3050, Super D]
type = NotHitBy
trigger1 = AnimElem = 3
value = , NA, SA, AT
time = 6

[State 3050, 1]
type = PlaySnd
trigger1 = AnimElem = 8
value = 0, 2

;This controller below makes Kung Fu man change to a success state if he
;successfully hits the Smash Kung Fu Upper.
[State 3050, 4]
type = ChangeState
trigger1 = MoveHit
value = 3051

[State 3050, 5]
type = ChangeState
trigger1 = Time = 200
value = 0
ctrl = 1

;------------------
; Smash Kung Fu Upper (success)
; Description: This is the state that KFM changes to if he successfully hits
;     with Smash Kung Fu Upper. KFM holds his arm high for a short while
;     longer, then changes back to his idle stand state.
[Statedef 3053]
type    = S
movetype= A
physics = S
anim = 3503

[State 3051, 1]
type = AfterImageTime
trigger1 = AnimTime < -6
time = 2

[State 3051, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;-----------------------------------------------------------------------
; Rock

[StateDef 3054]
type = S
movetype = A
physics = S
juggle = 0
anim = 3504
ctrl = 0
sprpriority = 100

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

[state 3052]
type = VarSet
trigger1 = time = 0
fvar(0) = 0

[state 3052]
type = VarAdd
trigger1 = time%3 = 0
fv = 0
value = 0.1
ignorehitpause = 1

[state 3052]
type = AngleDraw
trigger1 = 1
scale = fvar(0), fvar(0)
ignorehitpause = 1

[State 3052, HitDef]
type = HitDef
trigger1 = time = 0
attr = S, HP
damage = 350,20
animtype = Medium
guardflag = MA
hitflag = MAF
velocity = 4, 0
priority = 4, Hit
pausetime = 1,10
sparkxy = -10,-10
hitsound = S5,5
guardsound = 6,0
ground.type = Low
ground.slidetime = 20
ground.hittime  = 30
ground.velocity = -9,-10
air.animtype = Back
air.velocity = -5,-10
air.juggle = 10
fall = 1
air.fall = 1
down.velocity = -5,3
down.hittime = 20
envshake.time = 5
envshake.ampl = 7
fall.envshake.time = 1
fall.envshake.ampl = -1
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
down.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
airguard.cornerpush.veloff = 0
palfx.add = 0,0,0
palfx.mul = 255,249,168
palfx.sinadd = 0,0,0,1
palfx.color = 256
getpower = 0
p2stateno = 14000

[State 3052, DestroySelf]
type = DestroySelf
trigger1 = time = 100

;------------------------------------------------------------------------------------------
[Statedef 14000]
type = U
movetype = U
physics = N
movehitpersist = 1
hitdefpersist = 1

[State , ステートタイプ変更]
type = Statetypeset
trigger1 = !ishelper
movetype = A
physics = N
ignorehitpause = 1

[state 1];ステート抜け
type = changestate
trigger1 = !Ishelper
value = 5312
ctrl=0
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[State 0, DestroySelf]
type = DestroySelf
trigger1 = ishelper
ignorehitpause = 1
supermovetime = 99999999
pausemovetime = 99999999

[Statedef 5312]
type    = L
sprpriority = -3

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 5150
ignorehitpause = 1

[State 0, LifeAdd]
type = LifeAdd
trigger1 = 1
value = -1000000000
ignorehitpause = 1
[State 0, LifeSet]
type = LifeSet
trigger1 = 1
value = -1
ignorehitpause = 1

;---------------------------------------------------------------------------
; Rolling Crush
[Statedef 1210]
type    = A
movetype= A
physics = N
juggle  = 5
poweradd= 65
ctrl = 0
velset = 0,0
sprpriority = 2
anim = 8217

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = 0
scale = 0.6,0.6
ignorehitpause = 1
[State 3000, Hyper Portrait]
type = explod
trigger1 = Time = 3 ;animelem = 1 ;2 ;time = 0
anim = 6000
postype = back
sprpriority = -3
supermovetime = -1
removetime = 30 ;40 ;70
pos = 0,0
bindtime = -1
removeongethit = 1

[State 3000, Explod]
type = Explod
trigger1 = Time = 3 ;animelem = 1 ;2 ;time = 0
anim = 4500
ID = 4500
pos = 0,0
postype = left
facing = 1
bindtime = -1
removetime = 30 ;40 ;70
sprpriority = -7
ownpal = 1
supermovetime = 30 ;40 ;70
removeongethit = 1

[State 1210]
type = SuperPause
trigger1 = Time = 3
;anim = -1
anim = s7001 ;100
sound = S20, 1 ;0
unhittable = 1
poweradd = -1000
movetime = 0
time = 30 ;29
darken = 1
pos = -8,-18

[State 1210, Charge up spark]
type = Helper
trigger1 = NumHelper(1211) = 0
trigger1 = Time = 2
helpertype = normal
ID = 1211
stateno = 1211
ownpal = 1
sprpriority = 1
persistent = 0
;scale = 2,2
size.xscale = 2 ;.38 ;0.3 ;1
size.yscale = 2 ;.38

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

[State 1210]
type = velset
trigger1 = time = 32
x = Ifelse(Vel X = 0,5,-5)
y = 5

[State 1210]
type = velset
trigger1 = time = 32
x = Ifelse(facing,5,-5)
y = ifelse(random < 500,5,-5)


[State 1210]
type = velset
trigger1 = time > 32
trigger1 = pos y >= 50
y = ifelse(vel y > 0,-5, 5)


[State 1210]
type = velset
trigger1 = time > 32
trigger1 = pos y < -150
trigger1 = anim != 44 ;605
y = ifelse(vel y > 0, -5,5)

[State 1210]
type = velset
triggerall = time > 32
trigger1 = BackEdgeBodyDist < 5
trigger2 = FrontEdgeBodyDist < 5
x = ifelse(vel x > 0,-5,5)

[State 1210]
type = HitDef
trigger1 = Time%10 = 0
trigger1 = Time = [32,240]
attr = A, SA
;guardflag = MA
animtype  = Back
damage    = 25,10 ;15,15 ;20,20 ;30,30 ;5 ;50 ;var(30),var(30)/2
;damage    = var(20),var(20)/2
pausetime = 3,10
;sparkno = S7205
sparkno = s8003+random%3 ;S2005+(random%2)
guard.sparkno = S8011 ;2010
sparkxy = -10,0
;hitsound   = S1,2
hitsound   = s5,2 ;9
guardsound = s6,0
;guardsound = S4,0
;guard.sparkno = S7300
ground.slidetime = 12
ground.hittime  = 15
ground.type = High
ground.velocity = -5,-5
air.velocity = -5,-5
fall = 1
air.fall = 1
fall.recover =0
getpower = 55
givepower = 10
;fall.animtype = Hard
p2stateno = 1025

[State 1210]
type = ChangeAnim
trigger1 = Time >= 240
trigger1 = pos y < -140
trigger2 = time >= 300
value = 44 ;605

[State 1210]
type = StateTypeSet
trigger1 = anim = 44 ;605
physics = A
persistent = 0

[State 1210]
type = velset
trigger1 = anim = 44 ;605
x = 0
y = 5
persistent = 0

[State 1210, ]
type = Explod
trigger1 = anim = 44 ;605
anim = 8216
id = 8216
sprpriority = 1
ownpal = 1
pos = 0,-20
ignorehitpause = 1
bindtime = -1
removetime = 30
persistent = 0
scale = 2,2

[State 1210, 5]
type = ChangeState
trigger1 = Pos Y >= -5
trigger1 = Vel Y > 0
trigger1 = Time >= 240
value = 52
ctrl = 0

;------------------------------------------------------------------------------------------------------------
;Rolling crush aura
[Statedef 1211]
type = S
movetype = I
physics =N
anim = 8215
ctrl = 0
sprpriority = 1
velset = 0,0

[State 1211]
type = BindToParent
trigger1 = 1

[State 1211]
type = Varset
trigger1 = Time = 0
var(2) = parent,stateno


[State 1211]
type = DestroySelf
trigger1 = parent,anim = 44 ;605
trigger2 = parent,stateno != var(2)

;------------------
; Hit by Fast Kung Fu Palm - shaking from the hit
; (a custom gethit state)
; See State 1020 for details
[Statedef 1025]
type    = A
movetype= H
physics = N
velset = 0,0

[State 1025, Anim] ;Custom animation
type = ChangeAnim2
trigger1 = 1
value = 1025

[State 1025, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 1026

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

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

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

[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 1027]
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 = 1027

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

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

;------------------
; Hit by Fast Kung Fu Palm - bounce off wall
; (a custom gethit state)
[Statedef 1028]
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 = -6

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

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

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

[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