;-2 -3のステートをまとめておく。
;--------------------------------
[Statedef -2];それなり監視ステート

;ダメージ台詞
[State -2,DamegeVoice1]
type = PlaySnd
triggerall = var(40);ボイスＯＫ
triggerall = Alive
triggerall = Random < 400
triggerall = Time = 1
triggerall = movetype = H
triggerall = PrevStateno != [5000,5030]
trigger1 = anim = [5000,5030];何か条件あれば足す
value = 1,11;
channel = 0;VC

;簡易攻撃力補正
[State Attackfv]
type = varset
trigger1 = Numtarget
trigger1 = Target,Gethitvar(hitcount) >= 1
;fvar(10) = 1.0/(Target,Gethitvar(hitcount)+1)
fvar(10) = 1.0-(Target,Gethitvar(hitcount)/30.0)
ignorehitpause=1
;マスタースパーク補正
[State Attackfv]
type = varset
trigger1 = Stateno != [3000,3019];マスパステート
trigger1 = !numhelper(3013);マスパ補正
fvar(11) = 1.0
;ignorehitpause=1
[State Attackfv]
type = varset
trigger1 = Stateno = [3000,3019];マスパステート
trigger1 = numhelper(3013);マスパ
trigger1 = helper(3013),Hitcount >= 1
fvar(11) = 1.0-(helper(3013),Hitcount/700.0)-(Target,Gethitvar(hitcount)/60.0)
ignorehitpause=1
;ヴァリアブル中補正
[State Attackfv]
type = varset
trigger1 = Stateno = [3050,3099];まりす砲など
trigger1 = Numtarget
trigger1 = Target,Gethitvar(hitcount) >= 1
;fvar(10) = 1.0/(Target,Gethitvar(hitcount)+1)
fvar(10) = 1.0-(Target,Gethitvar(hitcount)/180.0)
ignorehitpause=1
[State Attackfv]
type = varset
trigger1 = Stateno = [3050,3099];まりす砲など
trigger1 = numhelper(3060);ノンディレ
trigger1 = helper(3060),Hitcount >= 1
fvar(11) = 1.0-(helper(3060),Hitcount/90.0)
ignorehitpause=1
;補正無し
[State Attackfv]
type = varset
trigger1 = !Numtarget
fvar(10) = 1.0 * fvar(11)
ignorehitpause=1

;MAX時のガーキャンとかも実装する？
;パワーＭＡＸ時の補正
[State -2, ParamMAX]
type = AttackMulSet
triggerall = fvar(10) > 0;補正値０以上
trigger1 = Numhelper(10010)
trigger1 = var(5) = -1
trigger1 = var(6) > 0;var6がある
value = 1.5 * fvar(10)
[State -2, ParamMAX]
type = AttackMulSet
triggerall = fvar(10) <= 0;補正値０未満
trigger1 = Numhelper(10010)
trigger1 = var(5) = -1
trigger1 = var(6) > 0;var6がある
value = 0
;通常時の補正
[State -2, ParamNOR]
type = AttackMulSet
triggerall = fvar(10) > 0;補正値０以上
trigger1 = !Numhelper(10010)
trigger2 = var(5) != -1
;trigger1 = var(5) != -1
;trigger1 = var(6) = 0;
;trigger2 = var(5) = -1
;trigger2 = var(6) = 0;
value = 1.0 * fvar(10)
[State -2, ParamNOR]
type = AttackMulSet
triggerall = fvar(10) <= 0;補正値０未満
trigger1 = !Numhelper(10010)
trigger2 = var(5) != -1
;trigger1 = var(5) != -1
;trigger1 = var(6) = 0;
;trigger2 = var(5) = -1
;trigger2 = var(6) = 0;
value = 0

;通常時防御力
[State ArmDefNor]
type = DefenceMulSet
trigger1 = Stateno = 0
value = 1
;マスターブレード時防御補正＋死亡時のレーザー消去
[State RemLZ]
type = RemoveExplod
trigger1 = NumExplod(3090) && !alive
id = 3090;レーザーをけしとく
[State ArmDef]
type = DefenceMulSet
trigger1 = Stateno = 3094
value = 3.5

;パワーＭＡＸ時の本体エフェクト
[State -2, 2nd Flash]
type = PalFX
trigger1 = var(5) = -1
trigger1 = var(6) > 0;var6がある
trigger1 = TimeMod = 4,0
time = 2
add = 128,128,80

;パワーＭＡＸ時のゲージ管理
[State -2,MAXGUAGETIME]
type = Varadd
trigger1 = var(5) = -1
trigger1 = var(6) >= 0;var6がある
trigger1 = Stateno != 3010;一部技演出中は停止させる
trigger1 = Stateno != 30410;一部技演出中は停止させる
var(6) = -4

;ゲージが0になったならすみやかに通常状態へ移行する
[State -2,WPNNORMAL]
type = Varset
trigger1 = var(5) = -1
trigger1 = var(6) <= 0;var6がありません
var(5) = 0

;バスターチャージ関連

;ぱわーちゃーじ
;[State -2, Reset Hits]
;type = VarSet
;triggerall = Command != "holdx"
;trigger1 = numproj != 0
;trigger2 = Var(2) > 0
;var(0) = 0

;[State -2, Charge X-Buster Hits]
;type = VarAdd
;triggerall = timemod = 50,10
;trigger1 = Command = "holdx"
;trigger1 = Var(2) = 0
;trigger1 = ctrl
;var(0) = 1

;[State -2, Charge Reset 1];りせっと状況その１
;type = VarSet
;triggerall = Command != "holdx"
;trigger1 = !ctrl ;コントロールできない状況で離したらリセットかかるようにする
;trigger1 = numproj != 0
;trigger2 = Var(2) > 0
;var(1) = 0

[State -2, Charge Reset 1];りせっと状況その１
type = VarSet
trigger1 = !var(59)
trigger1 = Command != "holdx" ;ボタンを離した状態
trigger1 = var(1) < 30 ;まだミドルチャージがはじまってないなら
trigger2 = var(59)	;AI時
trigger2 = var(39) = 0	;0 = ボタンを離した状態
trigger2 = var(1) < 30 ;まだミドルチャージがはじまってないなら
trigger3 = roundstate != 2;戦闘中以外
var(1) = 0

;var(39)を擬似ショットボタン("holdx"の代わり)として使っちゃってくれて結構です。
;チャージじゃない単発バスターのほうは、普通の記述でも大丈夫・・・？（まだ怪しいかもしれないです）
;こんな感じでしょうか
;[State Shot]
;type = varset
;trigger1 = ***
;var(39) = * ;0 or 1

[State -2, Charge Reset 1];りせっと状況その２・特定ステートの時など
type = VarSet
trigger1 = Stateno = [70001,70099];テーレッテー
trigger2 = Stateno = [3090,3095];マスターブレード
var(1) = 0

[State -2, Max Charge]
type = VarSet
trigger1 = Var(1) >= 400
var(1) = 400

[State -2, Charge Buster]
type = VarAdd
trigger1 = !var(59)
trigger1 = Command = "holdx"
;ＡＩセット時の記述を書いてません。ＡＩ作成の時は状況に応じて追記してっていただければ。
trigger2 = var(59)	;AI時
trigger2 = var(39) = 1	;1 = ボタンを押した状態
var(1) = 1

[State -2, Remove Charge]
type = RemoveExplod
;trigger1 = !var(59)
;trigger1 = Command != "holdx"
trigger1 = var(1) < 30 ;まだミドルチャージがはじまってないなら
id = 30050

[State -2, Remove Charge]
type = RemoveExplod
;trigger1 = !var(59)
;trigger1 = Command != "holdx"
trigger1 = var(1) < 100 ;まだミドルチャージがはじまってないなら
id = 30051

[State -2, ChargeSTOP]
type = stopsnd
trigger1 = var(1) < 30;チャージ30未満のときはチャージ音をけす
channel=4;

;-------

[State -2, 1st Blue]
type = PalFX
triggerall = var(1) >= 30
triggerall = var(1) <= 100
trigger1 = TimeMod = 4,0
time = 2
add = 0,100,30

;ちゃーじ音
[State -2, 1st Charge]
type = playsnd
triggerall = var(1) = 30
;triggerall = var(1) >= 30
;triggerall = var(1) <= 33;31
;trigger1 = TimeMod = 4,0
trigger1 = 1
value = S0,10
channel=4;サウンド止め用テスト

;チャージアニメ。多分
[State -2, 1st Charge]
type = Explod
trigger1 = var(1) >= 30
trigger1 = var(1) <= 100
trigger1 = !numexplod(30050)
trigger1 = (Command = "holdx")||var(59)
trigger1 = (stateno != [220,225])&&(stateno != [420,425])&&(stateno != [620,625]) 
;trigger1 = TimeMod = 1,0
anim = 30050
id = 30050
pos = 3,-45;0
bindtime = -1
;ownpal = 1
ontop = 5

[State -2, Remove Charge]
type = RemoveExplod
;trigger1 = command != "holdx"
;trigger2 = var(1) >= 100
trigger1 = !var(59)
trigger1 = Command != "holdx"
trigger2 = var(59)	;AI時
trigger2 = var(39) = 0	;
trigger3 = var(1) >= 100
id = 30050

;---
[State -2, 2nd Flash]
type = PalFX
triggerall = var(1) >= 100
triggerall = var(1) <= 300
trigger1 = TimeMod = 4,0
time = 2
add = 0,130,200


;チャージアニメ。多分
[State -2, 2nd Charge]
type = Explod
trigger1 = var(1) >= 100
;trigger1 = var(1) <= 300
trigger1 = !numexplod(30051)
trigger1 = (Command = "holdx")||var(59)
trigger1 = (stateno != [220,225])&&(stateno != [420,425])&&(stateno != [620,625]) 
;trigger1 = TimeMod = 1,0
anim = 30051
id = 30051
pos = 3,-45;0
bindtime = -1
;ownpal = 1
ontop = 5

[State -2, Remove Charge]
type = RemoveExplod
;trigger1 = command != "holdx"
;trigger2 = var(1) = 300
trigger1 = !var(59)
trigger1 = Command != "holdx"
trigger2 = var(59)	;AI時
trigger2 = var(39) = 0	;
trigger3 = var(1) >= 100
id = 10012

;---
[State -2, 3rd Flash]
type = PalFX
triggerall = var(1) >= 250
trigger1 = TimeMod = 4,0
time = 2
add = 0,255,128

;[State -2, 3rd Charge]
;type = Explod
;triggerall = var(1) >= 300
;triggerall = numexplod = 0
;trigger1 = TimeMod = 1,0
;anim = 10012
;id = 10012
;pos = 0,0
;bindtime = -1
;ownpal = 1
;ontop = 5

[State -2, 3rd Charge]
type = playsnd
triggerall = var(1) >= 247
triggerall = var(1) <= 250
trigger1 = TimeMod = 4,0
value = S0,33;S246, 3;フルチャージ音ヲせっと
channel=4;

[State -2, Final Flash]
type = PalFX
triggerall = power >= 3000
triggerall = var(1) >= 250;400
;trigger1 = TimeMod = 4,0
;time = 2
;add = 250,250,250
;sinadd = 255,223,45
trigger1 = Time % 2;TimeMod = 2,0
trigger1 = (Time + 11) % 32 != 0;
time = 1;3
add = 256,256,256
mul = 128,64,256;256-((Time % 16)*8),256-(((Time + 11) % 32)*8),256-(((Time + 22) % 32)*8)
;sinadd = 0,0,256,20

[State -2, Remove Charge]
type = RemoveExplod
;trigger1 = command != "holdx"
trigger1 = !var(59)
trigger1 = Command != "holdx"
trigger2 = var(59)	;AI時
trigger2 = var(39) = 0	;
id = 10012

;---------------------
;決着時エフェクト
[State -2, Finish Explod KO]
type = Helper
triggerall = RoundState = 3;var(*) = 0
triggerall = !NumHelper(15000)
trigger1 = winko;勝ったときか
trigger2 = loseko;まけたとき
helpertype = normal
name = "15000"
id = (15000)
pos = -250,-260
bindtime = -1
postype = left
stateno = 15000;6010
keyctrl = 0
persistent = 0
ownpal = 1
pausemovetime = 999999999999999999999
supermovetime = 999999999999999999999
ignorehitpause = 1

;---------------------
;やられカットイン
[State YARARETA,BAKURA]
type = Helper
triggerall = !Alive && (NumHelper(6010) = 0)
triggerall = RoundState = [1,3]
triggerall = HitOver = 0;自分がやられている時に。
;triggerall = RoundState <= 3
;trigger1 = !Alive && (NumHelper(6010) = 0)
;trigger1 = RoundState <= 3
;triggerall = StateNo != 5150
;trigger1 = 1;実験用トリガー　コメアウト
trigger1 = enemynear,stateno = [3000,4999]
trigger2 = enemynear,stateno = 2001 && enemynear,name = "Shadow DIO"
trigger3 = enemynear,stateno = 2012 && enemynear,name = "Shadow DIO"
trigger4 = enemynear,stateno = 3001 && enemynear,name = "Shadow DIO"
trigger5 = enemynear,stateno = 2206 && enemynear,name = "Shadow DIO"
trigger6 = enemynear,stateno = 2025 && enemynear,name = "Shadow DIO"
helpertype = normal
name = "6010"
id = (6010)
pos = -250,-260
bindtime = -1
postype = left
stateno = 6010
keyctrl = 0
persistent = 0
ownpal = 1
pausemovetime = 999999999999999999999
supermovetime = 999999999999999999999
ignorehitpause = 1

[State YARARETA,BAKURA SUIMU]
type = Helper
;triggerall = !Alive && (NumHelper(6011) = 0)
triggerall = RoundState <= 3
trigger1 = enemynear,name="Marisa Kirisame";相手が本家魔理沙だった場合
trigger1 = (NumHelper(6011) = 0); && winko
trigger1 = enemynear,stateno = 1253
;レーザーオブアイリスの破壊は1253-4
helpertype = normal
name = "6010-1"
id = (6011)
pos = -250,-260
bindtime = -1
postype = left
stateno = 6011
keyctrl = 0
persistent = 0
ownpal = 1
pausemovetime = 999999999999999999999
supermovetime = 999999999999999999999
ignorehitpause = 1

;アクセルフォーム----------------
;アクセルフォーム加速状態の制御。
;案１
[State Pause];
type = null;Pause;
trigger1 = gametime%4 = 0
trigger1 = var(5) = -2;アクセルモードで
trigger1 = var(6) > 0;var6がある
time = 2
movetime = 2
;案２
[State Pause];
type = Pause;
trigger1 = gametime%8 = 0
trigger1 = var(5) = -2;アクセルモードで
trigger1 = var(6) > 0;var6がある
time = 4
movetime = 4
;残像
[State Axel]
Type        = AfterImage
triggerall = var(5) = -2;アクセルモードで
triggerall = var(6) > 0;var6がある
trigger1 = prevstateno != 20
trigger1 = prevstateno != [50,52]
trigger1 = time = 1
Time        = -1
Trans       = Add
Length      = 20
TimeGap     = 1
FrameFap    = 1
PalBright   = 10,10,10;0  , 0  , 0
PalContrast = 0,220,40;0  , 0  , 150
;PalAdd      = 0  , 0  , 0
;PalMul      = .5 , .5 , .5
;攻撃力補正
[State -2, ParamAXEL]
type = AttackMulSet
trigger1 = Numhelper(10010)
trigger1 = var(5) = -2;Axel
trigger1 = var(6) >= 0;var6がある
value = .6
;ゲージ減少
[State -2,AXELGUAGETIME]
type = Varadd
trigger1 = var(5) = -2;あくせる
trigger1 = var(6) >= 0;var6がある
trigger1 = movetype != A;攻撃中でない
trigger1 = Stateno != 3010;一部技演出中は停止させる
var(6) = -6
;ゲージ減少２・攻撃時は更に減少
[State -2,AXELGUAGETIME]
type = Varadd
trigger1 = var(5) = -2;あくせる
trigger1 = var(6) >= 0;var6がある
trigger1 = movetype = A;攻撃中でない
trigger1 = Stateno != 3010;一部技演出中は停止させる
var(6) = -12

;発動中の背景
;ゲージヘルパーでやっとく
[State -2,AxelBG]
type = null;BGPalFX;この処理はゲージヘルパーに移動しますた　詳しくは「SasugaFightingROBERT.st」にて
trigger1 = var(5) = -2;あくせる
trigger1 = gameTime % 2 = 0;TimeMod = 2,0
time = 2;目にやさしくしたい時は値を２にした上で下の魔砲虹のownpalを０にしてください
add = 128,128,128
;mul = 128,64,256;256-((Time % 16)*8),256-(((Time + 11) % 32)*8),256-(((Time + 22) % 32)*8)
;color = 0;グレースケール
color = 96;色彩うすめに。

;タイムあうと
[State -2,AxelTimeOut]
type = changestate
trigger1 = ctrl
trigger1 = Stateno != 30415
trigger1 = pos Y >= 0;地上
trigger1 = statetype != A;空中じゃない
trigger1 = var(5) = -2;あくせる
trigger1 = var(6) <= 0;var6がじかんぎれ
value = 30415

;北斗七星------------------------
;あふろん氏のを参考に、4000番で管理する。詳しくはtehletteh.stにて
[State NorthStarGuage]
type = Helper
triggerall = !numhelper(4000)
;trigger1 = TeamMode = single
;trigger2 = TeamMode = turns
trigger1 = 1;無条件で。ゲージ表示はヘルパーまかせに
id = 4000
name = "NorthStarGuage"
sprpriority = 10
Pos = 0,0
PosType = left;p1
stateno = 4000
helpertype = normal
pausemovetime = 0
bindtime = -1
keyctrl = 0 
ownpal = 1

[State Star]
type = varset
trigger1 = var(41) <= 0
var(41) = 0

[State Star]
type = varset
trigger1 = var(41) >= 7
var(41) = 7


;--------------------------------
;ストライカー関連
[State -2,Alice]
type = varadd
trigger1 = var(30) > 0;カウンターが０になってない
var(30) = -1
[State -2,Spilitia]
type = varadd
trigger1 = var(31) > 0;カウンターが０になってない
var(31) = -1
[State -2,Patche]
type = varadd
trigger1 = var(32) > 0;カウンターが０になってない
var(32) = -1
;--------------------------------
;[Statedef -3];常時監視ステート

[State -3, State];てぃうんてぃうん
type = SelfState
;triggerall = Var(20) >= 0
trigger1 = MatchOver 
trigger1 = TeamMode = single
trigger2 = TeamMode = simul;まっちおーばーか、シングル以外か
trigger3 = TeamMode = turns
;triggerall = StateNo < 5150 || StateNo >= 5160
triggerall = !var(4);ティウンは一回だけでいい。その制御フラグ
triggerall = !Alive
value = 5151

[State *,*];BGMストップ
type = AssertSpecial
trigger1 = MatchOver 
trigger1 = TeamMode = single
;trigger2 = LoseKO
;trigger2 = TeamMode = simul;まっちおーばーか、シングル以外か
trigger3 = TeamMode = turns;このモードでは毎回ティウン
;triggerall = StateNo < 5150 || StateNo >= 5160
triggerall = !Alive
flag = nomusic
ignorehitpause = 1

[State PowRESET]
type = VarSet
trigger1 = var(4);ティウンしたなら発動
v = 1
value = 0

;うおおおおっ、ぐふぁっ
;[State -3, State]
;type = Playsnd
;triggerall = Time <= 1
;triggerall = !MatchOver
;trigger1 = !Alive
;value = 1,14;うおおおおっぐふぁ
;channel=0;VC
;persistent = 0

[state -2,kabegekitotz]
type = explod
;triggerall = var(42)
triggerall = Var(0);特定の攻撃でVar0が立っている時出す
triggerall = enemy,stateno != [120,159]
triggerall = enemynear, stateno != 5040
triggerall = !numexplod(6016);Timemod = 5,0;
trigger1 = numtarget
trigger1 = enemynear,movetype = h
trigger1 = enemynear,backedgedist <= 15
trigger1 = enemynear,statetype = a
trigger1 = enemynear,vel x < 0
anim = 4033;3010;6016
;pos = (enemy,const(size.mid.pos.x))-20,(target,const(size.mid.pos.y))
pos = (enemy,const(size.mid.pos.x))-20,(target,const(size.mid.pos.y))
postype = p2
sprpriority = 3
bindtime = 1
facing = -1
removetime = -2
id = 6016
shadow = -1
ownpal = 1

;[State -3,STOPBGM];BGMストップ
;type = AssertSpecial
;triggerall = Win
;trigger1 = var(20) = 1;BGMが流れ出したなら
;flag = nomusic
;これはヘルパーで制御したほうが良い模様である
[State -3,STOPBGM HELPER]
type = Helper
trigger1 = var(20) = 1;var20がオンになったら
trigger1 = !Numhelper(37000);かぶってないか確認
ID = 37000
Name = "STOPBGM HELPER"
Pos = 0,0
PosType = left;p1
StateNo = 37000
helpertype = Normal
Keyctrl = 0
ownpal = 1
pausemovetime = 99999999999999
supermovetime = 99999999999999
facing = 1

[State *,*];KO/BGMストップ・自前BGM 1
type = StopSnd
trigger1 = MatchOver 
trigger1 = TeamMode = single
;trigger2 = LoseKO
;trigger2 = TeamMode = simul;まっちおーばーか、シングル以外か
trigger3 = TeamMode = turns;このモードでは毎回ティウン
;triggerall = StateNo < 5150 || StateNo >= 5160
triggerall = !Alive
channel = 2;BGM

[State *,*];KO/BGMストップ・自前BGM 2
type = StopSnd
triggerall = RoundState = 3;var(*) = 0
trigger1 = Stateno = [35000,35999];特殊武器フィニッシュ
trigger1 = winko;勝ったときか
trigger2 = loseko;まけたとき
channel = 2;BGM


;ケンシロウ　8804 トキ　8804 ジャギ　8803 ラオウ　8804 ドロウィン北斗キャラ
;シン　2501　レイ　2502　サウザー　2502　アフロン北斗キャラ

[State *,*];BGMストップ・他のキャラのBGMが再生された時　自前BGM側　直近キャラ
type = varset
trigger1 = (Enemynear,name = "MegaMari")
trigger1 = (Enemynear,Stateno = 3502)
trigger2 = (Enemynear,authorname = "Drowin hokuto");ドロウィン北斗
trigger2 = (Enemynear,Stateno = [8803,8804])
trigger3 = (Enemynear,authorname = "ahuron");アフロン北斗
trigger3 = (Enemynear,name = "SHIN")||(Enemynear,name = "REI")||(Enemynear,name = "THOUTHER")
trigger3 = (Enemynear,Stateno = [2501,2502])
var(20) = 0

[State *,*];BGMストップ・他のキャラのBGMが再生された時　自前BGM側　もう一体のキャラ
type = varset
triggerall = NumEnemy >= 2;敵が複数の場合
trigger1 = (Enemynear(1),name = "MegaMari")
trigger1 = (Enemynear(1),Stateno = 3502)
trigger2 = (Enemynear(1),authorname = "Drowin hokuto")
trigger2 = (Enemynear(1),Stateno = [8803,8804])
trigger3 = (Enemynear(1),authorname = "ahuron");アフロン北斗
trigger3 = (Enemynear(1),name = "SHIN")||(Enemynear(1),name = "REI")||(Enemynear(1),name = "THOUTHER")
trigger3 = (Enemynear(1),Stateno = [2501,2502])
var(20) = 0

[State *,*];BGMストップ・他のキャラのBGMが再生された時　自前BGM側　パートナーキャラ
type = varset
;triggerall = Teammode = simul;simulの場合
triggerall = NumPartner ;パートナーがいます　Teammodeでの判定は推奨されない？
trigger1 = (partner,name = "MegaMari")
trigger1 = (partner,Stateno = 3502)
trigger2 = (partner,authorname = "Drowin hokuto")
trigger2 = (partner,Stateno = [8803,8804])
trigger3 = (partner,authorname = "ahuron");アフロン北斗
trigger3 = (partner,name = "SHIN")||(partner,name = "REI")||(partner,name = "THOUTHER")
trigger3 = (partner,Stateno = [2501,2502])
var(20) = 0

[State *,*];BGMストップ・他のキャラのBGMが再生された時　共通処理　var20が解除されたなら止めれ
type = StopSnd
trigger1 = var(20) = 0
channel = 2;BGM

;オーノーアナルパワー
[State OH NO!!]
type = ChangeState
trigger1 = Stateno = 0;立ちステートである
trigger1 = var(5) > 0;武器装備中である
trigger1 = var(6) <= 0;エネルギー切れである
value = 36000;移行せよ

[State Clip];何か参照したいときに手軽に使う
type = DisplayToClipboard
trigger1 = 1
text = "at = %f "
params = fvar(10);,  helper(3013),Hitcount
