
;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
;--------------------------------------------------------------

[statedef -2]
[State 1030,キャラ幅]
type = null;Width
trigger1 = 1
edge = 32,32
player = 32,0


[State -2,ピカピカ]
type = Palfx
triggerall = var(25) = 1
trigger1 = (GameTime%8) = 0
add = 200,200,40
sinadd = 255,250,50,2
time = 4

[State -2,var(25)セット(アーマーオン]
type = VarSet
trigger1 = RoundState = 0
trigger1 = life > 1
v = 25
value = 1

[State -2,var(25)セット(アーマーオフ]
type = VarSet
trigger1 = alive = 0 && life > 1
trigger2 = life <= 1
v = 25
value = 0

[State -2]
type = changestate
;trigger1 = var(25) = 1
trigger1 = alive = 0
trigger1 = stateno != 5150
trigger1 = stateno != 6000
value = 6000
persistent = 0

[State -2, Override]
type = HitOverride
trigger1 = var(25) = 1
trigger1 = 1
attr = SCA,AA,AP,AT
stateno = 9999
time = 1

[State -2];----------------------------発汗
type = Explod
triggerall = roundstate >= 2
triggerall = numExplod(6030) <= 1
trigger1 = GameTime%24 = 0
anim = 6030
ID = 6030
removetime = 17+random%6
facing = 1       
vfacing = 1   
bindtime = 1  
pos = 16,-80
postype = p1
random = 8,24  
scale = .5-((random%3)*0.1),.5-((random%3)*0.1)
sprpriority = 3       
removeongethit = 1 
ownpal = 1  
ignorehitpause = 1
persistent = 1 

[State -2];----------------------------息
type = Explod
triggerall = roundstate >= 2
triggerall = numExplod(6032) <= 2
trigger1 = GameTime%32 = 0 || GameTime%40 = 0
anim = 6032
ID = 6032
removetime = 18
facing = 1       
vfacing = 1   
bindtime = 1   
pos = 16,-92
postype = p1
random = 48,32
scale = .75-((random%3)*0.1),.75-((random%3)*0.1)
sprpriority = 3       
removeongethit = 1 
ownpal = 1  
ignorehitpause = 1
persistent = 1 

[State -2,相手押し判定呼び出し];----------------------------------------
type = null;Helper
trigger1 = numhelper(3) = 0
trigger1 = vel X > 0 
helperype = normal
name = "Cross angel"
id = 3
pos = 0,0
postype = p1
stateno = 3
helpertype = normal
size.xscale = .5
size.yscale = .5
ownpal = 1
keyctrl = 0
;ignorehitpause=1


;---------------------------------------
[State -2, 変数をセット]
type = Varset
triggerall = Time = 1
trigger1 = enemy,name = "RAOH" &&  enemy,Authorname = "gyuki"
trigger2 = enemy,name = "Date Masamune" &&  enemy,Authorname = "pH10"
trigger3 = enemy,name = "Thouther" &&  enemy,Authorname = "gyuki"
trigger4 = enemy,name = "maori" &&  enemy,Authorname = "gunmin"
v = 30
value = 200

;---------------------------------------
[State -2, 1];ブリス時ユリ台詞１
type = PlaySnd
trigger1 = anim = 9020
trigger1 = animelem = 2
trigger1 = time = 1
value = 9020, 0+(random%4)

[State -2, 1];ブリス時ユリ台詞２
type = null;PlaySnd
trigger1 = anim = 9020
trigger1 = animelem =3
trigger1 = time = 8
value = 9020, 1
persistent = 0



[State -2,***]
type = DisplayToClipboard
trigger1 = 1
text = "var(0) = %d,var(1) = %d,var(2) = %d,var(3) = %d,AnimElemtime(1) = %d"
params = var(0),var(1),var(2),var(3),AnimElemtime(1)

;--------------------------------------------------------------
[statedef -3]

[State 1060, 5]
type = varset
triggerall = anim = 1000
trigger1 = animelemtime(10) = 0
trigger2 = animelemtime(11) = 0
trigger3 = animelemtime(12) = 0
trigger4 = animelemtime(13) = 0
trigger5 = animelemtime(14) = 0
trigger6 = animelemtime(15) = 0
trigger7 = animelemtime(16) = 0
trigger8 = animelemtime(17) = 0
trigger9 = animelemtime(18) = 0
trigger10 = animelemtime(19) = 0
trigger11 = animelemtime(20) = 0
v = 3
value = 1

[State 1060, 5]
type = varset
triggerall = anim = 1000
trigger1 = animelemtime(10) = 1
trigger2 = animelemtime(11) = 1
trigger3 = animelemtime(12) = 1
trigger4 = animelemtime(13) = 1
trigger5 = animelemtime(14) = 1
trigger6 = animelemtime(15) = 1
trigger7 = animelemtime(16) = 1
trigger8 = animelemtime(17) = 1
trigger9 = animelemtime(18) = 1
trigger10 = animelemtime(19) = 1
trigger11 = animelemtime(20) = 1
v = 3
value = 0

[State 1060, 5]
type = varset
triggerall = anim = 1100
trigger1 = animelemtime(12) = 0
trigger2 = animelemtime(17) = 0
trigger3 = animelemtime(22) = 0
v = 3
value = 1

[State 1060, 5]
type = varset
triggerall = anim = 1100
trigger1 = animelemtime(12) = 1
trigger2 = animelemtime(17) = 1
trigger3 = animelemtime(22) = 1
v = 3
value = 0

[State 1060, 5]
type = varset
triggerall = anim = 1200
trigger1 = animelemtime(7) = 0
v = 3
value = 1

[State 1060, 5]
type = varset
triggerall = anim = 1200
trigger1 = animelemtime(7) = 1
v = 3
value = 0

[State 1060, 5]
type = varset
triggerall = anim = 1300
trigger1 = animelemtime(4) = 0
v = 3
value = 1

[State 1060, 5]
type = varset
triggerall = anim = 1300
trigger1 = animelemtime(4) = 1
v = 3
value = 0

[State 191, 1]
type = stopsnd
trigger1 = stateno = 0
trigger1 = prevstateno = 191
channel = 1

[State 191, 1]
type = stopsnd
trigger1 = stateno = 0
trigger1 = prevstateno = 191
channel = 2

[State -3]
type = AssertSpecial
trigger1 = alive = 1
flag = nostandguard
flag2 = nocrouchguard

[State -3,現在のステート番号を常時var(1)に入れとく]
type = VarSet
trigger1 = MoveType != H
trigger1 = StateNo != 9999
var(0) = StateNo

[State -3,現在のステート番号を常時var(1)に入れとく]
type = VarSet
trigger1 = MoveType != H
trigger1 = StateNo != 9999
var(1) = ctrl

;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------

;[Statedef -3]

;This controller plays a sound everytime KFM lands from a jump, or
;from his back-dash.
[State -3, 着地音]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 106 ;Run-back land
value = 40, 0



;---------------------------------------------------------------------------
;AI(on)
[State -3, on]
type     = VarSet
triggerall = var(20) >= -1  ;要するにOFFの時が含まれていれば良い
triggerall = RoundState = [1,2]
trigger1 = Command = "AI00"||Command = "AI01"||Command = "AI02"||Command = "AI03"||Command = "AI04"
trigger2 = Command = "AI05"||Command = "AI06"||Command = "AI07"||Command = "AI08"||Command = "AI09"
trigger3 = Command = "AI10"||Command = "AI11"||Command = "AI12"||Command = "AI13"||Command = "AI14"
trigger4 = Command = "AI15"||Command = "AI16"||Command = "AI17"||Command = "AI18"||Command = "AI19"
trigger5 = Command = "AI20"||Command = "AI21"||Command = "AI22"||Command = "AI23"||Command = "AI24"
trigger6 = Command = "AI25"||Command = "AI26"||Command = "AI27"||Command = "AI28"||Command = "AI29"
trigger3 = Command = "AI30"||Command = "AI31"||Command = "AI32"||Command = "AI33"||Command = "AI34"
trigger4 = Command = "AI35"||Command = "AI36"||Command = "AI37"||Command = "AI38"||Command = "AI39"
trigger5 = Command = "AI40"||Command = "AI41"||Command = "AI42"||Command = "AI43"||Command = "AI44"
trigger6 = Command = "AI45"||Command = "AI46"||Command = "AI47"||Command = "AI48"||Command = "AI49"
trigger7 = Command = "AI50"
Trigger8 = Helper(10000),var(59)
var(20)  = 1


[State -3]
Type = VarRandom
TriggerAll = Var(20) = 1
Trigger1 = Time = 1
Trigger2 = Time%60 = 1
Trigger2 = MoveType != I
Trigger3 = Time%1 = 1
Trigger3 = MoveType = I
V = 19
Range = 0,99
IgnoreHitPause = 1

;---------------------------------------------------------------------------
;アーマー解除
[State -1, Taunt]
type = ChangeState
value = 6002
triggerall = Var(20) = 1

trigger1 = var(25) = 1
trigger1 = statetype != A
trigger1 = ctrl
trigger1   = Var(19) = [90,99]

;---------------------------------------------------------------------------
;アーマー
[State -1, Taunt]
type = ChangeState
value = 6001
triggerall = Var(20) = 1

trigger1 = var(25) = 0
trigger1 = statetype != A
trigger1 = ctrl
trigger1   = Var(19) = [50,99]

;---------------------------------------------------------------------------
;
[State -1, お覇王翔吼拳(低速]
type = ChangeState
value = 2000
triggerall = power >= 1000
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = (power = [1000,1499]) && (Random = [600,649]) || (power = [1500,3000]) && (Random = [600,699])
trigger1   = P2BodyDist X = [31,255]
trigger1 = ctrl

trigger2   = (power = [1000,1499]) && (Random = [600,649]) || (power = [1500,3000]) && (Random = [600,699])
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact

;---------------------------------------------------------------------------
;
[State -1, お覇王翔吼拳(高速]
type = ChangeState
value = 2020
triggerall = power >= 1000
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = (power = [1000,1999]) && (Random = [700,749]) || (power = [1500,3000]) && (Random = [700,799])
trigger1   = P2BodyDist X = [31,255]
trigger1 = ctrl

trigger2   = (power = [1000,1999]) && (Random = [700,749]) || (power = [1500,3000]) && (Random = [700,799])
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact


;---------------------------------------------------------------------------
;騎乗位（ゲージレベル１）
[State -1, Triple Kung Fu Palm]
type = ChangeState
value = 2050
triggerall = power >= 1000
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = Var(19) = [10,19]
trigger1   = P2BodyDist X = [31,255]
trigger1   = ctrl

trigger2  = Var(19) = [10,19]
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact


;---------------------------------------------------------------------------
;三烈轢き潰し（ゲージレベル１）
[State -1, Triple Kung Fu Palm]
type = ChangeState
value = 3000
triggerall = power >= 1000
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = Var(19) = [20,25]
trigger1   = P2BodyDist X = [31,255]
trigger1   = ctrl

trigger2  = Var(19) = [20,25]
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact



;---------------------------------------------------------------------------
;轢き潰し（EX）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1020
triggerall = power >= 1000
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype = S

trigger1   = Var(19) = [26,29]
trigger1   = P2BodyDist X = [71,255]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Var(19) = [26,29]
trigger2   = P2BodyDist X = [71,255]
trigger2   = p2statetype = A                   
trigger2   = ctrl

trigger3   = Var(19) = [26,29]
trigger3   = P2BodyDist X = [54,70]
trigger3   = MoveContact
trigger3   = (stateno = 210) && time > 8

;---------------------------------------------------------------------------
;空中轢き潰し（強）
[State -1, Light Kung Fu Palm]
type = ChangeState
value = 1055
triggerall = Var(20) = 1
triggerall = P2BodyDist X = [60,142]
triggerall = P2BodyDist Y = [-10,80]
triggerall = Pos Y < -50

trigger1   = Random = [701,800]
trigger1   = statetype = A
trigger1   = ctrl
trigger1 = stateno != [1000,1005]

;---------------------------------------------------------------------------
;空中轢き潰し（弱）
[State -1, Light Kung Fu Palm]
type = ChangeState
value = 1050
triggerall = Var(20) = 1
triggerall = P2BodyDist X = [ 40,142]
triggerall = P2BodyDist Y = [-10,80]
triggerall = Pos Y < -50

trigger1   = Random = [601,700]
trigger1   = statetype = A
trigger1   = ctrl
trigger1 = stateno != [1000,1005]


;---------------------------------------------------------------------------
[State -3, 空中強パンチ]
type = ChangeState
value = 610
triggerall = var(20) = 1
triggerall = P2BodyDist X = [0,100]
triggerall = P2BodyDist Y = [-10,80]
triggerall = statetype = A

trigger1   = Random = [201,600]
trigger1   = ctrl

trigger2   = Random = [0,800]
trigger2   = (stateno = 600) && time > 8
trigger2   = movecontact

;---------------------------------------------------------------------------
[State -3, 空中弱パンチ]
type = ChangeState
value = 600
triggerall = var(20) = 1
triggerall = P2BodyDist X = [0,100]
triggerall = P2BodyDist Y = [-10,80] 
triggerall = statetype = A

trigger1   = Random = [0,200]
trigger1   = ctrl


;---------------------------------------------------------------------------
[State -3, 挑発]
type = ChangeState
value = 195
triggerall = var(20) = 1
triggerall = power < 2600
triggerall = P2BodyDist X > 200 ;遠距離
triggerall = Life > LifeMax / 2 ;HPに余裕があるとき
triggerall = statetype != A
triggerall = ctrl

trigger1   = Random = 777       ;かなり低確率

trigger2   = p2statetype = L    ;相手がダウン中
trigger2   = Random = [0,100]

trigger3   = Random = [0,750]
trigger3   = P2BodyDist X = [-50,50]



;---------------------------------------------------------------------------
;ジャンプ轢き潰し（強）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1035
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype = S

trigger1   = Random = [450,599+(var(30))]
trigger1   = P2BodyDist X = [-60,240]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Random = [450,799]
trigger2   = P2BodyDist Y = [40,-80]
trigger2   = p2statetype = A             
trigger2   = ctrl

trigger3   = Random = [250,599]
trigger3   = P2BodyDist X = [54,140]
trigger3   = MoveContact
trigger3   = (stateno = 210) && time > 8

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

;ジャンプ轢き潰し（弱）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1030
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype = S

trigger1   = Random = [400,449]
trigger1   = P2BodyDist X = [-60,180]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Random = [400,449]
trigger2   = P2BodyDist Y = [40,-120]
trigger2   = p2statetype = A        
trigger2   = ctrl

trigger3   = Random = [200,249]
trigger3   = P2BodyDist X = [54,140]
trigger3   = MoveContact
trigger3   = (stateno = 210) && time > 8

;---------------------------------------------------------------------------
;轢き潰し（強）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1005
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = Random = [300,399]
trigger1   = P2BodyDist X = [71,155]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Random = [300,399]
trigger2   = p2movetype = I                   
trigger2   = ctrl

trigger3   = Random = [100,199]
trigger3   = P2BodyDist X = [54,70]
trigger3   = MoveContact
trigger3   = (stateno = 210) && time > 8

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

;轢き潰し（弱）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1000
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype != A

trigger1   = Random = [200,299]
trigger1   = P2BodyDist X = [71,155]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Random = [200,299]
trigger2   = p2movetype = I                   
trigger2   = ctrl

trigger3   = Random = [0,99]
trigger3   = P2BodyDist X = [54,70]
trigger3   = MoveContact
trigger3   = (stateno = 210) && time > 8


;---------------------------------------------------------------------------
[State -3, 立ち強パンチ]
type = ChangeState
value = 210
triggerall = roundstate = 2
triggerall = var(20) = 1
triggerall = statetype != A

trigger1   = Random = [100,199]
trigger1   = P2BodyDist X = [0,60]
trigger1   = p2statetype != A                 
trigger1   = ctrl

trigger2   = Random = [101,200]
trigger2   = p2statetype = A                   
trigger2   = ctrl

trigger3   = Random = [701,999]
trigger3   = P2BodyDist X = [31,53]
trigger3   = MoveContact
trigger3   = (stateno = 200) && time > 10


;---------------------------------------------------------------------------
[State -3, 立ち弱パンチ]
type = ChangeState
value = 200
triggerall = roundstate = 2
triggerall = var(20) = 1
triggerall = statetype != A

trigger1   = Random = [0,99]
trigger1   = P2BodyDist X = [0,60]
trigger1   = p2statetype != A              ;相手が立ち状態
trigger1   = ctrl

trigger2   = Random = [0,100]
trigger2   = p2statetype = A                   ;相手が空中状態
trigger2   = ctrl

trigger3   = Random = [0,700]
trigger3   = P2BodyDist X = [0,30]
trigger3   = MoveContact
trigger3   = (stateno = 200) && time > 10


;---------------------------------------------------------------------------
[State -3, ジャンプ開始]
type = ChangeState
value = 40
triggerall = roundstate = 2
triggerall = var(20) = 1
triggerall = statetype != A
;triggerall = Random < P2BodyDist X ;離れるほど確率が高い
triggerall = Life < LifeMax

trigger1   = Random = [850,874]
trigger1   = P2BodyDist X > 10
trigger1   = ctrl

trigger2   = p2statetype = L
trigger2   = ctrl

trigger3   = enemy, numproj >= 1

;---------------------------------------------------------------------------
[State -3, 前にジャンプ]
type = VarSet
triggerall = var(20) = 1
triggerall = Random < (P2BodyDist X) * 2 ;前にジャンプする確率は距離の2倍
trigger1   = stateno = 40
sysvar(1)  = 1

;---------------------------------------------------------------------------
; ここから下は-3のステートを書いてください、ここに書いたものはゲーム中
; に条件が成立すればいつでも開始するステートです。
;---------------------------------------------------------------------------

[State -3, バット]
type = ChangeState
value = 4005
Triggerall = PalNo != 12
triggerall = var(20) = 1 && RoundState = 2 
trigger1 = statetype != A
trigger1 = ctrl
trigger1 = Random <=400
trigger1 = stateno != [4001,4005]
trigger1 = NumHelper(1000) = 0

[State -3, トキ]
type = ChangeState
value = 4001
Triggerall = PalNo != 12
triggerall = var(20) = 1 && RoundState = 2 
trigger1 = statetype != A
trigger1 = ctrl
trigger1 = Random <=700
trigger1 = stateno != [4001,4005]
trigger1 = NumHelper(1000) = 0

[State -3, 世紀末ドライブ]
type = ChangeState
value = 4000
triggerall = var(20) = 1 && RoundState = 2 
triggerall = power >= 3000
trigger1 = statetype != A
trigger1 = ctrl
trigger1 = Random <= 200
trigger2 = stateno = 4005 && movecontact
trigger3 = stateno = 210 && movecontact

