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

[statedef -2]

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

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

[State -2,var(25)セット(アーマーオフ]
type = VarSet
trigger1 = alive = 0
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 = 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の時が含まれていれば良い
trigger1 = (command="cpu1")||(command="cpu2")
trigger2 = (command="cpu3")||(command="cpu4")
trigger3 = (command="cpu5")||(command="cpu6")
trigger4 = (command="cpu7")||(command="cpu8")
trigger5 = (command="cpu9")||(command="cpuA")
trigger6 = (command="cpuB")||(command="cpuC")
trigger7 = (command="cpuD")||(command="cpuE")
trigger8 = (command="cpuF");||(command="start");デバッグ用
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

trigger1   = (power = [1000,1499]) && (Var(19) = [0,2]) || (power = [1500,3000]) && (Var(19) = [0,7])
trigger1   = P2BodyDist X = [31,255]
trigger1 = statetype = S
trigger1 = ctrl

trigger2   = (power = [1000,1499]) && (Var(19) = [0,2]) || (power = [1500,3000]) && (Var(19) = [0,7])
trigger2 = statetype != A
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact

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

trigger1   = (power = [1000,1999]) && (Var(19) = [10,12]) || (power = [1500,3000]) && (Var(19) = [10,17])
trigger1   = P2BodyDist X = [31,255]
trigger1 = statetype = S
trigger1 = ctrl

trigger2   = (power = [1000,1999]) && (Var(19) = [10,12]) || (power = [1500,3000]) && (Var(19) = [10,17])
trigger2 = statetype != A
trigger2 = hitdefattr = SC, NA, SA
trigger2 = movecontact



;---------------------------------------------------------------------------
;三烈カンフー突き手（ゲージレベル１）
[State -1, Triple Kung Fu Palm]
type = ChangeState
value = 3000
triggerall = power >= 1000
triggerall = Var(20) = 1

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

trigger2  = Var(19) = [20,25]
trigger2 = statetype != A
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 = 1005
triggerall = Var(20) = 1
triggerall = P2BodyDist X = [60,142]
triggerall = P2BodyDist Y = [-10,80]
triggerall = Pos Y < -50

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

;---------------------------------------------------------------------------
;空中カンフー突き手（弱）
[State -1, Light Kung Fu Palm]
type = ChangeState
value = 1000
triggerall = Var(20) = 1
triggerall = P2BodyDist X = [40,142]
triggerall = P2BodyDist Y = [-10,80]
triggerall = Pos Y < -50

trigger1   = Random = [601,700]
trigger1   = statetype != S
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 > 4
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 = 1015
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype = S

trigger1   = Random = [201,250]
trigger1   = P2BodyDist X = [71,155]
trigger1   = p2statetype != A                   
trigger1   = ctrl

trigger2   = Random = [201,250]
trigger2   = p2statetype = A                   
trigger2   = ctrl

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

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

;カンフー突き手（弱）
[State -3, Strong Kung Fu Palm]
type = ChangeState
value = 1010
triggerall = roundstate = 2
triggerall = Var(20) = 1
triggerall = statetype = S

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

trigger2   = Random = [251,300]
trigger2   = p2statetype = A                   
trigger2   = ctrl

trigger3   = Random = [151,300]
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 = S

trigger1   = Random = [100,200]
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 > 8


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

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 > 8


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

trigger1   = Random = [850,900]
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のステートを書いてください、ここに書いたものはゲーム中
; に条件が成立すればいつでも開始するステートです。
;---------------------------------------------------------------------------

