;-----------------------------------------------------------------------------
[Statedef -2];常時監視ステート(相手に行動を制御されても関係無く常に実行される)
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;設定項目
;-----------------------------------------------------------------------------
;ネバリ補正(根性値)設定
[State -2, ModifySET]
Type = VarSet
Trigger1 = 1
var(2) = 1

;var(2) = 0･･･なし
;var(2) = 1･･･あり

;空中ガード設定
[State -2, AirguardSET]
Type = VarSet
Trigger1 = 1
var(20) = 1

;var(20) = 0･･･空中ガード可。ただし自分の全ての技が空中ガード可。
;var(20) = 1･･･自分も相手も空中ガード不可。
;var(20) = 2･･･自分は空中ガード可、相手は不可(セコい)。通称甘えモード。

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

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


;ここでtrigger用に自分の初期ライフを確認します
[State -2, ライフ確認]
type = VarSet
triggerall = RoundState = [0,1] ;開始前の間
trigger1 = RoundNo = 1          ;一試合目
trigger2 = TeamMode = Turns     ;5900でイントロを作らないと ↓
trigger2 = RoundsExisted = 0    ;これは使えません
v = 22
value = Life   ;Var(22)に自分のライフを保存

[State -2, ライフ取得ミス対策]
type = VarSet
triggerall = Var(22) = [0,100] ;ライフが100以下と認識されたら
triggerall = Time = 1
trigger1 = RoundNo = 1
trigger2 = RoundsExisted = 0
v = 22
value = const(data.life) ;自分のデータに書かれたLifeにする

;----------------------------------------------------------------------------
;未完成な相手キャラによって、不具合が起きても自己解決するシステム(仮)
[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 < Var(22)  ;トレーニングでCtrl+Iを使うときに配慮
trigger1 = stateno = [0,30]  ;歩きも含める
trigger1 = floor(Pos Y) < -2 ;立ち位置が大きくずれていたら移動する
y = 2
[State -2, Y座標自動修正]
type = PosAdd
triggerall = RoundState = 2
triggerall = Life < Var(22)
trigger1 = stateno = [0,30]
trigger1 = floor(Pos Y) > 2 ;同じく
y = -2
[State -2, Y座標強制修復]               ;GATTより一言…
type = ChangeState                      ;この辺のシステムは
triggerall = RoundState = 2             ;うちの咲夜に搭載しているもので
triggerall = ctrl = 0                   ;かなりオリジナルな設定です。
triggerall = alive = 1                  ;いらない、または重い処理を使う際は削除してください
triggerall = !Lose
trigger1 = Pos Y < -1800 ;空高く飛ばされてしまっても体勢を立て直して落下する
trigger1 = GameTime % 10 = 0
trigger2 = Pos Y > 480   ;地中深くに埋められてしまっても這い上がってくる
trigger2 = GameTime % 10 = 0
value = 40

;-----------------------------------------------------------------------------
;パワーMAX
;-----------------------------------------------------------------------------
;パワーMAXの変数管理等

[state -2 ,1];MAX発動時のパワーセット
type = varset
trigger1 = var(40) = 900
v = 39
value = power

[state a]
type = varadd
trigger1 = var(40) > 0
v = 40
value = -1

[state a]
type = varset
trigger1 = var(40) < 0
trigger2 = RoundState = [0,1]
v = 40
value = 0

[state a]
type = powerset
triggerall = var(40) > 0
trigger1 = stateno != [3000,4999]
trigger1 = stateno != [11000,12999]
value = var(39)
ignorehitpause = 1

;点滅
[State -2, PalFX]
type = PalFX
triggerall = var(40) > 0 
trigger1 = MoveType != H && (GameTime%2)=0 
time = 1
add = 60,60,60
ignorehitpause = 1

;-----------------------------------------------------------------------------
;ゲージ表示

[state a];MAX発動ゲージ
type = Helper
trigger1 = numhelper(14000) = 0
id = 14000
name = "MAX"
sprpriority = 1
pos = 0,0
postype = p1
stateno = 14000
helpertype = normal
pausemovetime = 99999999
supermovetime = 99999999
keyctrl = 0 
ownpal = 1

;-----------------------------------------------------------------------------
;各種補正
;-----------------------------------------------------------------------------
; パワーMAX
[state a];通常時
type = varset
trigger1 = var(40) = 0
fvar(4) = 1.0

[state a];MAX発動補正
type = varset
trigger1 = var(40) > 0
fvar(4) = 1.1

; コンボ補正
[state a]
type = varset
trigger1 = 1
fvar(0) = 1.0

[state a];補正
type = varset
trigger1 = enemynear(var(58)),movetype = H
trigger1 = enemynear(var(58)),gethitvar(hitcount) > 1
fvar(0) = ((100.0-(25.0+(enemynear(var(58)),gethitvar(hitcount)/2.0)*5.0))/100.0)

[state a];補正限界値
type = varset
trigger1 = fvar(0) <= 0.2
fvar(0) = 0.2

[state a]
type = varset
trigger1 = enemynear(var(58)),statetype = L
trigger2 = enemynear(var(58)),movetype != H
trigger3 = ishelper
fvar(1) = 1.0

[state a];超必補正
type = varset
triggerall = !ishelper
triggerall = time = 1
trigger1 = stateno = [3000,3999]
trigger1 = prevstateno = [200,2999]
trigger2 = stateno = [4000,4999]
trigger2 = prevstateno = [200,3999]
fvar(1) = 0.9*fvar(1)

; 補正
[state a]
type = varset
trigger1 = 1
fvar(5) = fvar(0)*fvar(1)

[state a];補正限界値
type = varset
trigger1 = fvar(5) <= 0.2
fvar(5) = 0.2

[state a]
type = attackmulset
trigger1 = 1
value = fvar(5)*fvar(4)

;--------------------------------------------------------
;根性値

[State -2,]
Type = DefenceMulSet
Triggerall = var(2) = 1
Trigger1 = Alive
Trigger1 = (1000*Life/LifeMax) <= 750
value = fvar(6)

[State -2,]
Type = VarSet
TriggerAll = (1000*Life/LifeMax) > 150
Trigger1 = 1
IgnoreHitPause = 1
FV = 6
Value = 0.75

[State -2,]
Type = VarSet
TriggerAll = (1000*Life/LifeMax) <= 150
Trigger1 = 1
IgnoreHitPause = 1
FV = 6
Value = 0.5

;--------------------------------------------------------
;---端でめくらないように-----
[State -2, 100]
type = Width
trigger1 = p2Dist X >= 0
edge = 3,-3

[State -2, 100]
type = Width
trigger1 = p2Dist X < 0
edge = -3,3

;----------------------------------------------------------------------------
;特定技ヒット後ジャグル増大判定
[State -2, Combo]
type = VarSet
trigger1 = enemynear(var(58)),statetype = L
trigger2 = enemynear(var(58)),movetype != H
trigger3 = enemynear(var(58)),ctrl=1
trigger4 = enemynear(var(58)),stateno = [0,159]
var(12) = 0
ignorehitpause = 1

[State -2, Combo];通常技
type = VarSet
triggerall = enemynear(var(58)),statetype = A
triggerall = movehit
trigger1 = stateno = [200,690]
var(12) = 1
ignorehitpause = 1

[State -2, Combo];必殺技以上
type = VarSet
triggerall = movehit
trigger1 = stateno = 1200
var(12) = 2
ignorehitpause = 1

;----------------------------------------------------------------------------
;空中ガードシステム
[State -2, AirGuard]
type = AssertSpecial
triggerall = var(20) = 1
triggerall = roundstate = 2
trigger1 = 1
flag = noairguard

[State -2, AirGuard]
type = AssertSpecial
triggerall = var(20) >= 1
triggerall = roundstate = 2
trigger1 = 1
trigger1 = p2statetype = A
flag = unguardable

;----------------------------------------------------------------------------
;KO演出

[State a]
type = AssertSpecial
trigger1 = RoundState != 2
flag = nobardisplay

[state a];KO演出
type = Helper
trigger1 = numhelper(9900) = 0
id = 9900
name = "g"
sprpriority = 1
pos = 0,0
postype = p1
stateno = 9900
helpertype = normal
pausemovetime = 999999
keyctrl = 1 
ownpal = 1

;----------------------------------------------------------------------------
;AI用重力加速度計測
[state -2, yaccel]
type = varset
trigger1 = fvar(20) != enemynear(var(58)),const(movement.yaccel)
trigger1 = enemynear(var(58)),stateno != [5000,5210]
trigger1 = enemynear(var(58)),Vel Y != 0
FV = 20
value = enemynear(var(58)),const(movement.yaccel)
ignorehitpause = 1

[state -2, yaccel]
type = varset
trigger1 = fvar(20) != enemynear(var(58)),GetHitVar(yaccel)
trigger1 = enemynear(var(58)),stateno = [5000,5210]
trigger1 = enemynear(var(58)),Vel Y != 0
FV = 20
value = enemynear(var(58)),GetHitVar(yaccel);(打撃当てた時のyaccel値)
ignorehitpause = 1

;敵が空中じゃない時
[state -2, yaccel]
type = varset
trigger1 = fvar(20) != 0
trigger1 = enemynear(var(58)),Vel Y = 0
FV = 20
value = 0;(打撃当てた時のyaccel値)
ignorehitpause = 1

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

;♪

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

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


;デバッグモードに白い文字の表示を加える
[State -2, デバッグ表示]
type = DisplayToClipboard
trigger1 = 1
text = "P2X=%3.1f,Y=%3.1f,Vel X=%2.1f,Y=%2.1f\tSPX =%3.2f"
params = P2BodyDist X,P2Dist Y,Vel X,Vel Y,(ScreenPos X)
ignorehitpause = 1

;表示を横に加える
;[State -2, デバッグ表示その2]
;type = AppendToClipboard
:trigger1 = 1
:text = "\nV59=%d,V57=%d,V56=%d,V54=%d"
:params = var(59),var(57),var(56),var(54)
:ignorehitpause = 1

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

;表示を横に加える
;[State -2, デバッグ表示その2]
;type = AppendToClipboard
;trigger1 = 1
;text = " V22-L=%d,V21-R=%d,Pos X=%d,Y=%d"
;params = var(22),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 1000, ヘルパーを出す]
type = Helper
triggerall = Projhit(3055) = 1
trigger1 = Stateno = 3050
name = "Slow"
stateno = 3500
ID = 3500
helpertype = normal
pos = 0,0
postype = p1
keyctrl = 0
ownpal = 1
ignorehitpause = 1

[State 1001,]
type = AssertSpecial
trigger1 = Var(30) = 1
trigger1 = Stateno = [3000,3050]
flag  = nojugglecheck

[State 1001,]
type = RemoveExplod
trigger1 = Anim != 1550
trigger2 = Movetype != A
ID = 1560

[State 1001,]
type = RemoveExplod
trigger1 = Anim != 3100
trigger2 = Movetype != A
ID = 3100

[State 1001,]
type = RemoveExplod
trigger1 = Anim != 4000 && Anim != 4060
trigger2 = Movetype != A
ID = 4000

[State 1000, 音を鳴らす]
type = PlaySnd
trigger1 = P2Movetype = H
trigger1 = P2Stateno = 1120
trigger1 = P2Statetype = A
trigger1 = enemy, Pos Y >= 0
trigger1 = enemy, Vel Y > 0
value = s12,16

[State 100,]
type = StopSnd
trigger1 = command != "holdfwd"
trigger2 = Anim != 100
channel = 6

[State 100,]
type = StopSnd
trigger1 = Anim != 1300
channel = 13

;---------------------------------------------------------------------------------
;ダメージボイス
;---------------------------------------------------------------------------------
[State -2,]
type = StopSnd
trigger1 = Movetype = H
channel = 10
ignorehitpause = 1

[State -3,]
type = PlaySnd
triggerall = alive = 1
triggerall = random <= 250
triggerall = time = 1
trigger1 = stateno = 5000
trigger1 = anim = 5000 || anim = 5010
trigger2 = stateno = 5010
trigger2 = anim = 5020
value = s11,1

[State -3,]
type = PlaySnd
triggerall = alive = 1
triggerall = random <= 250
triggerall = time = 1
trigger1 = stateno = 5000
trigger1 = anim = 5002 || anim = 5012
trigger2 = stateno = 5010
trigger2 = anim = 5022
value = s11,2

[State -3,]
type = PlaySnd
triggerall = alive = 1
triggerall = random <= 250
triggerall = time = 1
trigger1 = stateno = 5101
value = s11,3

;---------------------------------------------------------------------------------
;NEO MAX背景
;---------------------------------------------------------------------------------
[State 1000, ヘルパーを出す]
type = Helper
triggerall = stateno = 4500
trigger1 = Anim = 3100
trigger1 = time = 30
name = "MAX2"
stateno = 16000
ID = 16000
helpertype = normal
pos = 0,0
postype = p2
keyctrl = 0
ownpal = 1
ignorehitpause = 1

[State 1000, ヘルパーを出す]
type = Helper
triggerall = stateno = 4500
trigger1 = Anim = 3100
trigger1 = Animtime = 0
name = "MAX2END"
stateno = 16005
ID = 16005
helpertype = normal
pos = 0,0
postype = p2
keyctrl = 0
ownpal = 1
ignorehitpause = 1
persistent = 0

[State 1000, ヘルパーを出す]
type = Helper
triggerall = stateno = 4515
trigger1 = Anim = 4515
trigger1 = AnimElem = 12
name = "MAX2END"
stateno = 16005
ID = 16005
helpertype = normal
pos = 0,0
postype = p2
keyctrl = 0
ownpal = 1
ignorehitpause = 1
persistent = 0

;---------------------------------------------------------------------------
;特殊効果対応ステート
;---------------------------------------------------------------------------
;獣を焦がす(tukemon氏秋葉)　相手ステータス変化
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "tukemon&HAL" && Enemy,Name = "Akiha"
Trigger1 = Enemy,Var(56) = 1
Value = -8
Kill = 0

[State -2]
Type = PowerAdd
TriggerAll = Enemy,AuthorName = "tukemon&HAL" && Enemy,Name = "Akiha"
Trigger1 = Enemy,Var(56) = 1
Value = -33

;---------------------------------------------------------------------------
;獣を焦がす(⑨氏秋葉)　相手用
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Akiha_Vermilion"
Trigger1 = Enemy,Var(47) = 1
Value = -5
Kill = 0

[State -2]
Type = PowerAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Akiha_Vermilion"
Trigger1 = Enemy,Var(47) = 1
Value = -26

;---------------------------------------------------------------------------
;パウダースノウ　相手用
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Len"
Trigger1 = Enemy,Var(47) = 1 || Enemy,Var(48) = 1
Value = -Enemy,Var(47)*4-Enemy,Var(48)*4
Kill = 0

;---------------------------------------------------------------------------
;じょうろ　相手用
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Hisui"
Trigger1 = Enemy,Var(47) = 1
Value = -10
Kill = 0

[State -2]
Type = PowerAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Hisui"
Trigger1 = Enemy,Var(47) = 1
Value = -150

;---------------------------------------------------------------------------
;ブラック・クラック　相手用
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Warachia"
Trigger1 = Enemy,Var(47) = 1
Value = -10
Kill = 0

[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Warachia"
Trigger1 = Enemy,Var(47) = 2 || Enemy,Var(47) = 4
Value = -15
Kill = 0

[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Warachia"
Trigger1 = Enemy,Var(47) = 3
Value = -30
Kill = 0

[State -2]
Type = PowerAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Warachia"
Trigger1 = Enemy,Var(47) = 1
Value = 6

[State -2]
Type = PowerAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Warachia"
Trigger1 = Enemy,Var(47) = 2 || Enemy,Var(47) = 3 || Enemy,Var(47) = 4
Value = 15

;---------------------------------------------------------------------------
;現代医学の犠牲者です。　相手用
[State -2]
Type = LifeAdd
TriggerAll = Enemy,AuthorName = "⑨" && Enemy,Name = "Kohaku"
Trigger1 = Enemy,Var(47) = 1
Value = -5
Kill = 0

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