;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
movetype = I
physics = N
sprpriority = 0

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 0]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim = 0 && AnimTime = 0
trigger2 = Anim != 0
value = 0

[State 0]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim = 200 && AnimTime = 0
trigger2 = Anim != 200
value = 200

[State 0]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 0]
type = ChangeAnim
trigger1 = palno = 12
value = 200

[State 0]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5150

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
movetype = I
physics = C

[State 10]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim != 0
value = 0

[State 10]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim != 200
value = 200

[State 10]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 10]
type = ChangeAnim
trigger1 = palno = 12
value = 200

[State 10]
type = VelSet
trigger1 = Time = 0

[State 10]
type = ChangeState
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
movetype = I
physics = C
sprpriority = 0

[State 11]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim != 0
value = 0

[State 11]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim != 200
value = 200

[State 11]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 11]
type = ChangeAnim
trigger1 = palno = 12
value = 200

[State 11];ｲﾗﾅｲ
type = null;ChangeAnim
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
movetype = I
physics = S

[State 12]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim != 0
value = 0

[State 12]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim != 200
value = 200

[State 12]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 12]
type = ChangeAnim
trigger1 = palno = 12
value = 200

[State 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
movetype = I
physics = S
sprpriority = 0

[State 20]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim = 0 && AnimTime = 0
trigger2 = Anim != 0
value = 0

[State 20]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim = 200 && AnimTime = 0
trigger2 = Anim != 200
value = 200

[State 20]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 20]
type = ChangeAnim
trigger1 = palno = 12
value = 200

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
movetype = I
physics = S
sprpriority = 1

[State 40]
type = ChangeAnim
triggerall = palno <= 6
trigger1 = Anim != 0
value = 0

[State 40]
type = ChangeAnim
triggerall = palno = [7,10]
trigger1 = Anim != 200
value = 200

[State 40]
type = ChangeAnim
trigger1 = palno = 11
value = 200

[State 40]
type = ChangeAnim
trigger1 = palno = 12
value = 200

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

;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U    ;Leave state type unchanged
movetype = I
physics = U ;Leave physics unchanged

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 120, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 120 + (statetype = C) + (statetype = A)*2

[State 120, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 120, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 120, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 120, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 130 + (statetype = C) + (statetype = A)*2

[State 120, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type    = S
movetype = I
physics = S

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 130, 1]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

[State 130, Hi to Lo]
type = ChangeState
trigger1 = command = "holddown"
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type    = C
movetype = I
physics = C

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 131, 1]
type = ChangeAnim
trigger1 = Anim != 131
value = 131

[State 131, Lo to Hi]
type = ChangeState
trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type    = A
movetype = I
physics = N

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 132, 1]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

[State 132, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

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

[State 132, 4]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, 5]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 132, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U    ;Leave state type unchanged
movetype = I
physics = U ;Leave physics unchanged
ctrl = 1

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2

[State 140, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

[State 140, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

;[State 140, 5] ;Implemented within engine
;type = ChangeState
;trigger1 = AnimTime = 0
;value = (statetype = C)*11 + (statetype = A)*51

;-------------------------------------------------------------------------------
;　　　　　　〃〃彡
;　　　　　ミ　　　　ミ
;　〜　 Ξ　ﾟдﾟ　　ﾐ
;　　　　彡　　　ﾟдﾟ　ﾐ　　引っ越してきました
;　　　Ξ　ﾟдﾟ　　　　　彡
;　　　　彡　　　　ﾟдﾟ　ミ
;　　　　　彡ノ〃〃ﾊヽﾐ
;-------------------------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
type    = S
movetype= I
physics = N
velset = 0,0

[State 0]
type = destroyself
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
;triggerall = !ishelper
trigger1 = root,name != "kedama"
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 150]
type = selfstate
triggerall = ishelper
trigger1 = !ishelper(1500);ビット
trigger1 = !ishelper(1501);制限
trigger1 = !ishelper(30000);重力
trigger1 = !ishelper(289289);過去の栄光
value = 0
ctrl = 1
ignorehitpause = 1

;===[ビットヘルパー補助]========================================================
[state 150]
type = ChangeAnim
triggerall = ishelper(1500)
trigger1 = anim != 1520
value = 1525
ignorehitpause = 1

[State 150]
type = SprPriority
triggerall = ishelper(1500)
trigger1 = 1
value = 3
ignorehitpause = 1

[State 150]
type = hitoverride
triggerall = ishelper(1500)
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = 150
ignorehitpause = 1

[State 150]
Type = StateTypeSet
triggerall = ishelper(1500)
trigger1 = 1
statetype = S
movetype= I
physics = N
ignorehitpause = 1

[State 150]
type = ReversalDef
triggerall = ishelper(1500)
trigger1 = 1
reversal.attr = SCA,AA
sparkno = -1
numhits = 0
p2stateno = 181818
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[state 150]
type = nothitby
value=SCA,AA,AT,AP
triggerall = ishelper(1500)
trigger1 = 1
time = -1
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 150]
type = hitoverride
triggerall = ishelper(1500)
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = 150
ignorehitpause = 1

[State 150]
type = varset
triggerall = ishelper(1500)
trigger1 = Time = 0
var(10) = 275
ignorehitpause = 1

[State 150]
type = varadd
triggerall = ishelper(1500)
trigger1 = time >0
var(10) = -1
ignorehitpause = 1

[State 150]
type = Turn
triggerall = ishelper(1500)
trigger1 = parent,facing != facing 
ignorehitpause = 1

[State 150]
type = VarSet
triggerall = ishelper(1500)
trigger1 = 1
fvar(1) = fvar(1)-10 * sin(time / 5.5 - 60)
ignorehitpause = 1

[State 150]
type = VarSet
triggerall = ishelper(1500)
trigger1 = 1
fvar(2) = fvar(2)-10 * cos(time / 5.5 - 60)
ignorehitpause = 1

[State 150]
type = PosAdd
triggerall = ishelper(1500)
trigger1 = 1
x = (parentdist x) - fvar(1) + 49
y = (parentdist y) - fvar(2) + 22
ignorehitpause = 1

[State -2]
type = screenbound
triggerall = ishelper(1500)
trigger1 = 1
value = 0
movecamera = 0,0

[State 150]
type = Projectile
;trigger1 = root,command = "x";テスト用
triggerall = root,palno = 8
triggerall = ishelper(1500)
trigger1=time%5=0
trigger1=time>=30
projID = gametime - var(10)
projanim = 1500
projhitanim = 1510
projremanim = 1510
projcancelanim = 1510
projscale = 1, 1
projremove = 1
projremovetime = -1
velocity = 5.5, 0
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 9999
projsprpriority = 5
projedgebound = 50
projstagebound = 50
projheightbound = -240, 1
offset = 0, -17
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,1
animtype = Heavy
guardflag = MA
hitflag = MAFD
priority = 7, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
hitsound = s500,3
guardsound = s500,4
ground.type = high
ground.slidetime = 2
ground.hittime  = 10
ground.velocity = -4,4
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
pausemovetime = 9999999
supermovetime = 9999999
ignorehitpause = 1
id = gametime - var(10)

[State 150]
type = Projectile
;trigger1 = root,command = "x";テスト用
triggerall = root,palno = 9
triggerall = ishelper(1500)
trigger1=time%6=0
trigger1=time>=25
projID = gametime - var(10)
projanim = 1500
projhitanim = 1510
projremanim = 1510
projcancelanim = 1510
projscale = 1, 1
projremove = 1
projremovetime = -1
velocity = 5.5, 0
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 9999
projsprpriority = 5
projedgebound = 50
projstagebound = 50
projheightbound = -240, 1
offset = 0, -17
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 11,2
animtype = Heavy
guardflag = MA
hitflag = MAFD
priority = 7, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
hitsound = s500,3
guardsound = s500,4
ground.type = high
ground.slidetime = 2
ground.hittime  = 10
ground.velocity = -4,4
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
pausemovetime = 9999999
supermovetime = 9999999
ignorehitpause = 1
id = gametime - var(10)

[State 150]
type = trans
triggerall = ishelper(1500)
trigger1 = var(10) <= 5
trans = addalpha
alpha = 255-(time*10), (time*10)
ignorehitpause = 1

[State 150]
type = destroyself
triggerall = ishelper(1500)
;triggerall = root,stateno != 1510
trigger1 = var(10) <= 0
trigger2 = roundstate != 2
trigger3 = parent,alive = 0
ignorehitpause = 1

[State 150]
type = null;ChangeState
value = 1520
triggerall = ishelper(1500)
trigger1 = var(10) <= 0
trigger2 = roundstate != 2
trigger3 = parent,alive = 0
ignorehitpause = 1
;=[ビットヘルパー制限]==========================================================
[state 150]
type = ChangeAnim
triggerall = ishelper(1501)
trigger1 = anim != 1520
value = 1520
ignorehitpause = 1

[State 150]
type = SprPriority
triggerall = ishelper(1501)
trigger1 = 1
value = 3
ignorehitpause = 1

[State 150]
type = hitoverride
triggerall = ishelper(1501)
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = 150
ignorehitpause = 1

[State 150]
Type = StateTypeSet
triggerall = ishelper(1501)
trigger1 = 1
statetype = S
movetype= I
physics = N
ignorehitpause = 1

[state 150]
type = nothitby
value=SCA,AA,AT,AP
triggerall = ishelper(1501)
trigger1 = 1
time = -1
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 150]
type = hitoverride
triggerall = ishelper(1501)
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = 150
ignorehitpause = 1

[State 150]
type = varset
triggerall = ishelper(1501)
trigger1 = Time = 0
var(11) = 300
ignorehitpause = 1

[State 150]
type = varadd
triggerall = ishelper(1501)
trigger1 = time >0
var(11) = -1
ignorehitpause = 1

[State 150]
type = Turn
triggerall = ishelper(1501)
trigger1 = parent,facing != facing 
ignorehitpause = 1

[State 150]
type = VarSet
triggerall = ishelper(1501)
trigger1 = 1
fvar(3) = fvar(3)-10 * sin(time / 5.5 - 60)
ignorehitpause = 1

[State 150]
type = VarSet
triggerall = ishelper(1501)
trigger1 = 1
fvar(4) = fvar(4)-10 * cos(time / 5.5 - 60)
ignorehitpause = 1

[State 150]
type = PosAdd
triggerall = ishelper(1501)
trigger1 = 1
x = (p2dist x) - fvar(3) + 49
y = (p2dist y) - fvar(4) -15
ignorehitpause = 1

[State -2]
type = screenbound
triggerall = ishelper(1501)
trigger1 = 1
value = 0
movecamera = 0,0

[State 150] 
type = PlaySnd
triggerall = ishelper(1501)
trigger1 = P2movetype = A
value = 20000,0

[State 150]
type = Explod
triggerall = ishelper(1501)
trigger1 = P2statetype = A
anim = 1610
ID = 1610
pos = 0, -16
postype = p1
facing = 1
vfacing = 1
bindtime = -1
vel = 0, 0
accel = 0, 0
random = 0, 0
removetime = -1
supermovetime = 9999999
pausemovetime = 9999999
scale = 1, 1
sprpriority = 2
ontop = 0
shadow = 0, 0, 0
ownpal = 1
removeongethit = 1

[State 150]
type = RemoveExplod
triggerall = ishelper(1501)
trigger1 = P2movetype != A
trigger2 = var(11) = 0
ID = 1610

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = 5, 0
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = -5, 0
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = 0, -5
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = 0, 5
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = 4.4, -4.4
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = 4.4, 4.4
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low 
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = -4.4, 4.4
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low 
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = Projectile
triggerall = ishelper(1501)
triggerall = P2movetype = A
trigger1 = time%5=0
projID = gametime - var(11)
projanim = 1600
;projhitanim = 2
;projremanim = 2
;projcancelanim = 2
projscale = 0.5, 0.5
projremove = 0
projremovetime = -1
velocity = -4.4, -4.4
remvelocity = 0, 0
accel = 0, 0
velmul = 1, 1
projhits = 1
projmisstime = 0
projpriority = 1
projsprpriority = 2
projedgebound = 50
projstagebound = 50
projheightbound = -240, 50
offset = 0, -16
postype = p1
projshadow = 0, 0, 0
supermovetime = 0
pausemovetime = 0
attr = S, SP
damage = 10,10
animtype = medium
guardflag = MA
hitflag = MAFD
priority = 5, Hit
pausetime = 0, 2
sparkno = -1
guard.sparkno = 40
sparkxy = -10, 0
ground.type = low
ground.slidetime = 2
ground.hittime  = 2
ground.velocity = -1,0
airguard.velocity = -1,-1
air.type = Low 
air.velocity = -1,-1
air.hittime = 3
id = gametime - var(11)

[State 150]
type = trans
triggerall = ishelper(1501)
trigger1 = var(11) <= 5
trans = addalpha
alpha = 255-(time*10), (time*10)
ignorehitpause = 1

[State 150]
type = destroyself
triggerall = ishelper(1501)
;triggerall = root,stateno != 1510
trigger1 = var(11) <= 0
trigger2 = roundstate != 2
trigger3 = parent,alive = 0
ignorehitpause = 

;=[重力ヘルパー]================================================================
[state 150]
type = ChangeAnim
triggerall = ishelper(30000)
trigger1 = anim != 30000
value = 30000
ignorehitpause = 1

[State 150]
type = SprPriority
triggerall = ishelper(30000)
trigger1 = 1
value = 0
ignorehitpause = 1

[State 150]
Type = StateTypeSet
triggerall = ishelper(30000)
trigger1 = 1
statetype = S
movetype= I
physics = N
ignorehitpause = 1

[State 150]
type = BindToParent
triggerall = ishelper(30000)
trigger1 = 1
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State 150]
type = VarSet
triggerall = ishelper(30000)
trigger1 = NumTarget >= 1
trigger1 = !enemy,NumHelper
v = 5
value = 1
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State -2]
type = screenbound
triggerall = ishelper(30000)
trigger1 = 1
value = 0
movecamera = 0,0

[State 150]
type = ReversalDef
triggerall = ishelper(30000)
trigger1 = var(5) = 0
reversal.attr = SCA,AA,AP,AT
sparkno = -1
numhits = 0
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State 150]
type = TargetLifeAdd
triggerall = ishelper(30000)
trigger1 = 1
trigger1=time%9=0
trigger1 = var(5) = 1
value = -ceil(enemy,lifemax*0.001)
absolute=1
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State 150]
type = TargetpowerAdd
triggerall = root,palno = 9
triggerall = ishelper(30000)
trigger1 = 1
trigger1=time%10=0
trigger1 = var(5) = 1
value = -ceil(enemy,powermax*0.005)
absolute=1
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State 150]
type = TargetLifeAdd
triggerall = ishelper(30000)
triggerall = !target,ishelper
triggerall = root,alive
trigger1 = RoundState = 3
trigger1 = var(5) = 1
value = -99999999999999999
absolute=1
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[State 150]
type = TargetDrop
triggerall = ishelper(30000)
trigger1 = !root,alive
ignorehitpause = 1
supermovetime = 99999999999
pausemovetime = 99999999999

[state 150]
type=destroyself
triggerall = ishelper(30000)
trigger1=!root,alive
supermovetime = 99999999999
pausemovetime = 99999999999

;===============================================================================

[State 150, 1]
type = ChangeAnim
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
triggerall = !ishelper
trigger1 = 1
value = 150

[State 150, 2]
type = ChangeState
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
triggerall = !ishelper
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 150, Hi to Lo]
type = StateTypeSet
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
triggerall = !ishelper
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
triggerall = !ishelper
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
;triggerall != ishelper(1500)
;triggerall != ishelper(1501)
;triggerall != ishelper(30000)
triggerall = !ishelper
trigger1 = time = 0
waveform = square
time = 3

;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type    = S
movetype= I
physics = S
anim = 150

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999
;-------------------------------------------------------------------------------

[State 151, 1]
type = HitVelSet
triggerall = !ishelper
trigger1 = Time = 0
x = 1

[State 151, 2]
type = VelSet
triggerall = !ishelper
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0


[State 151, 3]
type = CtrlSet
triggerall = !ishelper
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 151, Hi to Lo]
type = StateTypeSet
triggerall = !ishelper
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
triggerall = !ishelper
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 151, 4]
type = ChangeState
triggerall = !ishelper
trigger1 = HitOver
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type    = C
movetype= I
physics = N
velset = 0,0

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 152, 1]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 152, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 152, 4]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type    = C
movetype= I
physics = C
anim = 151

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 153, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 153, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

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

[State 153, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 153, 4]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1

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

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 154, 1]
type = ChangeAnim
trigger1 = 1
value = 152

[State 154, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 155 ;AGUARDHIT2

[State 154, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type    = A
movetype= I
physics = N
anim = 152

[State 0]
type = destroyself
trigger1 = root,name != "kedama"
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 155, 10000];selfstate
type = selfstate
triggerall = ishelper
trigger1 = !ishelper(10000);身代わり君
value = 0
ctrl = 1
ignorehitpause = 1

;---[身代わり君]----------------------------------------------------------------

[State 155]
Type = StateTypeSet
triggerall = ishelper(10000)
trigger1 = 1
statetype = S
movetype= I
physics = N
ignorehitpause = 1

[State 155]
type = AssertSpecial
triggerall = ishelper(10000)
trigger1 = 1
flag = Invisible
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[state 155];null
type = PlayerPush
triggerall = ishelper(10000)
trigger1 = 1
value = 1
ignorehitpause=1
supermovetime = 9999999999
pausemovetime = 9999999999

[State -2];カメラ
type = screenbound
triggerall = ishelper(10000)
trigger1 = 1
value = 1
movecamera = 1,0

[State 155]
type = BindToRoot
triggerall = ishelper(10000)
trigger1 = 1
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[state 155]
type = nothitby
triggerall = ishelper(10000)
triggerall = root,palno = [1,6]
trigger1 = gethitvar(damage) > 0
value = SCA
time = 20

[state 155]
type = nothitby
triggerall = ishelper(10000)
triggerall = root,palno = 7 || root,palno = 8
trigger1 = gethitvar(damage) > 0
value = SCA
time = 30

[state 155]
type = nothitby
triggerall = ishelper(10000)
triggerall = root,palno = 9
trigger1 = gethitvar(damage) > 0
value = SCA
time = 33

[State 155]
type = HitOverride
triggerall = ishelper(10000)
trigger1 = 1
time = -1
attr = SCA,AA,AT,AP
slot = 0
stateno = 155
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 155]
type = ChangeAnim
triggerall = ishelper(10000)
trigger1 = 1
value = parent,Anim
elem = parent,AnimElemNo(0)
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 155]
type = Turn
triggerall = ishelper(10000)
trigger1 = Facing != parent,Facing
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 155]
type = DestroySelf
triggerall = ishelper(10000)
trigger1 = roundstate != 2
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

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

[State 155, 1]
type = HitVelSet
triggerall = !ishelper
trigger1 = Time = 0
x = 1
y = 1

[State 155, 2]
type = VelAdd
triggerall = !ishelper
trigger1 = 1
y = Const(movement.yaccel)

[State 155, 3]
type = CtrlSet
triggerall = !ishelper
trigger1 = Time = GetHitVar(ctrltime)
value = 1

[State 155, 4]
type = VarSet
triggerall = !ishelper
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 155, 5]
type = VelSet
triggerall = !ishelper
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = PosSet
triggerall = !ishelper
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = ChangeState
triggerall = !ishelper
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 155, 7]
type = ChangeState
triggerall = !ishelper
trigger1 = sysvar(0)
value = 52

;---------------------------------------------------------------------------
; LOSE (Time over)
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

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

;---------------------------------------------------------------------------
; DRAWGAME (Time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 0]
type = destroyself
trigger1 = Ishelper
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State 175, 1] ; If no anim, use go to lose state.
type = ChangeState
trigger1 = Time = 0
trigger1 = !SelfAnimExist(175)
value = 170

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 175

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

;-[勝利ポーズ]------------------------------------------------------------------
[Statedef 180]
type = S

[State 180]
type = ChangeState
trigger1 = palno <= 6 && Time = 0 && RoundState != 0
value = 181

[State 180]
type = ChangeState
trigger1 = palno = 7 && Time = 0 && RoundState != 0
value = 182

[State 180]
type = ChangeState
triggerall = Roundno = 1
trigger1 = palno >= 8 && Time = 0 && RoundState != 0
value = 182

[State 180]
type = ChangeState
triggerall = Roundno >= 2
trigger1 = palno >= 8 && Time = 0 && RoundState != 0
value = 183

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

[Statedef 181]
type = S
anim = 180

[State 181];台詞
type = PlaySnd
trigger1 = time = 5
value = 190,0

[State 181]
type = AssertSpecial
trigger1 = time <= 180
flag = RoundNotOver
ignorehitpause = 1

;--------------------------------------------------------------------
[Statedef 182]
type = S
anim = 180

[State 182] 
type = changeanim
trigger1 = time = 0
value = 200

[State 182] 
type = changeanim
trigger1 = time = 120
value = 1520

[State 182]
type = AssertSpecial
trigger1 = time <= 300
flag = RoundNotOver
ignorehitpause = 1

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

[Statedef 183]
type = S
anim = 200

[State 182] 
type = changeanim
trigger1 = time = 41
value = 181

[State 182] 
type = changeanim
trigger1 = time = 120
value = 182

[State 182]
type = PlaySnd
trigger1 = time = 60
value = 190,4
freqmul = 1.2

[State 182];位置修正
type = PosSet
trigger1 = time = 39
y = 0
ignorehitpause = 1

[State 182]
type = PlaySnd
trigger1 = time = 40
value = 5900,0
ignorehitpause = 1

[State 182]
type = Explod
trigger1 = time = 40
anim = 5900
ID = 5900
pos = 0, 0
postype = p1
facing = 1
vfacing = 1
bindtime = -1
vel = 0, 0
accel = 0, 0
random = 0, 0
removetime = 23
supermovetime = 9999999
pausemovetime = 9999999
scale = 1.3, 1.3
sprpriority = 2
ontop = 0
shadow = 0, 0, 0
ownpal = 1
removeongethit = 1

[State 182]
type = AssertSpecial
trigger1 = time <= 300
flag = RoundNotOver
ignorehitpause = 1

;-------------------------------------------------------------------------------
[Statedef 191];イントロ
type = S
ctrl = 0

[State 191]
type = AssertSpecial
triggerall = palno > 6
trigger1 = Time = [0,200]
flag = Intro

[State 191];台詞
type = PlaySnd
trigger1 = time = 5
trigger1 = palno < 7
value = 190,0

[State 191];台詞
type = PlaySnd
trigger1 = time = 15
trigger1 = palno > 6
value = 190,1

[State 191]
type = ChangeState
triggerall = palno > 6
trigger1 = Time = 201
value = 0

[State 191]
type = ChangeAnim
triggerall = palno < 7
trigger1 = time = 5
value = 180

[State 191]
type = ChangeAnim
triggerall = palno < 7
trigger1 = time = 50
value = 0

[State 191]
type = ChangeState
triggerall = palno < 7
trigger1 = Time = 60
value = 0
;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
anim = 5000
velset = 0,0

[State 5000];赤
type = Palfx
trigger1 = Time = 0
add = 255,0,0
sinadd = 10,10,10
time = 3

[State 5000]
type = ChangeState
triggerall = time >= 1
trigger1 = hitshakeover = 1
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5001]
type    = S
movetype= H
physics = S

[State 5001, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HITC_SHAKE
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5010, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
triggerall = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;HITC_SLIDE

[State 5010, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5010, FFB Light]
type = ForceFeedback
trigger1 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5022
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITC_SLIDE
[Statedef 5011]
type    = C
movetype= H
physics = C

[State 5011, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1


;---------------------------------------------------------------------------
; HITA_SHAKE
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

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

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

[State 5030, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5050 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;HITA_UP (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

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

[State 5035, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5035, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_RECOV (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= H
physics = N

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

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

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

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

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

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

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
anim = 5150
physics = N

[State 5070, 1]
type = null
trigger1 = 1
value = 5070

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

[State 5070, 1]
type = ChangeAnim 
trigger1 = 1
value = 5070

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type    = A
movetype= H
physics = N

[State 5071, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5071, 2] ;Acceleration
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 15
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type    = L
movetype= H
physics = C

[State 5081, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 5110 ;HIT_LIEDOWN

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5100]
type    = L
movetype= H
physics = N

[State 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

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

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5100, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5100, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5100, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5100, 11]
type = PosFreeze
trigger1 = 1

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101

[State 5100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5101, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 5110

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
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, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[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 = ChangeState
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, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5120]
type    = L
movetype= I
physics = N

[State 1]
type = selfstate
triggerall = name = "kedama"
trigger1 = var(20)!=gametime + 12345
trigger2 = Life >= 100
value = (statetype=S)*151+(statetype=C)*153+(statetype=A)*155+(statetype=L)*151
ctrl = 1
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[State -2];こころないてんし
type = Lifeset
triggerall = roundstate = 2
trigger1 = life <= 10
value = 1
absolute = 1
ignorehitpause = 1
pausemovetime = 99999999
supermovetime = 99999999

[state -2];life10以下でピチューン
type = Selfstate
trigger1 = Life <= 10
ignorehitpause = 1
value = 5110
pausemovetime = 99999999
supermovetime = 99999999

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

[State 5120, 2]
type = VelSet
trigger1 = Time = 0
x = 0

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

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

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

;---------------------------------------------------------------------------
; HIT_LIEDEAD
;[Statedef 5150]
;type    = L
;movetype= H
;physics = N
;anim = 5150
;sprpriority = -3
;
;[State 5150, 8]
;type = velset
;trigger1 = 1
;x = 0
;y = 0
;
;[State 5150, 8]
;type = NotHitBy
;trigger1 = 1
;value = SCA
;time = 1
;
;[State 5150, 8]
;type = posfreeze
;trigger1 = 1
;value = 1
;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

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

[State 5200, 3]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 10
value = 5201

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (on the ground)
[Statedef 5201]
type    = A
movetype= H
physics = A
anim = 5200

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -.15
y = -3.5

[State 5201, 3]
type = PosSet
trigger1 = Time = 0
y = 0

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

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5201, 6]
type = GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5210, 1]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
y = -4.5

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

[State 5210, 2] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = 1.5

[State 5210, 2] ;Go fwd
type = VelMul
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = 1

[State 5210, 2] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = -1

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd;Gravity
trigger1 = Time >= 4
y = .35

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMP_LAND
ctrl = 1

;---------------------------------------------------------------------------
; Continue?
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, 1] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 0]
type = ChangeAnim
trigger1 = palno < 7
value = 0

[State 0]
type = ChangeAnim
trigger1 = palno > 6
value = 200

[State 5900]
type = Explod
triggerall = palno > 7
triggerall = roundno = 2
trigger1 = time = 61
anim = 5900
ID = 5900
pos = 0, 0
postype = p1
facing = 1
vfacing = 1
bindtime = -1
vel = 0, 0
accel = 0, 0
random = 0, 0
removetime = 23
supermovetime = 9999999
pausemovetime = 9999999
scale = 1.3, 1.3
sprpriority = 2
ontop = 0
shadow = 0, 0, 0
ownpal = 1
removeongethit = 1

[State 5900];スパーク
type = PlaySnd
triggerall = palno > 7
triggerall = roundno = 2
trigger1 = time = 60
value = 5900,0
ignorehitpause = 1

[State 5900];台詞
type = PlaySnd
triggerall = roundno = 2
triggerall = palno > 7
trigger1 = time = 5
value = 1500,2

[State 5900]
type = AssertSpecial
triggerall = palno > 7
triggerall = roundno = 2
trigger1 = time <= 150
flag = RoundNotOver
ignorehitpause = 1

[State 5900];Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0

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

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

