;======================<KUNG FU BARRAGE>===================
[Statedef 3000]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 3000
poweradd = ifelse(var(20) > 0, 0, -1000)
sprpriority = 2
facep2 = 1

[State 3000, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(4) < 0
time = 1
value = SCA

[State 3000, No Corner Push]
type = VarSet
trigger1 = Time = 3
fvar(5) = 0

[State 3000, Unguardable]
type = VarSet
trigger1 = Time = 3 && NumEnemy
trigger1 = (EnemyNear, StateNo != [120,155])
var(17) = 50

[State 3000, Super Cancel Flag]
type = VarSet
trigger1 = !Time
var(21) = (PrevStateNo = [1000,2999]) && var(6)

[State 3000, Hyper Cancel Flag]
type = VarSet
trigger1 = !Time
var(22) = (PrevStateNo = [3000,4999]) && var(7)

[State 3000, Super Cancel Flash]
type = PalFX
trigger1 = var(21) || var(22)
trigger1 = !(Time % 2) && Time <= 12
time = 1
add = 255,255,255
ignoreHitPause = 1

[State 3000, Super Cancel Juggle Reset]
type = VarSet
trigger1 = !Time
trigger1 = var(21) || var(22)
var(15) = 0
ignoreHitPause = 1

[State 3000, SuperPause FX]
type = Helper
trigger1 = Time = 3
helperType = Normal
stateNo = 8500
ID = 8500
name = "Superpause FX"
posType = P1
pos = 5,-60
superMoveTime = 255
size.xScale = 1
size.yScale = 1
ownPal = 1

[State 3000, SuperPause]
type = SuperPause
trigger1 = Time = 3
time = 50
moveTime = 50
p2DefMul = 1
unHittable = 1
anim = -1
sound = s8500,0
darken = 0
poweradd = 0

[State 3000, Dust Helper]
type = Helper
trigger1 = AnimElem = 3
helpertype = normal
stateno = 8103
ID = 8100
name = "Dash Dust"
postype = p1
pausemovetime = 255
supermovetime = 255
ownpal = 1

[State 3000, Width]
type = Width
trigger1 = AnimElemTime(3) > 0
value = 15,0

[State 3000, Voice Start]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 8
channel = 0

[State 3000, Voice 1-3]
type = PlaySnd
trigger1 = AnimElem = 3 || AnimElem = 11 || AnimElem = 19
value = 0, 0
channel = 0

[State 3000, Swing Snd]
type = PlaySnd
trigger1 = AnimElem = 4 || AnimElem = 12 || AnimElem = 20
value = 1, 2
channel = 1

[State 3000, Fly Snd]
type = PlaySnd
trigger1 = AnimElem = 3
value = 1000,1
channel = 2

[State 3000, PosAdd Elem 3]
type = PosAdd
trigger1 = AnimElem = 3
x = 20

[State 3000, Velocity]
type = VelSet
trigger1 = AnimElemTime(3) > 0 && AnimElemTime(26) < 0
x = 6

[State 3000, Friction]
type = VelMul
trigger1 = AnimElemTime(3) > 0 
x = .85

[State 3000, VelStop]
type = Velset
trigger1 = AnimElem = 26
x = 0

[State 3000, Hit 1&2]
type = HitDef
trigger1 = !var(16) && var(15) < 3
trigger1 = AnimElem = 6 || AnimElem = 14
attr = S, HA
damage = ceil(ifElse(fvar(11) * 49 < 7, 7, fvar(11) * 49)), 7
priority = 4, hit
animtype = Hard
getpower = 0, 0
givepower = 35, 35
guardflag = MA
hitflag = MAF
hitsound = S2,2
guardsound = S130,0
pausetime = 10,12
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 100), var(36) := -61
air.animtype = Back
fall.animtype = Back
ground.type = Low
air.type = Low
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -9, 0
air.velocity = -4, -3
guard.velocity = -11
airguard.velocity = -8, -3
airguard.ctrlTime = 16
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .5
fall = 0
air.fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 16
envshake.ampl = 4
envShake.freq = 120

[State 3000, Final Hit]
type = HitDef
trigger1 = !var(16) && var(15) < 4
trigger1 = AnimElem = 22
attr = S, HA
damage = ceil(ifElse(fvar(11) * 70 < 7, 7, fvar(11) * 70)), 7
priority = 4, hit
animtype = Hard
getpower = 0, 0
givepower = 35, 35
guardflag = MA
hitflag = MAF
hitsound = S2,2
guardsound = S130,0
pausetime = 12,12
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 100), var(36) := -61
air.animtype = Back
fall.animtype = Back
ground.type = Low
air.type = Low
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -7, -7.5
air.velocity = -7,-7
guard.velocity = -12
airguard.velocity = -8, -3
airguard.ctrlTime = 16
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .58
fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 16
envshake.ampl = 4
envShake.freq = 120

[State 3000, StateTypeSet: Idle]
type = StateTypeSet
trigger1 = AnimElemTime(23) >= 0
movetype = I

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

;======================<KUNG FU BARRAGE MAX>===================
[Statedef 3050]
type    = S
movetype= A
physics = N
velset = 0,0
ctrl = 0
anim = 3050
poweradd = ifelse(var(20) > 0, -1000, -2000)
sprpriority = 2
facep2 = 1

[State 3050, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(4) < 0
time = 1
value = SCA

[State 3050, No Corner Push]
type = VarSet
trigger1 = Time = 3
fvar(5) = 0

[State 3050, Unguardable]
type = VarSet
trigger1 = Time = 3 && NumEnemy
trigger1 = (EnemyNear, StateNo != [120,155])
var(17) = 50

[State 3050, Super Cancel Flag]
type = VarSet
trigger1 = !Time
var(21) = (PrevStateNo = [1000,2999]) && var(6)

[State 3050, Hyper Cancel Flag]
type = VarSet
trigger1 = !Time
var(22) = (PrevStateNo = [3000,4999]) && var(7)

[State 3050, Super Cancel Flash]
type = PalFX
trigger1 = var(21) || var(22)
trigger1 = !(Time % 2) && Time <= 12
time = 1
add = 255,255,255
ignoreHitPause = 1

[State 3050, Super Cancel Juggle Reset]
type = VarSet
trigger1 = !Time
trigger1 = var(21) || var(22)
var(15) = 0
ignoreHitPause = 1

[State 3050, SuperPause FX]
type = Helper
trigger1 = Time = 3
helperType = Normal
stateNo = 8510
ID = 8500
name = "Superpause FX"
posType = P1
pos = 5,-60
superMoveTime = 255
size.xScale = 1
size.yScale = 1
ownPal = 1

[State 3050, SuperPause]
type = SuperPause
trigger1 = Time = 3
time = 50
moveTime = 50
p2DefMul = 1
unHittable = 1
anim = -1
sound = s8500,0
darken = 0
poweradd = 0

[State 3050, Dust Helper]
type = Helper
trigger1 = AnimElem = 3
helpertype = normal
stateno = 8103
ID = 8100
name = "Dash Dust"
postype = p1
pausemovetime = 255
supermovetime = 255
ownpal = 1

[State 3050, Width]
type = Width
trigger1 = AnimElemTime(3) > 0
value = 15,0

[State 3050, Voice Star]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0, 8
channel = 0

[State 3050, Voice 1-3]
type = PlaySnd
trigger1 = AnimElem = 3 || AnimElem = 11 || AnimElem = 19
value = 0, 0
channel = 0

[State 3000, Voice 4]
type = PlaySnd
trigger1 = AnimElem = 31
value = 0, 7
channel = 0

[State 3050, Swing Snd]
type = PlaySnd
trigger1 = AnimElem = 4 || AnimElem = 12 || AnimElem = 20 || AnimElem = 30
value = 1, 2 
channel = 1

[State 3050, Fly Snd]
type = PlaySnd
trigger1 = AnimElem = 3
value = 1000,1
channel = 2

[State 3050, PosAdd Elem 3]
type = PosAdd
trigger1 = AnimElem = 3
x = 20

[State 3050, Velocity]
type = VelSet
trigger1 = AnimElemTime(3) > 0 && AnimElemTime(31) < 0
x = 6.75

[State 3050, Friction]
type = VelMul
trigger1 = AnimElemTime(3) > 0 
x = .9

[State 3050, VelStop]
type = Velset
trigger1 = AnimElem = 31
x = 0

[State 3050, Hit 1-2]
type = HitDef
trigger1 = !var(16) && var(15) < 4
trigger1 = AnimElem = 6 || AnimElem = 14
attr = S, HA
damage = ceil(ifElse(fvar(11) * 56 < 7, 7, fvar(11) * 56)), 7
priority = 4, hit
animtype = Hard
getpower = 0, 0
givepower = 35, 35
guardflag = MA
hitflag = MAF
hitsound = S2,2
guardsound = S130,0
pausetime = 10,12
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 100), var(36) := -61
air.animtype = Back
fall.animtype = Back
ground.type = Low
air.type = Low
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -7.5, 0
air.velocity = -4, -3
guard.velocity = -11
airguard.velocity = -8, -3
airguard.ctrlTime = 16
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .5
fall = 0
air.fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 16
envshake.ampl = 4
envShake.freq = 120

[State 3050, Hit 3]
type = HitDef
trigger1 = !var(16) && var(15) < 4
trigger1 = AnimElem = 22
attr = S, HA
damage = ceil(ifElse(fvar(11) * 56 < 7, 7, fvar(11) * 56)), 7
priority = 4, hit
animtype = Hard
getpower = 0, 0
givepower = 35, 35
guardflag = MA
hitflag = MAF
hitsound = S2,2
guardsound = S130,0
pausetime = 10,18
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 100), var(36) := -61
air.animtype = Back
fall.animtype = Back
ground.type = Low
air.type = Low
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -7.5, 0
air.velocity = -4, -3
guard.velocity = -11
airguard.velocity = -8, -3
airguard.ctrlTime = 16
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .5
fall = 0
air.fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 16
envshake.ampl = 4
envShake.freq = 120

[State 3050, Final Hit]
type = HitDef
trigger1 = !var(16) && var(15) < 5
trigger1 = AnimElem = 31
attr = S, HA
damage = ceil(ifElse(fvar(11) * 84 < 7, 7, fvar(11) * 84)), 7
priority = 4, hit
animtype = Diagup
getpower = 0, 0
givepower = 35, 35
guardflag = MA
hitflag = MAF
hitsound = S1000,0;S2,2
guardsound = S130,0
pausetime = 26,26
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 60), var(36) := -71
air.animtype = Diagup
fall.animtype = Diagup
ground.type = Low
air.type = Low
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -7, -10
air.velocity = -7,-9.5
guard.velocity = -15
airguard.velocity = -8, -3
airguard.ctrlTime = 16
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .58
fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 16
envshake.ampl = 4
envShake.freq = 150

[State 3050, StateTypeSet: Idle]
type = StateTypeSet
trigger1 = AnimElemTime(32) >= 0
movetype = I

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

;======================<GRAND KUNG FU UPPER>===================
[Statedef 3100]
type = S
movetype = A
physics = S
ctrl = 0
poweradd = ifelse(var(20) > 0, -1000, -3000)
velset = 0,0
anim = 3100
facep2 = 1
sprpriority = 2

[State 3100, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(7) < 0
time = 1
value = SCA

[State 3100, No Corner Push]
type = VarSet
trigger1 = Time = 3
fvar(5) = 0

[State 3100, Unguardable]
type = VarSet
trigger1 = Time = 3 && NumEnemy
trigger1 = (EnemyNear, StateNo != [120,155])
var(17) = 54

[State 3100, Super Cancel Flag]
type = VarSet
trigger1 = !Time
var(21) = (PrevStateNo = [1000,2999]) && var(6)

[State 3100, Hyper Cancel Flag]
type = VarSet
trigger1 = !Time
var(22) = (PrevStateNo = [3000,4999]) && var(7)

[State 3100, Super Cancel Flash]
type = PalFX
trigger1 = var(21) || var(22)
trigger1 = !(Time % 2) && Time <= 12
time = 1
add = 255,255,255
ignoreHitPause = 1

[State 3100, Super Cancel Juggle Reset]
type = VarSet
trigger1 = !Time
trigger1 = var(21) || var(22)
var(15) = 0
ignoreHitPause = 1

[State 3100, SuperPause FX]
type = Helper
trigger1 = Time = 3
helperType = Normal
stateNo = 8520
ID = 8500
name = "Superpause FX"
posType = P1
pos = 3,-68
superMoveTime = 255
size.xScale = 1
size.yScale = 1
ownPal = 1

[State 3100, SuperPause]
type = SuperPause
trigger1 = Time = 3
time = 54
moveTime = 54
p2DefMul = 1
unHittable = 1
anim = -1
sound = s8500,0
darken = 0
poweradd = 0

[State 3100, You're Finished!]
type = PlaySnd
trigger1 = AnimElem = 1
value = 0,19
channel = 0

[State 3100, HYAAAH!]
type = PlaySnd
trigger1 = AnimElem = 3
value = 0,6
channel = 0

[State 3100, Swing Snd]
type = PlaySnd
trigger1 = AnimElem = 5
value = 1,2
channel = 1

[State 3100, Width]
type = Width
trigger1 = AnimElemTime(4) >= 0 && AnimElemTime(15) < 0
value = 5,0

[State 3100, Hit] 
type = HitDef
trigger1 = !var(16) && var(15) < 2
trigger1 = AnimElem = 7
attr = S, HA
ID = 3100
damage = ceil(ifElse(fvar(11) * 322 < 7, 7, fvar(11) * 322)), 7
priority = 4, hit
animtype = Up
getpower = 0, 0
givepower = 35, 35
guardflag = M
hitflag = MAF
hitsound = S1000,0;S2,2
guardsound = S130,0
pausetime = 12,12
guard.pausetime = 12,12
sparkNo = -1 + 0 * (var(33) := 8014)
guard.sparkNo = -1 + 0 * (var(34) := 8001)
sparkXY = -10 + 0 * (var(35) := 90), var(36) := -110
air.animtype = Up
fall.animtype = Up
ground.type = High
air.type = High
ground.slidetime = 18
ground.hittime  = 18
guard.hittime = 18
ground.velocity = -2, -29
air.velocity = -2, -29
guard.velocity = -11
ground.cornerPush.velOff = 0
guard.cornerPush.velOff = 0
air.cornerPush.velOff = 0
yaccel = .8
p2facing = 1 
fall = 1
fall.recover = 0
forcestand = 1
palFX.time = 12 * var(9)
palFX.add = 255,255,255
palFX.sinAdd= -255,-255,-255,48
envshake.time = 25
envshake.ampl = 7
envShake.freq = 176
fall.envshake.ampl = 6       ;Parameters for shaking the screen when your foe hits the ground from their fall
fall.envshake.freq = 178
fall.envshake.time = 15
mindist = 50,-100            ;Keep p2 a minimum of 50 pixels away from p1, and no higher than 100 pixels up
maxdist = 100,-10	         ;Keep p2 a maximum of 100 pixels away from p1, and no lower than 10 pixels below

;This controller below makes Kung Fu Man change to a success state if he
;successfully hits the Smash Kung Fu Upper.
[State 3100, Pose On Hit]
type = ChangeState
trigger1 = MoveHit=1
value = 3101

[State 3100, StateTypeSet: Idle]
type = StateTypeSet
trigger1 = AnimElemTime(9) >= 0
movetype = I

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

; Grand KF Upper Success Pose
[Statedef 3101]
type    = S
movetype= A
physics = S
anim = 3101

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