; _____________________________________
;| Rare Akuma by Phantom.of.the.Server |
; ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
;===============================================================================
;SYSTEM
;===============================================================================
;LOSE> Time over
;===============================================================================
[Statedef 170]
type=S
ctrl=0
anim=170
velset=0,0

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

[State 170, dust]
type=explod
trigger1= animelem=2
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-6,0
ownpal=1
scale=.5,.5

[State 170, snd]
type=playsnd
trigger1= animelem=2
value=0,52

;===============================================================================
;DRAWGAME> Time over
;===============================================================================
[Statedef 175]
type=S
ctrl=0
anim=175
velset=0,0

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

[State 175, dust]
type=explod
trigger1=animelem=5
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-5,6
ownpal=1

[State 175, snd]
type=playsnd
trigger1= animelem=5
value=5,4

;===============================================================================
;PRE INTRO
;===============================================================================
[Statedef 190]
type=S
ctrl=0
velset=0,0

[State 190, specialintrounavailable]
type=varset
trigger1=!time
var(0)=0

[State 190, intro]
type=changestate
trigger1= ifelse(var(0)=2,time>=1,1)
value=ifelse(random<333,187,ifelse(random<500,187,187))

;===============================================================================
;INTRO 1
;===============================================================================
[Statedef 182]
type=S
anim=182

[State 182, intro]
type=assertspecial
trigger1=1
flag=intro

[State 182, aura]
type=helper
trigger1=!animelemtime(7)&&!ishelper(1)
helpertype=normal
stateno=6000
ID=6000
postype=p1
ownpal=1
persistent=0

[State 182, metsu]
type=helper
trigger1=!animelemtime(7)&&!ishelper(1)
helpertype=normal
stateno=6002
ID=6002
postype=p1
pos=-5,-100
facing=ifelse(facing=1,1,-1)
ownpal=1
persistent=0

[State 182, snd]
type=playsnd
trigger1=!animelemtime(7)
value=3,5
channel=0
freqmul=ifelse(ishelper,1.5,1)

[State 182, snd]
type=playsnd
trigger1=!animelemtime(7)
value=5,4

[State 182, dust]
type=explod
trigger1=animelem=7
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-34,0
scale=.75,.75
ownpal=1

[State 182, shake]
type=envshake
trigger1=animelemtime(7)>=0 && animelemtime(26)<0 && !(animelemtime(7)%12)
time=12
freq=60
ampl=4

[State 182, end]
type=changestate
trigger1= !animtime
value=0

;===============================================================================
;INTRO 2  SHIN GOUKI + GOUKI = HYPER AKUMA
;===============================================================================
[Statedef 187]
type=S
anim=187

[State 187, intro]
type=assertspecial
trigger1=1
flag=intro

[State 187, Explod]
type=playsnd
trigger1=time=160
value=7,0

[State 187, Gouki]
type=playsnd
trigger1=time=40
value=4,16

[State 187, ShinGouki]
type=playsnd
trigger1=time=100
value=4,17

[State 187, snd]
type=playsnd
trigger1=Time=180||Time=240||Time=280||Time=320||Time=360||Time=400||Time=440||Time=480
value=5,12
channel=4

[State 187, snd]
type=playsnd
trigger1=time=310
value=4,7
channel=0
freqmul=ifelse(ishelper,1.5,1)

[State 187, snd]
type=playsnd
trigger1=animelem=11
value=5,4

[State 187, envcolor]
type=envcolor
trigger1=time=140
time=10
value=500,0,0

[State 187, shake]
type=envshake
trigger1=time=130
time=50
freq=80
ampl=30

[State 187, EnvShake]
type=EnvShake
trigger1=Time=180
time=200
freq=80
ampl=30

[State 187, Gouki]
type=helper
trigger1=!Time
helpertype=normal
stateno=33337
ID=33337
name="Gouki"
pos=-45,0
ownpal=1
persistent=0
removetime=-1
supermovetime=9999

[State 187, ShinGouki]
type=helper
trigger1=!Time
helpertype=normal
stateno=33336
ID=33336
name="Shin Gouki"
pos=72, 0
ownpal=1
persistent=0
removetime=-1
supermovetime=9999

[State 187, Onda en el Piso]
type=explod
trigger1=time>200&&time<=500
trigger1=ifelse(animelemtime(4)>=0,!(time%12),!(time%9))
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=ifelse(animelemtime(4)>=0,16,20),0
ownpal=1
scale=.75,.75

[State 182, dust]
type=explod
trigger1=animelem=11
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-34,0
scale=.75,.75
ownpal=1

[State 182, Energya Explod]
type=explod
trigger1=time=150
anim=33338
ID=33338
sprpriority=99
postype=p1
pos=30,35
ownpal=1
scale=1.1,0.9
removetime=150

[State 187, Electricidad]
type=Explod
trigger1=Time=340
anim=33341
sprpriority=20
postype=p1
pos=5,-10
velocity=0,0
removetime=65
bindtime=-1
removeongethit=1

[State 187, Electricidad2]
type=Explod
trigger1=Time=375
anim=33341
sprpriority=20
postype=p1
pos=10,15
velocity=0,0
removetime=55
bindtime=-1
removeongethit=1

[State 187, Electricidad3]
type=Explod
trigger1=Time=399
anim=33341
sprpriority=20
postype=p1
pos=-8,-25
velocity=0,0
removetime=65
bindtime=-1
removeongethit=1

[State 187, Electricidad3]
type=Explod
trigger1=Time=429
anim=33341
sprpriority=20
postype=p1
pos=10,-30
velocity=0,0
removetime=55
bindtime=-1
removeongethit=1

;SND Electricidad
[State 187, Electricidad]
type=playsnd
trigger1=time=340
value=5,31

[State 187, Electricidad2]
type=playsnd
trigger1=time=375
value=5,32

[State 187, Electricidad3]
type=playsnd
trigger1=time=399
value=5,31

[State 187, Electricidad4]
type=playsnd
trigger1=time=429
value=5,32

[State 187, EarthQuake]
type=Explod
trigger1=Time=180
anim=33339
sprpriority=10
postype=p1
pos=-20,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=195
anim=33339
sprpriority=10
postype=p1
pos=0,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=205
anim=33339
sprpriority=10
postype=p1
pos=25,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=215
anim=33339
sprpriority=10
postype=p1
pos=40,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=228
anim=33339
sprpriority=10
postype=p1
pos=65,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=234
anim=33339
sprpriority=10
postype=p1
pos=83,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=190
anim=33339
sprpriority=10
postype=p1
pos=100,0
velocity=0,0
removetime=-2
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=210
anim=33339
sprpriority=3
postype=p1
pos=115,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=225
anim=33339
sprpriority=10
postype=p1
pos=130,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=245
anim=33339
sprpriority=10
postype=p1
pos=150,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=260
anim=33339
sprpriority=10
postype=p1
pos=175,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=195
anim=33339
sprpriority=10
postype=p1
pos=195,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=215
anim=33339
sprpriority=10
postype=p1
pos=205,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=290
anim=33339
sprpriority=10
postype=p1
pos=-30,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=310
anim=33339
sprpriority=10
postype=p1
pos=15,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=225
anim=33339
sprpriority=10
postype=p1
pos=33,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=235
anim=33339
sprpriority=10
postype=p1
pos=45,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=242
anim=33339
sprpriority=10
postype=p1
pos=70,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=240
anim=33339
sprpriority=10
postype=p1
pos=89,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=255
anim=33339
sprpriority=10
postype=p1
pos=110,0
velocity=0,0
removetime=-2
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=285
anim=33339
sprpriority=3
postype=p1
pos=125,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=315
anim=33339
sprpriority=10
postype=p1
pos=140,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, EarthQuake]
type=Explod
trigger1=Time=335
anim=33339
sprpriority=10
postype=p1
pos=175,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 187, end]
type=changestate
trigger1=!animtime
value=0

;===============================================================================
;INTRO 3
;===============================================================================
[Statedef 181]
type=S
anim=181

[State 181, intro]
type=assertspecial
trigger1=1
flag=intro

[State 181, kanji]
type=explod
trigger1=!time&&!ishelper(1)
anim=6010
ID=6010
sprpriority=1
postype=p1
facing=ifelse(facing=1,1,-1)
pos=ifelse(facing=1,0,32)
bindtime=-1
removeongethit=1
ownpal=1

[State 181, snd]
type=playsnd
trigger1=time=15
value=4,3
channel=0
freqmul=ifelse(ishelper, 1.5, 1)

[State 181, end]
type=changestate
trigger1=!animtime
value=0

;===============================================================================
;WIN PRE INTRO
;===============================================================================
[Statedef 180]
type=S

[State 180, win]
type=changestate
trigger1=!time
trigger1=command="holdx"||command="holdy"||command="holdz"||command="holda"||command="holdb"||command="holdc"
value=ifelse((command="holdz"||command="holdc"),189,ifelse((command="holdy"||command="holdb"),185,186))

[State 180, win]
type=changestate
trigger1=!time
value=ifelse(random<333,185,ifelse(random<500,186,189))

;===============================================================================
;WIN 1
;===============================================================================
[Statedef 185]
type=S
anim=185

[State 185, snd]
type=playsnd
trigger1=animelem=4
value=4,ifelse(random<500,2,8)
channel=0
freqmul=ifelse(ishelper, 1.5, 1)

[State 185, kanji]
type=explod
trigger1=animelem=4&&!ishelper(1)
anim=6011
ID=6011
sprpriority=1
postype=p1
facing=ifelse(facing=1,1,-1)
pos=ifelse(facing=1,0,32)
bindtime=-1
removeongethit=1
ownpal=1

;===============================================================================
;WIN 2
;===============================================================================
[Statedef 186]
type=S
anim=188

[State 186, shake]
type=envshake
trigger1=animelem=15
time=25
freq=90
ampl=10

[State 187, EarthQuake]
type=Explod
trigger1=animelem=16
anim=7107
sprpriority=99
postype=p1
pos=0,0
velocity=0,0
removetime=-1
bindtime=-1
removeongethit=1

[State 186, snd]
type=playsnd
trigger1=animelem=3
value=3,5
channel=0
freqmul=ifelse(ishelper,1.5,1)
persistent=0

;===============================================================================
;WIN 3
;===============================================================================
[Statedef 189]
type=S
anim=189

[State 189, aura]
type=helper
trigger1=!animelemtime(5)&&!ishelper(1)
helpertype=normal
stateno=6000
ID=6000
postype=p1
ownpal=1
persistent=0
ignorehitpause=1

[State 189, metsu]
type=helper
trigger1=!animelemtime(5)&&!ishelper(1)
helpertype=normal
stateno=6002
ID=6002
postype=p1
pos=-5,-100
facing=ifelse(facing=1,1,-1)
ownpal=1
persistent=0
ignorehitpause=1

[State 189, snd]
type=playsnd
trigger1=!animelemtime(5)
value=5,4
ignorehitpause=1

[State 189, snd]
type=playsnd
trigger1=animelem=5
value=4,13
channel=0
freqmul=ifelse(ishelper,1.5,1)

[State 189, dust]
type=explod
trigger1=animelem=5
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-34,0
scale=.75,.75
ownpal=1

[State 189, shake]
type=envshake
trigger1=animelemtime(5)>=0&&!(time%12)
time=12
freq=60
ampl=4

[State 189, snd]
type=playsnd
trigger1=animelem=4
value=7,0
persistent=0

[State 189, snd]
type=playsnd
trigger1=animelem=5
value=5,12
loop=1
persistent=0

;===============================================================================
;CONTINUE?
;===============================================================================
[Statedef 5500]
type=S
anim=5500
ctrl=0
velset=0,0

[State 5500, anim]
type=changeanim
trigger1=!time
value=5500

;===============================================================================
;POWER CHARGE>
;===============================================================================
[Statedef 740]
type=S
physics=S
movetype=I
anim=740
ctrl=0
velset=0,0

[State 740, power]
type=poweradd
triggerall=anim=740&&power<powermax
trigger1=var(59)<=0&&(command="holdb"&&command="holdy")
trigger2=var(59)>=1
value=30

[State 740, snd]
type=playsnd
trigger1= !time
value=3,2
channel=0
freqmul=ifelse(ishelper,1.5,1)

[State 740, shake]
type=envshake
trigger1=anim=740&&!(time%4)
time=4
freq=80
ampl=2

[State 740, flash]
type=palfx
trigger1= anim=740&&!(time%12)
add=80,20,0
sinadd=80,20,0,12
time=12

[State 740, flash]
type=palfx
trigger1= anim=741
add=0,0,0
time=1
persistent=0

[State 740, fx]
type=helper
trigger1=anim=740&&!numhelper(7240)&&!ishelper(1)
helpertype=normal
stateno=7240
ID=7240
name="Power Charge"
postype=p1
ownpal=1
persistent=0

[State 740, anim]
type=changeanim
triggerall=anim=740
trigger1=var(59)<=0 &&(command!="holdb"||command!="holdy")
trigger2=roundstate!=2
trigger3=var(59)>=1&&(inguarddist||p2movetype=A||p2bodydist x<160)
value=741

[State 740, ctrl]
type=ctrlset
trigger1=anim=741
value=1

[State 740, stopsnd]
type=stopsnd
trigger1=anim=741
channel=0
freqmul=ifelse(ishelper,1.5,1)
persistent=0

[State 740, end]
type=changestate
trigger1=anim=741&&!animtime
value=0
ctrl=1

;===============================================================================
;PARRY>
;===============================================================================
[Statedef 700]
type=U
physics=N
movetype=I
anim=700
velset=0,0
ctrl=0
sprpriority=2
poweradd=78

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

[State 700, stop]
type=posfreeze
trigger1=1
value=1

[State 700, pause]
type=pause
trigger1=!time
time=15
movetime=15
endcmdbuftime=15
pausebg=0

[State 700, pause]
type=pause
trigger1=!time&&numenemy
trigger1=(enemynear,movehit=1)
time=ifelse((enemynear,hitpausetime=[0,15]),15-(enemynear,hitpausetime),0)
movetime=ifelse((enemynear,hitpausetime=[0,15]),15-(enemynear,hitpausetime),0)
endcmdbuftime=ifelse((enemynear,hitpausetime=[0,15]),15-(enemynear,hitpausetime),0)
pausebg=0

[State 700, blueflash]
type=palfx
trigger1=!time
add=0,50,255
sinadd=0,-50,-255,60
time=15

[State 700, snd]
type=playsnd
trigger1=!time
value=3,(random<500)
channel=0
freqmul=ifelse(ishelper,1.5,1)

[State 700, snd]
type=playsnd
trigger1=!time
value=7,3

[State 700, spark]
type=explod
trigger1=animelem=2
anim=7200
ID=7200
sprpriority=5
postype=p1
pos=36,-65
pausemovetime=60
ownpal=1
scale=.5,.5

[State 700, nowalk]
type=assertspecial
trigger1=1
flag=nowalk

[State 700, end]
type=changestate
trigger1=!animtime
value=ifelse(statetype=A,51,0)
ctrl=1

;===============================================================================
;STANDING>
;===============================================================================
[Statedef 0]
type=S
physics=S
movetype=I
velset=0,0
sprpriority=0

[State 0, gone]
type=removeexplod
trigger1=ishelper&&!ishelper(1)

[State 0, gone]
type=destroyself
trigger1=ishelper&&!ishelper(1)

[State 0, anim]
type=changeanim
trigger1=anim!=0&&anim!=5
trigger2=anim=5&&!animtime
value=0

[State 0, dead]
type=changestate
trigger1=!alive
value=5050

;===============================================================================
;JUMPING>
;===============================================================================
[Statedef 40]
type=S
physics=S
anim=40
ctrl=0
sprpriority=1
facep2=1

[State 40, var]
type=varset
trigger1=var(59)>=1
sysvar(1)=ifelse((enemynear,movetype!=A||backedgebodydist<=10),1,ifelse((enemynear,movetype=A),-1,0))

[State 40, var]
type=varset
trigger1= var(59)<=0
sysvar(1)=ifelse(!time,0,ifelse(command="holdfwd",1,ifelse(command="holdback",-1,sysvar(1))))

[State 40, var]
type=varset
trigger1=!time
var(3)=0

[State 40, var]
type=varset
trigger1=!time
trigger1=var(59)<=0&&command="superjump"
trigger2=prevstateno=240
var(3)=1

[State 40, vel]
type=velset
trigger1=!animtime
x=ifelse(!sysvar(1),const(velocity.jump.neu.x),ifelse(sysvar(1)=1,const(velocity.jump.fwd.x),const(velocity.jump.back.x)))
y= ifelse(var(3)=1,1.33,1)*const(velocity.jump.y)

[State 40, end]
type=changestate
trigger1=!animtime
value=50
ctrl=1

;==================
[Statedef 50]
type=A
physics=A
anim= ifelse(!(vel x),41,ifelse((vel x)>0,42,43))

[State 50, snd]
type=playsnd
trigger1= !time
value=0,40

;===================
[Statedef 51]
type=A
physics=A

[State 51, anim]
type=changeanim
trigger1=!time
value=51

[State 51, vel]
type=velmul
trigger1=1
x=.9

;====================
[Statedef 52]
type=S
physics=S
ctrl=0
anim=47
ctrl=1
velset=0,0

[State 52, pos]
type=posset
trigger1= 1
y=0

[State 52, anim48]
type=changeanim
trigger1=!time&&(prevstateno=222||prevstateno=1050||(prevstateno=[1200,1250])||(prevstateno=[1301,1310])||prevstateno=3050)
value=48

[State 52, anim283]
type=changeanim
trigger1=!time&&prevstateno=282
value=283

[State 52, anim1102]
type=changeanim
trigger1=!time&&((prevstateno=[1100,1110]) || prevstateno=3100)
value=1102

[State 52, anim1103]
type=changeanim
trigger1=!time&&prevstateno=4302
value=1103

[State 52, snd]
type=playsnd
trigger1=!time
value=0,52

[State 52, dust]
type=explod
trigger1=!time
anim=7102
ID=7102
sprpriority=-2
postype=p1
scale=.5,.5
ownpal=1

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

;===============================================================================
;RUN>
;===============================================================================
[Statedef 100]
type=S
physics=S
anim=100
ctrl=1
sprpriority=1

[State 100,as]
type=assertspecial
trigger1=1
flag=nowalk
flag2=noautoturn

[State 100, vel]
type=velSet
trigger1=anim=100
x=const(velocity.run.fwd.x)

[State 100, steps]
type=playsnd
trigger1= anim=100&&(animelem=3||animelem=6)
value=0,100

[State 100, change]
type=changeanim
triggerall=time>7&&anim=100
trigger1=var(59)<=0&&command!="holdfwd"
trigger2=var(59)>=1&&p2dist x<60
value=101
persistent=0

[State 100, snd]
type=playsnd
trigger1=anim=101
value=0,101
persistent=0

[State 100, end]
type=changestate
trigger1=anim=101&&!animtime
value=0
ctrl=1

;===============================================================================
;FORWARD DASH>
;===============================================================================
[Statedef 102]
type=S
movetype=I
physics=S
velset=0,0
anim=102
ctrl=0
sprpriority=1

[State 102, vel]
type=velset
trigger1=animelem=2
x=-1.2*const(velocity.run.back.x)
y=const(velocity.run.back.y)

[State 102, snd]
type=playsnd
trigger1=animelem=2
value=0,105

[State 102, dust]
type=explod
trigger1=animelem=2
anim=7103
ID=7103
sprpriority=3
postype=p1
vel=1,0
ownpal=1

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

[State 102, end]
type=changestate
triggerall=(animelemtime(2)>4)&&(animelemtime(3)<0)
trigger1=var(59)<=0&&command="holdfwd"
trigger2=var(59)>=1&&p2dist x>=60
value=100

;===============================================================================
;BACK DASH>
;===============================================================================
[Statedef 105]
type=S
movetype=I
physics=S
velset=0,0
anim=105
ctrl=0
sprpriority=1

[State 105, vel]
type=velset
trigger1=animelem=2
x=const(velocity.run.back.x)
y=const(velocity.run.back.y)

[State 105, snd]
type=playsnd
trigger1=animelem=2
value=0,105

[State 105, dust]
type=explod
trigger1=animelem=2
anim=7103
ID=7103
sprpriority=3
postype=p1
pos=-17,0
vel=-1,0
ownpal=1

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

;===============================================================================
;GUARD> START
;===============================================================================
[Statedef 120]
type=U
physics=U

[State 120, vel]
type=velset
trigger1=!time&&statetype!=A
x=0
y=0

[State 120, anim]
type=changeanim
trigger1=!time
value=120+(statetype=C)+(statetype=A)*2

[State 120, sts]
type=statetypeset
trigger1=!time&&statetype=S
physics=S

[State 120, sts]
type=statetypeset
trigger1=!time&&statetype=C
physics=C

[State 120, sts]
type=statetypeset
trigger1=!time&&statetype=A
physics=A

[State 120, Hi to Lo]
type=statetypeset
trigger1=var(59)<=0&&statetype=S&&command="holddown"
trigger2=var(59)>=1&&statetype=S&&(enemynear,movetype=A)&&(enemynear,statetype=C)
statetype=C
physics=C

[State 120, Lo to Hi]
type=statetypeset
trigger1=var(59)<=0 && statetype=C && command!="holddown"
trigger2=var(59)>=1 && statetype=C && (enemynear,movetype=A)&&(enemynear,statetype!=C)
statetype=S
physics=S

[State 120, end]
type=changestate
trigger1=!animtime||var(59)>=1
value=130+(statetype=C)+(statetype=A)*2

[State 120, stop]
type=changestate
trigger1=(var(59)<=0&&command!="holdback")
trigger2=!inguarddist
value=140

;===============================================================================
;STAND GUARD> guarding
;===============================================================================
[Statedef 130]
type=S
physics=S

[State 130, anim]
type=changeanim
trigger1=anim!=130
value=130

[State 130, Hi to Lo]
type=changestate
trigger1=var(59)<=0&&command="holddown"
trigger2=var(59)>=1&&(enemynear,movetype=A)&&(enemynear,statetype=C)
value=131

[State 130, Stop Guarding]
type=changestate
trigger1=(var(59)<=0&&command!="holdback")
trigger2=!inguarddist
value=140

;===============================================================================
;CROUCH GUARD> guarding
;===============================================================================
[Statedef 131]
type=C
physics=C

[State 131, anim]
type=changeanim
trigger1=anim!=131
value=131

[State 131, Lo to Hi]
type=changestate
trigger1=var(59)<=0&&command!="holddown"
trigger2=var(59)>=1&&(enemynear,movetype=A)&&(enemynear,statetype!=C)
value=130

[State 131, Stop Guarding]
type=changestate
trigger1=(var(59)<=0&&command!="holdback")
trigger2=!inguarddist
value=140

;===============================================================================
;AIR GUARD> guarding
;===============================================================================
[Statedef 132]
type=A
physics=N

[State 132, anim]
type=changeanim
trigger1=anim!=132
value=132

[State 132, grav]
type=veladd
trigger1=1
y=const(movement.yaccel)

[State 132, var]
type=varset
trigger1= 1
sysvar(0)=(pos y>=0)&&(vel y>0)

[State 132, vel]
type=velset
trigger1=sysvar(0)
y=0

[State 132, pos]
type=posset
trigger1=sysvar(0)
y=0

[State 132, end]
type=changestate
trigger1=sysvar(0)&&inguarddist
trigger1=(var(59)<=0&&command="holdback")||var(59)>=1
value=130

[State 132, end]
type=changestate
trigger1=sysvar(0)
value=52

[State 132, stop guarding]
type=changestate
trigger1=(var(59)<=0&&command!="holdback")
trigger2=!inguarddist
value=140

;===============================================================================
;GUARD> end
;===============================================================================
[Statedef 140]
type=U
physics=U
ctrl=1

[State 140, anim]
type=changeanim
trigger1= !time
value=140+(statetype=C)+(statetype=A)*2

[State 140, sts]
type=statetypeset
trigger1=!time&&statetype=S
physics=S

[State 140, sts]
type=statetypeset
trigger1=!time&&statetype=C
physics=C

[State 140, sts]
type=statetypeset
trigger1=!time&&statetype=A
physics=A

[State 140, Hi to Lo]
type=statetypeset
trigger1=var(59)<=0&&statetype=S&&command="holddown"
trigger2=var(59)>=1&&statetype=S&&(enemynear,movetype=A)&&(enemynear,statetype=C)
statetype=C
physics=C

[State 140, Lo to Hi]
type=statetypeset
trigger1=var(59)<=0&&statetype=C&&command!="holddown"
trigger2=var(59)>=1&&statetype=C&&(enemynear,movetype=A)&&(enemynear,statetype!=C)
statetype=S
physics=S

[State 140, 5]
type=changestate
trigger1= !animtime
value=(statetype=C)*11+(statetype=A)*51

;===============================================================================
;SGUARDHIT shaking
;===============================================================================
[Statedef 150]
type=S
movetype=H
physics=N
velset=0,0

[State Hadouken]
type=helper
triggerall=!time&&!ishelper(1)
triggerall=numenemy&&numhelper(1025)<5
trigger1=!(enemynear,hitdefattr=SCA,AA,AT)
trigger2= random<200
helpertype=normal
stateno=1025
ID=1025
name="Hadouken"
postype=p1
pos=-4,-78
ownpal=1
size.xscale=.5
size.yscale=.5

[State 150, anim]
type=changeanim
trigger1= 1
value=150

[State 150, end]
type=changestate
trigger1= hitshakeover
value=151+2*((var(59)<=0&&command="holddown")||(var(59)>=1&&(enemynear,movetype=A)&&(enemynear,statetype=C)))

[State 150, Hi to Lo]
type=statetypeset
trigger1=var(59)<=0&&statetype=S&&command="holddown"
trigger2=var(59)>=1&&statetype=S&&(enemynear,movetype=A)&&(enemynear,statetype=C)
statetype=C
physics=C

[State 150, Lo to Hi]
type=statetypeset
trigger1= var(59)<=0&&statetype=C&&command!="holddown"
trigger2= var(59)>=1&&statetype=C&&(enemynear,movetype=A)&&(enemynear,statetype!=C)
statetype=S
physics=S

;===============================================================================
;SGUARDHIT2> knocked back
;===============================================================================
[Statedef 151]
type=S
movetype=H
physics=S
anim=150

[State 151, vel]
type=hitvelset
trigger1=!time
x=1

[State 151, vel]
type=velset
trigger1=time=gethitvar(slidetime)
trigger2= hitover
x=0

[State 151, ctrl]
type=ctrlset
trigger1=time=gethitvar(ctrltime)
value=1

[State 151, Hi to Lo]
type=statetypeset
trigger1= var(59)<=0&&statetype=S&&command="holddown"
trigger2= var(59)>=1&&statetype=S&&(enemynear,movetype=A)&&(enemynear,statetype=C)
statetype=C
physics=C

[State 151, Lo to Hi]
type=statetypeset
trigger1=var(59)<=0&&statetype=C&&command!="holddown"
trigger2=var(59)>=1&&statetype=C&&(enemynear,movetype=A)&&(enemynear,statetype!=C)
statetype=S
physics=S

[State 151, end]
type=changestate
trigger1= hitover
value=130
ctrl=1

;===============================================================================
;CGUARDHIT> shaking
;===============================================================================
[Statedef 152]
type=C
movetype=H
physics=N
velset=0,0

[State Hadouken]
type=helper
triggerall= !time && !ishelper(1)
triggerall= numenemy && numhelper(1025)<5
trigger1= !(enemynear,hitdefattr=SCA,AA,AT)
trigger2= random<200
helpertype=normal
stateno=1025
ID=1025
name="Hadouken"
postype=p1
pos=-8,-46
ownpal=1
size.xscale=.5
size.yscale=.5

[State 152, anim]
type=changeanim
trigger1= 1
value=151

[State 152, end]
type=changestate
trigger1= hitshakeover
value=151+2*((var(59)<=0 && command="holddown") || (var(59)>=1 && (enemynear,movetype=A) && (enemynear,statetype=C)))

[State 152, Hi to Lo]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
trigger2= var(59)>=1 && statetype=S && (enemynear,movetype=A) && (enemynear,statetype=C)
statetype=C
physics=C

[State 152, Lo to Hi]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
trigger2= var(59)>=1 && statetype=C && (enemynear,movetype=A) && (enemynear,statetype!=C)
statetype=S
physics=S

;===============================================================================
;CGUARDHIT2 knocked back
;===============================================================================
[Statedef 153]
type=C
movetype=H
physics=C
anim=151

[State 153, vel]
type=hitvelset
trigger1= !time
x=1
[State 153, vel]
type=velset
trigger1= time=gethitvar(slidetime)
trigger2= hitover
x=0

[State 153, ctrl]
type=ctrlset
trigger1= time=gethitvar(ctrltime)
value=1

[State 153, Hi to Lo]
type=statetypeset
trigger1= var(59)<=0 && statetype=S && command="holddown"
trigger2= var(59)>=1 && statetype=S && (enemynear,movetype=A) && (enemynear,statetype=C)
statetype=C
physics=C

[State 153, Lo to Hi]
type=statetypeset
trigger1= var(59)<=0 && statetype=C && command!="holddown"
trigger2= var(59)>=1 && statetype=C && (enemynear,movetype=A) && (enemynear,statetype!=C)
statetype=S
physics=S
[State 153, end]
type=changestate
trigger1= hitover
value=131
ctrl=1

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

[State Hadouken]
type=helper
triggerall= !time && !ishelper(1)
triggerall= numenemy && numhelper(1025)<5
trigger1= !(enemynear,hitdefattr=SCA,AA,AT)
trigger2= random<200
helpertype=normal
stateno=1025
ID=1025
name="Hadouken"
postype=p1
pos=0,-86
ownpal=1
size.xscale=.5
size.yscale=.5

[State 154, anim]
type=changeanim
trigger1= 1
value=152
[State 154, end]
type=changestate
trigger1= hitshakeover
value=155


;---AGUARDHIT2 (knocked away)---
[Statedef 155]
type=A
movetype=H
physics=N
anim=152
[State 155, vel]
type=hitvelset
trigger1= !time
x=1
y=1
[State 155, vel]
type=veladd
trigger1= 1
y=const(movement.yaccel)
[State 155, ctrl]
type=ctrlset
trigger1= time=gethitvar(ctrltime)
value=1
[State 155, var]
type=varset
trigger1= 1
sysvar(0)=(pos y>=0) && (vel y>0)
[State 155, vel]
type=velset
trigger1= sysvar(0)
y=0
[State 155, pos]
type=posset
trigger1= sysvar(0)
y=0
[State 155, end]
type=changestate
trigger1= sysvar(0) && inguarddist
trigger1= (var(59)<=0 && command="holdback") || var(59)>=1
value=130
[State 155, end]
type=changestate
trigger1= sysvar(0)
value=52


;==========<TAUNT>==========
[Statedef 195]
type=S
movetype=A
physics=S
juggle=0
anim=195
velset=0,0
sprpriority=1
poweradd=500
ctrl=0

[State 195, hit]
type=hitdef
trigger1= animelem=5
attr=S,NA 
damage=35,7
animtype=Up
guardflag=MA 
hitflag=MAFD
priority=4,Hit 
pausetime=8,8
sparkno=0
guard.sparkno=40
sparkxy=-10,-34
hitsound=s2,3
guardsound=s2,0
ground.type=High
ground.slidetime=9
ground.hittime=12
ground.velocity=-4,-16
guard.velocity=-12
air.type=Low
air.velocity=-4,-16
getpower=0
givepower=0
envshake.time=9
envshake.freq=60
envshake.ampl=2
palfx.sinadd=64,64,64,4
palfx.mul=128,128,128
palfx.time=110
fall=1
airguard.ctrltime= 16
airguard.velocity= -8, -1.5

[State 195, flames]
type=helper
triggerall= movehit && numtarget && numhelper(7181)<1
trigger1= !(target,time) && (target,movetype=H)
helpertype=normal
stateno=7181
ID=7181
name="flames"
postype=p2
bindtime=1000
ownpal=1
facing=-1
size.ground.front=0
size.ground.back=0
ignorehitpause=1
persistent=0

[State 195, aura]
type=helper
trigger1= !animelemtime(5) && !ishelper(1)
helpertype=normal
stateno=6000
ID=6000
postype=p1
ownpal=1
persistent=0
ignorehitpause=1
[State 195, metsu]
type=helper
trigger1= !animelemtime(5) && !ishelper(1)
helpertype=normal
stateno=6002
ID=6002
postype=p1
pos=-5,-100
facing=ifelse(facing=1,1,-1)
ownpal=1
persistent=0
ignorehitpause=1

[State 195, snd]
type=playsnd
trigger1= !animelemtime(5)
value=4,10
channel=0
freqmul=ifelse(ishelper, 1.5, 1)
ignorehitpause=1
[State 195, snd]
type=playsnd
trigger1= animelem=5
value=5,4
ignorehitpause=1
[State 195, dust]
type=explod
trigger1= animelem=5
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=-34,0
scale=.75,.75
ownpal=1
ignorehitpause=1
[State 195, shake]
type=envshake
trigger1= animelem=5
time=18
freq=60
ampl=4
ignorehitpause=1

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

;==========<INITIALIZE>==========
;[Statedef 5900]
;type=S
;[State 5900, varreset]
;type=varrangeset
;trigger1= !roundsexisted
;value=0
;[State 5900, varreset]
;type=varrangeset
;trigger1= !roundsexisted
;fvalue=0
;[State 5900, end]
;type=changestate
;trigger1= !time
;value=ifelse(roundno=1,190,0)

[Statedef 5900]
type = S

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
farst = 2
last = 59
value = 0

[State 5900, 2] ;Clear all float variables
type = null;VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190

;182,181
;---Stuff---
[Statedef 6970]
type=A
physics=N
movetype=I
anim=6970
sprpriority=2
velset=ifelse((root,stateno=1900), 8, 0), ifelse((root,stateno=1900), 0, -8)
ctrl=0
[State 6970]
type=playsnd
trigger1=time=8
value=4,ifelse(random<500,3,15)
channel=0
freqmul=1.5
[State 6980]
type=angledraw
trigger1=time<9
scale=.1+(.1*time), .1+(.1*time)
[State 6980]
type=veladd
trigger1=1
y=.5
[State 6980, end]
type=changestate
trigger1=pos y>-vel y
value=52

[Statedef 6980]
type=A
physics=N
movetype=H
anim=6980
sprpriority=2
velset=0,0
ctrl=0
[State 6980]
type=nothitby
trigger1=1
value=SCA,AA,AP,AT
time=1
[State 6980]
type=playsnd
trigger1=!time
value=11,0
freqmul=1.5
[State 6980]
type=posadd
trigger1=!time
y=-30
[State 6980]
type=angledraw
trigger1=1
value=22*time
scale=1+(.125*time), 1+(.125*time)
[State 6980]
type=trans
trigger1=1
trans=addalpha
alpha= 256-(16*time), (16*time)
[State 6980, end]
type=destroyself
trigger1=time>=16


[Statedef 6990]
type=A
physics=N
movetype=I
anim=6990
sprpriority=-1
velset=0,-2
ctrl=0

[State 6990]
type=nothitby
trigger1=1
value=SCA,AA,AP,AT
time=1

[State 6990]
type=varset
trigger1=1
var(38)=1
[State 6990]
type=varset
trigger1=1
var(39)=500
ignorehitpause=1

[State 6990]
type=playsnd
trigger1=animelem=10
value=3,2
channel=0
[State 6990]
type=playsnd
trigger1=!time
value=7,1
[State 6990]
type=playsnd
trigger1=animelem=10
value=5,17
[State 6990]
type=bgpalfx
trigger1=random<50
time=10
add=128,128,128
sinadd=-128,-128,-128,40

[State 6990, end]
type=changestate
trigger1=time>=60
value=51
ctrl=1


[Statedef 6997]
type=U
physics=U
movetype=H
ctrl=0
[State 6997]
type=lifeset
trigger1=1
value=0
[State 6997, end]
type=selfstate
trigger1=1
value=5000


[Statedef 6998]
type=A
velset=0,0
anim=9741
sprpriority=5
[State 6998, snd]
type=playsnd
trigger1= !time
value=5,19
[State 6998]
type=explod
trigger1=!numexplod(6998)
anim=6998
ID=6998
ontop=1
postype=back
bindtime=-1
removetime=80
ownpal=1

[State 6998]
type=modifyexplod
trigger1=numexplod(6998) && time<20
ID=6998
postype=back
pos= -120+ceil(6*time), 240
[State 6998]
type=modifyexplod
trigger1=numexplod(6998) && (time=[20,60])
ID=6998
postype=back
pos= 0, 240
[State 6998]
type=modifyexplod
trigger1=numexplod(6998) && time>=60
ID=6998
postype=back
pos= -ceil(6*(time-60)), 240

[State 6998, end]
type=removeexplod
trigger1= time>=80
[State 6998, end]
type=destroyself
trigger1= time>=80


[Statedef 6999]
type=S
physics=N
movetype=I
anim=6999
sprpriority=-1
velset=0,0
ctrl=0
[State 6999]
type=nothitby
trigger1=1
value=SCA,AA,AP,AT
time=1
[State 6999]
type=posset
trigger1=!time
y=0

[State 6999, reversal]
type=reversaldef
trigger1=1
reversal.attr=SCA,AA,AP,AT
p2stateno=6997
pausetime=0,12
hitsound=-1
sparkno=41
sparkxy=0,0
numhits=999

[State 6999, end]
type=changestate
trigger1= roundstate!=2
value=0
ctrl=1

;==========<DEAD>==========
[Statedef 5150]
type=L
movetype=H
physics=N
sprpriority=-3

[State 5150]
type=changeanim
trigger1=anim!=5150
value=5150

[State 5150]
type=velmul
trigger1=1
x=.85
[State 5150]
type=velset
trigger1=abs(vel x)=(0,.05]
x = 0

[State 5150]
type=nothitby
trigger1=1
value=SCA
time=1


;==========<FALL RECOVERY>==========
[Statedef 5200]
type=A
movetype=H
physics=N
[State 5200, anim]
type=changeanim
trigger1= anim=5035 && !animtime
value=5050
[State 5200, vel]
type=veladd
trigger1= 1
y=gethitvar(yaccel)
[State 5200, end]
type=selfstate
trigger1= vel y>0 && pos y>=-10
value=5201

[Statedef 5201]
type=A
movetype=I
physics=N
anim=5200
velset=vel x-3
[State 5201, turn]
type=turn
trigger1= !time && vel x>0
[State 5201, pos]
type=posset
trigger1= pos y>=0
y=0
[State 5201, vel]
type=velset
trigger1= pos y>=0
y=0
[State 5201, vel]
type=veladd
trigger1= 1
x=-vel x/20
[State 5201, snd]
type=playsnd
trigger1= animelem=1
value=3,1
[State 5201, flash]
type=palfx
trigger1= !time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 5201, nhb]
type=nothitby
trigger1= animelemtime(5)<0
value=SCA
time=1
[State 5201, dust]
type=explod
trigger1= !time
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=0,-ceil(pos y)
ownpal=1
scale=.5,.5
[State 5201, end]
type=changestate
trigger1= !animtime
value=0
ctrl=1

[Statedef 5210]
type=A
movetype=I
physics=N
anim=5210
ctrl=0
[State 5210, snd]
type=playsnd
trigger1= !time
value=3,1
channel=0
freqmul=ifelse(ishelper, 1.5, 1)

[State 5210, flash]
type=palfx
trigger1= !time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 5210, turn]
type=turn
trigger1= !time && vel x>0
[State 5210, vel]
type=velset
trigger1= !time
x=ifelse(command="holdback",-4,ifelse(command="holdfwd",-1.33,-2.67))
y=-7.4
[State 5210, grav]
type=veladd
trigger1= 1
y=.5
[State 5210, nhb]
type=nothitby
trigger1= time<14
value=SCA
time=1
[State 5210, ctrl]
type=ctrlset
trigger1= time>=14
value=1
[State 5210, land]
type=changestate
trigger1= vel y>0 && pos y>=0
value=52


;==========<RECOVERY ROLL>==========
[Statedef 5220]
type=A
movetype=H
physics=N
[State 5220, anim]
type=changeanim
trigger1= anim=5035 && !animtime
value=5050
[State 5220, vel]
type=veladd
trigger1= 1
y=gethitvar(yaccel)
[State 5220, end]
type=selfstate
trigger1= vel y>0 && pos y>=-10
value=5221

[Statedef 5221]
type=C
movetype=I
physics=N
anim=5220
[State 5221, turn]
type=turn
trigger1= !time && p2dist x<0
[State 5221, pos]
type=posset
trigger1= 1
y=0
[State 5221, vel]
type=velset
trigger1= 1
x=5
y=0
[State 5221, push]
type=playerpush
trigger1= animelemtime(15)<0
value=0
[State 5221, flash]
type=palfx
trigger1= !time
add=0,50,255
sinadd=0,-50,-255,60
time=15
[State 5221, anim]
type=changeanim
triggerall= !animelemtime(8)
trigger1= var(59)<=0 && command!="holdfwd"
trigger2= var(59)>=1 && p2bodydist x=[-5,25]
value=5220
elem=12
[State 5221, sts]
type=statetypeset
trigger1= animelemtime(15)>=0
physics=S
[State 5221, dust]
type=explod
trigger1= animelemtime(13)<0 && !(time%5)
anim=6051
ID=6051
sprpriority=3
postype=p1
vel=-1,0
ownpal=1
[State 5221, dust]
type=explod
trigger1= animelem=15
anim=7104
ID=7104
sprpriority=-2
postype=p1
pos=25,0
vel=0,0
ownpal=1
scale=.5,.5
[State 5221, snd]
type=playsnd
trigger1= animelem=15
value=0,53
persistent=0

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

;===================================================================================== >
;Gouki
;===================================================================================== >
[Statedef 33336]
physics=N
anim=33337
velset=0,0
sprpriority=8

[State 33336, ScreenBound]
type=ScreenBound
trigger1=1
value=0

[State 33336,Trans]
type=Trans
trigger1=time>90&&time<460
trans=addalpha
alpha=270-ceil(Time*1.5),256

[State 33336, Velset]
type=VelSet
trigger1=Time>90&&Time<=140
x=-1.1

[State 33336, Velset]
type=VelSet
trigger1=Time=140
x=0

[State 33336]
type=DestroySelf
trigger1=Time=460||RoundState=2

;===================================================================================== >
;Shin Gouki
;===================================================================================== >
[Statedef 33337]
physics=N
anim=33336
velset=0,0
sprpriority=8

[State 33337, ScreenBound]
type=ScreenBound
trigger1=1
value=0

[State 33337, Trans]
type=Trans
trigger1=time>90&&time<460
trans=addalpha
alpha=400-ceil(Time*2.5),256

[State 33337, Velset]
type=VelSet
trigger1=Time>90&&Time<=140
x=1.4

[State33337, Velset]
type=VelSet
trigger1=Time=140
x=0

[State 33337]
type=DestroySelf
trigger1=Time=460||RoundState=2

;==============================================================================
[Statedef 10051]
type=S
movetype=A
physics=S
anim=1

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life>=200
trigger1=time=0
value=-35
absolute=1

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life<=200
trigger1=time=0
value=-3
absolute=1

[State -2]
type=poweradd
trigger1=var(29)<=1
trigger1=time=0
value=100

[State -2]
type=poweradd
trigger1=var(29)>=1
trigger1=time=0
value=300

[State 10051,HitVelSet]
type=HitVelSet
trigger1=Time=0
x = 0

[State 10051, Velset]
type=Velset
trigger1=Time=GetHitVar(slidetime)
trigger2=Time>=GetHitVar(hittime)
x=0

[State 10051, CtrlSet]
type=CtrlSet
trigger1=Time=GetHitVar(ctrltime)
value=1

[State 10051, ChangeState]
type=ChangeState
trigger1=Time>=2
value=0
ctrl=1

[State 10051, NotHitBy]
type=NotHitBy
trigger1=Time=0
value=SCA,NA,SA,NP,SP,NT,ST
Time=30

;=================
[Statedef 38853]
type=A
movetype=A
physics=N

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life>=200
trigger1=time=0
value=-35
absolute=1

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life<=200
trigger1=time=0
value=-3
absolute=1

[State -2]
type=poweradd
trigger1=var(29)<=1
trigger1=time=0
value=100

[State 5040, ChangeState]
type=ChangeState
trigger1=!Alive
value=5050

[State 5040, ChangeAnim]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim != 5040
trigger2 = Time = 0
trigger2 = Anim != 5035
value = 5040

[State 5040, CtrlSet]
type=CtrlSet
trigger1=HitOver
value=1

[State 5040, StateTypeSet]
type=StateTypeSet
trigger1=HitOver
movetype=I

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

[State 5040, ChangeState]
type=ChangeState
trigger1=Vel Y>0
trigger1=Pos Y>=0
value=52

;====================
[Statedef 38852]
type=A
movetype=A
physics=A

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life >=200
trigger1=time=0
value=-35
absolute=1

[State -2]
type=lifeadd
trigger1=var(29)<=1
trigger1=life<=200
trigger1=time=0
value=-3
absolute=1

[State 50, VarSet]
type=VarSet
trigger1=Time=0
sysvar(1)=0

[State 50, ChangeAnim]
type=ChangeAnim
trigger1=Time=0
value=ifelse((vel x)=0,41,ifelse((vel x)>0,42,43))

[State 50, ChangeAnim2]
type=ChangeAnim
trigger1=Vel y>-2
trigger1=SelfAnimExist(anim+3)
persistent=0
value=Anim+3

;===============================================================================
;===============================================================================
[Statedef -2]
;===============================================================================
[State -2, AI]
type=varset
trigger1= alive && ishometeam
trigger1= teamside=2 || matchno>1
var(59)=1

[State -2, Stop AI]
type=varset
trigger1= var(59)!=0
trigger1= roundstate!=2 || !alive
var(59)=0
ignorehitpause=1

;Parado
[State -2, Color Titilante]
type = PalFX
triggerall = anim = 0
triggerall = time >= 15
trigger1 = Time % 4 = 0
time = 1
color = 0
add = 220,0,100
ignorehitpause = 1

[State -2, Color Titilante2]
type = PalFX
triggerall = anim = 0
triggerall = time >= 15
trigger1 = Time % 6 = 0
time = 1
color = 0
add = 125,125,125
ignorehitpause = 1

;Hacia Adelante
[State -2, Color Titilante]
type = PalFX
triggerall = anim = 20
triggerall = time >= 15
trigger1 = Time % 4 = 0
time = 1
color = 0
add = 220,0,100
ignorehitpause = 1

[State -2, Color Titilante2]
type = PalFX
triggerall = anim = 21
triggerall = time >= 15
trigger1 = Time % 6 = 0
time = 1
color = 0
add = 125,125,125
ignorehitpause = 1

;Hacia Atras
[State -2, Color Titilante]
type = PalFX
triggerall = anim = 0
triggerall = time >= 15
trigger1 = Time % 4 = 0
time = 1
color = 0
add = 220,0,100
ignorehitpause = 1

[State -2, Color Titilante2]
type = PalFX
triggerall = anim = 0
triggerall = time >= 15
trigger1 = Time % 6 = 0
time = 1
color = 0
add = 125,125,125
ignorehitpause = 1

[State -2, hitby]
type=hitby
trigger1=1
value=SCA,AA,AP
time=-1
ignorehitpause=1

;[State -2, hitby]
;type=hitoverride
;trigger1=1
;attr=SCA,AA,AP,AT
;stateno=5000
;slot=1
;time=-1

;[State -2, eye for an eye]
;,type=nothitby
;triggerall= numenemy
;trigger1= enemy,name="F1" && enemy,authorname="Thomas Hsieh"
;trigger2= enemy,name="Neo-Sephiroth"
;value=SCA,AA,AP,AT
;time=1
;ignorehitpause=1

[State -2]
type=assertspecial
triggerall=0
trigger1= !var(38) && numenemy
trigger1= enemy,life
trigger2= !var(38) && numenemy && numpartner
trigger2= enemy,life && partner,life
flag=noko
ignorehitpause=1

[State -2]
type=assertspecial
trigger1= gethitvar(damage)>=var(39)
flag=noko
ignorehitpause=1

[State -2]
type=varadd
trigger1= !(gametime%10)
trigger1= alive && roundstate=2 && stateno!=6990
var(39)=1
ignorehitpause=1

[State -2]
type=poweradd
trigger1= alive && roundstate=2
value=2
ignorehitpause=1

[State -2]
type=varset
trigger1= roundstate<2
trigger2= roundstate!=2 && alive
trigger3= var(39)>lifemax
var(39)=lifemax
ignorehitpause=1

[State -2]
type=varset
trigger1= var(39)<life
var(39)=life
ignorehitpause=1

[State -2]
type=varset
trigger1= roundstate!=2 && !alive
trigger2= var(39)<0
var(39)=0
ignorehitpause=1

[State -2, damage]
type=varadd
trigger1=var(37)
var(39)=var(37)
ignorehitpause=1

[State -2, damage]
type=varset
trigger1=1
var(37)=0
ignorehitpause=1

[State -2, RESURRECTION!]
type=varset
trigger1=roundstate<2
var(38)=0
ignorehitpause=1

[State -2, RESURRECTION!]
type=changestate
trigger1= !var(38)
trigger1= gethitvar(damage)>=var(39)
trigger1= roundstate=2 && (stateno!=6990 || movetype=H)
value=6990
ignorehitpause=1

[State -2, attackvarbyhits]
type=varset
trigger1= numenemy
fvar(12)= ifelse(enemynear,gethitvar(hitcount)<3, 36, ifelse(enemynear,gethitvar(hitcount)>=34, 2, 36-enemynear,gethitvar(hitcount)))/36.0
ignorehitpause=1

[State -2, attackvarbyhitsreset]
type=varset
trigger1= numenemy
trigger1= (enemynear,movetype!=H)
fvar(12)=1
ignorehitpause=1

[State -2, dampener]
type=attackmulset
trigger1= 1
value=fvar(12)
ignorehitpause=1

[State -2, Juggle]
type=assertspecial
trigger1= 1
flag=nojugglecheck
ignorehitpause=1

[State -2, Awesome]
type=assertspecial
trigger1= random<100
flag= unguardable
ignorehitpause=1

[State -2, stopsnd]
type=stopsnd
trigger1= !time && prevstateno=187
channel=4

[State -2, Debug]
type=displaytoclipboard
trigger1= 1
text="Where the hell is mah debug flood?!!!"

;[State -2, damage]
;type=varadd
;trigger1= gethitvar(damage) && stateno!=700 && numenemy
;trigger1= enemy,name!="Psycho Shredder[S]"
;var(37)= ifelse(gethitvar(damage)>=250, -250, -gethitvar(damage)); / ifelse(gethitvar(hitcount)<=1, 1, gethitvar(hitcount))
;ignorehitpause=1

;[State -2, damage]
;type=varadd
;trigger1= gethitvar(damage) && stateno!=700 && numenemy
;trigger1= enemy,name="Psycho Shredder[S]"
;var(37)= -12 / ifelse(gethitvar(hitcount)<=1, 1, gethitvar(hitcount))
;ignorehitpause=1

;[State -2]
;type=lifeset
;trigger1=1
;value=var(39)
;ignorehitpause=1

;[State lol owned]
;type=targetlifeadd
;triggerall= numtarget && stateno!=4001
;trigger1= target,name="Broly 'le cauchemar' super saiyen nv3" && target,life<=500
;value=-9000
;kill=1
;absolute=1
;ignorehitpause=1

[State -2,Rayos]
type=helper
triggerall=alive=1
triggerall=statetype!=C
triggerall=MoveType!=H
triggerall=stateno!=2991
triggerall=stateno!=2992
triggerall=stateno!=2993
triggerall=stateno!=2994
triggerall=stateno!=2995
trigger1=!numhelper(77)
helpertype=normal
stateno=77
ID=77
name="Holiness"
postype=p1
pausemovetime=65535
supermovetime=65535
ownpal=1

[State -2]
type = lifeadd
triggerall=alive=1
trigger1=(GameTime%1) = 0
ignorehitpause=0
value=var(38)

[State -2]
type=varset
trigger1=life>=500
var(38)=1

[State -2]
type=varset
trigger1=life<=499
var(38)=2

[State -2]
type=varset
trigger1=life<=199
var(38)=3

;=================
[State -2]
type=HitOverride
triggerall=life!=0
triggerall=statetype!=A
triggerall=stateno!=7769
trigger1=1
time=1
attr=SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP
stateno=10051
ignorehitpause = 1

[State -2]
type=HitOverride
triggerall=life!=0
triggerall=var(29)<=1
triggerall=statetype=A
trigger1=1
time=1
attr=SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP
stateno=38853
ignorehitpause=1

[State -2]
type=HitOverride
triggerall=life!=0
triggerall=var(29)<=1
triggerall=stateno=40
trigger1=1
time=1
attr=SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP
stateno=38852
ignorehitpause=1

[State -2]
type=HitOverride
triggerall=life!=0
triggerall=var(29)>=1
triggerall=stateno=40
trigger1=1
time=1
attr=SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP
stateno=7765
ignorehitpause=1

[State -2]
type=HitOverride
triggerall=life!=0
triggerall=var(29)>=1
triggerall=statetype=A
trigger1=1
time=1
attr=SCA,NA,SA,HA,NT,ST,HT,NP,SP,HP
stateno=7765
ignorehitpause=1

[state -2]
type=varset
trigger1=palno=1
trigger2=palno=2
trigger3=palno=3
trigger4=palno=4
trigger5=palno=5
trigger6=palno=6
v=1
value=1

[state -2]
type=varset
trigger1=palno=7
trigger2=palno=8
trigger3=palno=9
trigger4=palno=10
trigger5=palno=11
trigger6=palno=12
v=1
value=1

[state -2]
type=varadd
trigger1=1
persistent=0
ignorehitpause=1
v=4
value=-1

[state -2]
type=pause
trigger1=var(4)>=1
trigger1=gametime%2
persistent=0
ignorehitpause=1
time=1

[State -2]
type=varadd
trigger1=1
v=15
value=-1

[state -2]
type=varset
trigger1=var(10)=0
trigger1=facing=1
v=10
value=1

[state -2]
type=varset
trigger1=var(10)=0
trigger1=facing=-1
v=10
value=2

[State -2]
type=varset
trigger1=var(29)>=1
var(39)=2

[State -2]
type=varset
trigger1=var(29)<=1
var(39)=1

[state -2]
type=varadd
trigger1=1
v=29
value=-1

[State -2]
Type=VarSet
trigger1=RoundState=2
var(35)=0
IgnoreHitPause=1

[State -2]
Type=VarSet
trigger1=RoundState=2
trigger1=Random<=300
var(35)=1
IgnoreHitPause=1

[State -2]
Type=VarSet
trigger1=RoundState=2
trigger1=Random<=300
var(35)=2
IgnoreHitPause=1

[State -2]
Type=VarSet
trigger1=RoundState=2
trigger1=Random<=300
var(35)=3
IgnoreHitPause=1

[State -2]
type=varset
trigger1=roundstate=0
var(21)=1

[State -2]
type=varset
trigger1=roundstate=0
var(22)=1

[State -2]
type=varset
trigger1=var(21)<=1
var(22)=3

[State -2]
type=varset
trigger1=var(21)>=150
var(22)=2

[State -2]
type=varadd
trigger1=1
trigger1=var(22)=3
var(21)=5

[State -2]
type=varadd
trigger1=1
trigger1=var(22) =2
var(21)=-5

;===============================================================================
[Statedef -3]
;===============================================================================
[State -3, Rayos]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%15)=1
anim=100128
id=100128
sprpriority=1
postype=p1
pos=0,-50
bindtime=-1
supermove=1
under=1
ownpal=1

[State -3, Aura]
type=Explod
triggerall=anim=0
triggerall=time>=5
trigger1=(GameTime%10)=1
anim=100122
sprpriority=-99
postype=p1
pos=-3,-20
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3, Brillo]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%5)=1
anim=100123
sprpriority=-99
postype=p1
pos=-3,-20
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3,Energya Piso Parado]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%10)=1
anim=100121
sprpriority=-99
postype=p1
pos=0,0
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3, Hits Stnding 0]
type=Projectile
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%2)=1
attr=S,SA
projanim=100124
projhitanim=-1
projid=100124
projpriority=999999999
projsprpriority=1
projremove=1
projremovetime=4
postype=p1
offset=0,0
velocity=0
animtype=Light
damage=15,10
getpower=0,0
givepower=0,0
hitflag=MAFD
pausetime=1
sparkno=-1
sparkxy=-1
hitsound=s5,30
guard.sparkno=-1
guardsound=-1
ground.type=low
ground.slidetime=5
ground.hittime=5
ground.velocity=1,-8
air.velocity=1,-7
fall=1
air.fall=1
P2Stateno=19000

;============================================
;Burbujas Izquierda
[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1 =(GameTime%40)=1
anim=100125
id=100125
sprpriority=99
postype=p1
pos=-10,0
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1 =(GameTime%46)=1
anim=100125
id=100125
sprpriority=99
postype=p1
pos=-10,0
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%49)=1
anim=100125
id=100125
sprpriority=99
postype=p1
pos=0,-20
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

;============================================
;Burbujas Medio
[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%20)=1
anim=100126
id=100126
sprpriority=99
postype=p1
pos=0,-75
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type = Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%35)=1
anim=100126
id=00126
sprpriority=99
postype=p1
pos=20,-40
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type = Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%30)=1
anim=100126
id=100126
sprpriority=99
postype=p1
pos=-20,-30
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

;============================================
;Burbujas Derecha
[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%46)=1
anim=100127
id=100127
sprpriority=99
postype=p1
pos=10,0
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type=Explod
triggerall=anim=0
triggerall=time>=15
trigger1=(GameTime%38)=1
anim=100127
id=100127
sprpriority=99
postype=p1
pos=10,0
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

[State -3]
type = Explod
triggerall=anim =0
triggerall=time>=15
trigger1=(GameTime%42)=1
anim=100127
id=100127
sprpriority=99
postype=p1
pos=0,-10
bindtime=-1
under=0
ownpal=1
persistent=0
ignorehitpause=0
SuperMoveTime=9999
PauseMoveTime=9999

;===============================================================================
[State -3]
type=Afterimage
trigger1=TIME=12
trans=add
PalContrast=220,0,100
PalBright=220,0,100
time=-1
length=10
TimeGap=1
FrameGap=2
PalMul=1,1,1

;============================================
[State -3]
type=varset
trigger1=stateno=10
trigger1=time=0
trigger2=stateno=100
v=15
value=20

[State -3]
type=varset
trigger1=stateno=52
trigger1=time=0
v=15
value=0

[State -3]
type=varset
trigger1=stateno=40
trigger1=command!="holdup"
v=16
value=1

[State -3]
type=varset
trigger1=stateno=40
trigger1=command="holdup"
v=16
value=0

[State -3]
type=velset
trigger1=stateno=50
trigger1=anim=42
trigger1=time=1
trigger1=var(15)>=1
x=5

[State -3]
type=velset
trigger1=stateno=50
trigger1=anim=43
trigger1=time=1
trigger1=var(15)>=1
x=-5

[State -3]
type=veladd
trigger1=stateno=50
trigger1=time=1
trigger1=var(16)=1
y=3

;===============================================================================
[State -3, AI Helper]
type=helper
trigger1= !var(59) && !numhelper(9741)
trigger1= alive && roundstate=2
helpertype=normal
name="Rare Akuma's AI"
ID=9741
pos=99999,99999
stateno=9741
keyctrl=1
pausemovetime=65535
supermovetime=65535
[State -3, Gametime Var]
type=varset
trigger1= 1
var(58)=gametime
ignorehitpause=1

[State -3, c-c-c-combo breaker]
type=changestate
value=1505
trigger1= movetype=H && alive
trigger1= !hitshakeover && time<=1
trigger1= gethitvar(hitcount)>1 && random<(50*gethitvar(hitcount))

[State -3, GetHit Snd]
type=playsnd
triggerall= alive && time=1
triggerall= stateno=5000 || stateno=5010
trigger1= gethitvar(animtype)>=2 && random<500
trigger2= gethitvar(animtype)=1 && random<375
trigger3= gethitvar(animtype)=0 && random<250
value=5000,1+(random%5)
channel=0
ignorehitpause=1

[State -3, GetHit Snd]
type=playsnd
triggerall= alive && time=1
trigger1= (stateno=5000 || stateno=5010) && numenemy
trigger1= gethitvar(fall) || (enemynear,hitdefattr=SCA,SA,HA)
trigger2= (stateno=5020 || stateno=5070 || stateno=5080)
trigger3= (stateno=5050 || stateno=5100) && (prevstateno!=[5000,5199])
value=5000,1+(random%5)
channel=0
ignorehitpause=1
