;==============================================================================
[Statedef 99999]
anim=10000
ctrl=0
[State 99999]
Type = NotHitBy
Trigger1 = IsHelper
Value = SCA,AA,AP,AT
Time = 1
Persistent = 1
[State 99999]
Type = AssertSpecial
Trigger1 = IsHelper
Flag = NoShadow
Flag2 = Invisible
Persistent = 1
IgNoreHitPause = 1


;==============================================================================
;	AI各種設定（AI config）
;==============================================================================
;-3.cnsの本体設定と合わせて設定してください
;各項目の詳細についてはreadmeをお読みください。

[State , AIレベル設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
;------------------------------------------------------------------------------
var(59) = 5			;@ AI Level(0-5) Default:3
;------------------------------------------------------------------------------
; 	0：AIOFF　1：EASY  2：NORMAL  3：HARD  4：HARD+　5：BRAVER
;	Lv4は超反応　Lv5は10P以上で適用(1〜9Pは自動でLv4に変更)
										IgNoreHitPause = 1

[State ,常時AI起動設定]
Type = ParentVarSet
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = Root,Var(59) = 0
V = 59
;------------------------------------------------------------------------------
Value = 1			;@(0-1) Default:1
;------------------------------------------------------------------------------
; 	0：OFF  1：AI常時ON
;	CPUとして使う場合はON推薦
										IgNoreHitPause = 1

[State ,アシスト固定設定]
type = ParentVarSet
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
;------------------------------------------------------------------------------
var(34) = 0			;@(0-4) Default:0
;------------------------------------------------------------------------------
; 	0：ランダム　1：東郷さん　2：風　3：樹　4：夏凜
										IgNoreHitPause = 1

[State ,アシスト選択時間短縮]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
;------------------------------------------------------------------------------
var(58) = 1			;@(0-1) Default:1
;------------------------------------------------------------------------------
; 	0：OFF　1：ON
										IgNoreHitPause = 1


[State ,アシスト割り込み設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[1,6]
;------------------------------------------------------------------------------
var(55) = 0			;@(0-1) Default:0
IgNoreHitPause = 1
;------------------------------------------------------------------------------
[State ,アシスト割り込み設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[7,12]
;------------------------------------------------------------------------------
var(55) = 1			;@(0-1) Default:0
;------------------------------------------------------------------------------
;	0：喰らい時にアシストを使わない
;	1：喰らい時にアシストを使う
										IgNoreHitPause = 1							


[State ,AI満開使用体力設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[1,3]
;------------------------------------------------------------------------------
var(57) = 0			;@(0-3) Default:1
IgNoreHitPause = 1

[State ,AI満開使用体力設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[4,6]
;------------------------------------------------------------------------------
var(57) = 1			;@(0-3) Default:1
IgNoreHitPause = 1
;------------------------------------------------------------------------------

[State ,AI満開使用体力設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[7,8]
;------------------------------------------------------------------------------
var(57) = 2			;@(0-3) Default:1
IgNoreHitPause = 1


[State ,AI満開使用体力設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
trigger1= palno =[9,12]
;------------------------------------------------------------------------------
var(57) = 3			;@(0-3) Default:1

;	0：満開を使わない（強制満開のみ）
;	1：体力1/4以下で満開使用
;	2：体力半分以下で(ry
;	3：貯まったらすぐ満開
										IgNoreHitPause = 1							

[State ,AI満開使用ラウンド設定]
type = varset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
;------------------------------------------------------------------------------
var(56) = 3			;@(1-3) Default:1
;------------------------------------------------------------------------------
; 	1：相手に1本取られてから満開使用
;	2：2ラウンド目から満開使用
;	3：1ラウンド目から満開使用
										IgNoreHitPause = 1


;==============================================================================
;	↑ここまで  以下触るの禁止
;==============================================================================




































[State ,オートデバックスイッチ]
type = Parentvarset
trigger1 = isHelper
Trigger1 = IsHelper(98765 + Root,ID)
Trigger1 = root,var(4) = 1
var(47) = 0
;	本体のデバックスイッチが1のときのみ適用。満開ゲージを自動的にMAX。
;	0：OFF
;	1：非満開時のみON
;	2：常時ON
										IgNoreHitPause = 1
	

[State 99999, 間違いで本体が来たら立ちへ復帰]
Type = SelfState
Trigger1 = !IsHelper
Value = 0
Ctrl = 1

[State 99999, 本体と同じ向き]
Type = Turn
TriggerAll = IsHelper
Trigger1 = Facing != Root,Facing
Persistent = 1
IgNoreHitPause = 1

;==============================================================================
;	config代入
;==============================================================================
[State -1, Config変数代入_V58]
Type = Parentvaradd
TriggerAll = Root,RoundsExisted=0 && Roundstate<=1
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = var(58) != 0
Trigger1 = Root,Var(48)%10 = 0
V = 48
value = var(58)

[State -1, Config変数代入_V57]
Type = Parentvaradd
TriggerAll = Root,RoundsExisted=0 && Roundstate<=1
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = var(57) != 0
Trigger1 = (Floor(Root,Var(48))/10)%10 = 0
V = 48
value = var(57)*10

[State -1, Config変数代入_V56]
Type = Parentvaradd
TriggerAll = Root,RoundsExisted=0 && Roundstate<=1
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = var(56) != 0
Trigger1 = (floor(Root,var(48))/100)%10 = 0
V = 48
value = var(56)*100

[State -1, Config変数代入_V55]
Type = Parentvaradd
TriggerAll = Root,RoundsExisted=0 && Roundstate<=1
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = var(55) != 0
Trigger1 = Floor(Root,Var(48))/1000 = 0
V = 48
value = var(55)*1000

;==============================================================================
;	AI起動用ヘルパー
;==============================================================================
[State 99999,AI2];プレイヤー判定
Type = ParentVarSet
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
TriggerAll = Root,Var(59) = 0
trigger1=command="a"&&root,command="a"
trigger2=command="b"&&root,command="b"
trigger3=command="c"&&root,command="c"
trigger4=command="x"&&root,command="x"
trigger5=command="y"&&root,command="y"
trigger6=command="z"&&root,command="z"
trigger7=command="start"&&root,command="start"
var(59)=-1

[State 99999,AI3];立ったら消失
Type = DestroySelf
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = Root,Var(59) = 0
trigger2=command="a"&&root,command="a"
trigger3=command="b"&&root,command="b"
trigger4=command="c"&&root,command="c"
trigger5=command="x"&&root,command="x"
trigger6=command="y"&&root,command="y"
trigger7=command="z"&&root,command="z"
trigger8=command="start"&&root,command="start"
var(59)=1

[State 99999, AIレベル代入]
Type = ParentVarSet
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = Var(59) < 5
Trigger1 = Root,Var(59) > 0
Trigger2 = Var(59) = 5 && Root,Palno >= 10
Trigger2 = Root,Var(59) > 0
V = 59
Value = Var(59)

[State 99999, AIレベル代入]
Type = ParentVarSet
TriggerAll = IsHelper
TriggerAll = IsHelper(98765 + Root,ID)
TriggerAll = Parent,ID = Root,ID
Trigger1 = Var(59) = 5 && Root,Palno < 10
Trigger1 = Root,Var(59) > 0
V = 59
Value = 4

[State 99999,デストロイヤー]
Type = DestroySelf
Trigger1 = RoundState>=2
IgnoreHitPause = 1

;===========================================================================
; ステージ端検出ヘルパー右側
;===========================================================================
;var(1)〜(2) - 画面端判定
;var(10) - 追い打ち可能時間
;---------------------------------------------------------------------------
[Statedef 111111]
type=A
movetype=I
physics=N
ctrl=0
anim=10000
sprpriority=0
velset=10, 0

[State 111111, AssertSpecial]
type = assertspecial
trigger1 = 1
flag = invisible
flag2= noshadow

[State 9741, Safety]
type=selfstate
trigger1=!ishelper
value=0

[State 111111,NotHitBy]
type = nothitby
trigger1 = 1
value = SCA

[State 111111,ScreenBound]
type=ScreenBound
trigger1=1
value=0
movecamera=0,0

[State 111111,判定用飛び道具射出]
type=Projectile
trigger1=time=0
projID=111110
projanim=10000
velocity=10, 0
projpriority=4
projsprpriority=2
projstagebound=0
projedgebound=9999
offset=0, 0
postype=right
supermovetime=123456789
pausemovetime=123456789
projremovetime=-1

[State 111111, AssertSpecial]
type = assertspecial
trigger1 = 1
flag = invisible
flag2= noshadow

[State 111111];飛び道具が消えたら停止。
type = velset
trigger1=ishelper
trigger1=!(root,numprojID(111110))
x = 0
y = 0

[State 111111]
Type=Turn
TriggerAll=IsHelper
Trigger1=Facing=1
IgnoreHitPause=1

[State 111111, 相手画面端]
Type = varset
Trigger1 = root,Facing=1 && var(1)>-1
var(1) = P2bodydist X
IgNoreHitPause = 1

[State 111111, 相手画面端]
Type = varset
Trigger1 = root,Facing=1 && var(1)<0
var(1) = 0
IgNoreHitPause = 1

[State 111111, 相手not画面端]
Type = varset
Trigger1 = root,Facing=-1
var(1) = -1*P2bodydist X
IgNoreHitPause = 1

[State 111111, 自分画面端]
Type = varset
Trigger1 = root,Facing=-1
var(2) = Rootdist X
IgNoreHitPause = 1

[State 111111, 自分not画面端]
Type = varset
Trigger1 = root,Facing=1
var(2) = -1*Rootdist X
IgNoreHitPause = 1

[State 111111, デバッグ]
Type = DisplayToClipboard
Trigger1 = 1
Text = "P2X=%f, RX=%f, V1=%d, V1F=%d \n"
Params = P2bodydist X, rootdist X, var(1), Floor(Var(1))/10
Persistent = 1
IgNoreHitPause = 1

[State 111111, デバッグ]
Type = AppendToClipboard
Trigger1 = 1
Text = "\t PY=%f, velX=%f, velY=%f \n"
Params = (root,pos Y), (root,vel X), (root,vel Y)
Persistent = 1
IgNoreHitPause = 1

;===========================================================================
;var(1) = 相手位置
;var(2) = 自分位置
;var(10)= 追い打ち可能時間計測
;var(11)= 勝利ポーズ固定
;var(12)= アシストランダム
;var(13)= アピール制限
;var(14)〜var(15)= 追い打ちキック制限
;var(16)= コンボ用
;var(17)= キャンセルstate記憶
;===========================================================================
; 追い打ち可能時間記憶
;===========================================================================
[State 111111, 追い打ち可能時間計測]
type = varadd
TriggerAll = root,var(59)>2 && RoundState=2 && root,Alive
Trigger1 = PlayerID(root,var(49)),stateno=[5050,5119]
V = 10
value = 1

[State 111111, 追い打ち可能時間リセット]
type = varset
TriggerAll = root,var(59)>2 && RoundState=2 && root,Alive
Trigger1 = PlayerID(root,var(49)),stateno!=[5050,5120]
V = 10
value = 0

;===========================================================================
; 満開一撃判定
;===========================================================================
[State 111111, 勝利ポーズ固定用]
type = varset
TriggerAll = root,var(59)>0 && root,Alive
Trigger1 = root,stateno = [4000,4500]
Trigger1 = PlayerID(root,var(49)),Alive = 0
Trigger1 = var(11) = 0
Trigger1 = root,var(9)=1 || root,var(16)=0
V = 11
value = 1

[State 111111, 勝利ポーズ固定用]
type = varset
TriggerAll = root,var(59)>0 && root,Alive
Trigger1 = root,stateno = [4330,4337]
Trigger1 = PlayerID(root,var(49)),Alive = 0
V = 11
value = 2

[State 111111, 勝利アピール中止]
type = varset
TriggerAll = root,var(59)>0 && root,Alive
Trigger1 = root,Stateno = [3300,3308]
Trigger1 = PlayerID(root,var(49)),Alive = 0
V = 11
value = 3

[State 111111, 勝利ポーズ固定リセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(11) != 0
Trigger1 = roundstate = 1
Trigger2 = PlayerID(root,var(49)),Alive
V = 11
value = 0

;===========================================================================
; アシストランダム用
;===========================================================================
[State 111111, アシストランダム用]
type = varrandom
TriggerAll = root,var(59)>0
trigger1 = var(12) = 0
V = 12
Range = 4

;===========================================================================
; 勝利アピール用
;===========================================================================
[State 111111, アピールは1回]
type = varset
TriggerAll = root,var(59)>0
trigger1 = root,stateno = 195 || root,stateno = 10195
V = 13
value = 1

[State 111111, アピールは1R1回まで]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(13) != 0
Trigger1 = roundstate = 1
V = 13
value = 0

;===========================================================================
; コンボ制御用
;===========================================================================
[State 111111, 追い打ちキック]
type = varadd
TriggerAll = root,var(59)>0
trigger1 = var(14) <2
trigger1 = root,stateno = 1300 && root,movehit
V = 14
value = 1

[State 111111, 追い打ちキックリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(14) != 0
Trigger1 = root,stateno != 1300
V = 14
value = 0

[State 111111, 追い打ちキックは2回まで]
type = varadd
TriggerAll = root,var(59)>0
triggerall = var(14) = 1
trigger1 = var(15) <2
trigger1 = (Var(9) && Var(56)>=1) || Var(9)=0 || Var(7)=1
trigger2 = var(15) <1
trigger2 = !(Var(9) && Var(56)>=1) && Var(9)!=0
V = 15
value = 1

[State 111111, 追い打ちキックリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(15) != 0
Trigger1 = PlayerID(root,var(49)),Movetype !=H && PlayerID(root,var(49)),Statetype !=L
V = 15
value = 0

;===========================================================================
; コンボ制御用
;===========================================================================
[State 111111, 打ち上げジャンプキャンセル]
type = varset
TriggerAll = root,var(59)>0
trigger1 = var(16) =0
trigger1 = root,stateno = 39 && root,prevstateno = 410
V = 16
value = 1
[State 111111, キャンセルリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 1
Trigger1 = root,Movetype =A || root,Movetype =H
V = 16
value = 0

[State 111111, 弱パン使用判断]
type = varset
TriggerAll = root,var(59)>0
trigger1 = var(16) =0
trigger1 = root,stateno = 200 && root,time=3
trigger1 = root,P2bodydist X <45
V = 16
value = 2
[State 111111, キャンセルリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 2
Trigger1 = root,stateno!=200
V = 16
value = 0

[State 111111, 流星めくり用]
type = varset
TriggerAll = root,var(59)>0
trigger1 = var(16) =0 || var(16) =4
trigger1 = root,stateno = 1110 && root,movehit
V = 16
value = 3
[State 111111, 流星めくりリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 3
trigger1 = root,stateno != 1110
Trigger1 = root,Movetype =A || root,Movetype =H
V = 16
value = 0

[State 111111, 空中ダッシュ制限]
type = varset
TriggerAll = root,var(59)>0
trigger1 = var(16) =0
trigger1 = root,stateno = 1500
V = 16
value = 4
[State 111111, 空中ダッシュ制限リセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 4
Trigger1 = root,statetype !=A || root,stateno = 1110
V = 16
value = 0

[State 111111, 満開ヒット時]
type = varset
TriggerAll = root,var(59)>0 && Root,Palno>=10 && Root,Power>=1000
trigger1 = var(16) =0
trigger1 = root,stateno=3500
V = 16
value = 5
[State 111111, 満開ヒット時リセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 5
Trigger1 = root,stateno!=3500 && root,time>=5
Trigger1 = root,Movetype =A || PlayerID(root,var(49)),Movetype!=H || (PlayerID(root,var(49)),statetype=L && PlayerID(root,var(49)),stateno!=[5050,5119])
V = 16
value = 0

[State 111111, 満開ヒット時]
type = varset
TriggerAll = root,var(59)>0 && Root,Var(57)=1 && Root,Power<1000
trigger1 = var(16) =0
trigger1 = root,Var(37)=2 && root,stateno=4240
V = 16
value = 6
[State 111111, 満開ヒット時リセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(16) = 6
Trigger1 = Root,Var(57)!=1
Trigger2 = root,stateno!=4240
V = 16
value = 0

;===========================================================================
; キャンセルstate記憶
;===========================================================================
[State 111111, キャンセルstate]
type = varset
TriggerAll = root,var(59)>0
trigger1 = var(17) =0
trigger1 = root,stateno = 10000
V = 17
value = root,prevstateno
IgNoreHitPause = 1

[State 111111, stateリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(17) > 0
Trigger1 = root,Movetype =A || root,Movetype =H || root,stateno=115
V = 17
value = 0
IgNoreHitPause = 1

;===========================================================================
; キャンセル回数
;===========================================================================
[State 111111, キャンセルstate]
type = varadd
TriggerAll = root,var(59)>0
trigger1 = root,stateno = 10000 && root,time=5
V = 18
value = 1

[State 111111, stateリセット]
type = varset
TriggerAll = root,var(59)>0
TriggerAll = var(18) > 0
Trigger1 = PlayerID(root,var(49)),Movetype !=H && PlayerID(root,var(49)),Statetype !=L
V = 18
value = 0

;===========================================================================
; 当身可能判断
;===========================================================================
[State 111111, 当身可能(証)]
type = varadd
TriggerAll = root,var(59)>4 && Root,Palno>=10
TriggerAll = var(19) = 0
trigger1 = Root,Power>=3000 && Var(56)=0
V = 19
value = 1

[State 111111, 当身可能(輝き)]
type = varset
TriggerAll = root,var(59)>4 && Root,Palno>=10
Trigger1 = Root,Power>=1000
Trigger1 = Root,Var(56)>=Root,Fvar(10) && Root,Life<300 && Root,Var(58)>=60
V = 19
value = 2

[State 111111, リセット]
type = varadd
TriggerAll = root,var(59)>0
trigger1 = Root,Power<3000-ifelse((Root,Var(56)>=Root,Fvar(10) && Root,Life<300 && Root,Var(58)>=60),2000,0)
V = 19
value = 0

;===========================================================================
; ジャンプ用
;===========================================================================
[State 111111, キャンセルstate]
type = null
TriggerAll = root,var(59)>0 && root,var(57) != 1
TriggerAll = root,statetype!=A
trigger1 = root,P2bodydist X=[61,200]
trigger1 = !(root,backedgebodydist<20 && PlayerID(root,var(49)),backedgebodydist<20)
trigger1 = var(20):=1
trigger2 = root,P2bodydist X<=60
trigger2 = PlayerID(root,var(49)),statetype !=L
trigger2 = var(20):=2
trigger3 = root,P2bodydist X<=60
trigger3 = PlayerID(root,var(49)),statetype =L
trigger3 = Helper(111111),var(1)>5||Helper(111112),var(1)>5
trigger3 = var(20):=3
trigger4 = root,P2bodydist X<=60
trigger4 = PlayerID(root,var(49)),statetype =L
trigger4 = (Helper(111111),var(1)=[0,5])||(Helper(111112),var(1)=[0,5])
trigger4 = var(20):=4
trigger5 = root,P2bodydist X>=200
trigger5 = root,backedgebodydist<20 && PlayerID(root,var(49)),backedgebodydist<20
trigger5 = var(20):=1;5
trigger6 = root,P2bodydist X<=120 && root,fvar(27)=7 && root,Var(54)=0
trigger6 = var(20):=5
trigger7 = (root,P2bodydist X=[120,160]) && root,fvar(27)=7 && root,Var(54)=0
trigger7 = var(20):=6
trigger8 = root,P2bodydist X>160 && root,fvar(27)=7 && root,Var(54)=0
trigger8 = var(20):=7

;===========================================================================
; 満開接地状態
;===========================================================================
[State 111111, だいたい接地]
type = varset
TriggerAll = root,var(59)>0 && root,var(57) = 1
TriggerAll = var(20) != 1
trigger1 = Root,pos Y >= -30 && PlayerID(root,var(49)),statetype!=A
V = 20
value = 1

[State 111111, 空中]
type = varset
TriggerAll = root,var(59)>0 && root,var(57) = 1
triggerAll = var(20) != 0
trigger1 = Root,pos Y < -30
trigger2 = PlayerID(root,var(49)),statetype=A
V = 20
value = 0

;===========================================================================
; ステージ端検出ヘルパー左側
;===========================================================================
;var(1)〜(2) - 画面端判定
;var(49)〜(51) - 立ち下段ガード学習
;var(52)〜(54) - しゃがみ中段ガード学習
;---------------------------------------------------------------------------
[Statedef 111112]
type=A
movetype=I
physics=N
ctrl=0
anim=10000
sprpriority=0
velset=10, 0

[State 111112, AssertSpecial]
type = assertspecial
trigger1 = 1
flag = invisible
flag2= noshadow

[State 9741, Safety]
type=selfstate
trigger1=!ishelper
value=0

[State 111112,NotHitBy]
type = nothitby
trigger1 = 1
value = SCA

[State 111112,ScreenBound]
type=ScreenBound
trigger1=1
value=0
movecamera=0,0

[State 111112,判定用飛び道具射出]
type=Projectile
trigger1=time=0
projID=111120
projanim=10000
velocity=10, 0
projpriority=4
projsprpriority=2
projstagebound=0
projedgebound=99999
offset=0, 0
postype=left
supermovetime=123456789
pausemovetime=123456789
projremovetime=-1

[State 111112, AssertSpecial]
type = assertspecial
trigger1 = 1
flag = invisible
flag2= noshadow

[State 111112];飛び道具が消えたら停止。
type = velset
trigger1=ishelper
trigger1=!(root,numprojID(111120))
x = 0
y = 0

[State 111112]
Type=Turn
TriggerAll=IsHelper
Trigger1=Facing=-1
IgnoreHitPause=1

[State 111112, 相手画面端]
Type = varset
Trigger1 = root,Facing=-1 && var(1)>-1
var(1) = P2bodydist X
IgNoreHitPause = 1

[State 111112, 相手画面端]
Type = varset
Trigger1 = root,Facing=-1 && var(1)<0
var(1) = 0
IgNoreHitPause = 1

[State 111112, 相手not画面端]
Type = varset
Trigger1 = root,Facing=1
var(1) = -1*P2bodydist X
IgNoreHitPause = 1

[State 111112, 自分画面端]
Type = varset
Trigger1 = root,Facing=1
var(2) = Rootdist X
IgNoreHitPause = 1

[State 111112, 自分not画面端]
Type = varset
Trigger1 = root,Facing=-1
var(2) = -1*Rootdist X
IgNoreHitPause = 1

[State 111112, デバッグ]
Type = DisplayToClipboard
Trigger1 = 1
Text = "P2X=%f, RX=%f, V1=%d, V1F=%d \n"
Params = P2bodydist X, rootdist X, var(1), Floor(Var(1))/10
Persistent = 1
IgNoreHitPause = 1

;===========================================================================
; ガード学習ヘルパー（併用）
;===========================================================================
[State 111112,Reset]
type = VarRangeSet
TriggerAll = Root,var(59)>0
TriggerAll = Root,TeamMode = Turns
Trigger1 = Root,RoundState = 0
value = 0
first = 54
last = 59
;---------------------------------------------------------------------------
[State 111112, ガード判定]
type = varset
TriggerAll = Root,var(59)>0
Trigger1 = Root,stateNo=120 || Root,StateNo=130 || (Root,StateNo=[150,151])
Trigger1 = Root,Statetype=S
v = 53
value = 1

[State 111112, ガード判定]
type = varset
TriggerAll = Root,var(59)>0
Trigger1 = Root,stateNo=120 || Root,StateNo=131 || (Root,StateNo=[152,153])
Trigger1 = Root,Statetype=C
v = 53
value = 2

[State 111112, ガード判定リセット]
type = VarSet
TriggerAll = Root,var(59)>0
TriggerAll = var(53) !=0 && (Root,stateNo!=[120,153])
Trigger1 = Root,Statetype=L
Trigger2 = Root,Movetype=A || Root,Movetype=I
v = 53
value = 0
;---------------------------------------------------------------------------
[State 111112, 立ち下段学習その１]
type = VarSet
TriggerAll = Root,var(59)>2
TriggerAll = var(53)=1
TriggerAll = Var(54)=0
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 54
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112, 立ち下段学習その２]
type = VarSet
TriggerAll = Root,var(59)>2
TriggerAll = var(53)=1
TriggerAll = Var(54)!=0 && Var(55)=0
TriggerAll = Var(54)!=PlayerID(Root,var(49)),StateNo
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 55
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112, 立ち下段学習その３]
type = VarSet
TriggerAll = Root,var(59)>3
TriggerAll = var(53)=1
TriggerAll = Var(54)!=0 && Var(55)!=0 && Var(56)=0
TriggerAll = (Var(54)!=PlayerID(Root,var(49)),StateNo) && (Var(55)!=PlayerID(Root,var(49)),StateNo)
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 56
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112, しゃがみ中段学習その１]
type = VarSet
TriggerAll = Root,var(59)>2
TriggerAll = var(53)=2
TriggerAll = Var(57)=0
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 57
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112, しゃがみ中段学習その２]
type = VarSet
TriggerAll = Root,var(59)>2
TriggerAll = var(53)=2
TriggerAll = Var(57)!=0 && Var(58)=0
TriggerAll = Var(57)!=PlayerID(Root,var(49)),StateNo
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 58
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112, しゃがみ中段学習その３]
type = VarSet
TriggerAll = Root,var(59)>3
TriggerAll = var(53)=2
TriggerAll = Var(57)!=0 && Var(58)!=0 && Var(59)=0
TriggerAll = Var(57)!=PlayerID(Root,var(49)),StateNo
TriggerAll = Var(58)!=PlayerID(Root,var(49)),StateNo
Trigger1 = Root,StateNo=[5000,5099]
Trigger2 = Root,StateNo!=[5000,5099]
Trigger2 = (Root,Movetype=H && Root,Stateno>=200)
v = 59
value = PlayerID(Root,var(49)),StateNo
;---------------------------------------------------------------------------
[State 111112,vs]
Type = null
TriggerAll = IsHelper
TriggerAll = Parent,ID = Root,ID
Trigger1 = Root,Var(44)%100000 != 0 && var(54)=0
Trigger1 = var(54) := root,Var(44)%100000
Trigger2 = Floor(root,Var(44))/100000 != 0 && var(55)=0
Trigger2 = var(55) := Floor(root,Var(44))/100000
Trigger3 = Root,Var(45)%100000 != 0 && var(56)=0
Trigger3 = var(56) := root,Var(45)%100000
Trigger4 = Floor(root,Var(45))/100000 != 0 && var(57)=0
Trigger4 = var(57) := Floor(root,Var(45))/100000
Trigger5 = Root,Var(46)%100000 != 0 && var(58)=0
Trigger5 = var(58) := Root,Var(46)%100000
Trigger6 = Floor(root,Var(46))/100000 != 0 && var(59)=0
Trigger6 = var(59) := Floor(root,Var(46))/100000
ignorehitpause = 1

[State 111112, デバッグ]
Type = AppendToClipboard
Trigger1 = 1
Text = "state1=%d, state2=%d \n"
Params = var(1),var(2)
Persistent = 1
IgNoreHitPause = 1

;---------------------------------------------------------------------------
;var(54)〜(56) - 立ち下段ガード学習
;var(57)〜(59) - しゃがみ中段ガード学習
;TriggerAll = PlayerID(var(49)),stateno!=Helper(111112),var(50) && PlayerID(var(49)),stateno!=Helper(111112),var(51)
;===========================================================================
; 相手攻撃無効state判定
;===========================================================================
[State 111112, 相手打撃無効state判定1]
type = varset
TriggerAll = Root,var(59)>2 && (var(49)=0||var(49)=2) && Root,NumEnemy=1
TriggerAll = PlayerID(Root,var(49)),statetype!=A
TriggerAll = PlayerID(Root,var(49)),statetype!=L
TriggerAll = PlayerID(Root,var(49)),Movetype=I
TriggerAll = PlayerID(Root,var(49)),StateNo>=200
TriggerAll = PlayerID(Root,var(49)),Ctrl=0
Trigger1 = Root,StateNo=200 && Root,AnimTime=-10 && Root,MoveContact=0
Trigger1 = Root,P2bodydist X-(Root,fvar(26)*5)=[-5,70]
Trigger2 = Root,StateNo=400 && Root,AnimTime=-8 && Root,MoveContact=0
Trigger2 = Root,P2bodydist X-(Root,fvar(26)*5)=[-5,45]
v = 49
value = ifelse(var(49)=0,1,3)
ignorehitpause=1
;---------------------------------------------------------------------------
[State 111112, 相手打撃無効state判定2]
type = varset
TriggerAll = PlayerID(Root,var(49)),statetype!=A
TriggerAll = PlayerID(Root,var(49)),statetype!=L
TriggerAll = PlayerID(Root,var(49)),Movetype=I
TriggerAll = PlayerID(Root,var(49)),StateNo>=200
TriggerAll = PlayerID(Root,var(49)),Ctrl=0
Trigger1 = var(49)=1
v = 50
value = PlayerID(Root,var(49)),stateno
ignorehitpause=1
;---------------------------------------------------------------------------
[State 111112, 相手打撃無効state判定3]
type = varset
TriggerAll = Root,var(59)>2 && var(49)=1
Trigger1 = var(50)!=0 && Root,Movetype!=A
v = 49
value = 2
ignorehitpause=1
;---------------------------------------------------------------------------
[State 111112, 相手打撃無効state判定2]
type = varset
TriggerAll = PlayerID(Root,var(49)),statetype!=A
TriggerAll = PlayerID(Root,var(49)),statetype!=L
TriggerAll = PlayerID(Root,var(49)),Movetype=I
TriggerAll = PlayerID(Root,var(49)),StateNo>=200
TriggerAll = PlayerID(Root,var(49)),Ctrl=0
Trigger1 = var(49)=3
Trigger1 = PlayerID(Root,var(49)),stateno!=[var(50)-2,var(50)+4]
v = 51
value = PlayerID(Root,var(49)),stateno
ignorehitpause=1
;---------------------------------------------------------------------------
[State 111112, 相手打撃無効state判定3]
type = varset
TriggerAll = Root,var(59)>2 && var(49)=3
Trigger1 = var(51)!=0
v = 49
value = -1
ignorehitpause=1

;===========================================================================
; 対めくり補助ヘルパー
;===========================================================================
[Statedef 2666660]
ctrl = 0
Anim = 10000

[State 2666660, AssertSpecial]
Type = AssertSpecial
Trigger1 = 1
flag = Invisible
flag2 = Noshadow
ignorehitpause=1
[State 2666660, NotHitBy]
Type = NotHitBy
Value = SCA
Trigger1 = 1
IgnoreHitPause = 1

[State 2666660, Turn];振り向き
Type = turn
Trigger1 = Facing != root,Facing ;本体と異なる向きなら

[State 2666660, Posset in Root];座標Xを本体にあわせる
Type = Posset
Trigger1 = 1
X = Root,Pos X

[State 2666660, Posadd 100];座標+100（本体から+100へずらす）
Type = Posadd
Trigger1 = 1
X = 100
[State 2666660, Front GuardDist varset];前側のInGuardDistを代入
Type = Varset
var(40) = InGuardDist
Trigger1 = 1

[State 2666660, Posadd -200];座標-200（本体から-100へずらす）
Type = Posadd
Trigger1 = 1
X = -200
[State 2666662, Back GuardDist varset];後ろ側のInGuardDistを代入
Type = Varset
var(41) = InGuardDist
Trigger1 = 1

[State 2666660, Posadd 100];座標+100（本体と同座標にもどす）
Type = Posadd
Trigger1 = 1
X = 100

[State 2666660, デバッグ]
Type = DisplayToClipboard
Trigger1 = 1
Text = "V40=%d, V41=%d, V51=%d \n"
Params = Var(40),Var(41),var(51)
Persistent = 1
IgNoreHitPause = 1

;===========================================================================
; 飛び道具探知ヘルパー
;---------------------------------------------------------------------------
;Var(0)~Var(50) = ヘルパーリダイレクト用
;Var(54) = ガード補助用
;Var(55) = StateNo = 300020と300022ループカウント用
;Var(56) = StateNo = 300021ループカウント用
;Var(57) = リダイレクト変数のうちの暫定最高値
;Var(58) = 相手の飛び道具PlayerID
;===========================================================================
[Statedef 300020]
Ctrl = 0
Anim = 10000

[State 300020, 間違いで本体が来たら立ちへ復帰]
Type = SelfState
Trigger1 = !IsHelper
Value = 0
Ctrl = 1

[State 300020, 1フレーム進行して探索再開]
Type = ChangeState
Trigger1 = Time
Value = 300020

[State 300020, 無敵]
Type = NotHitBy
Trigger1 = IsHelper
Value = SCA,AA,AP,AT
Time = 1
Persistent = 1
IgNoreHitPause = 1

[State 300020, 不可視化]
Type = AssertSpecial
Trigger1 = IsHelper
Flag = NoShadow
Flag2 = Invisible
Persistent = 1
IgNoreHitPause = 1

[State 300020, 本体と同じ向き]
Type = Turn
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing != PlayerID(Root,var(49)),Facing
Trigger1 = Facing != Root,Facing

[State 300020, 本体の後ろを向く]
Type = Turn
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing = PlayerID(Root,var(49)),Facing
Trigger1 = Facing = Root,Facing

[State 300020, 本体と相手の中間に配置]
Type = BindToRoot
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing != PlayerID(Root,var(49)),Facing
Trigger1 = Root,Facing * (PlayerID(Root,var(49)),Pos X - Root,Pos X) > 0
Pos = (PlayerID(Root,var(49)),Pos X + Root,Pos X) / 2.0,9999

[State 300020, 本体の背後に配置]
Type = BindToRoot
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing != PlayerID(Root,var(49)),Facing
Trigger1 = Root,Facing * (PlayerID(Root,var(49)),Pos X - Root,Pos X) <= 0
Pos = -80 - Root,Const(Size.Ground.Back),9999

[State 300020, 本体の前方に配置]
Type = BindToRoot
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing = PlayerID(Root,var(49)),Facing
Trigger1 = Root,Facing * (PlayerID(Root,var(49)),Pos X - Root,Pos X) > 0
Pos = 80 + Root,Const(Size.Ground.Front),9999

[State 300020, 本体と相手の中間に配置]
Type = BindToRoot
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
TriggerAll = Root,Facing = PlayerID(Root,var(49)),Facing
Trigger1 = Root,Facing * (PlayerID(Root,var(49)),Pos X - Root,Pos X) <= 0
Pos = (PlayerID(Root,var(49)),Pos X + Root,Pos X) / 2.0,9999

[State 300020, InGuardDist検出]
Type = VarSet
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
Trigger1 = InGuardDist
Trigger2 = Root,InGuardDist
Trigger3 = PlayerID(Root,var(49)),MoveType = A
Trigger3 = P2Dist X > PlayerID(Root,var(49)),Const(Size.Attack.Dist)
Trigger3 = PlayerID(Root,var(49)),StateNo >= 200
Trigger3 = PlayerID(Root,var(49)),Ctrl = 0
Trigger4 = Var(54) := 0
V = 54
Value = 1

[State 300020, ID用変数の最高値記録]
Type = VarSet
TriggerAll = NumHelper(300022)
Trigger1 = Var(57) < Var(Var(55))
V = 57
Value = Var(Var(55))

[State 300020, 開始値を最高値に合わせる]
Type = VarSet
TriggerAll = Var(51) = 0
Trigger1 = Var(56) = 0
V = Var(55)
Value = Var(57) + 1

[State 300020, 飛び道具検出]
Type = ChangeState
TriggerAll = PlayerIDExist(Var(Var(55)))
Trigger1 = PlayerID(Var(Var(55))),IsHelper
Trigger1 = TeamSide != PlayerID(Var(Var(55))),TeamSide
Trigger1 = Abs(PlayerID(Var(Var(55))),ScreenPos X) < 320
Trigger1 = Abs(PlayerID(Var(Var(55))),ScreenPos Y) < 240
Trigger1 = PlayerID(Var(Var(55))),MoveType = A
Trigger1 = PlayerID(Var(Var(55))),HitDefAttr = SCA,AA,AP,AT
Value = 300021

[State 300020, 10回繰り返して当たりがこなかったら予測用ヘルパー呼ぶ]
Type = Helper
TriggerAll = Var(51) = 0
TriggerAll = Var(56) > 10
Trigger1 = Var(56) := -1 || 1
Trigger1 = NumHelper(300022) = 0
Name = "ID_Check"
ID = 300022
Pos = 9999,9999
StateNo = 300022
SuperMoveTime = 2147483647
PauseMoveTime = 2147483647

[State 300020, 変数に予測用ヘルパーのIDを代入]
Type = VarSet
TriggerAll = NumHelper(300022)
Trigger1 = Var(56) = -1
V = Var(55)
Value = Helper(300022),ID

[State 300020, 飛び道具巡回探索]
Type = ChangeState
TriggerAll = Var(51) = 0
Trigger1 = Var(56) != -1
Trigger1 = Var(Var(55)) := Var(Var(55)) + 1 || 1
Trigger1 = Var(56) := Var(56) + 1 || 1
Trigger2 = Var(56) = -1
Trigger2 = Var(55) < 50
Trigger2 = Var(55) := Var(55) + 1 || 1
Value = 300020

[State 300020, 格納Varシフトカウンタ初期化]
Type = VarSet
Trigger1 = 1
V = 55
Value = 0

[State 300020, ループカウンタ初期化]
Type = VarSet
Trigger1 = 1
V = 56
Value = 0

;---------------------------------------------------------------------------
[Statedef 300021]
Ctrl = 0

[State 300021, 無敵]
Type = NotHitBy
Trigger1 = IsHelper
Value = SCA,AA,AP,AT
Time = 1
Persistent = 1
IgNoreHitPause = 1

[State 300021, 不可視化]
Type = AssertSpecial
Trigger1 = IsHelper
Flag = NoShadow
Flag2 = Invisible
Persistent = 1
IgNoreHitPause = 1

[State 300021, 本体と同じ向き]
Type = Turn
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing != PlayerID(Var(Var(55))),Facing
Trigger1 = Facing != Root,Facing

[State 300021, 本体の後ろを向く]
Type = Turn
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing = PlayerID(Var(Var(55))),Facing
Trigger1 = Facing = Root,Facing

[State 300021, 本体と相手の中間に配置]
Type = BindToRoot
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing != PlayerID(Var(Var(55))),Facing
Trigger1 = Root,Facing * (PlayerID(Var(Var(55))),Pos X - Root,Pos X) > Root,Const(Size.Ground.Front)
Pos = (PlayerID(Var(Var(55))),Pos X + Root,Pos X) / 2.0,9999

[State 300021, 本体の背後に配置]
Type = BindToRoot
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing != PlayerID(Var(Var(55))),Facing
Trigger1 = Root,Facing * (PlayerID(Var(Var(55))),Pos X - Root,Pos X) <= Root,Const(Size.Ground.Front)
Pos = -80 - Root,Const(Size.Ground.Back),9999

[State 300021, 本体の前方に配置]
Type = BindToRoot
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing = PlayerID(Var(Var(55))),Facing
Trigger1 = Root,Facing * (PlayerID(Var(Var(55))),Pos X - Root,Pos X) > Root,Const(Size.Ground.Front)
Pos = 80 + Root,Const(Size.Ground.Front),9999

[State 300021, 本体と相手の中間に配置]
Type = BindToRoot
TriggerAll = IsHelper
TriggerAll = PlayerIDExist(Var(Var(55)))
TriggerAll = Root,Facing = PlayerID(Var(Var(55))),Facing
Trigger1 = Root,Facing * (PlayerID(Var(Var(55))),Pos X - Root,Pos X) <= Root,Const(Size.Ground.Front)
Pos = (PlayerID(Var(Var(55))),Pos X + Root,Pos X) / 2.0,9999

[State 300021, InGuardDist検出]
Type = VarSet
TriggerAll = IsHelper && PlayerIDExist(Root,var(49))
Trigger1 = InGuardDist
Trigger2 = Root,InGuardDist
Trigger3 = PlayerID(Root,var(49)),MoveType = A
Trigger3 = P2Dist X > PlayerID(Root,var(49)),Const(Size.Attack.Dist)
Trigger3 = PlayerID(Root,var(49)),StateNo >= 200
Trigger3 = PlayerID(Root,var(49)),Ctrl = 0
Trigger4 = PlayerIDExist(Var(Var(55)))
Trigger4 = PlayerID(Root,var(49)),StateNo >= 200
Trigger4 = PlayerID(Root,var(49)),Ctrl = 0
Trigger5 = Var(54) := 0
V = 54
Value = 1

[State 300021, デバッグ]
Type = DisplayToClipboard
Trigger1 = 1
Text = "Var(55) = %d,Var(56) = %d,Var(57) = %d,Var(58) = %d \n"
Params = Var(55),Var(56),Var(57),Var(58)
Persistent = 1
IgNoreHitPause = 1

[State 300021, デバッグ]
Type = AppendToClipboard
Trigger1 = 1
Text = "Var(0) = %d,Var(1) = %d,Var(2) = %d,Var(3) = %d,Var(4) = %d"
Params = Var(0),Var(1),Var(2),Var(3),Var(4)
Persistent = 1
IgNoreHitPause = 1

[State 300021, 該当する飛び道具が無い場合は常に初期化]
Type = VarSet
Trigger1 = 1
V = 58
Value = 0

[State 300021, 飛び道具検出]
Type = VarSet
Trigger1 = PlayerIDExist(Var(Var(55)))
Trigger1 = PlayerID(Var(Var(55))),IsHelper
Trigger1 = TeamSide != PlayerID(Var(Var(55))),TeamSide
Trigger1 = Abs(PlayerID(Var(Var(55))),ScreenPos X) < 320
Trigger1 = Abs(PlayerID(Var(Var(55))),ScreenPos Y) < 240
Trigger1 = PlayerID(Var(Var(55))),MoveType = A
Trigger1 = PlayerID(Var(Var(55))),HitDefAttr = SCA,AA,AP,AT
V = 58
Value = PlayerID(Var(Var(55))),ID

[State 300021, 飛び道具が無くなったので探索再開]
Type = ChangeState
Trigger1 = Var(58) = 0
Value = 300020

;---------------------------------------------------------------------------
[Statedef 300022]
Ctrl = 0

[State 300022]
Type = DestroySelf
Trigger1 = IsHelper


