;最終ステートファイル。 statedef -2,-3を記述。

;-----------------------------------------------------------------------------
[Statedef -2]

[State a]
type = helper
triggerall = Numhelper(12340) = 0
trigger1 = anim = 0
name = "shadow"
helpertype = normal
ID = 12340
pos = 0, -70
postype = p1
stateno = 12340
keyctrl = 0
size.xscale = .6
ontop = 1
size.yscale = .6
under = 0
ownpal = 1
persistent = 0
ignorehitpause = 0
SuperMoveTime = 9999999
PauseMoveTime = 9999999
ownpal = 1

[Statedef 12340]
type = S
physics = S
velset = 0,0
ctrl = 0
anim = 1921
sprpriority = 5

[State 1001, 摿庩岠壥]
type = AssertSpecial
trigger1 = 1
flag = NoShadow ;塭傪徚偡

[State 2000,4]
type = PlaySnd
trigger1 = Time = 5
value = 12346, 0

[state a]
type = bindtoroot
trigger1 = 1
pos = 0,-70

[State a]
type = destroyself
trigger1 = parent,Anim != 0

[State 2900, 1];アネル呼び出し
type = helper
trigger1   = palno = [6,12]
trigger1 = numhelper(6000) = 0
id = 6000
persistent = 0
name = "Aner"
pos = 0,0
postype = P1
stateno = 6000
helpertype = normal
keyctrl = 0
ownpal = 1

[State -2]
Type = VarSet
trigger1 = Enemy,MoveType != H
V = 41
Value = 0

[State 240, 5];→
type = VarSet
triggerall = var(38) = 0
triggerall = command = "holdfwd"
triggerall = Movetype != H
triggerall = StateNo != [130,133]
triggerall = RoundState = 2
trigger1 = command = "c"
var(39) = 1

[State 240, 5];↑
type = VarSet
triggerall = var(38) = 0
triggerall = command = "holdup"
triggerall = Movetype != H
triggerall = StateNo != [130,133]
triggerall = RoundState = 2
trigger1 = command = "c"
var(39) = 3

[State 240, 5];↓
type = VarSet
triggerall = var(38) = 0
triggerall = command = "holddown"
triggerall = Movetype != H
triggerall = StateNo != [130,133]
triggerall = RoundState = 2
trigger1 = command = "c"
var(39) = 4


[State -2]
Type = VarSet
trigger1 = StateNo = 0
trigger2 = StateNo = [1040,1045]
V = 43
Value = 0

[State -2, パワー溜めのエフェクトを削除]
type = RemoveExplod
triggerall = NumExplod(130) > 0
trigger1 = StateNo != 700
trigger2 = MoveType != I
ID = 130

[state -2,nekoneko];立ち用
type = RemoveExplod
trigger1 = Anim != 1 
id = 3006

[State -2,]
type = RemoveExplod
trigger1 = StateNo != 1014
ID = 1014

[State -2,]
type = RemoveExplod
trigger1 = StateNo != 8011
ID = 8011

[State -2,]
type = RemoveExplod
trigger1 = StateNo != 1031
ID = 1031

[state ]
Type = varset
trigger1 = Enemy,MoveType != H
var(12) = 0

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

;ループ阻止
[state ]
Type = varset
trigger1 = Enemy,MoveType != H
var(50) = 0

[State -2]
Type = VarSet
trigger1 = Enemy,MoveType != H
var(15) = 0


;---------------------------------------------------------------------------
;StateNo 5900について
;
;5900番のステートは、2試合目以降のラウンドコール中に呼び出されます。
;このステートでVarやFVarを初期化しています。
;なのでTurn Modeでは、初登場でも2試合目なのでイントロがありません。


[State -2, 二人目のイントロ]
type = ChangeState             ;二人目でもイントロを作る
value = 190                    ;イントロへ
triggerall = RoundsExisted = 0 ;自分が初参戦時
triggerall = TeamMode = Turns  ;ターンモード
trigger1 = stateno = 5900      ;5900番

[State -2, 勝利バグ解消]
type = CtrlSet                 ;歩きバグ対策
trigger1 = RoundState = 4      ;勝利ポーズ時
trigger1 = Win && Ctrl = 1     ;動ける場合
value = 0                      ;制御不能に


;----------------------------------------------------------------------------
;未完成な相手キャラによって、不具合が起きても自己解決するシステム(仮)
[State -2, Y座標自己修復]
type = PosSet
triggerall = RoundState = 2
trigger1 = stateno = [0,12]      ;立ち＆屈み時
trigger1 = floor(Pos Y) = [-2,3] ;立ち位置が僅かにずれていたらすぐ修正
y = 0
[State -2, Y座標自動修正]
type = PosAdd
triggerall = RoundState = 2
triggerall = Life < LifeMax  ;トレーニングでCtrl+Iを使うときに配慮
trigger1 = stateno = [0,30]  ;歩きも含める
trigger1 = floor(Pos Y) < -2 ;立ち位置が大きくずれていたら移動する
y = 2
[State -2, Y座標自動修正]
type = PosAdd
triggerall = RoundState = 2
triggerall = Life < LifeMax
trigger1 = stateno = [0,30]
trigger1 = floor(Pos Y) > 2 ;同じく
y = -2
;----------------------------------------------------------------------------

;----------------------------------------------------------------------------
;デバッグ支援記述集

; ※ この一連の記述は、キャラが完成したら消すか";"を付けて無効化しましょう。
;　　僅かにでも処理が重くなることが理由です。（ちなみにNullではダメです）


;デバッグモードに白い文字の表示を加える
[State -2, デバッグ表示]
type = DisplayToClipboard
trigger1 = 1
text = "V1-C=%d,V2-S=%d,V3-J=%d,V4-D=%d,V5-B=%d"
params = var(1),var(2),var(3),var(4),var(5)
ignorehitpause = 1

;表示を横に加える
[State -2, デバッグ表示その2]
type = AppendToClipboard
trigger1 = 1
text = " V20-A=%d,V21-R=%d,Pos X=%d,Y=%d"
params = var(20),var(21),ceil(Pos X),floor(Pos Y)
ignorehitpause = 1

;表示を下に加える
[State -2, デバッグ表示その3]
type = AppendToClipboard
trigger1 = 1
text = "\nDist X=%d,Y=%d, Vel X=%d/10,Y=%d/10 : Power=%d"
params = floor(P2BodyDist X),ceil(P2BodyDist Y),ceil(Vel X*10),floor(Vel Y*10),Power
ignorehitpause = 1


; ※ 関数説明：floor(1.5) = 1、ceil(1.5) = 2になります。 小数を含む場合によく使います。
;　　小数を詳しく見たい場合は%dの代わりに%fを使います。 MUGENに限らず結構常識です。
;　　Vel X*10に対し、表記はVel X=%d/10になっています。 10で割った数値が目安のVel Xです。
;　　PosとDistはfloorとceilが逆になっています。

;ガード疑似学習　------------------------------------------
[State -2, 中段1]
Type = VarSet 
triggerall = var(59) > 0 && roundstate = 2
triggerall = !fvar(35)
triggerall = !var(53) && !var(54)
triggerall = EnemyNear(var(55)),stateno != fvar(37)
triggerall = EnemyNear(var(55)),HitDefAttr = SC, NA, SA, HA 
triggerall = Prevstateno = [120,155]
triggerall = StateType = C
triggerall = !Enemy,numproj
trigger1 = stateno != [120,159]
trigger1 = MoveType = H
trigger1 = EnemyNear(var(55)),movehit = 1 
trigger1 = EnemyNear(var(55)),hitcount = 1 
fvar(35) = EnemyNear(var(55)),stateno

[State -2, 中段2]
Type = VarSet 
triggerall = var(59) > 0 && roundstate = 2 
triggerall = !var(53) && !var(54)
triggerall = fvar(35) && !fvar(36)
triggerall = EnemyNear(var(55)),stateno != fvar(35)
triggerall = EnemyNear(var(55)),stateno != fvar(37)
triggerall = EnemyNear(var(55)),HitDefAttr = SC, NA, SA, HA 
triggerall = Prevstateno = [120,155]
triggerall = StateType = C
triggerall = !Enemy,numproj
trigger1 = stateno != [120,159]
trigger1 = MoveType = H
trigger1 = EnemyNear(var(55)),movehit = 1 
trigger1 = EnemyNear(var(55)),hitcount = 1 
fvar(36) = EnemyNear(var(55)),stateno

[State -2, 下段]
Type = VarSet 
triggerall = var(59) > 0 && roundstate = 2
triggerall = !var(53) && !var(54)
triggerall = !fvar(37)
triggerall = EnemyNear(var(55)),stateno != fvar(35)
triggerall = EnemyNear(var(55)),stateno != fvar(36)
triggerall = EnemyNear(var(55)),HitDefAttr = SC, NA, SA, HA 
triggerall = Prevstateno = [120,155]
triggerall = StateType = S
triggerall = !Enemy,numproj
trigger1 = stateno != [120,159]
trigger1 = MoveType = H
trigger1 = EnemyNear(var(55)),movehit = 1 
trigger1 = EnemyNear(var(55)),hitcount = 1 
fvar(37) = EnemyNear(var(55)),stateno

;この下、一行以上空ける事！
