;=============================================
; CNS File for SSJ Goku Z2 by Team Z2
; Super Moves
;=============================================

;===========================================================================
; <<<<< KAMEHAMEHA >>>>>
; State = 2000
; Helper : 2001
;===========================================================================

;Lvl 1 Kame
[Statedef 2000]
type = S
physics = S
movetype = A
anim = 2000
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -1000

[State 3000, width]
type=width
trigger1= animelemtime(22)<0
value=25,0

[State 0, for trial]
type = VarSet
trigger1 = !time
var(18) = 1

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time = [0,48]
flag = noBG
flag2 = noFG

[State 3000, nhb]
type = nothitby
trigger1 = animelemtime(22) < 0
time = 1
value = SCA

[State 200, 1]
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2000,5+random%3
volume = 355
channel = 0

[State 200, 1]
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2000,105
volume = 355
channel = 0

[State 200, Kmh charge]
type = PlaySnd
trigger1 = time = 10
trigger2 = time = 30
value = 2000,10
volume = 355

[State 3000, superpause]
type = superpause
trigger1 = time=5
time = 40
p2defmul = 1
unhittable = 1
anim = -1
sound = s2000,0
darken = 0
movetime = 40

[State 0, Super FX]
type = Explod
trigger1 = time = 5
anim = 2003
id = 2003
pos = -139,50    ;-145,52
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 8
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
trigger1 = time = 5
anim = 2001+10000*(var(2)=0)
id = 2001
pos = -25,-59   ;-31,-57
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = 43
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Ki Gather FX]
type = Explod
trigger1 = time = 5
anim = 2002+10000*(var(2)=0)
id = 2002
pos = -25,-59   ;-31,-57
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = 43
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 200, Kmh charge long]
type = PlaySnd
trigger1 = time = 5
value = 2400,1

[State 2500, bgpalfx1]
type = bgpalfx
trigger1 = !time
time = 48
color=0
mul=0,0,0

;--------------
; Teleportation during superpause
; GROUND (far, mid, behind) = 2010,2020,2030
; AIR    (far, mid, behind) = 2040,2050,2060

[state 2000, Change to ground teleport Kmh]
type = ChangeState
triggerall = !AILevel && power >= 500 && anim = 2000
triggerall = animelemtime(20) < 0
trigger1 = var(48) = 1  	;Easy command
trigger1 = (command = "Ds") || (command = "DFs") || (command = "DBs")
trigger2 = var(48) = 0  	;Normal command
trigger2 = (command = "ddxy") || (command = "ddxz") || (command = "ddyz") || (command = "qcbx") || (command = "qcby") || (command = "qcbz")
value = ifelse (var(48)=1, 2020-10*(command = "DBs")+10*(command = "DFs"),  2010 + 10*(command = "ddxz" || command = "qcby") + 20*(command = "ddyz" || command = "qcbz") - 10*(command = "ddxyz" || command = "qcb2p"))

[state 2000, Change to ground teleport Kmh]
type = ChangeState
triggerall = AILevel && power >= 500 && anim = 2000 && random<100+(20*var(54)) && enemynear,statetype!=A
triggerall = animelemtime(18)>=0 && animelemtime(20)<0
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,movetype=A)
value = Ifelse(backedgedist >=100 && enemynear,vel x>=1,2010,2030)

[state 2000, Change to air teleport Kmh]
type = ChangeState
triggerall = !AILevel && power >= 500 && anim = 2000
triggerall = animelemtime(20) < 0
trigger1 = var(48) = 1  	;Easy command
trigger1 = (command = "Us") || (command = "UFs") || (command = "UBs")
trigger2 = var(48) = 0  	;Normal command
trigger2 = (command = "ddab") || (command = "ddac") || (command = "ddbc") || (command = "qcba") || (command = "qcbb") || (command = "qcbc")
value = ifelse (var(48)=1, 2050-10*(command = "UBs")+10*(command = "UFs"),  2040 + 10*(command = "ddac" || command = "qcbb") + 20*(command = "ddbc" || command = "qcbc") - 10*(command = "ddabc" || command = "qcb2k"))

[state 2000, Change to air teleport Kmh]
type = ChangeState
triggerall = AILevel && power >= 500 && anim = 2000 && random<100+(20*var(54)) && enemynear,statetype!=C
triggerall = animelemtime(18)>=0 && animelemtime(20)<0
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,movetype=A)
value = Ifelse(backedgedist >=100 && enemynear,vel x>=1,2040,2060)

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

[state 1215, Change to up Kmh]
type = ChangeAnim
trigger1 = !AILevel && anim = 2000 && animelemtime(20)=3
trigger1 = command = "holdup"
trigger2 = AILevel && anim = 2000 && animelemtime(20)=3
trigger2 = numenemy && (p2dist y<=-60) && (p2bodydist x=[20,140])
value = 2100

[state 1215, Smoke FX]
type = explod
trigger1 = anim=2000 && animelemtime(21)=0
trigger2 = anim=2100 && animelemtime(1)=0
anim = 1206+(var(2)=0)
id = 1206
pos = -25,3
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

;[state 1215, Flash FX straight]
;type = explod
;trigger1 = anim=2000 && animelemtime(21)=0
;anim = 2005
;id = 2005
;pos = 0,0
;postype = P1
;sprpriority = 3
;ownpal = 1
;removetime = -2
;persistent = 0
;ignorehitpause = 0
;
;[state 1215, Flash FX Up]
;type = explod
;trigger1 = anim=2100 && animelem=1
;anim = 2105
;id = 2105
;pos = 0,0
;postype = P1
;sprpriority = 3
;ownpal = 1
;removetime = -2
;persistent = 0
;ignorehitpause = 0

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2000 && animelem=21
helpertype = normal
stateno = 2001
ID = 2001
name = "kameha"
postype = p1
pos = 80,-60
ownpal = 1

[State 3000, Up Kamehameha]
type = helper
trigger1 = anim=2100 && animelem=1
helpertype = normal
stateno = 2101
ID = 2101
name = "kameha_up"
postype = p1
pos = 40,-67
ownpal = 1

[State 3000, Idle]
type = statetypeset
trigger1 = animelemtime(34) = 0
movetype = I

[State 3000, end]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

;-------------------------------------
; TELEPORT KAMEHAMEHA
;-------------------------------------

;Light Ground Kmh teleport
[Statedef 2010]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = -100

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = 0

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = S
physics = S

[State 4001, Launch Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2065
ctrl = 0

;-----------------------------
;Medium Ground Kmh teleport
[Statedef 2020]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011 ;1400

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012 ;1405

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = (p2dist X)/2

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = 0

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = S
physics = S

[State 4001, Launch Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2065
ctrl = 0

;-----------------------------
;Strong Ground Kmh teleport
[Statedef 2030]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011 ;1400

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012 ;1405

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = (p2dist X) + 60

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = 0

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = S
physics = S

[State 4001, Teleport]
type = Turn
trigger1 = !AnimTime
trigger1 = p2dist X < -10

[State 4001, Launch Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2065
ctrl = 0

;-------------------------------------
;Light Aerial Kmh teleport
[Statedef 2040]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011 ;1400

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012 ;1405

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = -100

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = ifelse((enemy,statetype=A),(enemy,pos Y)-80,-100)

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = A
physics = A

[State 4001, Launch Air Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2070
ctrl = 0

;-------------------------------------
;Medium Aerial Kmh teleport
[Statedef 2050]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011 ;1400

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012 ;1405

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = (p2dist X)/2

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = ifelse((enemy,statetype=A),(enemy,pos Y)-40,-60)

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = A
physics = A

[State 4001, Launch Air Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2070
ctrl = 0

;-------------------------------------
;Strong Aerial Kmh teleport
[Statedef 2060]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
poweradd = -500
sprpriority = 1

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 12
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 12

[State 6100, EX snd]
type = playsnd
trigger1 = !time
value = 7,0
channel = 1

[State 8000, flash]
type = PalFX
trigger1 = 1
add = 40, 30, -40
time=1
ignorehitpause = 1

[State 4001, Ground version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype!=A
value = 2011 ;1400

[State 4001, Air version]
type = ChangeAnim
triggerall = !time
trigger1 = statetype=A || pos Y < -5
value = 2012 ;1405

[State 17100, Teleport Sound]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
trigger2 = AnimElemTime(2) = 0
value = 2302, 0
persistent = 1

[State 4001, Teleport]
type = PosAdd
trigger1 = AnimElemTime(2) = 0
X = (p2dist X) + 70

[State 4001, Teleport]
type = PosSet
trigger1 = AnimElemTime(2) = 0
Y = ifelse((enemy,statetype=A),(enemy,pos Y)-40,-60)

[State 4001, Teleport]
type = StatetypeSet
trigger1 = AnimElemTime(2) = 0
statetype = A
physics = A

[State 4001, Teleport]
type = Turn
trigger1 = !AnimTime
trigger1 = p2dist X < -10

[State 4001, Launch Air Kmh]
type = ChangeState
trigger1 = !AnimTime
value = 2070
ctrl = 0

;----------------------------------
;Ground Kmh teleport LAUNCH
[Statedef 2065]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
sprpriority = 1

;JUSTICE MODE
[State 3000, Buffer var]
type = varadd
trigger1 = !time
var(49) = IfElse(Enemy, MoveType != H,-50,-150) ;0
;JUSTICE MODE
[State 3000, Justice var]
type = varadd
trigger1 = !time
var(50) = 300

[State 4001, Launch Kmh]
type = ChangeAnim
trigger1 = !time
value = 2000
elem = 18

[State 3000, superpause]
type = superpause
trigger1 = !time 
time = 10
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 10

[state 1215, Change to up Kmh]
type = ChangeAnim
trigger1 = anim = 2000
trigger1 = animelemtime(20)=3
trigger1 = command = "holdup"
value = 2100

[state 1215, Smoke FX]
type = explod
trigger1 = anim=2000 && animelemtime(21)=0
trigger2 = anim=2100 && animelemtime(1)=0
anim = 1206+(var(2)=0)
id = 1206
pos = -25,3
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

;[state 1215, Flash FX straight]
;type = explod
;trigger1 = anim=2000 && animelemtime(21)=0
;anim = 2005
;id = 2005
;pos = 0,0
;postype = P1
;sprpriority = 3
;ownpal = 1
;removetime = -2
;persistent = 0
;ignorehitpause = 0
;
;[state 1215, Flash FX Up]
;type = explod
;trigger1 = anim=2100 && animelem=1
;anim = 2105
;id = 2105
;pos = 0,0
;postype = P1
;sprpriority = 3
;ownpal = 1
;removetime = -2
;persistent = 0
;ignorehitpause = 0

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2000 && animelem=21
helpertype = normal
stateno = 2001
ID = 2001
name = "kameha"
postype = p1
pos = 80,-60
ownpal = 1

[State 3000, Up Kamehameha]
type = helper
trigger1 = anim=2100 && animelem=1
helpertype = normal
stateno = 2101
ID = 2101
name = "kameha_up"
postype = p1
pos = 40,-67
ownpal = 1

[State 3000, end]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

;----------------------------------
;Air Kmh teleport LAUNCH
[Statedef 2070]
type = U
physics = N
movetype = A
velset = 0,0
ctrl = 0
sprpriority = 1


;JUSTICE MODE
[State 3000, Buffer var]
type = varadd
trigger1 = !time
var(49) = IfElse(Enemy, MoveType != H,-50,-150) ;0
;JUSTICE MODE
[State 3000, Justice var]
type = varadd
trigger1 = !time
var(50) = 300

[State 4001, Launch Kmh]
type = ChangeAnim
trigger1 = !time
value = 2200
elem = 18

[State 3000, superpause]
type = superpause
trigger1 = !time 
time = 7
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 7

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2200 && animelemtime(20)=0
helpertype = normal
stateno = 2201
ID = 2201
name = "kameha_down"
postype = p1
pos = 40,-60
ownpal = 1

[State 2200, vel]
type = velset
trigger1 = animelemtime(20)=0
x = -1.5
y = -6

[State 2200, sts]
type = statetypeset
trigger1 = animelemtime(20)>0
physics = A



;===========================================================================
; <<<<< AIR KAMEHAMEHA >>>>>
; State = 2200
; Helper : 2201
;===========================================================================

;Air Lvl1 Kame
[Statedef 2200]
type = A
physics = N
movetype = A
anim = 2200
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -1000

[State 0, from Blast Fist]
type = PosAdd
trigger1 = !time && (prevstateno=[1201,1251])
X = 15
Y = -40

[State 0, for trial]
type = VarSet
trigger1 = !time
var(18) = 1

[State 3000, width]
type = width
trigger1 = anim=2200 && animelemtime(21)<0
value = 15,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = time = [5,45]
flag = noBG
flag2 = noFG

[State 3000, nhb]
type = nothitby
trigger1 = animelemtime(21) < 0
time = 1
value = SCA

[State 200, 1]
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2000,5+random%3
volume = 355
channel = 0

[State 200, 1]
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2000,105
volume = 355
channel = 0

[State 3000, superpause]
type = superpause
trigger1 = time = 5
time = 40
p2defmul = 1
unhittable = 1
anim = -1
sound = s2000,0
darken = 0
movetime = 40

[State 0, Super FX]
type = Explod
trigger1 = time = 5
anim = 2003
id = 2003
pos = -131,27
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 8
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
trigger1 = time = 5
anim = 2001+10000*(var(2)=0)
id = 2001
pos = -17,-78
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = 41
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Ki Gather FX]
type = Explod
trigger1 = time = 5
anim = 2002+10000*(var(2)=0)
id = 2002
pos = -17,-78
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = 41
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 200, Kmh charge long]
type = PlaySnd
trigger1 = time = 5
value = 2400,1

[State 2500, bgpalfx1]
type = bgpalfx
trigger1 = time = 0
time = 45
color=0
mul=0,0,0

;--------------
; Teleportation during superpause
; GROUND (far, mid, behind) = 2010,2020,2030
; AIR    (far, mid, behind) = 2040,2050,2060

[state 2000, Change to ground teleport Kmh]
type = ChangeState
triggerall = !AILevel && power >= 500 && anim = 2200
triggerall = animelemtime(19) < 0
trigger1 = var(48) = 1  	;Easy command
trigger1 = (command = "Ds") || (command = "DFs") || (command = "DBs")
trigger2 = var(48) = 0  	;Normal command
trigger2 = (command = "ddxy") || (command = "ddxz") || (command = "ddyz") || (command = "qcbx") || (command = "qcby") || (command = "qcbz")
value = ifelse (var(48)=1, 2020-10*(command = "DBs")+10*(command = "DFs"),  2010 + 10*(command = "ddxz" || command = "qcby") + 20*(command = "ddyz" || command = "qcbz") - 10*(command = "ddxyz" || command = "qcb2p"))

[state 2000, Change to ground teleport Kmh]
type = ChangeState
triggerall = AILevel && power >= 500 && anim = 2200 && random<100+(5*var(54)) && enemynear,statetype!=A
triggerall = animelemtime(17)>=0 && animelemtime(19)<0
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,movetype=A)
value = Ifelse(backedgedist >=100 && enemynear,vel x>=1,2010,2030)

[state 2000, Change to air teleport Kmh]
type = ChangeState
triggerall = !AILevel && power >= 500 && anim = 2200
triggerall = animelemtime(19) < 0
trigger1 = var(48) = 1  	;Easy command
trigger1 = (command = "Us") || (command = "UFs") || (command = "UBs")
trigger2 = var(48) = 0  	;Normal command
trigger2 = (command = "ddab") || (command = "ddac") || (command = "ddbc") || (command = "qcba") || (command = "qcbb") || (command = "qcbc")
value = ifelse (var(48)=1, 2050-10*(command = "UBs")+10*(command = "UFs"),  2040 + 10*(command = "ddac" || command = "qcbb") + 20*(command = "ddbc" || command = "qcbc") - 10*(command = "ddabc" || command = "qcb2k"))

[state 2000, Change to air teleport Kmh]
type = ChangeState
triggerall = AILevel && power >= 500 && anim = 2200 && random<100+(5*var(54)) && enemynear,statetype!=C
triggerall = animelemtime(17)>=0 && animelemtime(19)<0
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,movetype=A)
value = Ifelse(backedgedist >=100 && enemynear,vel x>=1,2040,2060)
;--------------

;[state 1215, Flash FX]
;type = explod
;trigger1 = anim=2200 && animelemtime(20)=0
;anim = 2210
;id = 2210
;pos = 0,0
;postype = P1
;sprpriority = 3
;ownpal = 1
;removetime = -2
;persistent = 0
;ignorehitpause = 0
;bindtime = -1

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2200 && animelemtime(20)=0
helpertype = normal
stateno = 2201
ID = 2201
name = "kameha_down"
postype = p1
pos = 40,-60
ownpal = 1

[State 2200, vel]
type = velset
trigger1 = animelemtime(20)=0
x = -1.2;-1.5
y = -2.25;-6

[State 2200, sts]
type = statetypeset
trigger1 = animelemtime(23)>0
physics = A


;===========================================================================
; <<<<< SONIC RUSH >>>>>
; Charge State = 2300
; Charging up = 2301
; Charging 45° = 2302
; Hitting = 2310
; P2 binded = 2311
; Roundhouse Kick = 2315
;===========================================================================

;Sonic Rush
[Statedef 2300]
type = S
physics = S
movetype = A
anim = 2300
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -1000

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

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG

[State 3000, superpause]
type = superpause
trigger1 = time=5
time = 40
p2defmul = 1
unhittable = 1
anim = -1
sound = s2000,0
darken = 0
movetime = 40

[State 0, Super FX]
type = Explod
trigger1 = time = 5
anim = 2003
id = 2003
pos = -110,67
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 8
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 4500, 1];Small sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,1
volume = 255
[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1900, Aura helper]
type = Helper
trigger1 = animelemtime(2)=0
id = 905
name = "Charge"
pos = 0,-2
postype = P1
stateno = 905
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999
pausemovetime = 9999

[State 1900, dust]
type = explod
trigger1 = animelemtime(2)=0
anim = 908+(var(2)=0)
id = 908
pos = 17,5
sprpriority = 4
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = -1
removetime = -1
supermovetime = 9999
pausemovetime = 9999

[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1000, shake]
type = EnvShake
triggerall = animelemtime(2)>=0
trigger1 = !(time%4)
time=4
freq=80
ampl=1+0.02*time

[State 2500, bgpalfx1]
type = bgpalfx
trigger1 = !time
time = 48
color = 0
mul = 0,0,0

[State 4001, End]
type = ChangeState
trigger1 = !AILevel && time=49 && command!="holdfwd"
trigger2 = AILevel && time=49 && p2bodydist x<=45 && p2dist y<=-75
value = 2301
ctrl = 0
[State 4001, End]
type = ChangeState
trigger1 = !AILevel && time=49 && command="holdfwd"
trigger2 = AILevel && time=49 
value = 2302
ctrl = 0

;-------------------------
; Sonic Rush Charging
[Statedef 2301]
type = S
physics = S
movetype = A
anim = 2301
ctrl = 0
velset = 0,0
sprpriority = 2

[State 3000, noshadow]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 4500, 1];Speed FX
type = PlaySnd
trigger1 = !time
value = 2700,1

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType !=A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = MA
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2310
;p2stateno = 2311
id = 2301

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType =A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
;guardflag = MA
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2310
;p2stateno = 2311
id = 2311

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2398)
trigger1 = MoveHit = 1
anim = 15999
ID = 2398
removetime = -1
ignorehitpause = 1

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2399)
trigger1 = NumTarget(2311)
anim = 15999
ID = 2399
removetime = 160
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 2310
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2311
ID = 2301
ignorehitpause = 1
persistent = 0

[State 1000, in air]
type = PosAdd
trigger1 = !AnimTime
X = 80
Y = -230

[State 1000, in air]
type = statetypeset
trigger1 = !AnimTime
movetype = I
statetype = A
physics = A

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 0

;-------------------------
; Sonic Rush Charging 45°
[Statedef 2302]
type = S
physics = S
movetype = A
anim = 2302
ctrl = 0
velset = 0,0
sprpriority = 2

[State 3000, noshadow]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 4500, 1];Speed FX
type = PlaySnd
trigger1 = !time
value = 2700,1

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType !=A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = MA
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2310
;p2stateno = 2311
id = 2302

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType =A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = MA
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2310
;p2stateno = 2311
id = 2312

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2398)
trigger1 = MoveHit = 1
anim = 15999
ID = 2398
removetime = -1
ignorehitpause = 1

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2399)
trigger1 = NumTarget(2312)
anim = 15999
ID = 2399
removetime = 160
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 2310
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2311
ID = 2302
ignorehitpause = 1
persistent = 0

[State 1000, in air]
type = PosAdd
trigger1 = !AnimTime
X = Cond(FrontEdgeBodyDist<=100,50,260)
Y = -90

[State 1000, in air]
type = statetypeset
trigger1 = !AnimTime
movetype = I
statetype = A
physics = A

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 0

;-------------------------
; Sonic Rush Attacking
[Statedef 2310]
type = A
physics = N
movetype = A
anim = 2310+2*(prevstateno=2302)
ctrl = 0
velset = 0,0
sprpriority = 2

[State 0, ChangeState]
type = ChangeState
trigger1 = Time >=10
trigger1 = P2MoveType != H
value = 50

[State 3000, width]
type = width
trigger1 = !time
value = 25,0

[State 1000, in air]
type = PosAdd
trigger1 = !Time && prevstateno=2301
X = 80
Y = -230
[State 1000, in air]
type = PosSet
trigger1 = !Time && prevstateno=2301
Y = -120

[State 1000, in air]
type = PosAdd
trigger1 = !Time && prevstateno=2302
X = 260
Y = -90

[State 810, bind 1]
type = targetbind
trigger1 = animelemtime(1)>=0 && animelemtime(4)<0
pos = 60,-40

[State 200, 1];Haria voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,15
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,112
channel = 0

[State 640, 2]
type = HitDef
trigger1 = animelem = 1
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 15 < 7, 7, fvar(11) * 15)), 1
;Ceil(IfElse(fvar(11) * 10 < 5, 5, fvar(11) * 10)), 1
;10, 1
; ceil(10.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s7030
guard.sparkno = s7000
sparkxy = -16,-87
hitsound   = s5,9
guardsound = S6,random%2
ground.type = High
pausetime = 19,25
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time = 20
envshake.freq = 100
envshake.ampl = 7
fall = 1
fall.recover = 0
kill = 0

[State 640, 2]
type = HitDef
trigger1 = animelemtime(2)>0
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 15 < 7, 7, fvar(11) * 15)), 1
;Ceil(IfElse(fvar(11) * 10 < 5, 5, fvar(11) * 10)), 1
;10, 1
; ceil(10.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s(7010+10*(random%2))
guard.sparkno = s7000
sparkxy = -10-(random%20),-70-(random%40)
hitsound   = s5,ifelse(random<333,200,random%2)
guardsound = S6,random%2
ground.type = High
pausetime = 4,5
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time=16
envshake.freq=80
envshake.ampl=4
fall = 1
fall.recover = 0
kill = 0

[State 902, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 5000
ignorehitpause = 1


[State 4001, Go to Roundhouse Kick]
type = ChangeState
trigger1 = !AnimTime
value = 2315
ctrl = 0

;-------------------------
; Sonic Rush - P2 binded
[Statedef 2311]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0,0
sprpriority = 1

[State 802, anim]
type = changeanim2
trigger1 = !time
value = 2311

;-------------------------
; Sonic Rush - Roundhouse Kick
[Statedef 2315]
type = A
physics = N
movetype = A
anim = 2315
ctrl = 0
velset = 0,0
sprpriority = 2

[State 250, woosh]
type = PlaySnd
trigger1 = AnimElem = 2
value = 0, 2

[State 200, 1];urriyaa voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,11
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,106
channel = 0

[State 250, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = S, HA
animtype  = Hard
damage = Ceil(IfElse(fvar(11) * 18 < 7, 7, fvar(11) * 18)), 6
;Ceil(IfElse(fvar(11) * 18 < 7, 7, fvar(11) * 18)), 6
;18, 6
; ceil(18.0/fvar(15)),6                ;;;old
priority = 4, Hit
guardflag = MA
pausetime = 24,25
guard.pausetime = 20,20
sparkno = s7030
guard.sparkno = s7000
sparkxy = -25,-90
hitsound   = s5,5
guardsound = S6,1
ground.type = high
ground.slidetime = 15
ground.hittime = 20
ground.velocity = -7
air.velocity = -12,-3
air.animtype = back
getpower= 0,0
givepower = 35,35
yaccel = 0.5
envshake.time = 25
envshake.freq = 120
envshake.ampl = 8
p2facing = 1
;p2stateno = 275		; <- Opponent sent to flying state
airguard.cornerpush.veloff= 0
air.animtype = Back
air.juggle = 0
fall = 1
fall.recover = 0


[State 1211, AllPalFX]
type = AllPalFX
trigger1 = Movehit
time = 5
color = 0
invertall = 1
ignorehitpause = 1
persistent = 0

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = Cond(NumExplod(2399),1,0)


;===========================================================================
; <<<<< SUPERSONIC RUSH >>>>>
; Charge State = 2500
; Charging up = 2501
; Charging 45° = 2502
; Hitting = 2510
; P2 binded = 2511
; Roundhouse Kick = 2515
;===========================================================================

;Supersonic Rush
[Statedef 2500]
type = S
physics = S
movetype = A
anim = 2300
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -2000

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

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG

[State 3000, superpause]
type = superpause
trigger1 = time=5
time = 40
p2defmul = 1
unhittable = 1
anim = -1
sound = s2350,0
darken = 0
movetime = 40

[State 0, Hyper Charge FX]
type = Explod
trigger1 = time = 5
anim = 2440
id = 2440
pos = 8,-40
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 4500, 1];Small sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,1
volume = 255
[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1900, Aura helper]
type = Helper
trigger1 = animelemtime(2)=0
id = 905
name = "Charge"
pos = 0,-2
postype = P1
stateno = 905
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999
pausemovetime = 9999

[State 1900, dust]
type = explod
trigger1 = animelemtime(2)=0
anim = 908+(var(2)=0)
id = 908
pos = 17,5
sprpriority = 4
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = -1
removetime = -1
supermovetime = 9999
pausemovetime = 9999

[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1000, shake]
type = EnvShake
triggerall = animelemtime(2)>=0
trigger1 = !(time%4)
time=4
freq=80
ampl=1+0.04*time

[State 2500, bgpalfx1]
type = bgpalfx
trigger1 = !time
time = 48
color = 0
mul = 0,0,0

[State 4001, End]
type = ChangeState
trigger1 = !AILevel && time=49 && command!="holdfwd"
trigger2 = AILevel && time=49 && p2bodydist x<=45 && p2dist y<=-75
value = 2501
ctrl = 0
[State 4001, End]
type = ChangeState
trigger1 = !AILevel && time=49 && command="holdfwd"
trigger2 = AILevel && time=49 
value = 2502
ctrl = 0

;-------------------------
; Supersonic Rush Charging
[Statedef 2501]
type = S
physics = S
movetype = A
anim = 2301
ctrl = 0
velset = 0,0
sprpriority = 2

[State 3000, noshadow]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 4500, 1];Speed FX
type = PlaySnd
trigger1 = !time
value = 2700,1

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType !=A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
;guardflag = 
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2510
;p2stateno = 2511
id = 2501

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType =A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
;guardflag = 
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2510
;p2stateno = 2511
id = 2511

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2398)
trigger1 = MoveHit = 1
anim = 15999
ID = 2398
removetime = -1
ignorehitpause = 1

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2399)
trigger1 = NumTarget(2511)
anim = 15999
ID = 2399
removetime = 160
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 2510
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2511
ID = 2501
ignorehitpause = 1
persistent = 0

[State 1000, in air]
type = PosAdd
trigger1 = !AnimTime
X = 80
Y = -230

[State 1000, in air]
type = statetypeset
trigger1 = !AnimTime
movetype = I
statetype = A
physics = A

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 0

;-------------------------
; Supersonic Rush Charging 45°
[Statedef 2502]
type = S
physics = S
movetype = A
anim = 2302
ctrl = 0
velset = 0,0
sprpriority = 2

[State 3000, noshadow]
type = assertspecial
trigger1 = 1
flag = noshadow

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 4500, 1];Speed FX
type = PlaySnd
trigger1 = !time
value = 2700,1

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType !=A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = 
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2510
;p2stateno = 2511
id = 2502

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = !NumHelper(2398)
trigger1 = p2statetype = A
trigger1 = P2MoveType =A
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = 
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p1stateno = 2510
;p2stateno = 2511
id = 2512

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2398)
trigger1 = MoveHit = 1
anim = 15999
ID = 2398
removetime = -1
ignorehitpause = 1

[State 0, Explod]
type = Explod
trigger1 = !NumHelper(2399)
trigger1 = NumTarget(2512)
anim = 15999
ID = 2399
removetime = 160
ignorehitpause = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 2510
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2511
ID = 2502
ignorehitpause = 1
persistent = 0

[State 1000, in air]
type = PosAdd
trigger1 = !AnimTime
X = Cond(FrontEdgeBodyDist<=100,50,260)
Y = -90

[State 1000, in air]
type = statetypeset
trigger1 = !AnimTime
movetype = I
statetype = A
physics = A

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 0

;-------------------------
; Supersonic Rush Attacking
[Statedef 2510]
type = A
physics = N
movetype = A
anim = 2510+(prevstateno=2502)
ctrl = 0
velset = 0,0
sprpriority = 2

[State 0, ChangeState]
type = ChangeState
trigger1 = Time >=10
trigger1 = P2MoveType != H
value = 50

[State 3000, width]
type = width
trigger1 = !time
value = 25,0

[State 1000, in air]
type = PosAdd
trigger1 = !Time && prevstateno=2501
X = 80
Y = -230
[State 1000, in air]
type = PosSet
trigger1 = !Time && prevstateno=2501
Y = -120

[State 1000, in air]
type = PosAdd
trigger1 = !Time && prevstateno=2502
X = 260
Y = -90

[State 810, bind 1]
type = targetbind
trigger1 = animelemtime(1)>=0 && animelemtime(4)<0
pos = 60,-40

[State 200, 1];Haria voice
type = PlaySnd
trigger1 = !time
triggerall = var(55)=0		;Voice=Japan
value = 3,15
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,112
channel = 0

[State 640, 2]
type = HitDef
trigger1 = animelem = 1
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 20 < 10, 10, fvar(11) * 20)), 1
;Ceil(IfElse(fvar(11) * 15 < 7, 7, fvar(11) * 15)), 1
;15, 1
; ceil(15.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s7030
guard.sparkno = s7000
sparkxy = -16,-87
hitsound   = s5,9
guardsound = S6,random%2
ground.type = High
pausetime = 19,25
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time = 20
envshake.freq = 100
envshake.ampl = 7
fall = 1
fall.recover = 0
kill = 0

[State 640, 2]
type = HitDef
trigger1 = animelemtime(2)>0
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 10 < 5, 5, fvar(11) * 10)), 1
;Ceil(IfElse(fvar(11) * 9 < 5, 5, fvar(11) * 9)), 1
;9, 1
; ceil(9.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s(7010+10*(random%2))
guard.sparkno = s7000
sparkxy = -10-(random%20),-70-(random%40)
hitsound   = s5,ifelse(random<333,200,random%2)
guardsound = S6,random%2
ground.type = High
pausetime = 4,5
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time=16
envshake.freq=80
envshake.ampl=4
fall = 1
fall.recover = 0
kill = 0

[State 902, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 5000
ignorehitpause = 1


[State 4001, Go to Roundhouse Kick]
type = ChangeState
trigger1 = !AnimTime
value = 2515
ctrl = 0

;-------------------------
; Supersonic Rush - P2 binded
[Statedef 2511]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0,0
sprpriority = 1

[State 802, anim]
type = changeanim2
trigger1 = !time
value = 2311

;-------------------------
; Supersonic Rush - Roundhouse Kick
[Statedef 2515]
type = A
physics = N
movetype = A
anim = 2315
ctrl = 0
velset = 0,0
sprpriority = 2

[State 250, woosh]
type = PlaySnd
trigger1 = AnimElem = 2
value = 0, 2

[State 200, 1];urriyaa voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,11
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,106
channel = 0

[State 250, 2]
type = HitDef
trigger1 = AnimElem = 3
attr = S, HA
animtype  = Hard
damage = Ceil(IfElse(fvar(11) * 65 < 32, 32, fvar(11) * 65)), 6
;Ceil(IfElse(fvar(11) * 18 < 7, 7, fvar(11) * 18)), 6
;18, 6
; ceil(18.0/fvar(15)),6                ;;;old
priority = 4, Hit
guardflag = MA
pausetime = 24,25
guard.pausetime = 20,20
sparkno = s7030
guard.sparkno = s7000
sparkxy = -25,-90
hitsound   = s5,5
guardsound = S6,1
ground.type = high
ground.slidetime = 15
ground.hittime = 20
ground.velocity = -7
air.velocity = -12,-3
air.animtype = back
getpower= 0,0
givepower = 35,35
yaccel = 0.5
envshake.time = 25
envshake.freq = 120
envshake.ampl = 8
p2facing = 1
;p2stateno = 2520		; <- Opponent sent to flying state
id = 2515
airguard.cornerpush.veloff= 0
air.animtype = Back
air.juggle = 0
fall = 1
fall.recover = 0

[State 802, TargetState]
type = TargetState
trigger1 = !NumExplod(2399)
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2520
ID = 2515
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = NumExplod(2399)
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2521
ID = 2515
ignorehitpause = 1
persistent = 0

[State 1211, AllPalFX]
type = AllPalFX
trigger1 = Movehit
time = 5
color = 0
invertall = 1
ignorehitpause = 1
persistent = 0

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = Cond(NumExplod(2399),1,0)

;===========================================================================
;P2 custom state, sent away
[Statedef 2520]
type = A
movetype = H
physics = N
ctrl = 0
velset = 0,0
facep2 = 1

[State 4005, anim]
type = ChangeAnim2
trigger1 = !Time
Value = 2520

[State 4005, vel]
type = Velset
trigger1 = anim=2520
x = 0
y = 0

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

[State 4005, vel]
type = ChangeAnim
trigger1 = anim=2520 && !AnimTime
Value = ifelse(selfanimexist(5052),5052,5030)

[State 4005, vel]
type = velset
trigger1 = anim=5052 || anim=5030
x = -10
y = -5
persistent = 0

[State 9011, VelAdd]
type = VelAdd
triggerall = anim=5052 || anim=5030
trigger1 = (Pos Y < 0)
y = 0.35
 
[State 9011, ChangeState]
type = SelfState
triggerall = anim=5052 || anim=5030
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 5100

;===========================================================================
;P2 CH custom state, sent away
[Statedef 2521]
type = A
movetype = H
physics = N
ctrl = 0
velset = 0,0
facep2 = 1

[State 4005, anim]
type = ChangeAnim2
trigger1 = !Time
Value = 2520

[State 4005, vel]
type = Velset
trigger1 = anim=2520
x = 0
y = 0

[State 4005, vel]
type = ChangeAnim
trigger1 = anim=2520 && !AnimTime
Value = ifelse(selfanimexist(5052),5052,5030)

[State 4005, vel]
type = velset
trigger1 = anim=5052 || anim=5030
x = -10
y = -7
persistent = 0

[State 9011, VelAdd]
type = VelAdd
triggerall = anim=5052 || anim=5030
trigger1 = (Pos Y < 0)
y = 0.35
 
[State 9011, ChangeState]
type = SelfState
triggerall = anim=5052 || anim=5030
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 5100


;===========================================================================
; <<<<< CHOU KAMEHAMEHA >>>>>
; Charge State = 2400
; Throw Kmh : 2401
; Beam helper : 2402
; stop and go to stance : 2403
; Throw Kmh Up : 2461
; Beam counter charge state : 2480
; Beam counter thrown for both players : 2481
; Collision beam helper : 2482
; Both helpers have collided : 2483
;===========================================================================

;Lvl2 Kame
[Statedef 2400]
type = S
physics = S
movetype = A
anim = 2400
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -2000

[State 0, for trial]
type = VarSet
trigger1 = !time
var(18) = 1

[State 0, remove Kmh Flash FX]
type = RemoveExplod
trigger1 = !time
ID = 2005
[State 0, remove Kmh Flash FX]
type = RemoveExplod
trigger1 = !time
ID = 2105

[State 3000, width]
type=width
trigger1 = 1
value = 25,0

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(26) = 0

[State 0, AssertSpecial]
type = AssertSpecial
triggerall = anim = 2400
trigger1 = time = [0,200]
;flag = noBG
flag = noFG

[State 3000, nhb]
type = nothitby
trigger1 = anim = 2400 && var(26) = 0
time = 1
value = SCA

[State 1000, shake]
type = EnvShake
triggerall = anim=2400
trigger1 = !(time%4)
time=4
freq=80
ampl=2+0.02*time

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
triggerall = anim = 2400
trigger1 = time = 0
value = 2400,0
channel = 0
volume = 255

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
triggerall = anim = 2400
trigger1 = time = 0
value = 2400,100
channel = 0
volume = 255

[State 200, Kmh charge long]
type = PlaySnd
triggerall = anim = 2400
trigger1 = time = 60
value = 2400,1

[State 200, 1];charge power-up sound
type = PlaySnd
trigger1 = time = 5
value = 2400,20
channel = 5

[State 200, electricity]
type = PlaySnd
trigger1 = time > 60
trigger1 = (GameTime%40) = 20
value = 2400,2
volume = 10

[State 2500, bgpalfx1]
type = bgpalfx
triggerall = anim = 2400
trigger1 = time = [1,200]
time = 1
color=0
mul=0,0,0

[State 200, BGPalFX]
type = BGPalFX
trigger1 = time>=200
time = 1
add	= ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26))
mul	= 256,256,256
invertall = 0
color = 256

[State 200, Superpause sound]
type = PlaySnd
trigger1 = time=5
value = 2350,0

[State 3000, superpause]
type = superpause
triggerall = anim = 2400
trigger1 = time=5
time = 192
p2defmul = 1
unhittable = 1
anim = -1
;sound = s2350,0
darken = 0
movetime = 192

[State 0, mouth LOL]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 24000
id = 24000
pos = 0,0
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 2
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Hyper Charge FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2440
id = 2440
pos = -25,-57
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2420+10000*(var(2)=0)
id = 2420
pos = -25,-60
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 0.6,0.6
persistent = 0

[state 17100, scale charge FX]
type = modifyexplod
trigger1 = numexplod(2420)
scale = 0.6+0.002*(time-20),0.6+0.002*(time-20)
id = 2420

[State 0, Charge lightning FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2430
id = 2430
pos = -25,-57
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0,from sky lightning]
type = explod
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
anim = 2450+random%6
sprpriority = 7
postype = p1
pos = 0,ceil(pos y)
facing = ifelse(random<500,-1,1)
random = 160,0
scale = 1,2
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 0, lightning sound]
type = playsnd
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
value = 2400,3
volume = -170-(32*numexplod)
freqmul = .9 + (random/5000.0)

[State 1211, BGPalFX]
type = BGPalFX
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
time = 3
color = 0
invertall = 1

[State 800, VarSet]
type = VarAdd
triggerall = Anim=2400 && time>200
trigger1 = !AILevel && ((command = "hold_x") || (command = "hold_y") || (command = "hold_z"))
trigger2 = AILevel
var(26) = 1

;Throw Kmh
[State 901, ChangeAnim]
type = ChangeState
triggerall = !AILevel
triggerall = command != "holdup"
triggerall = Anim=2400 && time>=200
trigger1 = (command != "hold_x") && (command != "hold_y") && (command != "hold_z")
trigger2 = time >= 350
value = 2401
ctrl = 0
[State 901, ChangeAnim]
type = ChangeState
triggerall = AILevel && numenemy
triggerall = enemynear,Statetype!=A && (p2dist y>=-80)
triggerall = Anim=2400 && time>=200
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = time >= 350
trigger4 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,Movetype=A)
value = 2401
ctrl = 0

;Throw Kmh Up
[State 901, ChangeAnim]
type = ChangeState
triggerall = !AILevel
triggerall = command = "holdup"
triggerall = Anim=2400 && time>=200
trigger1 = (command != "hold_x") && (command != "hold_y") && (command != "hold_z")
trigger2 = time >= 350
value = 2461
ctrl = 0
[State 901, ChangeAnim]
type = ChangeState
triggerall = AILevel && numenemy
triggerall = enemynear,Statetype=A && (p2dist y<-80)
triggerall = Anim=2400 && time>=200
trigger1 = enemynear,Movetype=A||Inguarddist
trigger2 = enemynear,vel x>1
trigger3 = time >= 350
trigger4 = (enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<100 || enemy,numproj>0 || enemy,Movetype=A)
value = 2461
ctrl = 0

;-----------------------------
;Throwing Chou Kamehameha
[Statedef 2401]
type = S
physics = S
movetype = A
anim = 2401
ctrl = 0
velset = 0,0
sprpriority = 5

[state -2, remove charge ball FX Chou Kmh]
type = removeexplod
trigger1 = !time
id = 2420

[State 3000, nhb]
type = nothitby
trigger1 = var(26)=0 && time<6
time = 1
value = SCA

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(25) = floor(var(26)/7.5)

[State 3000, width]
type=width
trigger1 = 1
value = 25,0

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2401,0
channel = 0
volume = 355

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2401,100
channel = 0
volume = 355

[State 200, 1];Launching SFX
type = PlaySnd
trigger1 = time=4
value = 2401,1

[state 1215, Smoke FX]
type = explod
trigger1 = anim=2401 && animelem=3
anim = 1206+(var(2)=0)
id = 1206
pos = -25,3
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Flash FX]
type = null ;explod
trigger1 = anim=2401 && time=3
anim = 2406
id = 2405
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 0
bindtime = -1

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2401 && animelem=3
helpertype = normal
stateno = 2402
ID = 2402
name = "ckameha"
postype = p1
pos = 40,-58
ownpal = 1

[State -2, Explod];On hands explod
type = Explod
triggerall = !numexplod(2403)
trigger1 = anim=2401 && animelem=3
anim = 2403
removetime = -1
sprpriority = 4
id = 2403
ownpal = 1
pos = 58,-58
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999
bindtime = -1
;scale = 0.5,1

[State -2, Explod];On hands explod
type = ModifyExplod
trigger1 = anim=2401
trigger1 = WinKO && MatchOver
pos = 58,-58
scale = .6,1.5
ID = 2403

[State 3000, Kamehameha FX beam]
type = helper
trigger1 = anim=2401 && animelem=3
helpertype = normal
stateno = 2464
ID = 2464
name = "ckamehaFX_scale_beam"
postype = p1
pos = 47,-58
ownpal = 1

[State 200, 1];Dramatic SFX
type = PlaySnd
trigger1 = WinKO && (p2stateno=5941 || p2stateno=5943)
value = 5941,0
volume = 255
persistent = 0

;Stop
[State 901, ChangeAnim]
type = ChangeState
trigger1 = numhelper(2402)
trigger1 = helper(2402),var(2)=20+var(25)
trigger1 = Anim=2401
trigger2 = time>91 && !MatchOver
trigger3 = time>120 && WinKO && MatchOver
value = 2403
ctrl = 0

;-----------------------------
;Stop throwing Chou Kamehameha
[Statedef 2403]
type = S
physics = S
movetype = A
anim = 2410
ctrl = 0
velset = 0,0
sprpriority = 1

[state 17100,remove FX]
type = removeexplod
trigger1 = !time
id = 2405
[state 17100,remove overlay FX]
type = removeexplod
trigger1 = !time
id = 2908

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2403)
scale = 1, ifelse(1-0.05*time<0, 0, 1-0.05*time)
id = 2403
[state 17100,remove FX]
type = removeexplod
trigger1 = !animtime
id = 2403

[State 3000, end]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

;-----------------------------
;Throwing Chou Kamehameha Up
[Statedef 2461]
type = S
physics = S
movetype = A
anim = 2461
ctrl = 0
velset = 0,0
sprpriority = 5

[state -2, remove charge ball FX Chou Kmh]
type = removeexplod
trigger1 = !time
id = 2420

[State 3000, nhb]
type = nothitby
trigger1 = var(26)=0 && time<6
time = 1
value = SCA

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(25) = floor(var(26)/7.5)

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2401,0
channel = 0
volume = 355

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2401,100
channel = 0
volume = 355

[State 200, 1];Launching SFX
type = PlaySnd
trigger1 = time=4
value = 2401,1

[state 1215, Smoke FX]
type = explod
trigger1 = anim=2461 && animelem=2
anim = 1206+(var(2)=0)
id = 1206
pos = -25,3
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Flash FX]
type = null;explod
trigger1 = anim=2461 && time=3
anim = 2462
id = 2462
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 0
bindtime = -1

[State 3000, Kamehameha]
type = helper
trigger1 = anim=2461 && animelem=2
helpertype = normal
stateno = 2462
ID = 2462
name = "ckameha"
postype = p1
pos = 40,-58
ownpal = 1

[State 3000, Kamehameha FX on hands]
type = helper
trigger1 = anim=2461 && animelem=2
helpertype = normal
stateno = 2463
ID = 2463
name = "ckamehaFX_hands"
postype = p1
pos = 47,-58
ownpal = 1

[State 3000, Kamehameha FX beam]
type = helper
trigger1 = anim=2461 && animelem=2
helpertype = normal
stateno = 2464
ID = 2464
name = "ckamehaFX_scale_beam"
postype = p1
pos = 47,-58
ownpal = 1

[state 1215, Hands overlay]
type = null ;explod
trigger1 = anim=2461 && animelem=2
anim = 2467
id = 2467
pos = 0,0
postype = P1
sprpriority = 4
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1

[State 200, 1];Dramatic SFX
type = PlaySnd
trigger1 = WinKO && p2stateno=5944
value = 5941,0
volume = 255
persistent = 0

;Stop
[State 901, ChangeAnim]
type = ChangeState
trigger1 = numhelper(2462)
trigger1 = helper(2462),var(2)=20+var(25)
trigger1 = Anim=2461
trigger2 = time>91 && !MatchOver
trigger3 = time>120 && WinKO && MatchOver
value = 2466
ctrl = 0

;-----------------------------
;Stop throwing Chou Kamehameha Up
[Statedef 2466]
type = S
physics = S
movetype = A
anim = 2466
ctrl = 0
velset = 0,0
sprpriority = 5

[State 3000, end]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1

;-------------------------------------
[Statedef 2467];P2 knocked down by Chou Kamehameha Up.
type = A
movetype = H
physics = N
anim = ifelse(selfanimexist(5052),5052,5030)
ctrl = 0
velset = -6, -8
 
[State 9011, VelAdd]
type = VelAdd
trigger1 = (Pos Y < 0)
y = 0.35
 
[State 9011, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
 
[State 9011, ChangeState]
type = SelfState
trigger1 = (Pos Y >= 0) && (Vel Y > 0)
value = 5100

;-------------------------------------
;Beam counter - Big Portraits
[Statedef 2480]
type = S
physics = S
movetype = A
anim = 2400
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -2000

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[state 1215, big portrait P1]
type = explod
trigger1 = !time && facing=1
anim = 2480
id = 2480
pos = 0,0
postype = Left
sprpriority = -5
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
scale = 0.71875,0.71875
vel = -.7,0
supermovetime = 99999
pausemovetime = 99999

[state 1215, big portrait P1 flash]
type = explod
trigger1 = !time && facing=1
anim = 2481
id = 2480
pos = 0,0
postype = Left
sprpriority = -4
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
scale = 0.71875,0.71875
vel = -.7,0
supermovetime = 99999
pausemovetime = 99999

[state 1215, big portrait mouth P1]
type = explod
trigger1 = !time && facing=1
anim = 2482
id = 2480
pos = 0,0
postype = Left
sprpriority = -3
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
scale = 0.71875,0.71875
vel = -.7,0
supermovetime = 99999
pausemovetime = 99999

[state 1215, big portrait P2]
type = explod
trigger1 = !time && facing=-1
anim = 2480
id = 2480
pos = 320,0
postype = Left
sprpriority = -5
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
facing = -1
scale = 0.71875,0.71875
vel = .7,0
supermovetime = 99999
pausemovetime = 99999

[state 1215, big portrait P2 flash]
type = explod
trigger1 = !time && facing=-1
anim = 2481
id = 2480
pos = 320,0
postype = Left
sprpriority = -4
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
facing = -1
scale = 0.71875,0.71875
vel = .7,0
supermovetime = 99999
pausemovetime = 99999

[state 1215, big portrait mouth P2]
type = explod
trigger1 = !time && facing=-1
anim = 2482
id = 2480
pos = 320,0
postype = Left
sprpriority = -3
;ontop = 1
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
facing = -1
scale = 0.71875,0.71875
vel = .7,0
supermovetime = 99999
pausemovetime = 99999

[State 3000, width]
type=width
trigger1 = 1
value = 25,0

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(26) = 0

[State 3000, nhb]
type = nothitby
trigger1 = anim = 2400 && var(26) = 0
time = 1
value = SCA

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
triggerall = anim = 2400
trigger1 = time = 0
value = 2400,0
channel = 0
volume = 255

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
triggerall = anim = 2400
trigger1 = time = 0
value = 2400,100
channel = 0
volume = 255

[State 200, Kmh charge long]
type = PlaySnd
triggerall = anim = 2400
trigger1 = time = 60
value = 2400,1

[State 200, electricity]
type = PlaySnd
trigger1 = time > 60
trigger1 = (GameTime%40) = 20
value = 2400,2
volume = 10

[State 2500, bgpalfx1]
type = bgpalfx
triggerall = anim = 2400
trigger1 = time = [1,200]
time = 1
color=0
mul=0,0,0

[State 200, BGPalFX]
type = BGPalFX
trigger1 = time>=200
time = 1
add	= ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26))
mul	= 256,256,256
invertall = 0
color = 256

[State 200, Superpause sound]
type = PlaySnd
trigger1 = time=5
value = 2350,0

[State 0, mouth LOL]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 24000
id = 24000
pos = 0,0
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 2
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Hyper Charge FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2440
id = 2440
pos = -22,-55
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2420+10000*(var(2)=0)
id = 2420
pos = -22,-55
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 0.6,0.6
persistent = 0

[state 17100, scale charge FX]
type = modifyexplod
trigger1 = numexplod(2420)
scale = 0.6+0.002*(time-20),0.6+0.002*(time-20)
id = 2420

[State 0, Charge lightning FX]
type = Explod
triggerall = anim = 2400
trigger1 = time = 5
anim = 2430
id = 2430
pos = -22,-55
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0,from sky lightning]
type = explod
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
anim = 2450+random%6
sprpriority = 7
postype = p1
pos = 0,ceil(pos y)
facing = ifelse(random<500,-1,1)
random = 160,0
scale = 1,2
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 0, lightning sound]
type = playsnd
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
value = 2400,3
;channel=1
volume = -170-(32*numexplod)
freqmul = .9 + (random/5000.0)

[State 1211, BGPalFX]
type = BGPalFX
triggerall = anim = 2400 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
time = 3
color = 0
invertall = 1

[State 1000, Fade to Black]
type = Helper
trigger1 = time=100
helpertype = Normal
name = "fade"
id = 2771
pos = 0,0
postype = p1
facing = 1
stateno = 2771
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

;Throw Kmh
[State 901, ChangeAnim]
type = ChangeState
trigger1 = enemy,name = "Goku Z2" || enemy,name = "Yellow Suika" || enemy,name = "Combo Stickman" || enemy,name="Vegeta Z2" || enemy,name = "SSJ Goku Z2" || enemy,name = "Gohan Z2"
trigger1 = Anim=2400 && time>=200
value = 2481
ctrl = 0

;-----------------------------
;Throwing Chou Kamehameha as Beam Counter
[Statedef 2481]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1

;Proportionality variable
[State 800, count]
type = VarSet
trigger1 = !time
fvar(20) = 0.5

[State -2, notification]
type = helper
trigger1 = !time && numhelper(13250)=0 && teamside = 1
helpertype=normal
stateno=13250
ID=13250
name="notif-col"
ownpal=1
pausemovetime=65535
supermovetime=65535
ignorehitpause=1

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = timerfreeze
ignorehitpause = 1

[state 0, 1 tick fix]
type = ChangeAnim
trigger1 = enemy,stateno = 2481 && anim!=2401
value = 2401

[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2480
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2420
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2430
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2440
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 24000

[State 13100, shake]
type = envshake
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = 1
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -130, 130)
Y = -20

[State -2];Counter variable from state -2
type = VarSet
trigger1 = !time
var(31) = 0

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2401,0
channel = 0
volume = 355

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2401,100
channel = 0
volume = 355

[State 200, 1];Launching SFX
type = PlaySnd
trigger1 = time=4
value = 2401,1
[State 200, 1];Beam clash
type = PlaySnd
trigger1 = time=4
value = 2480,0
loop = 1
channel = 5

[State 200, 1];Beam colision voice tatatatata
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time>40 && fvar(20)<=0.2
value = 2480,1
channel = 5
persistent = 0
[State 200, 1];Beam colision voice gnaaa
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time>40 && fvar(20)<=0.2
value = 2480,2
channel = 5
persistent = 0

[state 1215, Smoke FX]
type = explod
trigger1 = anim=2401 && animelem=2
anim = 1206+(var(2)=0)
id = 1206
pos = -12,2
postype = P1
sprpriority = 3
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
scale = .5,.5

[State -2, Explod];On hands explod
type = Explod
triggerall = !numexplod(2403)
trigger1 = anim=2401 && animelem=2
anim = 2403
removetime = -1
supermove = 1
sprpriority = 3
id = 2481
ownpal = 1
pos = 23,-27
ignorehitpause = 1
pausemovetime = -1
bindtime = -1
scale = 0.25,.5

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2481)
scale = 0.25+0.1*(fvar(20)-0.5) ,0.5+0.3*(fvar(20)-0.5)
id = 2481
ignorehitpause = 1

[State -2, Explod];Scaling part
type = Explod
triggerall = !numexplod(2464)
trigger1 = anim=2401 && animelem=2
anim = 2464
removetime = -1
supermove = 1
sprpriority = 2
id = 2464
pos = 36,-27
scale = .5,.5
bindtime = -1
ownpal = 1
ignorehitpause = 1
pausemovetime = -1

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2464)
scale = fvar(20)*2. ,0.5+0.3*(fvar(20)-0.5)
id = 2464
ignorehitpause = 1

[State 3000, Center Ball]
type = helper
triggerall = !numhelper(2483)
trigger1 = anim=2401 && animelem=2 ;&& facing=1
helpertype = normal
stateno = 2483
ID = 2483
name = "centerball"
postype = left
pos = 0,0
ownpal = 1

[state 3250, speedlines1 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 0,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines2 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 149,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines3 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 298,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines4 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 0,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines5 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 149,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines6 WIN]
type = explod
trigger1 = numexplod(2923)<6 && teamside = 1
trigger1 = fvar(20)>0.5
anim = 2923
ID = 2923
postype = back
pos = 298,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[State 800, trans speedlines WIN]
type = ModifyExplod
trigger1 = fvar(20) > 0.5
trans = addalpha
alpha = ceil(512*(fvar(20)-0.5)), ceil(256-512*(fvar(20)-0.5))
ID = 2923
[State 800, remove speedlines WIN]
type = RemoveExplod
trigger1 = fvar(20) <= 0.5
ID = 2923

[state 3250, speedlines1 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 0,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines2 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 149,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines3 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 298,0
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines4 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 0,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines5 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 149,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[state 3250, speedlines6 LOSE]
type = explod
trigger1 = numexplod(2922)<6 && teamside = 1
trigger1 = fvar(20)<0.5
anim = 2922
ID = 2922
postype = back
pos = 298,120
bindtime = -1
supermove = 0
sprpriority = -1
ontop = 0
ownpal = 1
facing = 1
ignorehitpause = 1
removetime = -1
scale = 0.5,0.5
[State 800, trans speedlines LOSE]
type = ModifyExplod
trigger1 = fvar(20) < 0.5
trans = addalpha
alpha = ceil(-512*(fvar(20)-0.5)), ceil(256+512*(fvar(20)-0.5))
ID = 2922
[State 800, remove speedlines LOSE]
type = RemoveExplod
trigger1 = fvar(20) >= 0.5
ID = 2922

[State 800, count];Smashing counter set
type = VarSet
trigger1 = !time
var(30) = 0
[State 800, count];Smashing counter
type = VarAdd
trigger1 = command="x" || command="y" || command="z" || command="a" || command="b" || command="c"
trigger2 = command = "up" || command = "down" || command = "back" || command = "fwd"
var(30) = 1

[State 800, count];Dump power
type = VarAdd
triggerall = power>0
trigger1 = command="s" || command="hold_s"
trigger1 = time%5 = 0
var(30) = 1
[State 800, count];Dump power
type = PowerAdd
triggerall = power>0
trigger1 = command="s" || command="hold_s"
trigger1 = time%5 = 0
value = -20
[State 800, count];Dump power
type = PalFX
triggerall = power>0
trigger1 = command="s" || command="hold_s"
trigger1 = time%5 = 0
time = 5
add = 150,0,0
mul = 200,200,200
;sin = 50,50,50

;Proportionality variable for scaling : =1 when beating the opponent by 20, =0 when beaten by 20.
[State 800, count]
type = VarSet
trigger1 = 1
fvar(20) = 0.5+(var(30)-enemy,var(30))/40.0

[State 800, WIN]
type = ChangeState
triggerall = time>10
trigger1 = fvar(20)>=.9
value = 2485

[State 800, no winner, both take damage]
type = ChangeState
trigger1 = time>=300
value = 2489

;-----------------------------
;WIN Chou Kamehameha Beam Counter
[Statedef 2485]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 2485

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[State 800, hit]
type = hitdef
trigger1 = !movehit
attr = S,HA
hitflag = MAF
priority = 7,Hit
damage = 0,0
sparkno = -1

[State 3025, p2state - killed]
type = targetstate
trigger1 = movehit && numtarget
value = ifelse(target,life > 350,2486,2487)
ignorehitpause = 1

[state 0, remove explod];center ball
type = RemoveExplod
trigger1 = !time
ID = 2483

[State 200, 1];Beam clash stop
type = StopSnd
trigger1 = !time
channel = 5

[State 13100, shake]
type = envshake
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = 1
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -130, 130)
Y = -20

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2481)
scale = 0.25+0.1*(fvar(20)-0.5) ,0.5+0.3*(fvar(20)-0.5)
id = 2481
ignorehitpause = 1

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2464)
scale = fvar(20)*2. ,0.5+0.3*(fvar(20)-0.5)
id = 2464
ignorehitpause = 1

;Proportionality variable for scaling
[State 800, count]
type = VarSet
trigger1 = 1
fvar(20) = 2.0

[State 1315, Sparks]
type=explod
trigger1= time<60 && !(time%3)
anim=7030
sprpriority=6
postype=p2
pos=(random%20), -floor(p2dist y)+(random%20)-30
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
pausemovetime=100
supermovetime=100
scale = .5,.5

[State 3000, hitsound]
type = PlaySnd
trigger1= time<60 && !(time%3)
value = 1000,0
volume = -100

[State 3000, hitadd]
type = HitAdd
trigger1= time<60 && !(time%3)
value = 20

[State 800, WIN]
type = ChangeState
trigger1 = time=120
value = 2488
ctrl = 0

;-----------------------------
;LOSE Chou Kamehameha Beam Counter (normal)
[Statedef 2486]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 5
anim = 5017

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[state 0, remove explod];center ball
type = RemoveExplod
trigger1 = !time
ID = 2483
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 1206
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2403
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2464
[state 0, remove explod];on hands
type = RemoveExplod
trigger1 = !time
ID = 2481
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2922
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2923

[State 200, 1];Beam clash stop
type = StopSnd
trigger1 = !time
channel = 5

[State 13100, shake]
type = envshake
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = 1
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -230, 230)
Y = -20

[State 10000, Explod]; White BG
type = Explod
trigger1 = time = 20
anim = 2763
id = 19875
pos =  160,120
postype = left
sprpriority = 7
bindtime = -1
ownpal = 1
removetime = -2
pausemovetime = 999999
supermovetime = 999999
supermove = 1
scale = 1.50,1.50
ignorehitpause = 1
persistent = 0

[State 3000, shaking]
type = PosAdd
trigger1 = time<30
X = ifelse(time%4=0,-2,ifelse(time%4=2,2,0))
ignorehitpause = 1

[State 6100, voice killed snd]
type = playsnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time=20
value = 11,1
volume = 255
[State 6100, voice killed snd]
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = time=20
value = 11,10
volume = 255

[State 3000, nhb]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 13100, Hurt]
type = LifeAdd
trigger1 = !time
value = ceil(ifElse(fvar(11) * -350 > -150, -150, fvar(11) * -350))

[State 800, hitground]
type = SelfState
trigger1 = time=120
value = 5110
;ctrl = 0

;-----------------------------
;LOSE Chou Kamehameha Beam Counter (Fatality)
[Statedef 2487]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 15999

[State 10500, snd]
type = playsnd
trigger1 = time=60
value = 9,0

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[state 0, remove explod];center ball
type = RemoveExplod
trigger1 = !time
ID = 2483
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 1206
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2403
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2464
[state 0, remove explod];on hands
type = RemoveExplod
trigger1 = !time
ID = 2481
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2922
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2923

[State 200, 1];Beam clash stop
type = StopSnd
trigger1 = !time
channel = 5

[State 13100, shake]
type = envshake
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = 1
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -130, 130)
Y = -20

[State 10000, Explod]; White BG
type = Explod
trigger1 = time = 20
anim = 2763
id = 19875
pos =  160,120
postype = left
sprpriority = 7
bindtime = -1
ownpal = 1
removetime = -2
pausemovetime = 999999
supermovetime = 999999
supermove = 1
scale = 1.50,1.50
ignorehitpause = 1
persistent = 0

[State 10000, Explod]; White BG front holes
type = Explod
triggerall = !SelfAnimExist(5941)
trigger1 = time=30
anim = 5944
id = 5944
postype = p1
pos =  0, -20
sprpriority = 10
bindtime = -1
ownpal = 1
removetime = -2
pausemovetime = 999999
supermovetime = 999999
supermove = 1
ignorehitpause = 1
persistent = 0
facing = -1
ontop = 1
scale = .5,.5

[State 3000, shaking]
type = PosAdd
trigger1 = time<30
X = ifelse(time%4=0,-2,ifelse(time%4=2,2,0))
ignorehitpause = 1

[State 1315, Goku]
type = explod
triggerall = !SelfAnimExist(5941)
trigger1 = !time
anim = 5943
ID = 5943
sprpriority=7
postype = p1
pos = 0,-7
removetime=-2
ownpal=0
ignorehitpause=1
bindtime = -1
ontop = 1
scale = 0.5,0.5
[State 1315, Goku]
type = explod
triggerall = SelfAnimExist(5941)
trigger1 = !time
anim = 5941
ID = 5941
sprpriority=7
postype = p1
pos = 0,-7
removetime=-2
ownpal=0
ignorehitpause=1
bindtime = -1
ontop = 1
scale = 0.5,0.5
[State 1315, Goku]
type = explod
triggerall = SelfAnimExist(5942)
trigger1 = !time
anim = 5942
ID = 5942
sprpriority=7
postype = p1
pos = 0,-7
removetime=-2
ownpal=0
ignorehitpause=1
bindtime = -1
ontop = 1
scale = 0.5,0.5

[State 13300, Fadeout]
type = PalFX
trigger1 = Time = [0,30]
time = 1
add = -8*(Time),-8*(Time),-8*(Time)

[State 13300, Fadeout]
type = PalFX
trigger1 = Time >= 30
time = 1
add = -256,-256,-256

[State 182, 1]
type = screenbound
trigger1 = 1
movecamera = 0,0
value = 1

[State 3000, nhb]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

;This prevent freeze game
[State 49999, 5]
type = ChangeState
trigger1 = time = 120
value = 5942

;-----------------------------
;WIN Beam collision, remove explods, posset
[Statedef 2488]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 0

[state 0, put on ground]
type = PosSet
trigger1 = !time
Y = 0

[state 0, remove explod];center ball
type = RemoveExplod
trigger1 = !time
ID = 2483
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 1206
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2403
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2464
[state 0, remove explod];on hands
type = RemoveExplod
trigger1 = !time
ID = 2481
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2922
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2923

[State 800, WIN]
type = ChangeState
trigger1 = time=1
value = 0
ctrl = 1

;-----------------------------
;NO WINNER Chou Kamehameha Beam Counter
[Statedef 2489]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 2485

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[State 200, 1];Beam clash stop
type = StopSnd
trigger1 = !time
channel = 5

[State 13100, shake]
type = envshake
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = time>0
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -130, 130)
Y = -20

[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2481)
scale = 0.25+0.1*(fvar(20)-0.5) ,0.5+0.3*(fvar(20)-0.5)
id = 2481
ignorehitpause = 1
[state 17100,scale FX]
type = modifyexplod
trigger1 = numexplod(2464)
scale = fvar(20)*2. ,0.5+0.3*(fvar(20)-0.5)
id = 2464
ignorehitpause = 1

[State 10000, Explod]; White BG
type = Explod
trigger1 = time = 10
anim = 2489   ;2763
id = 19875
pos =  160,120
postype = left
sprpriority = 7
bindtime = -1
ownpal = 1
removetime = -2
pausemovetime = 999999
supermovetime = 999999
supermove = 1
scale = 1.50,1.50
ignorehitpause = 1
persistent = 0

[State 6100, voice killed snd]
type = playsnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time=40
value = 11,1
volume = 255
[State 6100, voice killed snd]
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = time=40
value = 11,10
volume = 255

[State 800, WIN]
type = ChangeState
trigger1 = time=130
value = 2490
ctrl = 0

;-----------------------------
;HitState NO WINNER Chou Kamehameha Beam Counter
[Statedef 2490]
type = S
physics = S
movetype = A
ctrl = 0
velset = 0,0
sprpriority = 1
anim = 5017

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1

[state 0, remove explod];center ball
type = RemoveExplod
trigger1 = !time
ID = 2483
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 1206
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2403
[state 0, remove explod]
type = RemoveExplod
trigger1 = !time
ID = 2464
[state 0, remove explod];on hands
type = RemoveExplod
trigger1 = !time
ID = 2481
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2922
[state 0, remove explod];speed lines
type = RemoveExplod
trigger1 = !time
ID = 2923

[State 13100, shake]
type = envshake
trigger1 = !time
time = 12
freq = 130
ampl = 3

[State 0, Scale]
type = AngleDraw
trigger1 = 1
scale = .5,.5
[State 0, Position]
type = PosSet
trigger1 = 1
X = ifelse(facing=1, -130, 130)
Y = -20

[State 3000, nhb]
type = nothitby
trigger1 = 1
time = 1
value = SCA
ignorehitpause = 1

[State 13100, Hurt];remove life depending on smashing variable
type = LifeAdd
trigger1 = !time
;value = floor(-350*(enemy,var(30))/(var(30)+(enemy,var(30))+.001))
value = floor(-350.0*(1.0-fvar(20)))

[State 800, hitground]
type = SelfState
trigger1 = time=10
value = 5110



;===========================================================================
; <<<<< AIR CHOU KAMEHAMEHA >>>>>
; State = 2600
; Throw state = 2601
;===========================================================================

;Air lvl2 Kame
[Statedef 2600]
type = A
physics = N
movetype = A
anim = 2600
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -2000

[State 2600, No Push Dummy]
type		= Helper
triggerall	= !NumHelper(2650)
trigger1		= !time
name		= "Air Chou Kame - No Push"
id		= 2650
stateno		= 2650
size.ground.back	= Const(size.ground.back) +20
size.ground.front	= Const(size.ground.front) +20
size.height	= Const(size.height) +60
pausemovetime	= 99999
supermovetime	= 99999

[State 2600, No Push]
type		= PlayerPush
trigger1		= 1
value		= 0
ignorehitpause	= 1

[State 0, from Blast Fist]
type = PosAdd
trigger1 = !time && (prevstateno=[1201,1251])
X = 15
Y = -40

[State 0, for trial]
type = VarSet
trigger1 = !time
var(18) = 1

[State 3000, width]
type = width
trigger1 = 1
value = 20,0

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(26) = 0

[State 0, AssertSpecial]
type = AssertSpecial
triggerall = anim = 2600
trigger1 = time = [0,200]
flag = noFG

[State 3000, nhb]
type = nothitby
trigger1 = anim = 2600 && var(26) = 0
time = 1
value = SCA

[State 1000, shake]
type = EnvShake
triggerall = anim=2600
trigger1 = !(time%4)
time=4
freq=80
ampl=2+0.02*time

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
triggerall = anim = 2600
trigger1 = time = 0
value = 2400,0
channel = 0
volume = 255

[State 200, 1];Voice (Kamehame)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
triggerall = anim = 2600
trigger1 = time = 0
value = 2400,100
channel = 0
volume = 255

[State 200, Kmh charge long]
type = PlaySnd
triggerall = anim = 2600
trigger1 = time = 60
value = 2400,1

[State 200, 1];charge power-up sound
type = PlaySnd
trigger1 = time = 5
value = 2400,20
channel = 5

[State 200, electricity]
type = PlaySnd
trigger1 = time > 60
trigger1 = (GameTime%40) = 20
value = 2400,2
volume = 10

[State 2500, bgpalfx1]
type = bgpalfx
triggerall = anim = 2600
trigger1 = time = [1,200]
time = 1
color=0
mul=0,0,0

[State 200, BGPalFX]
type = BGPalFX
trigger1 = time>=200
time = 1
add	= ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26)),ceil(-256+1.7*Var(26))
mul	= 256,256,256
invertall = 0
color = 256

[State 200, Superpause sound]
type = PlaySnd
trigger1 = time=5
value = 2350,0

[State 3000, superpause]
type = superpause
triggerall = anim = 2600
trigger1 = time=5
time = 192
p2defmul = 1
unhittable = 1
anim = -1
;sound = s2350,0
darken = 0
movetime = 192

[State 0, mouth LOL]
type = Explod
triggerall = anim = 2600
trigger1 = time = 5
anim = 24000
id = 24000
pos = 5,-8
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 2
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Hyper Charge FX]
type = Explod
triggerall = anim = 2600
trigger1 = time = 5
anim = 2440
id = 2440
pos = -21,-80
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
triggerall = anim = 2600
trigger1 = time = 5
anim = 2420+10000*(var(2)=0)
id = 2420
pos = -21,-81
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 0.6,0.6
persistent = 0

[state 17100, scale charge FX]
type = modifyexplod
trigger1 = numexplod(2420)
scale = 0.6+0.002*(time-20),0.6+0.002*(time-20)
id = 2420

[State 0, Charge lightning FX]
type = Explod
triggerall = anim = 2600
trigger1 = time = 5
anim = 2430
id = 2430
pos = -17,-78  ;-25,-57
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0,from sky lightning]
type = explod
triggerall = anim = 2600 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
anim = 2450+random%6
sprpriority = 7
postype = p1
pos = 0,-ceil(pos y)
facing = ifelse(random<500,-1,1)
random = 160,0
scale = 1,2
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 0, lightning sound]
type = playsnd
triggerall = anim = 2600 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
value = 2400,3
volume = -170-(32*numexplod)
freqmul = .9 + (random/5000.0)

[State 1211, BGPalFX]
type = BGPalFX
triggerall = anim = 2600 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
time = 3
color = 0
invertall = 1

[State 800, VarSet]
type = VarAdd
triggerall = Anim=2600 && time>200
trigger1 = !AILevel && ((command = "hold_x") || (command = "hold_y") || (command = "hold_z"))
trigger2 = AILevel
var(26) = 1

;Throw Kmh
[State 901, ChangeAnim]
type = ChangeState
triggerall = Anim=2600 && time>=200
trigger1 = !AILevel && ((command != "hold_x") && (command != "hold_y") && (command != "hold_z"))
trigger2 = time >= 350
trigger3 = AILevel && (inguarddist || enemy,hitdefattr= SAC,AA,AT,AP   || p2dist x<90  || enemynear,vel x>=1 || enemy,numproj>0 || enemy,Movetype=A)
value = 2601
ctrl = 0

;-----------------------------
;Throwing Air Chou Kamehameha
[Statedef 2601]
type = A
physics = N
movetype = A
anim = 2601
ctrl = 0
velset = 0,0
sprpriority = 1

[State 2601, No Push]
type		= PlayerPush
trigger1		= 1
value		= 0
ignorehitpause	= 1

[state -2, remove charge ball FX Chou Kmh]
type = removeexplod
trigger1 = !time
id = 2420

[State 3000, nhb]
type = nothitby
trigger1 = var(26)=0 && time<6
time = 1
value = SCA

[State 800, VarSet];Charging time
type = VarSet
trigger1 = !time
var(25) = floor(var(26)/7.5)

[State 3000, width]
type = width
trigger1 = 1
value = 25,0

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time = 0
value = 2401,0
channel = 0
volume = 355

[State 200, 1];Voice (Haaa)
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 0
value = 2401,100
channel = 0
volume = 355

[State 200, 1];Launching SFX
type = PlaySnd
trigger1 = time=4
value = 2401,1

[state 1215, Flash FX]
type = null;explod
trigger1 = !time
anim = 2611
id = 2611
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1

[State 3000, Kamehameha]
type = helper
trigger1 = animelem=1
helpertype = normal
stateno = 2602
ID = 2602
name = "ckameha"
postype = p1
pos = 40,-54
ownpal = 1

[State 3000, Kamehameha FX on hands]
type = helper
trigger1 = animelem=1
helpertype = normal
stateno = 2603
ID = 2603
name = "ckamehaFX_hands"
postype = p1
pos = 47,-54
ownpal = 1

[State 3000, Kamehameha FX beam]
type = helper
trigger1 = animelem=1
helpertype = normal
stateno = 2604
ID = 2604
name = "ckamehaFX_scale_beam"
postype = p1
pos = 47,-54
ownpal = 1

[State 200, 1];Dramatic SFX
type = PlaySnd
trigger1 = WinKO && p2stateno=5946
value = 5941,0
persistent = 0

;Stop
[State 901, ChangeState]
type = ChangeState
trigger1 = numhelper(2602)
trigger1 = helper(2602),var(2)=20+var(25)
trigger1 = Anim=2601
trigger2 = time>91 && !MatchOver
trigger3 = time>120 && WinKO && MatchOver
value = 2610
ctrl = 0

;-----------------------------
;Stop throwing Air Chou Kamehameha
[Statedef 2610]
type = A
physics = A
movetype = I
anim = 2610
ctrl = 0
velset = 0,0
sprpriority = 1

[State 2610, No Push]
type		= PlayerPush
trigger1		= 1
value		= 0
ignorehitpause	= 1

[state 17100,remove FX]
type = removeexplod
trigger1 = !time
id = 2611

[State 2200, vel]
type = velset
trigger1 = !time
x = -1.5
y = -5

[State 4001, End]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 0


;===========================================================================
; <<<<< HYPER RUSH >>>>>
; State = 2700
; Aura Helper = 2701 ?
; Afterimage helper = 2702
; Speed Dash state = 2703
;===========================================================================

;Hyper Rush
[Statedef 2700]
type = S
physics = S
movetype = A
anim = 2300
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = ifelse(var(49)=0,-3000,-2000)

[State 3000, remove justice bar when Hyper Rush fails]
type = varset
trigger1 = !time
var(16) = 1

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

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG

[State 3000, superpause]
type = superpause
trigger1 = time=5
time = 40
p2defmul = 1.2
unhittable = 1
anim = -1
sound = s2350,0
darken = 0
movetime = 40

[State 0, Hyper Charge FX]
type = Explod
trigger1 = time = 5
anim = 2440
id = 2440
pos = 8,-40
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 4500, 1];Small sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,1
volume = 255
[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1900, Aura helper]
type = Helper
trigger1 = animelemtime(2)=0
id = 905
name = "Charge"
pos = 0,-2
postype = P1
stateno = 905
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
supermovetime = 9999
pausemovetime = 9999

[State 1900, dust]
type = explod
trigger1 = animelemtime(2)=0
anim = 908+(var(2)=0)
id = 908
pos = 17,5
sprpriority = 4
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = -1
removetime = -1
supermovetime = 9999
pausemovetime = 9999

[State 1000, flash]
type = PalFX
trigger1 = !(time%10)
add = 10, 20, -20
sinadd = -10,20,60,10
mul = 256,256,256
time = 10

[State 4500, 2];long sound
type = PlaySnd
trigger1 = animelemtime(2)=0
value = 8,0
loop = 1
pan = 1
volume = 25
channel = 3

[State 1000, shake]
type = EnvShake
triggerall = animelemtime(2)>=0
trigger1 = !(time%4)
time=4
freq=80
ampl=1+0.04*time

[State 2500, bgpalfx1]
type = bgpalfx
trigger1 = !time
time = 48
color = 0
mul = 0,0,0

[State 4001, End]
type = ChangeState
trigger1 = time=48
value = 2703
ctrl = 0

;-------------------------------
; Hyper Rush Dash
[Statedef 2703]
type    = S
movetype= A
physics = N
ctrl = 0
anim = 2703

[State 4500, 1];speed SFX
type = PlaySnd
trigger1 = animelemtime(3)=0
value = 2700,1

[State 1000, flash]
type = null ;PalFX
trigger1 = 1
add = 10, 20, -20
sinadd = -10,20,60,10
mul = 256,256,256
time = 1

[State 1900, horizontal dash FX]
type = explod
trigger1 = animelemtime(3)=0
anim = 2704
id = 2704
pos = 40,-45
sprpriority = -1
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = 1
removetime = -1
supermovetime = 99999
pausemovetime = 99999
scale = 1.2,1.2

[State 3005, 2]
type = VelSet
trigger1 = animelemtime(3)=0
x = 20

[State 3005, 3]
type = VelMul
trigger1 = Time > 5
x = .97

[State 3000, width]
type=width
trigger1 = 1
value=35,0

[State 100, A must for dashes everywhere]
type = Assertspecial
trigger1 = 1
flag = nowalk
[State 100, No Turn]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[state 1215, Smoke FX]
type = explod
trigger1 = animelemtime(3)=0
anim = 1206+(var(2)=0)
id = 1206
pos = -25,3
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[State 13000, HelpTrain]
type = Helper
trigger1 = Time = 1
name = "Trainee"
ID = 2702
stateno = 2702
pausemovetime = 50

[State 3005, hit]
type = hitdef
triggerall = roundstate=2
trigger1 = p2stateno != [150,155]
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = MA
numhits = 0
sparkno = -1
getpower = 0,0
guard.sparkno = s7000
sparkxy = -35,-50
hitsound = -1
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
id = 2703

[State 0, ChangeState]
type = ChangeState
trigger1 = MoveHit=1
value = 2710
ignorehitpause = 1
persistent = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2711
ID = 2703
ignorehitpause = 1
persistent = 0

[State 4001, End]
type = ChangeState
trigger1 = time > 30
value = 2705
ctrl = 0

;-------------------------
;Hyper Rush, Dash Stop
[Statedef 2705]
type    = S
physics = S
movetype = A
anim = 2705
sprpriority = 1
ctrl = 0

[State 0, AttackDist]
type = AttackDist
;trigger1 = Anim = 240
trigger1 = 1
value = 0

[State 100, snd]
type = playsnd
trigger1 = time=0
value = 5,8
persistent = 0

[State 101, 1]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

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

[State 100, 1]
type = VelMul
trigger1 = 1
x = .85

[State 100, 1]
type = VelSet
trigger1 = animtime = 0
x = 0

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

;-------------------------
; Hyper Rush Attacking
[Statedef 2710]
type = S
physics = N
movetype = A
anim = 2710
ctrl = 0
velset = 0,0
sprpriority = 2

[State 0, VarAdd]
type = VarAdd
trigger1 = !Time
fvar(13) = 1

[State 0, ChangeState]
type = ChangeState
trigger1 = Time >=5
trigger1 = P2MoveType != H
value = 105

[State 3000, width]
type = width
trigger1 = !time
value = 25,0

[State 810, bind 1]
type = targetbind
trigger1 = animelemtime(1)>=0 && animelemtime(4)<0
pos = 55,0

[State 200, 1];Haria voice
type = PlaySnd
trigger1 = !time
triggerall = var(55)=0		;Voice=Japan
value = 3,15
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,112
channel = 0

[State 640, 2]
type = HitDef
trigger1 = time%4 = 0
trigger1 = animelemtime(3)>=0 && animelemtime(30)<0
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 7 < 4, 4, fvar(11) * 7)), 1
;Ceil(IfElse(fvar(11) * 7 < 4, 4, fvar(11) * 7)), 1
;7, 1
; ceil(7.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s(7010+10*(random%2))
guard.sparkno = s7000
sparkxy = -10-(random%20),-30-(random%40)
hitsound   = s5,ifelse(random<333,200,random%2)
guardsound = S6,random%2
ground.type = High
pausetime = 4,5
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time=16
envshake.freq=80
envshake.ampl=4
fall = 0
fall.recover = 0
kill = 0
forcestand = 1
forcenofall = 1

[State 640, 2]
type = HitDef
trigger1 = time%4 != 0
trigger1 = animelemtime(3)>=0 && animelemtime(30)<0
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 7 < 4, 4, fvar(11) * 7)), 1
;Ceil(IfElse(fvar(11) * 7 < 4, 4, fvar(11) * 7)), 1
;7, 1
; ceil(7.0/fvar(15)),1                ;;;old
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s(7010+10*(random%2))
guard.sparkno = s7000
sparkxy = -10-(random%20),-30-(random%40)
hitsound   = s5,ifelse(random<333,200,random%2)
guardsound = S6,random%2
ground.type = low
pausetime = 4,5
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time=16
envshake.freq=80
envshake.ampl=4
fall = 0
fall.recover = 0
kill = 0
forcestand = 1
forcenofall = 1

[State 902, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 5000
ignorehitpause = 1


[State 4001, Go to Shoryuken (Piccolo)]
type = ChangeState
triggerall = enemy, name = "Piccolo Z2" && (enemy, numhelper(3501) || enemy, numhelper(3502))
trigger1 = !AnimTime
value = 1220
ctrl = 0
[State 4001, Go to Shoryuken (Saibamen)]
type = ChangeState
triggerall = enemy, name = "Saibamen Z2" && authorname = "Team Z2"
trigger1 = !AnimTime
value = 1220
ctrl = 0



[State 4001, Go to Shin Shoryuken]
type = ChangeState
trigger1 = TeamMode != Simul
trigger1 = !AnimTime
value = 2715
ctrl = 0

[State 4001, Go to Shin Shoryuken]
type = ChangeState
trigger1 = TeamMode = Simul
trigger1 = !AnimTime
value = 1220
ctrl = 0

;-------------------------
; Hyper Rush - P2 binded
[Statedef 2711]
type = S
physics = N
movetype = H
ctrl = 0
velset = 0,0
sprpriority = 1

[State 802, anim]
type = changeanim2
trigger1 = !time
value = 2711

;-------------------------
; Shin Shoryuken 1 - on ground
[Statedef 2715]
type    = S
movetype = A
physics = N
anim = 2715
juggle = 0
ctrl = 0
velset = 0,0
facep2 = 1
sprpriority = 2

[State 1000, flash]
type = null ;PalFX
trigger1 = 1
add = 40, 30, -40
;sinadd = -10,20,60,10
;mul = 256,256,256
time = 1
ignorehitpause = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nobg
flag2 = nofg
flag3 = nobardisplay
ignorehitpause = 1

[State 2201, helper]; Background lines
type = Helper
trigger1 = !time
pos = -640, -480
postype = back
stateno = 2718
helpertype = normal
name = "vertical_lines_BG"
id = 2773
ownpal = 1
supermovetime = 150
pausemovetime = 150
sprpriority = 4
size.xscale = 5
size.yscale= 5

[State 200, 1];urriyaa voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,11
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,106
channel = 0

[State 1120, HitDef]
type = HitDef
trigger1 = !time       
attr = S, HA
animtype  = hard
air.animtype  = hard
damage = Ceil(IfElse(fvar(11) * 25 < 11, 11, fvar(11) * 25)), 0
;Ceil(IfElse(fvar(11) * 200 < 7, 7, fvar(11) * 200)), 0
;200, 0
priority = 6,Hit
getpower = 0,0
givepower = 0,0
hitflag = MAF
guardflag = M
pausetime = 49,50   ;35,35
sparkno = s2719  ;s7020
sparkxy = -15, -65
hitsound = S2720,0
ground.type = Low
ground.slidetime = 13
ground.hittime  = ifelse(p2statetype=C,22,20)
guard.hittime = 18
guard.slidetime = 13
guard.ctrltime = 18
ground.velocity = 3.0*const(size.xscale),-5.0*const(size.yscale)
guard.velocity = -5.0*const(size.xscale)
air.velocity = 3.0*const(size.xscale),-5.0*const(size.yscale)
fall = 0
fall.recover = 0
fall.envshake.time = 12
fall.envshake.freq = 80
fall.envshake.ampl = -4
down.bounce = 1
air.fall = 0
yaccel = .60*const(size.yscale)
envshake.time = 15
envshake.freq = 100
envshake.ampl = 8
forcestand = 1
P2facing = 1
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
;p2stateno = 2716
id = 2716
kill = 0

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2716
ID = 2716
ignorehitpause = 1
persistent = 0

[State 3700]; Send Goku to next state
type = changestate
trigger1 = !animtime
value = 2720
ignorehitpause = 1

;---------------------------------
; P2 state, hit by Shin Shoryuken 1
[Statedef 2716]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1]
type = ChangeAnim2
trigger1 = Time = 0
value = 2716

[State 5020, 3]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"
value = 105050

[State 1100, ‰¹‚ð–Â‚ç‚·]
type = playsnd
trigger1 = time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"||name="Ibuki"||name="Gill"
value = 5000,1
channel = 2

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = anim = [105050,105051]
trigger1 = time <= 60
value = anim

[State -2, posadd]
type = posadd
trigger1 = time <= 60
x = 3*ifelse(time%2=0,1,-1)*ifelse(enemy,fvar(38)>1.0,1.5,1)

[State -2, AngleDraw]
type = AngleDraw
trigger1 = numenemy
trigger1 = enemy,authorname = "GM"
trigger1 = enemy,name = "Ryu"
trigger1 = enemy,var(6) = 2
value = 0
scale = enemy,fvar(38),enemy,fvar(38)

[State 810, ScreenBound]
type = ScreenBound
trigger1 = time <= 60
value = 1
movecamera = 1,1

[State 820, ChangeAnim2]
type = ChangeAnim
Trigger1 = anim != [105050,105051]
trigger1 = time > 60
value = 5030
persistent = 0

[State 5020, 3]
type = ChangeAnim
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"
trigger1 = time > 60
value = 105050
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
trigger1 = time > 60
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5030
Trigger1 = AnimTime = 0
value = 5035
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
triggerall = time > 60
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5035
Trigger1 = AnimTime = 0
trigger2 = !SelfAnimExist(5035)
Trigger2 = anim = 5030
Trigger2 = AnimTime = 0
value = 5050
persistent = 0

[State 5050, 2]
type = ChangeAnim
triggerall = time > 60
trigger1 = anim = 5050
trigger1 = Vel Y >= 1
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5030, 1]
type = VelAdd
trigger1 = time > 60
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = time > 60
x = 1
y = 1
persistent = 0

[State 810, ScreenBound]
type = ScreenBound
trigger1 = time > 60
value = 1
movecamera = 1,0

[State 5030, 4]
type = SelfState
trigger1 = time > 60
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100

;-------------------------
; Shin Shoryuken 2 - on ground
[Statedef 2720]
type    = S
movetype = A
physics = N
anim = 2720
juggle = 0
ctrl = 0
velset = 0,0
facep2 = 1
sprpriority = 2

[State 1000, flash]
type = null ;PalFX
trigger1 = 1
add = 40, 30, -40
time = 1
ignorehitpause = 1

[State -2, scale var]
type = VarSet
trigger1 = !time
fvar(38) = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = nobg
flag2 = nofg
flag3 = nobardisplay
ignorehitpause = 1

[State -2, scale var]
type = VarAdd
triggerall = fvar(38) < 1.5
trigger1 = 1
fvar(38) = 0.0625
ignorehitpause = 1

[State -2, AngleDraw]
type = AngleDraw
trigger1 = 1
value = 0
scale = fvar(38), fvar(38)
ignorehitpause = 1

[State 1120, HitDef]
type = HitDef
trigger1 = animelem=2
attr = S, HA
animtype  = back
air.animtype  = back
damage = Ceil(IfElse(fvar(11) * 15 < 7, 7, fvar(11) * 15)), 0
;Ceil(IfElse(fvar(11) * 200 < 7, 7, fvar(11) * 200)), 0
;200, 0
priority = 6,Hit
getpower = 0,0
givepower = 0,0
hitflag = MAF
guardflag = M
pausetime = 49,50   ;35,35
sparkno = -1
guard.sparkno = S8410
sparkxy = -15, ceil(-60*const(size.yscale))
hitsound = S2720,0  ;S2720,1
ground.type = Low
ground.slidetime = 13
ground.hittime  = ifelse(p2statetype=C,22,20)
guard.hittime = 18
guard.slidetime = 13
guard.ctrltime = 18
ground.velocity = 2.0*const(size.xscale),-15.0*const(size.yscale)
guard.velocity = 0
air.velocity = 2.0*const(size.xscale),-15.0*const(size.yscale)
fall = 0
fall.recover = 0
fall.envshake.time = 12
fall.envshake.freq = 80
fall.envshake.ampl = -4
down.bounce = 1
air.fall = 0
yaccel = .80*const(size.yscale)
persistent = 0
envshake.time = 15
envshake.freq = 100
envshake.ampl = 8
forcestand = 1
P2facing = 1
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
kill = 0
;p2stateno = 2721
id = 2721

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2721
ID = 2721
ignorehitpause = 1
persistent = 0

[State 1315, Sparks]
type = explod
trigger1 = movehit && numtarget
trigger1 = (target,movetype=H) && !(target,time)
anim = 2719  ;7030
sprpriority=7
postype = p1
pos = 55,-67
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent = 1
pausemovetime=100
supermovetime=100
scale = fvar(38),fvar(38)

[State 3700]; Send Goku to next state
type = changestate
trigger1 = !animtime
value = 2725

;--------------------------------
; P2 hit by Shin Shoryuken 2
[Statedef 2721]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1]
type = ChangeAnim2
trigger1 = Time = 0
value = 2721

[State 5020, 3]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"
value = 5030

[State 1100, ‰¹‚ð–Â‚ç‚·]
type = playsnd
trigger1 = time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"||name="Ibuki"||name="Gill"
value = 5000,1
channel = 2

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = anim = 5030
trigger1 = !HitShakeOver
value = anim

[State -2, posadd]
type = posadd
trigger1 = !HitShakeOver
x = 3*ifelse(time%2=0,1,-1)*ifelse(enemy,fvar(38)>1.0,1.5,1)

[State -2, AngleDraw]
type = AngleDraw
trigger1 = numenemy
value = 0
scale = enemy,fvar(38), enemy,fvar(38)

[State 810, ScreenBound]
type = ScreenBound
trigger1 = !HitShakeOver
value = 1
movecamera = 1,1

[State 820, ChangeAnim2]
type = ChangeAnim
trigger1 = HitShakeOver
value = 5030
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
trigger1 = HitShakeOver
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5030
Trigger1 = AnimTime = 0
value = 5035
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
triggerall = HitShakeOver
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5035
Trigger1 = AnimTime = 0
trigger2 = !SelfAnimExist(5035)
Trigger2 = anim = 5030
Trigger2 = AnimTime = 0
value = 5050
persistent = 0

[State 5050, 2]
type = ChangeAnim
triggerall = HitShakeOver
trigger1 = anim = 5050
trigger1 = Vel Y >= 1
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5030, 1]
type = VelAdd
trigger1 = HitShakeOver
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = HitShakeOver
x = 1
y = 1
persistent = 0

[State 810, ScreenBound]
type = ScreenBound
trigger1 = HitShakeOver
value = 1
movecamera = 1,0

[State 5030, 4]
type = SelfState
trigger1 = HitShakeOver
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100

;----------------------------
; Shin Shoryuken Rising
[StateDef 2725]
type = A
movetype = A
physics = N
ctrl = 0
anim = 2725
velset = 4,-2

[State 4001, StopFwd]
type = VelSet   ;FOR TEST
triggerall = (var(49)=0) || (var(49)>0 && var(50)<700)
trigger1 = time = 2
X = 4
Y = -14

[State 4001, Sonic Beatdown vel init]
type = VelSet
triggerall = (var(49)=0) || (var(49)>0 && var(50)>=700 && var(50)<1400)
trigger1 = time = 2
X = 4
Y = -6

[State 1000, flash]
type = null ;PalFX
trigger1 = 1
add = 40, 30, -40
time = 1
ignorehitpause = 1

[State -2, AssertSpecial]
type = AssertSpecial
trigger1 = fvar(38) > 1.0   ;anim = 2725
trigger2 = var(49)>0 && var(50)>=700
flag = nobg
flag2 = nofg
flag3 = nobardisplay
ignorehitpause = 1

[State -2, VarAdd]
type = VarAdd
triggerall = fvar(38) > 1.0
trigger1 = anim=1202
trigger2 = anim=1203
trigger3 = anim=2725 && animelemtime(4)>5 && var(49)>0 	;Ultimate Kmh
fvar(38) = -0.05

[State -2, AngleDraw]
type = AngleDraw
trigger1 = time>0
value = 0
scale = fvar(38), fvar(38)
ignorehitpause = 1

[State 6100, snd]
type = playsnd
trigger1 = !time
value = 20,2

[State 200, 1];scream voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,17
channel = 0

[State 220, snd];scream voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,112
channel = 0

[State 4001, Pos]
type = PosAdd
trigger1 = time=0
x = 10

[State 4001, AirFriction]
type = VelMul
trigger1 = Vel X != 0
X = .9

[State 1120, HitDef]
type = HitDef
trigger1 = animelemtime(1)=1 
attr = A, HA
animtype  = up
air.animtype  = up
damage = Ceil(IfElse(fvar(11) * 50 < 25, 25, fvar(11) * 50)), 0
;Ceil(IfElse(fvar(11) * 150 < 7, 7, fvar(11) * 150)), 0
;150, 0
;ceil(150.0/fvar(15)),0         ;;;old
priority = 6,Hit
getpower = 0,0
givepower = 0,0
hitflag = MAF
guardflag = M
pausetime = 59,60  ;40,40
sparkno = -1
guard.sparkno = S8410
sparkxy = -15, ceil(-100*const(size.yscale))
hitsound = S2720,2
ground.type = high
ground.slidetime = 13
ground.hittime  = ifelse(p2statetype=C,22,20)
guard.hittime = 18
guard.slidetime = 13
guard.ctrltime = 18
ground.velocity = -1.5*const(size.xscale),-20*const(size.yscale)+2*(var(49)>0)
guard.velocity = -15.0*const(size.xscale)
air.velocity = -1.5*const(size.xscale),-20*const(size.yscale)+2*(var(49)>0)
fall = 0
fall.recover = 0
fall.envshake.time = 20
fall.envshake.freq = 120
fall.envshake.ampl = -10
down.bounce = 1
air.fall = 0
yaccel = 0.45+0.1*(var(49)=0)   ;0.55
persistent = 0
envshake.time = 10
envshake.freq = 90
envshake.ampl = 5
P2facing = 1
forcestand = 1
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
;p2stateno = 2726
id = 2725
kill = (var(49)=0) || (var(49)>0 && var(50)<700)

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value =2726
ID = 2725
ignorehitpause = 1
persistent = 0

[State 1315, Sparks]
type = explod
trigger1 = movehit && numtarget
trigger1 = (target,movetype=H) && !(target,time)
anim = 2719
sprpriority=7
postype = p1
pos = 30,-165
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
persistent = 1
pausemovetime=100
supermovetime=100
scale = fvar(38),fvar(38)

;----------------
; Falling and change to Finisher states if necessary

; var(50) = [0,700[ 		-> nothing
; var(50) = [700,1400[		-> Finisher 1, Sonic Beatdown
; var(50) = [1400,2100[		-> Finisher 2, Ultimate Kmh
; var(50) = 2100			-> Finisher 3, Buu Genkidama

[State 4001, Fall]
type = VelAdd
trigger1 = Anim = 2725
trigger1 = Pos Y < -30
trigger2 = Anim = 1202
Y = .38

[State 4001, Return&Landing normal - no finisher]
type = ChangeAnim   ;FOR TEST
triggerall = (var(49)=0) || (var(49)>0 && var(50)<700)
trigger1 = Anim = 2725
trigger1 = Vel Y >= 0.0
trigger2 = Anim = 1202
trigger2 = Pos Y = 0
value = ifelse(anim=2725,1202,1203)

[State 4001, Go to Sonic Beatdown]
type = ChangeState
triggerall = var(49)>0 && var(50)>=700 && var(50)<1400
trigger1 = Anim = 2725 && animelemtime(4)>5 && abs(fvar(38)-1)<0.1
value = 2800
ctrl = 0

[State 4001, Go to Ultimate Kamehameha]
type = ChangeState
triggerall = var(49)>0 && var(50)>=1400 && var(50)<2100
trigger1 = Anim = 2725 && animelemtime(4)>5 && abs(fvar(38)-1)<0.1
trigger1 = time=28   ;ScreenPos Y >= 175
value = 2900
ctrl = 0

[State 4001, Go to Buu Genkidama]
type = ChangeState
triggerall = var(49)>0 && var(50)>=2100
;;;triggerall = (var(49)=0) || (var(49)>0 && var(50)<700)   ;FOR TEST
trigger1 = Anim = 2725 && animelemtime(4)>5 && abs(fvar(38)-1)<0.1
trigger1 = time=28   ;ScreenPos Y >= 175
value = 2930
ctrl = 0

[State 4001, StopFwd]
type = VelSet
trigger1 = Vel X = (0,0.4]
X = 0

[State 4001, Stop]
type = VelSet
trigger1 = Vel Y > abs(Pos Y)
Y = 0

[State 4001, Replace]
type = PosSet
trigger1 = Vel Y = 0
Y = 0

[State 4001, ToGround]
type = StateTypeSet
trigger1 = Anim = 1203
persistent = 0
statetype = S
physics = S

[State 17100, Landing Sound]
type = PlaySnd
trigger1 = anim=1203
value = 40, 0
persistent = 0

[state 17100, Landing Effect]
type=explod
trigger1 = Anim = 1203
anim=17100
id=17100
pos=-15,0
postype=P1
sprpriority=-3
ownpal=1
supermovetime=-1
removetime = -2
persistent = 0

[State 4001, End]
type = ChangeState
trigger1 = Anim = 1203
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;--------------------------------
;P2 hit by Shin Shoryuken 3 Rising
[Statedef 2726]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1]
type = ChangeAnim2
trigger1 = Time = 0
value = 2726

[State 5020, 3]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"
value = 105051

[State 1100, ‰¹‚ð–Â‚ç‚·]
type = playsnd
trigger1 = time = 0
trigger1 = authorname = "GM"
trigger1 = name="Ryu"||name="Ken"||name="Gouki"||name="Sean"||name="Alex"||name="Hugo"||name="Ibuki"||name="Gill"
value = 5000,1
channel = 2

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = anim = [105050,105051]
trigger1 = !HitShakeOver
value = anim

[State -2, posadd]
type = posadd
trigger1 = !HitShakeOver
x = 3*ifelse(time%2=0,1,-1)*ifelse(enemy,fvar(38)>1.0,1.5,1)

[State -2, AngleDraw]
type = AngleDraw
trigger1 = numenemy
value = 0
scale = enemy,fvar(38),enemy,fvar(38)

[State 810, ScreenBound]
type = ScreenBound
trigger1 = !HitShakeOver && enemy,var(49)=0
value = 1
movecamera = 1,1
ignorehitpause = 1

[State 810, ScreenBound]
type = ScreenBound
trigger1 = HitShakeOver && enemy,var(49)=0
value = 0
movecamera = 1,0
ignorehitpause = 1

[State 0, out of screen - Ultimate Kmh]
type = screenbound
trigger1 = enemy,var(49)>0 || enemy,stateno=2900
value = 0
movecamera = 0,0
ignorehitpause = 1

[State 820, ChangeAnim2]
type = ChangeAnim
Trigger1 = anim != [105050,105051]
trigger1 = HitShakeOver
value = 5030+(SelfAnimExist(5051)=1)*21
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
trigger1 = HitShakeOver
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5030
Trigger1 = AnimTime = 0
value = 5035
persistent = 0

[State 820, ChangeAnim2]
type = ChangeAnim
triggerall = HitShakeOver
trigger1 = SelfAnimExist(5035)
Trigger1 = anim = 5035
Trigger1 = AnimTime = 0
trigger2 = !SelfAnimExist(5035)
Trigger2 = anim = 5030
Trigger2 = AnimTime = 0
value = 5050
persistent = 0

[State 5050, 2]
type = ChangeAnim
triggerall = HitShakeOver
trigger1 = (anim = [5050,5051])||(anim = [105050,105051])
trigger1 = Vel Y >= 1
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5030, 1]
type = VelAdd
trigger1 = HitShakeOver
y = GetHitVar(yaccel)

[State 5030, Buu Genkidama]
type = Changestate
triggerall = enemy,stateno=2935
trigger1 = HitShakeOver
value = 2933

[State 5030, Sonic Beatdown repositioning]
type = posadd
triggerall = enemy,stateno=2801
trigger1 = HitShakeOver
X = enemy,fvar(4)
persistent = 0

[State 5030, 2]
type = HitVelSet
trigger1 = HitShakeOver
x = 1
y = 1
persistent = 0

[State 5030, 4]
type = SelfState
trigger1 = HitShakeOver
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100


;===========================================================================
; <<<<< JUSTICE MODE >>>>>
; Rage Activation = 2745
;===========================================================================

;JUSTICE MODE
[Statedef 2745]
type = S
movetype = I
physics = S
anim = 2745
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = -2000

[State 200, BGPalFX]
type = BGPalFX
trigger1 = animelemtime(7)>=0
time = 1
add	= -100,-100,-100
;mul	= 256,100,100
mul	= 100,100,256
invertall = 0
color = 256

[State 3000, superpause]
type = superpause
trigger1 = animelemtime(7)=0
time = 138
p2defmul = 1
unhittable = 1
anim = -1
sound = s2350,0
darken = 0
movetime = 138

[State 3000, nhb]
type = nothitby
trigger1 = animelemtime(7)>=0
time = 1
value = SCA

[State 13100, shake]
type = envshake
trigger1 = animelemtime(7)>=0
trigger1 = !(time%12)
time = 12
freq = 130
ampl = 5

[State 4500, 1];Scream
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = animelemtime(5)=0
value = 8,2
volume = 500
channel = 8

[State 4500, 1];Scream
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = animelemtime(5)=0
value = 8,102
volume = 500
channel = 8

[State 4500, 1];power up SFX
type = PlaySnd
trigger1 = animelemtime(7)=0
value = 193,1
volume = 500
channel = 9

[State 4500, 1];Small sound
type = PlaySnd
trigger1 = time=21
value = 8,6
channel = 9
[State 4500, 2];long sound
type = PlaySnd
trigger1 = time=21
value = 8,5
pan = 1
channel = 9

[State 1900, dust]
type = explod
trigger1 = animelemtime(7)=0
anim = 908+(var(2)=0)
id = 908
pos = 17,5
sprpriority = 4
bindtime = -1
ownpal = 1
removeongethit = 1
ignorehitpause = 1
facing = -1
removetime = -1
pausemovetime = 99999
supermovetime = 99999

[State 1900, Aura helper]
type = Helper
trigger1 = animelemtime(7)=0 && !numhelper(905)
id = 905
name = "Charge"
pos = 0,-2
postype = P1
stateno = 905
helpertype = normal
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 3000, Buffer var]
type = varset
trigger1 = animelemtime(7)=0
var(49) = 1000   ;32 in Vegeta

[State 3000, Justice var]
type = varset
trigger1 = animelemtime(7)=0
var(50) = 0      ;33 in Vegeta

[State 3000, end]
type = changestate
trigger1 = !animtime
value = 0
ctrl = 1


;===========================================================================
; <<<<< SONIC BEATDOWN >>>>>
; Start charge : 2800
; Sonic Beatdown combo : 2801
; Gut Punch : 2805
; Transition Gut Punch to charge : 2810
; Charge Loop : 2815
; Final Punch Attack : 2820
; P2 State - Sent down : 2822
; P2 State - Hitting ground : 2823
; Final Punch Loop : 2825
; P2 Hit Lie Down (copy 5110) : 2829
; Recovery : 2830
;===========================================================================

; Sonic Beatdown - 1
[Statedef 2800]
type = A
movetype = A
physics = N
anim = 2800
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[State 3000, Buffer var]
type = varset
trigger1 = time=10
var(49) = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4)
time=4
freq=80
ampl=2+0.02*time

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 45
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 45

[state 17100, aura]
type = explod
trigger1 = time=7
anim = 30013
id = 30013
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[state 17100, mouth sprite]
type = explod
trigger1 = animelemtime(3)=0 && !numexplod(2803)
anim = 2803
id = 2803
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[State 4500, 1];Niyjaaa voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 2800,0
volume = 500
channel = 0

[State 4500, 1];Niyjaaa voice
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2800,1
volume = 500
channel = 0

[State 4500, 1];power up SFX
type = PlaySnd
trigger1 = !time
value = 193,1
volume = 500
[State 4500, 2];long sound
type = PlaySnd
trigger1 = !time
value = 8,0
loop = 1
pan = 1
volumescale = 50
channel = 4

[State 3000, position save]
type = varset
trigger1 = !time
fvar(3) = pos X

[State 3000, position properly]
type = posadd
triggerall = time >= 1
trigger1 = (pos X > 3) || (pos X < -3)
X = ifelse (pos X > 3, ifelse(facing=1,-3.5,3.5), ifelse(facing=1,3.5,-3.5))

[State 3000, X pos to move P2]
type = varset
trigger1 = !time
fvar(4) = fvar(3) - (pos X)

;Sonic Beatdown
[State 901, ChangeAnim]
type = ChangeState
trigger1 = time=80
value = 2801
ctrl = 0

;------------------------------------
; Sonic Beatdown combo
[Statedef 2801]
type = A
movetype = A
physics = N
anim = 2801
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 30013
[state 17100, mouth]
type = removeexplod
trigger1 = !time
ID = 2803

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, aura]
type = explod
trigger1 = !time
anim = 2802
id = 2802
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[State 810, bind 1]
type = targetbind
trigger1 = animelemtime(1)>=0 && animelemtime(3)<0
pos = 70,-30

[State 4500, 1];Atatatata voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 2801,0
volume = 500

[State 4500, 1];Atatatata voice
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2801,0
volume = 500

[State 640, 2]
type = HitDef
trigger1 = 1
attr = A, HA
damage = 0,0
guardflag = HA
hitflag = MAF
animtype  = Hard
priority = 3,Hit
sparkno = s(7010+10*(random%2))
guard.sparkno = s7000
sparkxy = -10-(random%20),-70-(random%40)
hitsound   = s5,ifelse(random<333,200,random%2)
guardsound = S6,random%2
ground.type = High
pausetime = 4,5
ground.slidetime = 8
ground.hittime = 15
ground.velocity = -4
air.velocity = -1,0
getpower= 0,0
givepower = 5,5
yaccel = 0.5
envshake.time=16
envshake.freq=80
envshake.ampl=4
fall = 1
fall.recover = 0
kill = 0

[State 902, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 5000
ignorehitpause = 1

;to gut punch
[State 901, ChangeAnim]
type = ChangeState
trigger1 = !animtime
value = 2805
ctrl = 0

;------------------------------------
; Gut Punch
[Statedef 2805]
type = A
movetype = A
physics = N
anim = 2805
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2802

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, aura]
type = explod
trigger1 = !time
anim = 2806
id = 2806
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[State 810, bind 1]
type = targetbind
trigger1 = 1
pos = 50,-40

[State 200, 1];Haria voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 3,15
channel = 0

[State 220, snd];voice
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 3,105  ;112
channel = 0

[State 3005, hit]
type = hitdef
trigger1 = !time
attr = S, HA
damage = 0,0
animtype = light
priority = 7, Miss
hitflag = MAF
guardflag = MA
sparkno = s7030
getpower = 0,0
guard.sparkno = s7000
sparkxy = -16,-87
hitsound   = s5,9
guardsound = 6,1
guard.dist = 0
pausetime = 0,0
ground.hittime = 15
ground.type = high
ground.slidetime = 5
ground.velocity = 0,0
air.velocity = 0,0
p2facing = 1
kill = 0
;p2stateno = 2311
id = 2805

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2311
ID = 2805
ignorehitpause = 1
persistent = 0

[State 13100, shake]
type = envshake
trigger1 = movehit
time = 20
freq = 180
ampl = 8-0.2*time
persistent = 0

[State 200, 1];Hitsound SFX
type = PlaySnd
trigger1 = !time
value = 2805,0
volume = 500
ignorehitpause = 1

;gut punch to charge transition
[State 901, ChangeAnim]
type = ChangeState
trigger1 = time = 30
value = 2810
ctrl = 0

;------------------------------------
; Transition Gut Punch to charge
[Statedef 2810]
type = A
movetype = A
physics = N
anim = 2810
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2806

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, aura]
type = explod
trigger1 = !time
anim = 2811
id = 2811
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -2
persistent = 0
bindtime = -1

[State 810, bind 1]
type = targetbind
trigger1 = 1
pos = 50,-40

[State 1305, P2 pushed sound (ultimate hitbreak SFX)]
type = PlaySnd
trigger1 = !time
value = 2905,0
volume = 300

;to charge anim
[State 901, ChangeAnim]
type = ChangeState
trigger1 = !AnimTime
value = 2815
ctrl = 0

;------------------------------------
; Charge Loop
[Statedef 2815]
type = A
movetype = A
physics = N
anim = 2815
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2811

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, aura]
type = explod
trigger1 = !time
anim = 2816
id = 2816
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[State 810, bind 1]
type = targetbind
trigger1 = 1
pos = 50,-40

;to Gut Punch
[State 901, ChangeAnim]
type = ChangeState
trigger1 = time = 15  ;60
value = 2820
ctrl = 0

;------------------------------------
; Final Punch Attack
[Statedef 2820]
type = A
movetype = A
physics = N
anim = 2820
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2816

[State 4500, 1];Harria voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 2820,2
volume = 500
channel = 0

[State 4500, 1];Harria voice
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2820,3
volume = 500
channel = 0

[State 810, bind 1]
type = targetbind
trigger1 = !time
pos = 50,-40

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, aura]
type = explod
trigger1 = !time
anim = 2821
id = 2821
pos = 0,0
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -2
persistent = 0
bindtime = -1
ignorehitpause = 0

[State 650, 3]
type = HitDef
trigger1 = !time
attr = A, HA
damage = Ceil(IfElse(fvar(11) * 50 < 25, 25, fvar(11) * 50)), 0
;Ceil(IfElse(fvar(11) * 50 < 7, 7, fvar(11) * 50)), 50
;50, 50
;ceil(50.0/fvar(15)),ceil(50.0/fvar(15))         ;;;old
hitflag = MAF
guardflag = HA
animtype = Hard
priority = 4, Hit
pausetime = 11,12
sparkno = s7030
guard.sparkno = s7000
sparkxy = -30,-55
hitsound   = s5,2
guardsound = S6,1
ground.type = High
ground.slidetime = 12
ground.hittime  = 15
ground.velocity = -5
air.velocity = 0,10
envshake.time = 20
envshake.freq = 80
envshake.ampl = 6
fall = 1
fall.recover = 0
p2facing = 1
airguard.cornerpush.veloff= 0
air.animtype = Back
fall.animtype = Back
getpower= 0,0
givepower = 35,35
yaccel = 0.5
;p2stateno = 2822
id = 2820

[State 802, TargetState]
type = TargetState
trigger1 = movehit
trigger1 = numtarget
trigger1 = !(target, ishelper)
value = 2822
ID = 2820
ignorehitpause = 1
persistent = 0

[State 200, 1];Hitsound SFX
type = PlaySnd
trigger1 = animelemtime(3)=0
value = 2805,1
volume = 500
ignorehitpause = 1

;Thunder Strike hit sound
[State 901, thunder sound]
type = Playsnd
trigger1 = animelemtime(3)=0
value = 2820,0
ignorehitpause = 1

[state 1215, Thunder Strike FX]
type = explod
trigger1 = animelemtime(3)=0
anim = 2823
id = 2823
pos = 60,-50
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1
[state 1215, Thunder Strike FX]
type = explod
trigger1 = enemy,stateno = 2822
anim = 2824
id = 2824
pos = 0,-15
postype = P2
sprpriority = 2
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1
scale = 0.3,0.3
[state 1215, Thunder Strike FX]
type = explod
trigger1 = enemy,stateno = 2822
anim = 2828
id = 2824
pos = 15,-5
postype = P2
sprpriority = 2
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1
scale = 0.3,0.3
[state 1215, Thunder Strike FX]
type = explod
trigger1 = enemy,stateno = 2822
anim = 2824
id = 2824
pos = 35,-15
postype = P2
sprpriority = 2
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1
scale = 0.3,0.3
[state 1215, Thunder Strike FX]
type = explod
trigger1 = enemy,stateno = 2822
anim = 2828
id = 2824
pos = -20,-20
postype = P2
sprpriority = 2
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1
scale = 0.3,0.3
[state 1215, Thunder Strike FX]
type = explod
trigger1 = enemy,stateno = 2822
anim = 2824
id = 2824
pos = -30,-5
postype = P2
sprpriority = 2
ownpal = 1
removetime = -1
persistent = 0
ignorehitpause = 1
bindtime = -1
scale = 0.3,0.3

;to final punch loop
[State 901, ChangeAnim]
type = ChangeState
trigger1 = !AnimTime
value = 2825
ctrl = 0

;------------------------------------------------
;P2 State - Sent down
[Statedef 2822]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0, 14

[State 3020, 2]
type = changeanim2
trigger1 = !time && anim !=2822
value = 2822

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

[State 1050, 1]
type = sprpriority
trigger1 = 1
value = 1

[State 901, ChangeAnim]
type = ChangeState
trigger1 = Pos Y >= -10
value = 2823
ctrl = 0

;------------------------------------------------
; P2 State - Hitting ground
[Statedef 2823]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0, 0.2

[State 13100, shake]
type = envshake
trigger1 = !time
time = 100
freq = 150
ampl = 10
persistent = 0

[State 3020, 2];hit ground
type = changeanim
trigger1 = time>=0 && time<100 && (time%12)=0
value = 5080

[State 3020, 2];lie on ground
type = changeanim
trigger1 = time>=100 && anim!=5110
value = 5110

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

[State 1050, 1]
type = sprpriority
trigger1 = 1
value = 1

[State 5101, 6];vel
type = Velset
trigger1 = time>=130
Y = 0

[State 5101, 6];Position
type = Posset
trigger1 = time=130
Y = 0

[State 5101, 6];get up
type = ChangeState
trigger1 = time=210
value = 2829   ;5110

;------------------------------------
; Final Punch Loop
[Statedef 2825]
type = A
movetype = A
physics = N
anim = 2825
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2821

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[state 17100, radial aura]
type = explod
trigger1 = !time
anim = 2826
id = 2826
pos = 0,-5
postype = P1
sprpriority = -1
ownpal = 1
supermovetime = -1
removetime = -1
persistent = 0
bindtime = -1

[State 13300, Fadeout]
type = modifyexplod
trigger1 = Time = [80,110]
trans = addalpha
alpha = floor(256-8.53*(Time-80)),floor(8.53*(Time-80))
ID = 2826

;P2 hits ground sound
[State 901, hitground sound]
type = Playsnd
trigger1 = enemy,stateno=2823
value = 2820,5;1
persistent = 0
[State 901, hitground sound]
type = Playsnd
trigger1 = enemy,stateno=2823
value = 2820,1
persistent = 0

[State 1900, lightning ground burst]
type = explod
trigger1 = enemy,stateno=2823
anim = 2827
Postype = P2
pos = 0,25
sprpriority = 6
bindtime = 1
ownpal = 1
ignorehitpause = 1
removetime = -2
persistent = 0

[State 5101, 6];vel
type = Velset
trigger1 = time=20
Y = -1.5
[State 5101, 6];vel
type = Velset
trigger1 = Pos Y < -180
Y = 0

[State 0, out of screen]
type = screenbound
trigger1 = 1
value = 0
movecamera = 0,0

[State 0, stop power charge SFX]
type = stopsnd
trigger1 = time=60 && !winKO
trigger2 = time=10 && winKO
channel = 4

[State 1900, white circle]
type = explod
trigger1 = time = 60
anim = 90200
id = 90200
Postype = P2
pos = 0,-10
sprpriority = 7
ontop = 1
bindtime = -1
ownpal = 1
ignorehitpause = 1
removetime = -2
scale = .005,.005

[State 1900, white circle]
type = modifyexplod
trigger1 = numexplod(90200)
scale = .12*(time-60),.12*(time-60)
ID = 90200

[State 1900, lightning bind remove]
type = removeexplod
trigger1 = time=70
ID = 2824

;to Recovery
[State 901, ChangeAnim]
type = ChangeState
trigger1 = time = 165  ;180
value = 2830
ctrl = 0

;------------------------------------
;P2 Hit Lie Down (copy 5110)
[Statedef 2829]
type    = L
movetype= H
physics = N

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 11];not dead
type = SelfState
triggerall = alive
trigger1 = AnimTime = 0
trigger2 = Anim = [5110,5119]
value = 5120

;------------------------------------
; Recovery
[Statedef 2830]
type = A
movetype = A
physics = N
anim = 2830
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[state 17100, aura]
type = removeexplod
trigger1 = !time
ID = 2826

[State 0, AssertSpecial]
type = null ;AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

;to fall state
[State 1400, EndState]
type = ChangeState
trigger1 = !animtime
value = 50
ctrl = 0


;===========================================================================
; <<<<< ULTIMATE KAMEHAMEHA >>>>>
; Start charge : 2900
; Throwing Angry Kamehameha : 2901
; (Helper) Horizontal Lines BG - Angry Kmh : 2902
; (Helper) Ultimate Kamehameha Beam hits : 2903
; (Helper) Ultimate Kamehameha Beam moves : 2905
; P2 hit by tip of beam : 2906
; Throwing Angry Kamehameha - Goku moving out of screen : 2910
; SSJ Goku waiting : 2911
; Goku going back to screen : 2912
; P2 hit goes back to screen : 2915
;===========================================================================

;Finisher- Kamehameha
[Statedef 2900]
type = A
movetype = A
physics = N
anim = 2900
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[State 3000, Buffer var]
type = varset
trigger1 = time=10
var(49) = 0

[State 10000, Explod]; Yellow FG
type = Explod
trigger1 = AnimElem = 8
anim = 2902
id = 2902
pos =  160,120
postype = left
sprpriority = 10
bindtime = -1
ownpal = 1
removetime = -2
pausemovetime = 999999
supermovetime = 999999
supermove = 1
scale = 1.50,1.50
ignorehitpause = 1
persistent = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4)
time=4
freq=80
ampl=2+0.02*time

[State 3000, superpause]
type = superpause
trigger1 = !time
time = 135
p2defmul = 1
unhittable = 1
anim = -1
darken = 0
movetime = 135

[State 200, Kmh voice and SFX]
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 2900,0

[State 200, Kmh voice]; <<<<<<<<<<<
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2900,1
[State 200, Kmh charge long]
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time = 5
value = 2400,1

[State 200, Superpause sound]
type = PlaySnd
trigger1 = time=6
value = 2350,0

[State 0, mouth LOL]
type = Explod
triggerall = anim = 2900
trigger1 = time = 5
anim = 24000
id = 24000
pos = 5,-8
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 2
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Hyper Charge FX]
type = Explod
triggerall = anim = 2900
trigger1 = time = 5
anim = 2440
id = 2440
pos = -21,-80
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -2
sprpriority = 6
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0, Charge Ball FX]
type = Explod
triggerall = anim = 2900
trigger1 = time = 5
anim = 2420+10000*(var(2)=0)
id = 2420
pos = -21,-81
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 0.6,0.6
persistent = 0

[state 17100, scale charge FX]
type = modifyexplod
trigger1 = numexplod(2420)
scale = 0.6+0.002*(time-20),0.6+0.002*(time-20)
id = 2420

[State 0, Charge lightning FX]
type = Explod
triggerall = anim = 2900
trigger1 = time = 5
anim = 2430
id = 2430
pos = -17,-78
postype = p1
supermovetime = 9999
pausemovetime = 9999
supermove = 1
removetime = -1
sprpriority = 5
ownpal = 1
bindtime = -1
scale = 1,1
persistent = 0

[State 0,from sky lightning]
type = explod
triggerall = anim = 2900 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
anim = 2450+random%6
sprpriority = 7
postype = p1
pos = 0,-ceil(pos y)
facing = ifelse(random<500,-1,1)
random = 160,0
scale = 1,2
pausemovetime = -1
supermovetime = -1
ownpal = 1

[State 0, lightning sound]
type = playsnd
triggerall = anim = 2900 && time>=45
trigger1 = gametime%(40-var(26)/5) = 0
value = 2400,3
volume = -170-(32*numexplod)
freqmul = .9 + (random/5000.0)

;Throw Kmh
[State 901, ChangeAnim]
type = ChangeState
trigger1 = time=187   ;170
value = 2901
ctrl = 0

;-----------------------------
;Throwing Angry Kamehameha
[Statedef 2901]
type = A
physics = N
movetype = A
anim = 2901
ctrl = 0
velset = -1,0
sprpriority = 1

[state -2, remove charge ball]
type = removeexplod
trigger1 = !time
ID = 2420

[State 200, 1];Launching SFX
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2401,1

[State 200, Launch SFX]
type = PlaySnd
trigger1 = !time
value = 2901,0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 2201, helper]; Background lines
type = Helper
trigger1 = !time
pos = -640, -480
postype = back
stateno = 2902
helpertype = normal
name = "horizontal_lines_BG"
id = 2902
ownpal = 1
supermovetime = 150
pausemovetime = 150
sprpriority = 4
size.xscale = 5
size.yscale= 5

[state 1215, Hands overlay]
type = explod
trigger1 = !time
anim = 2908
id = 2908
pos = 0,0
postype = P1
sprpriority = 6
ownpal = 1
removetime = 90
persistent = 0
ignorehitpause = 1
bindtime = -1

[State 13000, Angry Kmh Beam]
type = Helper
trigger1 = !time
name = "Angry_KMH_Beam"
ID = 2903
stateno = 2903

[State 3005, end]
type = changestate
trigger1 = helper(2903),movehit
value = 2910

;-----------------------------
;Throwing Angry Kamehameha - Goku moving out of screen
[Statedef 2910]
type = A
physics = N
movetype = A
anim = 2901
ctrl = 0
velset = -1,0
sprpriority = 1

[State 0, out of screen]
type = screenbound
trigger1 = 1
value = 0
movecamera = 0,0

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4)
time=4
freq=80
ampl=6

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 0, vel]
type = velset
trigger1 = time=30
X = -8
[State 0, vel]
type = velset
trigger1 = ifelse(facing=1,pos X <-790,pos X > 790)
X = 0

[State 0, vel]
type = velset
trigger1 = time>=50 && (pos Y != [-26,-24])
Y = ifelse(pos Y > -24, -1, 1)
[State 0, vel]
type = velset
trigger1 = pos Y = [-26,-24]
Y = 0

[State 1315, Sparks]
type=explod
trigger1= numtarget
trigger1= (time%4=0) && (time> 180) && (time < 180+ 39*4 + 1)
anim=7030
sprpriority=8
postype=p2
pos=(target,const(size.ground.front)-40)+(random%60), (random%60)-90
removetime=-2
ownpal=1
facing=-1
ignorehitpause=1
pausemovetime=100
supermovetime=100

[State 800, count]
type = HitAdd
trigger1= (time%4=0) && (time> 180) && (time < 180+ 39*4 + 1)
value = 1

[State 800, hitsound]
type = PlaySnd
trigger1= (time%8=0) && (time> 180) && (time < 180+ 39*4 + 1)
value = s1000,0
volume = 300

[State 13100, Hurt]
type = TargetLifeAdd
trigger1 = time = 180 + 39*4 + 1
value = ceil(ifElse(fvar(11) * -350 > -70, -70, fvar(11) * -350))
kill = 1
persistent = 0

[State 13100, Hurt]
type = TargetPowerAdd
trigger1 = time = 180+ 39*4 + 1
value = 2000
persistent = 0

[State 13100, Back to screen]
type = ChangeState
trigger1 = time = 180+ 39*4 + 60
value = 2911
ctrl = 0

;--------------------------------
; P2 hit by tip of beam
[Statedef 2906]
type    = A
movetype= H
physics = N
velset = 0,0
ctrl = 0

[State 0, anim hit]
type = changeanim2
trigger1 = !time
value = 2906

[State 0, out of screen]
type = screenbound
trigger1 = 1
value = 0
movecamera = 0,0

[State 1000]
type = PosAdd
trigger1 = abs(P2bodydist X) < 700
X = -40
[State 1000]
type = PosAdd
trigger1 = abs(P2bodydist X) > 700 && abs(P2bodydist X) < 740
X = -5
[State 1000]
type = PosAdd
trigger1 = abs(P2bodydist X) > 740 && abs(P2bodydist X) < 760
X = -2

[State 0, reposition P2]
type = posAdd
trigger1 = !time
Y = ceil(-ScreenPos Y + 120)-const(size.head.pos.Y)-20

[State 0, vel]
type = velset
trigger1 = time=30
X = 8

[State 0, vel]
type = velset
trigger1 = enemy,vel X = 0
X = 0

;[State -3, GetHit Snd]
;type = playsnd
;trigger1 = Time >= 180 && time<=(180+ 39*4)
;trigger1 = Time%20 = 0
;value = 5000,1+(random%5)
;volume = 200
;ignorehitpause = 1

[State 13100, shake]
type = envshake
trigger1 = Time >= 180
trigger1 = (time%12)=0
time = 12
freq = 150
ampl = 10

[State 3025, p2state - killed fatality]
type = changestate
trigger1 = enemy,stateno=2911
trigger1 = MatchOver
value = ifelse(SelfAnimExist(5941), 5941, 5943)
ignorehitpause = 1

[State 801, end]
type = changestate
trigger1 = enemy,stateno=2911
value = 2915
ctrl = 0

;----------------------------
; SSJ Goku waiting
[Statedef 2911]
type = A
physics = N
movetype = A
ctrl = 0
sprpriority = 1
velset = 0,0

[State 182, 1]
type = screenbound
trigger1 = 1
movecamera = 0,0
value = 0

[State 3025, killed, beam fatality sound]
type = playsnd
trigger1 = numenemy
trigger1 = (enemy,stateno=5941 || enemy,stateno=5943 || enemy,stateno=2990) && enemy,time=30
value = 5941,0
volume = 300
persistent = 0

[State 13100, Back to screen]
type = ChangeState
triggerall = enemy,stateno != 2990
trigger1 = time >= 2+120*MatchOver
value = 2912
ctrl = 0

;---------------------------------------
; Going back to screen
[Statedef 2912]
type    = S
movetype = A
physics = N
ctrl = 0
anim = 102
sprpriority = 1
velset = 0,0

[State 105, 3]
type = PosSet
trigger1 = !time
x = ifelse(facing=1,-250,250)
y = -50

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

[State 41, Train]
type = AfterImage
trigger1 = Time = 0
time= 30
timegap= 1
framegap= 3
length= 12
palbright= 0,0,0
paladd= 0,0,0
palmul= .9,.9,.9
palcontrast= 120,120,120
palpostbright= 0,0,0
trans= add1

[State 100, 7]
type = Explod
trigger1 = Time = 0
Anim = 8050
postype = P1
pos = -10,-20
scale = 1,.8
bindtime = 15
sprpriority = 2
ownpal = 1
removetime = -2
removeongethit = 1

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

[State 115, dash Sound]
type = PlaySnd
trigger1 = time=0
value = 100,0

[State 111, 1]
type = VelAdd
trigger1 = time>=5 && vel X>=0
x = -0.3

[State 111, 1]
type = StateTypeSet
trigger1 = time >= 5
physics = A

[State 111, 1]
type = ChangeState
trigger1 = time = 15
value = 50

[State 111, end]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 112

;---------------------------------------------------------------------------
;P2 hit goes back to screen
[Statedef 2915]
type = S
movetype = H
physics = N
ctrl = 0
sprpriority = -1
velset = 0,0

[State 4005, vel Y]
type = posset
trigger1 = !time
x = ifelse(facing=1, -90, 90)
y = -40

[State 111, go to common hitstate]
type = SelfState
trigger1 = !Time
value = 5100


;===========================================================================
; <<<<< BUU GENKIDAMA >>>>>
; Transition : 2930
; Little balls charge helpers : 2931, 2932
; P2 invisible & waiting : 2933
; Genkidama charge : 2935
; Goku throws Genkidama : 2940
; Genkidama helper : 2941
; Horizontal BG lines : 2942
; P2 back on screen guarding : 2945
; Goku back on screen and powering up : 2950
;===========================================================================

;Finisher- Genkidama
[Statedef 2930]
type = A
movetype = A
physics = N
anim = 2930
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[State 3000, Buffer var]
type = varset
trigger1 = time=5
var(49) = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 1000, shake]
type = EnvShake
trigger1 = !(time%4)
time=4
freq=80
ampl=3

[State 3000, position properly]
type = posadd
trigger1 = (pos X > 3) || (pos X < -3)
X = ifelse (pos X > 3, ifelse(facing=1,-3.5,3.5), ifelse(facing=1,3.5,-3.5))

[State 111, to charge]
type = ChangeState
trigger1 = !animtime
value = 2935

;------------------------------------------------
[StateDef 2933] ; P2 invisible and waiting
type = S
movetype = H
physics = N
velset = 0,0
ctrl = 0

[State 13200, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 15999

[State 182, 1]
type = screenbound
trigger1 = 1
movecamera = 1,0
value = 0

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 13200, Anim];Go to guarding state back on screen
type = ChangeState
trigger1 = Time = 430
value = 2945

;---------------------------------------------------------------------------
;Genkidama charge loop
[Statedef 2935]
type = A
movetype = A
physics = N
anim = 2935
ctrl = 0
velset = 0,0
sprpriority = 1
poweradd = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noBG
flag2 = noFG
flag3 = nobardisplay
ignorehitpause = 1

[State 3001, shake]
type = EnvShake
trigger1 = time = 0
time = 300
freq = 100
ampl = 3

[State 181, 1];revert SFX
type = PlaySnd
trigger1 = !time
value = 181,0

[State 8000, less vibrant]
type = PalFX
trigger1 = 1
add = -15,-15,-15
color = 200
time = 1

[State 1000, Helper]
type = Helper
trigger1 = anim = 2935 && !(time%7) && numhelper(2931)<20 && numhelper(2932)<20
helpertype = Normal
name = "PerseEffect_GK"
id = 2931
pos = 0,0   ;ceil(50-random/20),-ceil(random/7)
postype = p1
facing = 1
stateno = 2931
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State 200, 1];Super charging SND
type = PlaySnd
trigger1 = !time
value = 2930,0
volume = 355

[State 200, charge SFX]
type = PlaySnd
trigger1 = (GameTime%20) = 0
value = 2500,1
volume = -200
freqmul = .9 + (random/5000.0)

[State 13300, Genkidama Ball]
type = Explod
trigger1 = time=20
anim = 2936
ID = 2936
postype = p1
pos = -5,-220
bindtime = 1
removetime = -1
pausemovetime = -1
ontop = 1
sprpriority = 7
scale = 0.3,0.3
persistent = 0

[State 13300, Genkidama Ball Scale]
type = ModifyExplod
trigger1 = time>20 && time<264
scale = 0.3+.003*(time-20),0.3+.003*(time-20)
ID = 2936

[State 111, end]
type = ChangeState
trigger1 = time=320
value = 2940

;------------------------------------------------
; Goku throws his HUGE genkidama
[StateDef 2940] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2940

[State 8000, less vibrant]
type = PalFX
trigger1 = 1
add = -15,-15,-15
color = 200
time = 1

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 3001, shake]
type = EnvShake
trigger1 = time = 0
time = 150
freq = 100
ampl = 3

[State 220, snd];voice scream
type = playsnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = Anim=2940 && AnimElemtime(3)=0
value = 3,16
channel = 0
volume = 255

[State 220, snd];voice scream
type = playsnd
triggerall = var(55)=1		;Voice=English
trigger1 = Anim=2940 && AnimElemtime(3)=0
value = 3,116
channel = 0
volume = 255

[State 220, snd];Genkidama goes
type = playsnd
trigger1 = Anim=2940 && AnimElemtime(6)=0
value = 2940,0   ;2401,1
volume = 255

[State 13300, Genkidama Ball old]
type = RemoveExplod
trigger1 = Anim=2940 && AnimElemtime(5)=0
ID = 2936

[State 1000, Helper Genkidama]
type = Helper
trigger1 = Anim=2940 && AnimElemtime(5)=0
helpertype = Normal
name = "Genkidama"
id = 2941
pos = -20,-190
postype = p1
stateno = 2941
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State 13100, go out of screen]
type = Velset
trigger1 = time=40
x = -6

[State 2201, helper]; Background lines
type = Helper
trigger1 = !time
pos = -640, -480
postype = back
stateno = 2942
helpertype = normal
name = "horizontal_lines_BG"
id = 2942
ownpal = 1
supermovetime = 150
pausemovetime = 150
sprpriority = 4
size.xscale = 5
size.yscale= 5

[State 3001, screen]
type = Screenbound
trigger1 = 1
movecamera = 0,0
value = 0

[State 13100, stop moving]
type = Velset
trigger1 = time=150
x = 0

[State 200, 1];Beam clash
type = PlaySnd
trigger1 = Anim=2940 && AnimElemtime(6)=0   ;time=176
value = 2480,0
loop = 1
channel = 5
volume = 300

[State 13300, Guard sparks]
type = Explod
trigger1 = time>=176 && time%10=0
anim = 7000
ID = 7000
postype = p2
pos = -10+3*(random%15), -30-3*(random%16)
bindtime = 1
removetime = -2
pausemovetime = -1
ontop = 1
sprpriority = 7

[State 640, guard sounds]
type = PlaySnd
trigger1 = time>=176 && time%10=0
value = 6,1

[State 1000, shake]
type = EnvShake
trigger1 = time>=176 && time%6=0
time = 4
ampl = 5
freq = 176

[State 200, 1];Beam clash Stop
type = StopSnd
trigger1 = time=300
channel = 5

[State 111, go back to screen]
type = ChangeState
trigger1 = time=300
value = 2950

;------------------------------------------------
;P2 Guarding Comes back to screen
[StateDef 2945] 
type = S
movetype = H
physics = N
velset = 0,0
ctrl = 0
anim = 130
sprpriority = -1

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 3001, screen]
type = Screenbound
trigger1 = 1
movecamera = 0,0
value = 0

[State 13200, Pos]
type = PosSet
trigger1 = !time
x = 500*(enemy,facing)
y = -20

[State 13200, Move]
type = VelSet
trigger1 = !time
x = 6

[State 13200, In contact with Genkidama]
type = VelSet
trigger1 = time=68
x = 0

[State 13200, Invisible]
type = changeanim2
trigger1 = enemy,stateno = 2950
value = 15999

[State 13200, go to hit state]
type = changestate
trigger1 = enemy,stateno = 2980
value = 2985

;------------------------------------------------
; Goku push loop normal
[StateDef 2950] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2950

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 2260, destroy guard sparks]
type = RemoveExplod
trigger1 = !time
ID = 7000

[State 4500, 1];Hitbreak sound for build up
type = PlaySnd
trigger1 = time=30
trigger2 = time=100
value = 2905,0

[State 8000, less vibrant]
type = PalFX
trigger1 = 1
add = -15,-15,-15
color = 200
time = 1

[State 13200, Pos]
type = PosSet
trigger1 = !time
x = -20 * facing

[State 13300, yellow flash]
type = Explod
trigger1 = time=120
trigger2 = time=180
anim = 2951
ID = 2951
postype = p1
pos = 0,0
bindtime = -1
removetime = -2
pausemovetime = -1
sprpriority = 6

[State 4500, 1];Aura Burst
type = PlaySnd
trigger1 = time=120
trigger2 = time=180
value = 8,1

[State 111, go to SSJ]
type = ChangeState
trigger1 = time=200
value = 2955

;------------------------------------------------
; Goku push loop SSJ
[StateDef 2955] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2955
sprpriority = 4

[State 13300, yellow flash]
type = Explod
trigger1 = !time
anim = 2951
ID = 2951
postype = p1
pos = 0,0
bindtime = -1
removetime = -2
pausemovetime = -1
sprpriority = 6

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 13200, Pos]
type = PosSet
trigger1 = !time
x = -20 * facing

[State 4500, 1];Transformation sound
type = PlaySnd
trigger1 = !time
value = 188,0

[State 4500, 1];"push the genki" presence sound
type = PlaySnd
trigger1 = !time
value = 2955,0

[State 13300, aura]
type = Explod
trigger1 = !time
anim = 2956
ID = 2956
postype = p1
pos = 0,0
bindtime = -1
removetime = -1
pausemovetime = -1
sprpriority = 2

[State 4500, 1];Small sound
type = null ;PlaySnd
trigger1 = !time
value = 8,1
volume = 255
[State 4500, 2];long sound
type = PlaySnd
trigger1 = !time
value = 8,5 ;8,0
;loop = 1
pan = 1
volume = 25
channel = 3
[State 4500, 2];long sound
type = PlaySnd
trigger1 = time=150
value =  8,5 ;8,0
;loop = 1
pan = 1
volume = 25
channel = 3

[State 111, go to Salute transition]
type = ChangeState
trigger1 = time=160  ;200
value = 2960

;------------------------------------------------
; Goku salute transition
[StateDef 2960] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2960

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 111, go to Salute]
type = ChangeState
trigger1 = !animtime
value = 2965

;------------------------------------------------
; Goku salute 
[StateDef 2965] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2965

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 4500, 2];See you voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = time=50
value = 182,2

[State 4500, 2];See you voice
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = time=50
value = 182,102

[State 13300, mouth LOL]
type = Explod
trigger1 = Time = 50
anim = 2966
pos = 0,0
postype = P1
bindtime = -1
removetime = -2
ontop = 1
sprpriority = 7

[State 111, go to push transition]
type = ChangeState
trigger1 = time=150
value = 2970

;------------------------------------------------
; Goku push transition
[StateDef 2970] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2970

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 4500, 1];Niyjaaa scream voice
type = PlaySnd
triggerall = var(55)=0		;Voice=Japan
trigger1 = !time
value = 2800,0
volume = 500
channel = 0

[State 4500, 1];Niyjaaa scream voice
type = PlaySnd
triggerall = var(55)=1		;Voice=English
trigger1 = !time
value = 2800,1
volume = 500
channel = 0

[State 4500, 1];power boost sound
type = PlaySnd
trigger1 = !time
value = 2970,0

[State 2201, helper]; Background lines
type = Helper
trigger1 = !time
pos = -640, -480
postype = back
stateno = 2942
helpertype = normal
name = "horizontal_lines_BG"
id = 2942
ownpal = 1
supermovetime = 150
pausemovetime = 150
sprpriority = 4
size.xscale = 5
size.yscale= 5

[State 111, go to push loop]
type = ChangeState
trigger1 = !animtime
value = 2975

;------------------------------------------------
; Goku push loop
[StateDef 2975] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 2975

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 111, invisible]
type = ChangeState
trigger1 = time=60  ;80
value = 2980

;------------------------------------------------
; Goku invisible
[StateDef 2980] 
type = S
movetype = I
physics = N
velset = 0,0
ctrl = 0
anim = 15999

[State 111, remove aura]
type = removeexplod
trigger1 = !time
ID = 2956

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 200, 1];Beam clash
type = PlaySnd
trigger1 = !time
value = 2480,0
channel = 5
loop = 1
volume = 300

[State 1000, Helper Genkidama advances]
type = Helper
trigger1 = time=1
helpertype = Normal
name = "Genkidama"
id = 2981
pos = 0,0
postype = p1
stateno = 2981
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State 13100, Hurt]
type = TargetLifeAdd
trigger1 = enemy,anim= 2985
value = ceil(ifElse( fvar(11) * -450 > -130, -130, fvar(11) * -450))
;- ceil(250*fvar(11)) - var(21)*ceil(4*fvar(11)) - 95
kill = 1
persistent = 0

[State 13100, Hurt]
type = TargetPowerAdd
trigger1 = enemy,anim= 2985
value = 2000
persistent = 0

[State 13300, white screen fade]
type = Explod
trigger1 = Time = 20
anim = 2982  ;2907
ID = 2982    ;2907
postype = left
pos = 0,-50
bindtime = -1
removetime = -2
ownpal = 1
ontop = 1
sprpriority = 9
scale = 2,3
ignorehitpause = 1
facing = 1

[State 200, 1];Beam clash stop
type = StopSnd
trigger1 = time=105
channel = 5

[State 13100, Back to screen]
type = ChangeState
trigger1 = time = 180  ;105
value = 2911
ctrl = 0

;------------------------------------------------
;P2 Guard broken
[StateDef 2985] 
type = S
movetype = H
physics = N
velset = 0,0
ctrl = 0
anim = 130
sprpriority = -1

[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = noFG
flag2 = noBG
flag3 = nobardisplay
ignorehitpause = 1
[State 2260, bg]
type = assertspecial
trigger1 = 1
flag = globalnoshadow
ignorehitpause = 1

[State 2260, bg]
type = changeanim2
trigger1 = time=10
value = 2985

[State 3025, p2state - Genki killed fatality]
type = changestate
trigger1 = enemy,stateno=2911
trigger1 = MatchOver
value = 2990
ignorehitpause = 1

[State 801, end]
type = changestate
trigger1 = enemy,stateno=2911
value = 2915
ctrl = 0
