;---------------------------------------------------------------------------
; SGS Start
[Statedef 4800]
;type    = S
;movetype= A
;physics = S
;juggle  = 1
;velset = 0,0
;anim = 3080
;poweradd = 20
;ctrl = 0
;sprpriority = 2
type = S
movetype= A
physics = S
juggle  = 1
velset = 0,0
ctrl = 0
anim = 4100
;poweradd = 20
poweradd= -5000
sprpriority = 2

[State 2200, 膠着(画面固定)]
Type = Pause
Trigger1 = Time = 0
Anim = -1
Pos = 0,0
Time = 40
;MoveTime = 40

[State 90000, 一撃の背景]
Type = Helper
Trigger1 = Time = 0
Persistent = 0
Name = "Ichigeki"
StateNo = 90000
ID = 90000
Pos = 0,0
PosType = Back
KeyCtrl = 0
OwnPal = 1
Size.XScale = 0.5
Size.YScale = 0.5
HelperType = Normal
SuperMoveTime = 99999999
PauseMoveTime = 99999999
ReMoveOnGetHit = 1
IgNoreHitPause = 1

[State 4600, 音楽の再生]
Type = PlaySnd
Trigger1 = Time = 0
Volume = 255
Value = S9000,1
Loop = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = S4000,0

[State 3131, ChangeState]
type = ChangeState
trigger1 = animTime = 0
value = 4801 ;3045 ;3131
ctrl = 0

;---------------------------------------------------------------------------
; 999 Hits Shun Joey Satsu - Glide
[Statedef 4801]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0,0
anim = 4101 ;3131

;[State 13500, RemoveExplod]
;type = RemoveExplod
;trigger1 = WinKO
;;trigger2 = AnimTime = 0 ;elem = 158
;id = 3085

;[State 13500, 1]
;type = Explod
;trigger1 = Time = 1 ;70
;id = 3085 ;8507
;anim = 3085 ;8507
;pos = 0,0 ;0,0
;postype = back
;sprpriority = -3
;removeongethit = 1
;removetime = 450 ;550 ;250 ;105 ;520
;bindtime = -1
;supermove = 1
;ownpal = 1
;removeongethit = 1

;[State 13500, 2]
;type = AssertSpecial
;trigger1=numexplod(3085)
;flag = noBG
;flag2= globalnoshadow
;pausemove=99999
;supermove=99999
;ignorehitpause=1

[State 4001, AfterImage]
type = AfterImage
trigger1 = time = 0
time = -1
framegap = 6

[State 4001, AfterImage]
type = AfterImage
trigger1 = Time = 35
time = 0

[State 4001, VelSet]
type = VelSet
trigger1 = 1
x = 5

[State 4001, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 4001, AssertSpecial]
type = AssertSpecial
trigger1 = time > 0
flag = unguardable

[State 4001, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S4000,1

[State 4001, HitDef]
type = HitDef
trigger1 = time = 0
attr = S,HT
hitflag = MAF
guardflag = MA
p1stateno = 4802 ;3132
p2stateno = 4820 ;3047 ;3133
sparkno = s8006+random%3
guard.sparkno = s8011 ;-1
hitsound = S1, 1
guardsound = S6, 0
sparkxy = -5, -65
p2facing = 1
priority = 1,Miss
numhits = 0

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

;---PLAYER---
[Statedef 4802]
type=A
physics=N
movetype=A
anim=4802
ctrl=0
velset=0,0
sprpriority=1

[State 4002, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S4000,2

[State 4001, throw]
type=targetstate
trigger1= 1
value=4820

[State 4001, throw]
type=changestate
trigger1= !numtarget
value=51
ctrl=1

[State 4001]
type=assertspecial
trigger1= animelemtime(2)>=0
flag=timerfreeze
flag2=nomusic

[State 4001, loop]
type=changeanim
trigger1= hitcount<999
trigger1= animelemtime(37)>=0 && animelemtime(38)<0
value=4802 ;4001
elem=6+(random%30)

[State 4001, loop]
type=changeanim
triggerall= animelemtime(38)<0
trigger1= hitcount>=999
trigger2= numtarget
trigger2= target,ishelper && hitcount>=333
value=4802
elem=38 ;34

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

[State 4001, fadeout]
type=allpalfx
trigger1= animelemtime(5)=10
time=30
sinadd=-255,-255,-255,120

[State 4001, black]
type=envcolor
trigger1= animelemtime(6)>=0
time=4
value=0,0,0

[State 4001, assert]
type=assertspecial
trigger1= animelemtime(6)>=0
flag=nobardisplay

[State 4001, bind]
type=targetbind
trigger1= 1
pos=45,0

[State 4001, hitadd]
type=hitadd
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
value=10+(random%10)

[State 4001, hitdamage]
type=targetlifeadd
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
value= -9999
kill=0
absolute=1

[State 4001, hitsnd]
type=playsnd
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
value=S5,17+random%5 ;S5,5 ;1,4
channel=2
;freqmul= .75 + (random/2000.0)
volume=-128

[State 4001, sparks]
type=explod
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
anim= 8006+random%3 ;f(random%4)
ontop=1
postype=left
pos=160,120
random=240,160
facing=ifelse(random<500,-1,1)
vfacing=ifelse(random<500,-1,1)
ownpal=1
pausemovetime=-1
supermovetime=-1

[State 4001, sparks]
type=explod
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
anim= 8006+random%3 ;f(random%4)
ontop=1
postype=p1
pos=0,-64
random=80,80
facing=ifelse(random<500,-1,1)
vfacing=ifelse(random<500,-1,1)
ownpal=1
pausemovetime=-1
supermovetime=-1

[State 4001, shake]
type=envshake
trigger1= animelem=6 || animelem=7 || animelem=8 || animelem=9 || animelem=10 || animelem=11 || animelem=12 || animelem=13
trigger2= animelem=14 || animelem=15 || animelem=16 || animelem=17 || animelem=18 || animelem=19
trigger3= animelem=20 || animelem=21 || animelem=22 || animelem=23 || animelem=24 || animelem=25 || animelem=26 || animelem=27 || animelem=28 || animelem=29
trigger4= animelem=30 || animelem=31 || animelem=32 || animelem=33 || animelem=34 || animelem=35 || animelem=36 || animelem=37 || animelem=38
trigger5= animelemtime(6)>0
trigger5= command="x" || command="y" || command="y" || command="a" || command="b" || command="c" || command="s"
trigger6= animelemtime(6)>0
trigger6= command="fwd" || command="back" || command="up" || command="down"
time=2
freq=90
ampl=-3

[State 9800, 音楽の再生(ｵｰﾓｰｲｰｶﾞｰ)]
Type = PlaySnd
Trigger1 = Time = 0
Volume = 255
Value = S10000,0
Persistent = 0
IgNoreHitPause = 1
Loop = 1

[State 50000, 音楽無音効果]
Type = Helper
Trigger1 = Time = 0
Persistent = 0
Name = "No Music"
StateNo = 50000
ID = 50000
Pos = -400,0
PosType = Back
KeyCtrl = 0
OwnPal = 1
Color = 0
Size.XScale = 0.5
Size.YScale = 0.5
HelperType = Normal
SuperMoveTime = 99999999
PauseMoveTime = 99999999
ReMoveOnGetHit = 1
IgNoreHitPause = 1

[State 11000, 特殊効果(背景消去)]
Type = AssertSpecial
Trigger1 = 1
Trigger1 = !WinKO
Flag = NoBG
Flag2 = NoFG
Flag3 = NoShadow

[State 4001, vel]
type=velset
trigger1= animelemtime(6)>0
trigger1= !(gametime%20) && random<500
x=-20+(random/25.0)
y=-20+(random/25.0)
[State 4001, vel]
type=velmul
trigger1= vel x>0 && frontedgebodydist<=0
trigger2= vel x<0 && backedgebodydist<=0
x=-1
[State 4001, vel]
type=velmul
trigger1= vel y>0 && pos y>=0
trigger2= vel y<0 && screenpos y<=0
y=-1
[State 4001, vel]
type=posset
trigger1= animelemtime(6)>=0 && pos y>0
y=0

;[State 4001, interrupt]
;type=Null ;changestate
;trigger1= hitcount>=100
;trigger1= animelemtime(6)>0 && numtarget=1
;trigger1= target,name="Josh Geary AKA: Joey Slikk"
;value=4890

[State 4001, end]
type=changestate
trigger1= !animtime
value=4803

;---TARGET---
[Statedef 4820]
type=A
physics=N
movetype=H
velset=0,0
ctrl=0
[State 4002, anim]
type=changeanim2
trigger1= !time
value=4804 ;4103 ;4030
[State 4002, nhb]
type=nothitby
trigger1= 1
time=1
value=SCA
[State 4002, end]
type=selfstate
trigger1= time>=60
value=5030


;------------------------------------
[Statedef 4803]
type=A
physics=N
movetype=A
anim=4803 ;4103 ;4830
sprpriority=-1
velset=0,0
ctrl=0

[State 4030, throw]
type=targetstate
trigger1= !time
value=4833

[State 4030, pos]
type=posset
trigger1= !time
x=40*facing
y=0

[State 4030]
type=assertspecial
trigger1= 1
flag=nomusic
flag2=nobardisplay

[State 4030]
type=playsnd
trigger1= time=8
value=S4100,0 ;5,11

[State 4030]
type=playsnd
trigger1= numtarget
trigger1= target,stateno=4834
value=S4100,1 ;5,1
persistent=0

[State 100000, バサラケーオー]
Type = Helper
Trigger1 = WinKO
Persistent = 0
Name = "BASARA KO"
StateNo = 100000
ID = 100000
Pos = 0,0
PosType = Back
KeyCtrl = 0
OwnPal = 1
Color = 0
Size.XScale = 0.5
Size.YScale = 0.5
HelperType = Normal
SuperMoveTime = 99999999
PauseMoveTime = 99999999
ReMoveOnGetHit = 1
IgNoreHitPause = 1

[State 4030]
type=explod
trigger1= numtarget
trigger1= target,stateno=4834
pos= ceil(target,pos x)+160, ceil(target,screenpos y)-40
anim=7170
postype=left
sprpriority=3
facing=ifelse(random<500, -1, 1)
vfacing=ifelse(random<500, -1, 1)
pausemovetime=-1
supermovetime=-1
persistent=0

[State 4030, end]
type=changeanim
trigger1= numtarget
trigger1= target,stateno=4833
value=4803 ;4103 ;4030
elem=1

[State 12345, Special Win State]
type = Varset
;;trigger1 = Movehit
trigger1 = WinKO
;trigger1 = WinPerfect
V = 22 ;7
Value = 1
persistent = 0

[State 4030, win]
type=changestate
trigger1= !animtime
value=0
ctrl=1

;---Target---
[Statedef 4833]
type=A
physics=N
movetype=H
velset=0,0
ctrl=0
[State 4033, nhb]
type=nothitby
trigger1= 1
time=1
value=SCA

[State 4033, anim]
type=changeanim2
trigger1= 1
value=4833

[State 4033, pos]
type=posset
trigger1= !time
x=0
y=-1280

[State 4033, vel]
type=velset
trigger1= 1
x=0
y=20

[State 4033, end]
type=changestate
trigger1= pos y>-vel y
value=4834


;---Target hit ground---
[Statedef 4834]
type=A
physics=N
movetype=H
velset=0,0
ctrl=0
[State 4034, nhb]
type=nothitby
trigger1= 1
time=1
value=SCA

[State 4034, anim]
type=changeanim2
trigger1= 1
value=4834

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

[State 4034, damage]
type=lifeset
trigger1= 1
value=0

[State 4034, snd]
type=playsnd
trigger1= !time
value=f7,2

[State Invisible Flag]
type=varset
trigger1= 1
sysvar(3)=2423

[State 4034, end]
type=changestate
trigger1= time>=6
value=5150
