; 教材用カンフーマン（ちょっとこ丸版）のステートファイルです。
;---------------------------------------------------------------------------
; 単にわかりやすいように別ファイルに分けているだけです。
; ステート自体に種類別の概念（通常技や必殺技扱いなど）は存在しません。
;===========================================================================
;---------------------------------------------------------------------------
; ここは全部ヘルパー用に設定したステート。
;
; ヘルパー専用ステートにも、ヘルパー専用のコントローラやトリガーがある。
; それらも駆使して「Explodで表現出来ないエフェクト画像」など、
; 様々なオブジェクトを画面中に出す事も可能。
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;=====================================================================
;羽
[Statedef 9393]
type     = S
movetype = I
physics  = S
velset   = 0,0
ctrl     = 0
anim     = 20006
sprpriority = -3
facep2   = 1
xscale = 0.5
yscale = 0.5

[State ];カウンタア１Ｐ
type = Explod
trigger1 = EnemyNear,GethitVar(hitcount) = 1
trigger1 = EnemyNear,movetype = H
trigger1 = parent,var(15) = 1
trigger1 = parent,var(34) = 1
anim = 20041
ID = 2
movetime = -1
sprpriority = 5000
postype = left
pos = 10,50
bindtime = -1
scale =0.5,0.5
ignorehitpause = 1

[State ];カウンタア２Ｐ
type = Explod
trigger1 = EnemyNear,GethitVar(hitcount) = 1
trigger1 = EnemyNear,movetype = H
trigger1 = parent,var(15) = 1
trigger1 = parent,var(34) = 2
anim = 20042
ID = 2
movetime = -1
sprpriority = 5000
postype = right
pos = -10,50
bindtime = -1
scale =0.5,0.5
ignorehitpause = 1

[State , 音を鳴らす]
type = PlaySnd
trigger1 = EnemyNear,GethitVar(hitcount) = 1
trigger1 = EnemyNear,movetype = H
trigger1 = parent,var(15) = 1
value = 50008,0
ignorehitpause = 1

[State 0]
type = turn
trigger1 = P2dist X < 0
trigger1 = parent,movetype != A

[State 0]
type = posset
trigger1 = 1
x = (parent,pos x)-5
y = (parent,pos y)

[State 0]
type = RemoveExplod
trigger1 = P2dist X < 0
trigger1 = parent,movetype != A
ID = 20001

[State 0]
type = changeanim
trigger1 = parent,movetype != H
trigger1 = parent,statetype != L
trigger1 = (parent,statetype = S)||(parent,statetype = A)
trigger1 = anim != 20006
value = 20006
ignorehitpause = 1

[State 0]
type = changeanim
trigger1 = parent,movetype != H
trigger1 = parent,statetype != L
trigger1 = parent,statetype = C
trigger1 = anim != 20004
value = 20004
ignorehitpause = 1

[State 0]
type = changeanim
trigger1 = parent,movetype = H
trigger1 = (parent,statetype = S)||(parent,statetype = A)
trigger1 = parent,statetype != L
value = 20005
ignorehitpause = 1

[State 0]
type = changeanim
trigger1 = parent,statetype = L
value = 20044
ignorehitpause = 1

[State 0];煙
type = Explod
trigger1 = parent,anim = 0
trigger1 = parent,animelem = 10,>=0
anim = 7901
ID = 1
movetime = -1
sprpriority = -1
postype = p1
pos = 0,0
bindtime = 1
scale =0.5,0.5
persistent = 20


[State 0];煙
type = Explod
trigger1 = parent,anim = 0
trigger1 = parent,animelem = 10,>=0
anim = 7901
facing = -1
movetime = -1
sprpriority = -1
postype = p1
pos = 0,0
bindtime = 1
scale =0.5,0.5
persistent = 20

[State 191, エフェクト];後光
type = Explod
trigger1 = parent,anim = 0
anim = 20043
ID = 85
postype = p1
pos = -10,-110
scale = 0.5,0.5
sprpriority = -2
persistent = 20

;+++++++++++++++++++++++++++++++++++++
;後ろ向き勝利中
[State ]
type = changeanim
trigger1 = parent,stateno = 182
trigger1 = anim != 20012
value = 20012
ignorehitpause = 1

[State ]
type = Explod
trigger1 = parent,stateno = 182
anim = 20032
facing = -1
sprpriority = -1
postype = p1
pos = -30,-100
bindtime = 1
scale =0.5,0.5
persistent = 0
[State ]
type = Explod
trigger1 = parent,stateno = 182
anim = 20032
facing = -1
sprpriority = -1
postype = p1
pos = 30,-100
bindtime = 1
scale =0.5,0.5
persistent = 0
;+++++++++++++++++++++++++++++++++++++
[State 0]
type = RemoveExplod
trigger1 = parent,anim != 0
ID = 85
;++++++++++++++++++++++++++++++++++++++
;スフィア
[Statedef 9595]
type     = S
movetype = A
physics  = N
ctrl     = 0
anim     = 20007
sprpriority = 2
vel = 0,0
xscale = 0.5
yscale = 0.5

[State 3001, 音を鳴らす]
type = PlaySnd
trigger1 = time = 0
value = 0,14
channel = 2

[State 3001, 音を鳴らす:予備]
type = PlaySnd
trigger1 = 1
value = 0,14
channel = 2
lowpriority = 2
loop = 1

[State 0]
type = Explod
trigger1 =  1
anim = 20008
sprpriority = 2
postype = p1
pos = 0,0
bindtime = 1
scale =0.1,0.1
persistent = 2

[State 0]
type = turn
trigger1 = P2dist X < 0

[State 0]
type = veladd
trigger1 = P2dist X >= 0
trigger1 = vel x < 5
x = 0.1

[State 0]
type = veladd
trigger1 = P2dist X < 0
trigger1 = vel x > -5
x = -0.1

[State 0]
type = veladd
trigger1 = P2dist Y >= 60
trigger1 = vel y < 3
y = 0.1

[State 0]
type = veladd
trigger1 = P2dist Y < 60
trigger1 = vel y > -3
y = -0.1

[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) <= 2 
value = 1.0*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 3
value = 0.9*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 4
value = 0.8*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 5
value = 0.7*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 6
value = 0.6*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 7
value = 0.5*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 8
value = 0.4*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 9
value = 0.3*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 10
value = 0.2*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) >= 11
value = 0.1*((parent,var(11)>0)*1.2)

[State 200, 1];通常ヒット
type = HitDef
trigger1 = time = 0
trigger2 = (vel X = [0.5,0.55])
trigger3 = (vel X = [-0.55,-0.5])
attr = S, SP
damage = 30,0
getpower = 26,26
givepower = 13,13
animtype = midium;（light/midium/hard/back)
guardflag = MA
hitflag = MAF
misstime = 60
pausetime = 0,0
sparkno = s8010
sparkxy = 0, 0
hitsound = s2,0
guard.sparkno = s8400
guardsound = s3,0
ground.type = high
guard.hittime  = 15+((enemynear,statetype = A)*2)
ground.slidetime = 20+((enemynear,statetype = C)*2)+(var(15)*8)
ground.hittime  = 20+((enemynear,statetype = C)*2)+(var(15)*8)
ground.velocity = -2.8
air.type = high
airguard.velocity = -1.6,-1.5
air.velocity = -1.6,-5
air.fall = 1
envshake.time    = 5
envshake.ampl    = 2
envshake.freq    = 120
yaccel = 0.4
fall.recovertime = 20+(var(15)*15)
air.hittime = 20+(var(15)*15)

[State ];補正
type = ParentVarset
triggerall = (EnemyNear,GethitVar(hitcount) < 2)
trigger1 = movecontact
var(11) = 3
persistent = 0
ignorehitpause = 1

[State 3001, 音を鳴らす]
type = PlaySnd
trigger1 = time >= 500
trigger2 = parent,palno != 12
trigger2 = parent,movetype = H
trigger2 = (parent,stateno != [120,159])
value = 50003,4
channel = 2
volume = 200

[State ]
type = Explod
trigger1 =  time >= 500
trigger2 = parent,palno != 12
trigger2 = parent,movetype = H
trigger2 = (parent,stateno != [120,159])
anim = 8020
sprpriority = 2
postype = p1
pos = 0,0
bindtime = 1
scale =0.5,0.5
ID = 44193
ignorehitpause = 1

[State ]
type = destroyself
trigger1 = time > 500
trigger2 = parent,palno != 12
trigger2 = parent,movetype = H
trigger2 = (parent,stateno != [120,159])
trigger2 = parent,time >= 1
;+++++++++++++++++++++++++++++++++++++++++
;柱
[Statedef 9596]
type     = S
movetype = I
physics  = N
ctrl     = 0
anim     = 20010
sprpriority = 2
vel = 0,0

[State ]
type = Posset
trigger1 = ishelper(9596)
x = helper(9597),pos X
y = 0

[State ]
type = Posset
trigger1 = ishelper(9599)
x = helper(9600),pos X
y = 0

[State ]
type = HitOverride
trigger1 = 1
attr = SCA,NA,NT,NP,SA,ST,SP,HA,HT,HP
stateno = 9598
time = 1

[State ,無敵]
type = HitBy
trigger1 = parent,palno != 12
value = SCA,NA,SA,HA,NP,SP,HP
time = 100

[State ,無敵]
type = notHitBy
trigger1 = parent,palno = 12
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 100

[State ]
type = PlayerPush
trigger1 = 1
value = 1

[State 3001, 音を鳴らす]
type = PlaySnd
triggerall = (animelem = 12,>=0)
trigger1 = (P2bodydist x = [-50,10])&&(P2bodydist y > -120)
trigger1 = enemynear,movetype = H
trigger1 = enemynear,statetype != L
trigger1 = (enemynear,stateno != [120,159])
trigger1 = (enemynear,stateno != 3111)
trigger2 = (parent,stateno = 1001)
trigger2 = (parent,animelemtime(4) = 1)
value = 50003,1
volume = 250

[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) <= 2 
value = 1.0*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 3
value = 0.9*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 4
value = 0.8*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 5
value = 0.7*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 6
value = 0.6*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 7
value = 0.5*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 8
value = 0.4*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 9
value = 0.3*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 10
value = 0.2*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) >= 11
value = 0.1*((parent,var(11)>0)*1.2)

[State 0,]
type = Projectile
triggerall = (animelem = 12,>=0)
trigger1 = (P2bodydist x = [-50,10])&&(P2bodydist y > -120)
trigger1 = enemynear,movetype = H
trigger1 = enemynear,statetype != L
trigger1 = (enemynear,stateno != [120,159])
trigger1 = (enemynear,stateno != 3111)
trigger2 = (parent,stateno = 1001)
trigger2 = (parent,animelemtime(4) = 1)
ProjAnim = 20013
Projscale = 1,1
projsprpriority = 3
projhitanim = -1
projID = 8765
Projremove = 0
Projremovetime = 28
Projpriority = 3
Projemisstime = 500
Offset = 0,0
hitflag = MAFDP
attr = S, SP
damage = 80,16
guard.dist = 50 
animtype = Hard
getpower = 74,74
givepower = 37,37
guardflag = MA
pausetime = 0,0
sparkno = s8000
sparkxy = 0+(floor(p2bodydist X)),0+(floor(p2bodydist Y))
guard.sparkno = s8400
hitsound = s2231,0
guardsound = s122,0
fall = 1
fall.recover = 0
ground.type = High
guard.slidetime = 40+((enemynear,statetype = A)*2)
ground.slidetime = 65+((enemynear,statetype = C)*2)
ground.hittime = 65+((enemynear,statetype = C)*2)
ground.velocity = 0,-12
guard.velocity = 0
airguard.velocity = -0.5,-1.5
air.type = Low
air.velocity = 0,-8.6
yaccel       = 0.45
palfx.time =43
palfx.mul = 20,150,130
palfx.sinadd = 255,255,255,5
palfx.add = 16,16,16
palfx.color = 1
palfx.invertall = 1

[State 200];補正
type = ParentVarset
triggerall = (EnemyNear,GethitVar(hitcount) < 2)
trigger1 = ProjContactTime(8765) = 1
var(11) = 3
persistent = 0
ignorehitpause = 1

[State ]
type = changestate
triggerall = (animelem = 12,>=0)
trigger1 = (P2bodydist x = [-50,10])&&(P2bodydist y > -120)
trigger1 = enemynear,movetype = H
trigger1 = enemynear,statetype != L
trigger1 = (enemynear,stateno != [120,159])
trigger1 = (enemynear,stateno != 3111)
trigger2 = (parent,stateno = 1001)
trigger2 = (parent,animelemtime(4) = 1)
value = 9598
;+++++++++++++++++++++++++++++++++++++++++
;柱消える
[Statedef 9598]
type     = S
movetype = I
physics  = N
ctrl     = 0
anim     = 20011
sprpriority = 4
vel = 0,0

[State ]
type = destroyself
trigger1 = animtime = 0
;+++++++++++++++++++++++++++++++++++++++++++++
;透明
[Statedef 9597]
type     = S
movetype = I
physics  = N
ctrl     = 0
anim     = 20012
sprpriority = 0
vel = 0,0
xscale = 0
yscale = 0

[State ,]
type = turn
trigger1 = 1
value = SCA,NA,NT,NP
time = 1

[State ,無敵]
type = NotHitBy
trigger1 = 1
value = SCA,NA,NT,NP
time = 1

[State ]
type = destroyself
trigger1 = ishelper(9597)
trigger1 = numhelper(9596) < 1
trigger2 = ishelper(9600)
trigger2 = numhelper(9599) < 1

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;ライトニング
[Statedef 9601]
type     = S
movetype = A
physics  = N
ctrl     = 0
anim     = 20014
sprpriority = 2
xscale = 0
yscale = 0

[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) <= 2 
value = 1.0*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 3
value = 0.9*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 4
value = 0.8*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 5
value = 0.7*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 6
value = 0.6*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 7
value = 0.5*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 8
value = 0.4*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 9
value = 0.3*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 10
value = 0.2*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) >= 11
value = 0.1*((parent,var(11)>0)*1.2)

[State 0]
type = velset
trigger1 = time < 40
x = 1

[State 0]
type = velset
trigger1 = time > 40
x = 5

[State ]
type = Explod
trigger1 =  animelem = 1
anim = 20023
sprpriority = 1
postype = p1
pos = 0,0
bindtime = -1
scale =0.5,0.5

[State 200, 1];通常ヒット
type = HitDef
trigger1 = 1
attr = S, SP
damage = 50,10
getpower = 0,0
givepower = 0,0
animtype = hard;（light/midium/hard/back)
guardflag = MA
hitflag = MAFD
misstime = 10
pausetime = 0,10
sparkno = s8010
sparkxy = 0, 0
hitsound = s2,0
guard.sparkno = s8400
guardsound = s3,0
ground.type = high
guard.slidetime = 15+((enemynear,statetype = A)*2)
ground.slidetime = 20+((enemynear,statetype = C)*2)+(var(15)*8)
ground.hittime = 20+((enemynear,statetype = C)*2)+(var(15)*8)
ground.velocity = -2.8
air.type = high
airguard.velocity = -1.6,-1.5
air.velocity = -1.6,-5
air.fall = 1
envshake.time    = 5
envshake.ampl    = 2
envshake.freq    = 120
yaccel = 0.4
fall.recovertime = 45+(var(15)*20)
air.hittime = 45+(var(15)*20)
palfx.time =43
palfx.mul = 200,180,100
palfx.sinadd = 255,255,255,5
palfx.add = 16,16,16
palfx.color = 1
palfx.invertall = 1
persistent = 8

[State 200];補正
type = ParentVarset
triggerall = (EnemyNear,GethitVar(hitcount) < 2)
trigger1 = movecontact
var(11) = 2
persistent = 0
ignorehitpause = 1

[State ]
type = destroyself
trigger1 = time > 500
trigger2 = frontedgedist < -150
;=====================================================================


;+++++++++++++++++++++++++++++++++++++++++
;ビーム火柱
[Statedef 9650]
type     = S
movetype = I
physics  = N
ctrl     = 0
anim     = 20012
sprpriority = 0
vel = 0,0

[State ]
type = velset
trigger1 = 1
x = 3
y = 10

[State ]
type = changestate
trigger1 = pos y >= 0
value = 9651

;+++++++++++++++++++++++++++++++
;ビーム火柱2
[Statedef 9651]
type     = S
movetype = I
physics  = N
ctrl     = 0
anim     = 20012
sprpriority = 0
vel = 0,0

[State 3001, 音を鳴らす]
type = PlaySnd
trigger1 = 1
value = 50003,2
persistent = 5

[State ]
type = Posset
trigger1 = 1
y = 0

[State ]
type = velset
trigger1 = 1
x = 10
y = 0

[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) <= 2 
value = 1.0*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 3
value = 0.9*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 4
value = 0.8*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 5
value = 0.7*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 6
value = 0.6*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 7
value = 0.5*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 8
value = 0.4*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 9
value = 0.3*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) = 10
value = 0.2*((parent,var(11)>0)*1.2)
[State -3,]
type = AttackMulSet
trigger1 = (parent,Var(10)+parent,var(11)) >= 11
value = 0.1*((parent,var(11)>0)*1.2)

[State 0,]
type = Projectile
trigger1 = 1
ProjAnim = 20022
Projscale = 1,1
projsprpriority = 3
projhitanim = -1
projID = 9988
Projremove = 0
Projremovetime = 24
Projpriority = 3
Projemisstime = 500
Offset = 0,0
hitflag = MAFDP
attr = S, SA
damage = 30,6
guard.dist = 50 
animtype = Hard
getpower = 29,29
givepower = 14,14
guardflag = HA
pausetime = 0,0
sparkno = s8000
sparkxy = 0+(floor(p2bodydist X)),0+(floor(p2bodydist Y))
guard.sparkno = s8400
hitsound = s2231,0
guardsound = s122,0
ground.type = High
guard.slidetime = 40+((enemynear,statetype = A)*2)
ground.slidetime = 45+((enemynear,statetype = C)*2)+(var(15)*8)
ground.hittime = 45+((enemynear,statetype = C)*2)+(var(15)*8)
ground.velocity = -10,0
guard.velocity = -10
airguard.velocity = -8,-1.5
air.type = Low
air.velocity = -10,-2
yaccel       = 0.4
palfx.time =43
palfx.mul = 200,100,100
palfx.sinadd = 255,255,255,5
palfx.add = 16,16,16
palfx.color = 1
palfx.invertall = 1
persistent = 5

[State 200];補正
type = ParentVarset
triggerall = (EnemyNear,GethitVar(hitcount) < 2)
trigger1 = ProjContactTime(9988) = 1
var(11) = 1
persistent = 0
ignorehitpause = 1

[State ]
type = destroyself
trigger1 = time > 60