; _____________________________________
;| Shin Gouki by Phantom.of.the.Server |
; ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
;================================================================================================
;=======================================<COMMON STATES>==========================================
;================================================================================================

;==========<PARRY>==========
[Statedef 500]
type=U
physics=U
movetype=I
anim=500
velset=0,0
ctrl=0
sprpriority=2

[State 500, pause]
type=pause
trigger1=!time
time=8
movetime=8
[State 500, nhb]
type=nothitby
trigger1=anim=500&&animelemtime(3)<=5
trigger2=anim!=500&&animelemtime(2)<=5
time=1
value=SCA

[State 500, snd]
type=playsnd
trigger1=!time
value=3,1
channel=0
[State 500, snd]
type=playsnd
trigger1=!time
value=6,3

[State 500, shake]
type=envshake
trigger1=!time
time=8
frequency=60
ampl=3

[State 500, flash]
type=palfx
trigger1=!time
add=30,30,100
sinadd=30,30,100,8
time=8

[State 500, asserts]
type=assertspecial
trigger1=1
flag=nowalk
flag2=nostandguard
flag3=nocrouchguard

[State 500, ctrl]
type=ctrlset
trigger1=anim=500&&animelemtime(3)>5
trigger2=anim!=500&&animelemtime(2)>5
value=1
[State 500, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1


;===================<CUSTOM COMBO>================
[Statedef 550]
type=S
physics=S
movetype=I
anim=550
ctrl=0
velset=0,0

[State 550, snd]
type=playsnd
trigger1=!time
value=4,11
channel=0
volume=200
[State 550, superchargehelper]
type=helper
trigger1=!time
helpertype=normal
stateno=6110
ID=6110
postype=p1
pos=-5,-45
ownpal=1
persistent=0
supermovetime=9999
[State 550, superchargepause]
type=superpause
trigger1=!time
time=30
anim=-1
sound=s6,2
darken=0
movetime=30

[State 550, var]
type=varset
trigger1=time=30
var(20)=ifelse(power>=3000,500,floor(power/6))
[State 550, var]
type=varset
trigger1=time=30
var(21)=30

[State 550, image]
type=afterimage
trigger1=time=30
time=2
timegap=1
framegap=10
length=30
paladd=0,0,0
palmul=.9,.9,.9
palcontrast=60,120,180
palpostbright=0,0,0
trans=add1
persistent=0

[State 550, hitby]
type=hitby
trigger1=1
time=1
value=SCA,HA,HT,HP
ignorehitpause=1

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


;==========<STAND>==========
[Statedef 0]
type=S
physics=S
sprpriority=(prevstateno=500)
[State 0, anim]
type=changeanim
trigger1=anim!=0&&anim!=5
trigger2=anim=5&&!animtime
value=0
[State 0, stop]
type=posset
trigger1=1
y=0
[State 0, stop]
type=velset
trigger1=abs(vel x)<2
trigger2=time=4
x=0


;===================<JUMPING>================
[Statedef 40]
type=S
physics=S
anim=40
ctrl=0
sprpriority=1
[State 40, var]
type = VarSet
trigger1=!time
var(7)=1
[State 40, var]
type = VarSet
trigger1=!time&&command="superjump"
trigger2=!time&&var(59)&&random<300
var(7)=3
[State 40, var]
type = VarSet
trigger1=!time
sysvar(1)=0
[State 40, var]
type = VarSet
trigger1=command="holdfwd"
sysvar(1)=1
[State 40, var]
type = VarSet
trigger1=command="holdback"
sysvar(1)=-1
[State 40, dust]
type=explod
trigger1=time=1
anim=6022
ID=6022
sprpriority=3
postype=p1
pos=0,0
vel=ifelse(sysvar(1)=0,0,ifelse(sysvar(1)=1,.5,-.5)),ifelse(var(7)=3,-.75,-.5)
removetime=-2
ownpal=1
scale=ifelse(var(7)=3,.75,.66),ifelse(var(7)=3,.75,.66)
[State 40, vel]
type=velset
trigger1=!animtime&&var(7)=1
x=ifelse(sysvar(1)=0,const(velocity.jump.neu.x),ifelse(sysvar(1)=1,const(velocity.jump.fwd.x),const(velocity.jump.back.x)))
y=ifelse(var(1),1.1*const(velocity.jump.y),const(velocity.jump.y))
[State 40, vel]
type=velset
trigger1=!animtime&&var(7)=3
x=ifelse(sysvar(1)=0,const(velocity.jump.neu.x),ifelse(sysvar(1)=1,1.33*const(velocity.jump.fwd.x),1.33*const(velocity.jump.back.x)))
y=ifelse(var(1),1.22*const(velocity.jump.y),1.15*const(velocity.jump.y))
[State 40, vel]
type=velset
trigger1=!animtime&&prevstateno=100&&sysvar(1)=1
x=const(velocity.runjump.fwd.x)
[State 40, var]
type=varset
trigger1=!animtime&&prevstateno=100&&sysvar(1)=1
var(7)=3
[State 40, end]
type=changestate
trigger1=!animtime
value=50
ctrl=1
[Statedef 50]
type=A
physics=A
[State 50, snd]
type=playsnd
trigger1=!time
value=0,ifelse(var(7)=3,42,41)
[State 50, var]
type=varset
trigger1=var(7)!=3&&time<3&&vel y<0&&command!="holdup"
var(7)=2
persistent=0
[State 50, vel]
type=velmul
trigger1=var(7)=2
x=.9
y=.66
persistent=0
[State 50, anim]
type=changeanim
trigger1=var(7)!=2
value=ifelse(!(vel x), 41, ifelse((vel x)>0, 42, 43))
persistent=0
[State 50, anim]
type=changeanim
trigger1=var(7)=2
value=ifelse(!(vel x), 51, ifelse((vel x)>0, 52, 53))
elem=animelemno(0)
persistent=0
[State 50, particles]
type=explod
trigger1=var(7)=3&&vel y<-1&&!(time%3);;;time<10&&!(time%2)
anim=6032
ID=6032
sprpriority=3
postype=p1
pos=0,-20
random=50,40
vel=floor(vel x)/3,-floor(vel y)/3
accel=-floor(vel x)/30,floor(vel y)/15
removetime=-2
ownpal=1
scale=.75,.15

[Statedef 51]
type=A
physics=A
[State 51, null]
type=null
trigger1=1

[Statedef 52]
type=S
physics=S
ctrl=0
anim=ifelse(vel y>11,48,47)
[State 52, anim48]
type=changeanim
trigger1=!time&&(prevstateno=222||prevstateno=1200||(prevstateno=[1301,1310]))
value=48
[State 52, anim283]
type=changeanim
trigger1=!time&&prevstateno=282
value=283
[State 52, tkk]
type=assertspecial
trigger1=anim=283
flag=nowalk
[State 52, tkk]
type=ctrlset
trigger1=anim=283
value=1
[State 52, dust]
type=explod
trigger1=!time
anim=6020
ID=6020
sprpriority=-2
postype=p1
pos=2,0
vel=0,0
removetime=-2
ownpal=1
scale=ifelse(vel y>11,.66,.5),ifelse(vel y>11,.66,.5)
[State 52, stop]
type=velset
trigger1=1
y=0
[State 52, pos]
type=posset
trigger1=1
y=0
[State 52, snd]
type=playsnd
trigger1=time=1
value=0,52
[State 52, ctrl]
type=ctrlset
trigger1=animtime=1
value=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, width]
type=width
trigger1=1
value=8
[State 100,as]
type=assertspecial
trigger1=1
flag=nowalk
[State 100, as]
type=assertspecial
trigger1=1
flag=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,52
[State 100, change]
type=changeanim
trigger1=time>7&&anim=100&&command!="holdfwd"
value=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, dust]
type=explod
trigger1=animelem=2
anim=6021
ID=6021
sprpriority=3
postype=p1
vel=1,0
removetime=-2
ownpal=1
[State 102, snd]
type=playsnd
trigger1=!animelemtime(2)
value=0,41
[State 102, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1
[State 102, end]
type=changestate
trigger1=(command="holdfwd")&&(animelemtime(2)>4)&&(animelemtime(3)<0)
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, dust]
type=explod
trigger1=animelem=2
anim=6021
ID=6021
sprpriority=3
postype=p1
pos=-17,0
vel=-1,0
removetime=-2
ownpal=1
[State 105, snd]
type=playsnd
trigger1=!animelemtime(2)
value=0,41
[State 105, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1


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

[State 195, hit]
type=hitdef
trigger1=animelem=5
trigger1=var(11):=3&&var(12):=-10&&var(13):=-34
attr=S,NA                   
damage=ceil(5+random/200),0    
animtype=Back        
guardflag=MA           
hitflag=MA          
priority=1,Hit             
pausetime=9,9              
sparkno=-1  
guard.sparkno=-1        
hitsound=s2,3      
guardsound=s2,0
ground.type=High
ground.slidetime=9
ground.hittime=12
ground.velocity=-3,-4.5
air.type=Low
air.velocity=-3,-4
getpower=0
givepower=0
envshake.time=9
envshake.freq=60
envshake.ampl=2
palfx.color=32
palfx.sinadd=40,20,60,8
palfx.mul=384,128,512
palfx.time=32
fall=1

[State 195, flames]
type=helper
triggerall=movehit&&numtarget&&numhelper(6041)<1
trigger1=(target,time=0)&&(target,movetype=H)
helpertype=normal
stateno=6041
ID=6041
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)
helpertype=normal
stateno=6050
ID=6050
postype=p1
ownpal=1
persistent=0
ignorehitpause=1
[State 195, metsu]
type=helper
trigger1=!animelemtime(5)
helpertype=normal
stateno=6051
ID=6051
postype=p1
pos=-5,-95
ownpal=1
persistent=0
ignorehitpause=1
[State 195, snd]
type=playsnd
trigger1=!animelemtime(5)
value=5,4
ignorehitpause=1
[State 195, snd]
type=playsnd
trigger1=!animelemtime(5)
value=4,10
channel=0
ignorehitpause=1
[State 195, dust]
type=explod
trigger1=animelem=5
anim=6020
ID=6020
sprpriority=-2
postype=p1
pos=-42,0
vel=0,0
removetime=-2
ownpal=1
ignorehitpause=1
[State 195, shake]
type=envshake
trigger1=animelem=5
time=18
frequency=180
ampl=4
ignorehitpause=1
[State 195, end]
type=changestate
trigger1=!animtime
value=0
ctrl=1

;==========<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


;==========<DRAWGAME (Time over)>==========
[Statedef 175]
type=S
ctrl=0
velset=0,0
[State 175, switch]
type=changestate
trigger1=!time&&!selfanimexist(175)
value=170
[State 175, anim]
type=changeanim
trigger1=!time
value=175
[State 175, nhb]
type=nothitby
trigger1=1
value=SCA
time=1


;==========<PREINTRO>==========
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, var]
type=varrandom
trigger1=!time
v=0
range=1,1
[State 190, intro]
type=changestate
trigger1=!time
value=ifelse(var(0)=1,351,351)

;==========<INTRO 2>==========
[Statedef 351]
type=S
anim=351
[State 351, intro]
type=assertspecial
trigger1=1
flag=intro

[State 351, aura]
type=helper
trigger1=!animelemtime(7)
helpertype=normal
stateno=6050
ID=6050
postype=p1
ownpal=1
persistent=0
[State 351, metsu]
type=helper
trigger1=!animelemtime(7)
helpertype=normal
stateno=6051
ID=6051
postype=p1
pos=-5,-95
ownpal=1
persistent=0
[State 351, snd]
type=playsnd
trigger1=!animelemtime(7)
value=5,4
[State 351, dust]
type=explod
trigger1=animelem=7
anim=6020
ID=6020
sprpriority=-2
postype=p1
pos=-42,0
vel=0,0
removetime=-2
ownpal=1
[State 351, shake]
type=envshake
;trigger1=animelem=7
trigger1=animelemtime(7)>=0&&animelemtime(26)<0&&!(animelemtime(7)%12)
time=12
frequency=60
ampl=4
[State 351, end]
type=changestate
trigger1=!animtime
value=0


;==========<WIN POSE DECIDER>==========
[Statedef 180]
type=S
[State 180, winSGS]
type=changestate
trigger1=prevstateno=352
value=352
[State 180, var]
type=varrandom
trigger1=!time
v=0
range=1,1
[State 180, win1]
type=changestate
trigger1=time&&var(0)=1
value=0


;==========<WIN by S.G.S.>==========
[Statedef 352]
type=S
sprpriority=-4
anim=352

[State 352, kanji]
type=helper
trigger1=!time&&prevstateno=4001
helpertype=normal
stateno=6054
ID=6054
postype=p1
facing=ifelse(facing=1,1,-1)
pos=ifelse(facing=1,0,32)
ownpal=1
persistent=0

[State 352, kanjibg]
type=helper
trigger1=!time&&prevstateno=4001
helpertype=normal
stateno=6200
ID=6200
postype=left
ownpal=1
persistent=0

[State 352, snd]
type=playsnd
trigger1=time=10&&prevstateno=4001
value=4,12
channel=0

[State 352, win]
type=changestate
trigger1=prevstateno=4001&&time>150
value=180
ctrl=1


;==========<CONTINUE?>==========
[Statedef 5500]
type=S
ctrl=0
velset=0,0
[State 5500, anim]
type=changeanim
trigger1=!time
value=5500


;==========<INITIALIZE>==========
[Statedef 5900]
type=S

[State 5900, AI]
type=varset
trigger1=ishometeam&&teamside=2
var(59)=1

[State 5900, partner]
type=varset
trigger1=teammode=simul
trigger1=partner,name="Ryu"&&partner,authorname="Phantom.of.the.Server"
var(22)=1
[State 5900, partner]
type=varset
trigger1=teammode=simul
trigger1=partner,name="Pocket Shin Gouki"&&partner,authorname="Phantom.of.the.Server"
var(22)=2

[State 5900, end]
type=changestate
trigger1=!time
value=ifelse(roundno=1,190,0)


;==========<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=H
physics=N
anim=5200
velset=vel x-2

[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,3
[State 5201, flash]
type=palfx
trigger1=!time
add=20,50,75
sinadd=20,50,75,6
time=12

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

[State 5201, fx]
type=gamemakeanim
trigger1=!time
value=60
pos=0,-ceil(pos y)
under=1

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

[Statedef 5210]
type=A
movetype=I
physics=A
anim=5210
ctrl=0
[State 5210, snd]
type=playsnd
trigger1=animelem=1
value=3,3
channel=0
ignorehitpause=1
[State 5210, flash]
type=palfx
trigger1=!time
add=20,50,75
sinadd=20,50,75,6
time=12
[State 5210, turn]
type=turn
trigger1=!time&&p2dist x<-20
[State 5210, direction]
type=velset
trigger1=!time
x=ifelse(command="holdback",(.75*vel x),-2)
y=-7
[State 5210, nhb]
type=nothitby
trigger1=animelemtime(8)<0
value=SCA
time=1
[State 5210, ctrl]
type=ctrlset
trigger1=time=30
value=1


;===========================================================================
;===============================<-2 STATES>=================================
;===========================================================================
[Statedef -2]

[State -2, sparks]
type=helper
triggerall=movetype=A&&movecontact&&numtarget&&var(11)>0
trigger1=movehit&&(target,movetype=H)&&(target,time=0)
trigger2=moveguarded&&(target,movetype=H)&&(target,time=0)
trigger2=var(11):=1
helpertype=normal
stateno=6000
ID=6000
name="spark"
postype=p2
pos=(target,const(size.ground.front)+var(12)),var(13)-floor(p2dist y)
ownpal=1
facing=-1
ignorehitpause=1
persistent=0

[State -2, AIvar]
type=varset
trigger1=var(58)=1
;trigger2=var(59):=0
var(59)=1
[State -2, turnoffAI]
type=varset
trigger1=var(59)&&(roundstate!=2||!alive)
var(59)=0

[State -2, powerCC]
type=poweradd
trigger1=movetype=H&&var(20)>0
trigger1=var(20):=-1
value=-1500
ignorehitpause=1
[State -2, turnoffCC]
type=varset
trigger1=var(20)<=0||roundstate!=2
var(20)=0
ignorehitpause=1

[State -2, nodizzy >:)]
type=selfstate
trigger1=anim=5300
value=0
ctrl=1

[State -2, Debug]
type=displaytoclipboard
trigger1=1
text="AI=%d saasas=%d Helpers=%d Dampener=%f CC=%d"
params=var(59), var(58), numhelper, fvar(1), var(20)


;===========================================================================
;===============================<-3 STATES>=================================
;===========================================================================
[Statedef -3]

[State -3, AIactivation]
type=helper
trigger1=!var(59)&&!numhelper(9741)&&roundstate=2&&alive
helpertype=normal
name="Shin Gouki's AI"
ID=9741
pos=9999999,99999
stateno=9741
keyctrl=1
pausemovetime=999999999
supermovetime=999999999

[State -3, parryhelper]
type=helper
triggerall=!var(59)&&!numhelper(504)&&roundstate=2&&alive
trigger1=statetype!=A&&command="fwd"&&(ctrl||stateno=500||stateno=501)
trigger2=(statetype=S&&command="down")||(statetype=C&&command="fwd")&&(ctrl||stateno=500||stateno=501)
trigger3=statetype=A&&(command="down"||command="fwd")&&(ctrl||stateno=502)
helpertype=normal
name="Parry Helper"
stateno=504
ID=504
postype=p1
pausemovetime=999999999
supermovetime=999999999

[State -3, AIparryhelper]
type=helper
triggerall=var(59)&&random<200
trigger1=ctrl||stateno=500||stateno=501||stateno=502
helpertype=normal
name="Parry Helper"
stateno=504
ID=504
postype=p1
pausemovetime=999999999
supermovetime=999999999

[State -3, attackvar]
type=varadd
trigger1=movetype=A&&time=1&&fvar(1)<.6
fvar(1)=.075
persistent=0
ignorehitpause=1
[State -3, attackvar]
type=varset
trigger1=(enemynear,movetype!=H)&&fvar(1)
fvar(1)=0
persistent=0
ignorehitpause=1
[State -3, dampener]
type=attackmulset
trigger1=1
value=ifelse(fvar(1)>=.6,.5,1-fvar(1))
ignorehitpause=1

[State -3, varCC]
type=varadd
trigger1=var(20)>0
var(20)=-1
ignorehitpause=1
[State -3, powerCC]
type=poweradd
trigger1=var(20)>0
value=-6
ignorehitpause=1

[State -3, glowCC]
type=palfx
trigger1=var(20)>0&&!(gametime%18)
time=18
add=0,30,50
sinadd=0,30,50,18

[State -3, assertsCC]
type=assertspecial
trigger1=var(20)>0
flag=nojugglecheck
[State -3, assertsCC]
type=assertspecial
trigger1=var(20)>0
flag=nostandguard
flag2=nocrouchguard
flag3=noairguard

[State -3, varCCnhb]
type=varadd
trigger1=var(21)>0
var(21)=-1
ignorehitpause=1
[State -3, nhb]
type=nothitby
trigger1=var(21)>0
time=1
value=SCA

[State -3, moveshadow]
type=afterimage
triggerall=time=1&&!var(20)
trigger1=stateno=50&&var(7)=3
time=2
timegap=1
framegap=3
length=9
palbright=0,0,0
paladd=0,0,0
palmul=.9,.9,.9
palcontrast=120,120,120
palpostbright=0,0,0
trans=add1
persistent=0

[State -3, supershadow]
type=afterimage
trigger1=stateno=3000&&anim=3000&&!animelemtime(3)
trigger2=stateno=3050&&!animelemtime(2)
trigger3=stateno=3100&&anim=3100&&animelemtime(1)=2
trigger4=stateno=3200&&anim=3200&&!animelemtime(2)
trigger5=stateno=3250&&anim=3250&&!animelemtime(3)
trigger6=stateno=4000&&time=1
trigger7=stateno=4100&&anim=4101&&!animelemtime(1)
time=2
timegap=1
framegap=10
length=30
paladd=0,0,0
palmul=.9,.9,.9
palcontrast=120,120,120
palpostbright=0,0,0
trans=add1
persistent=0

[State -3, AfterImagePersist]
type=afterimagetime
trigger1=stateno=50&&var(7)=3&&vel y<-1
trigger2=(stateno=[3000,4999])&&anim!=1101&&anim!=1102&&anim!=3205
trigger3=stateno=1400
trigger4=var(20)
time=2

[State -3, HitSnd]
type=playsnd
triggerall=alive&&(time=1)&&(random<250)
trigger1=stateno=5000||stateno=5010||stateno=5020||stateno=5080
value=5000,ceil(random/200)
channel=0
ignorehitpause=1
persistent=0