;--------------------------------------------------------------------
; ■『コモンステート』について■
; コモンステートとは、全キャラ共通の基本動作のステートです。
; 通常は特に変更しない限り、M.U.G.E.N本体のdataフォルダにある
;「common1.cns（コモンステートファイル）」を使います。
;
; しかし、もしもあなたのキャラのステートファイルでcommon1.cnsと同じ番号の
; 基本動作のステートを作った場合は処理が上書きされ、
; common1.cns側の同じ番号のステートは無効になります。
;
; common1.cnsのプログラム優先度は最低に属しているので、
; ステートの作成には番号に注意しないといけません。
;=====================================================================
; 上書きした一部のコモンステート
;=====================================================================
;通常立ち・改
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, アニメ変更]
type = ChangeAnim
trigger1 = (Anim != 0) && (Anim != 5)
trigger2 = (Anim = 5) && (AnimTime = 0)
value = 0

[State 0, アニメ変更]
type = ChangeAnim
trigger1 = (prevstateno = [1700,1703])
value = 0
elem = 10
persistent = 0

[State 0, 移動速度]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 移動速度]
type = VelSet
trigger1 = (abs(Vel X) < 2) ;absは『Absolute（絶対値）』
trigger2 = Time = 4
trigger3 = (PrevStateNo = 20) && (Time = 0)
x = 0

[State 0, ステート変更]
type = ChangeState
trigger1 = (!Alive)
value = 5050

[State 0, ヘルパーを消す];ヘルパー分身バグ対策
type = DestroySelf
trigger1 = (IsHelper) ;このプレイヤーが「ヘルパーオブジェクト」だったら

;--------------------------------------------------------------------
;ジャンプ開始・改
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 変数];※システム用
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 変数];※システム用
type = VarSet
trigger1 = (command = "holdfwd")
sysvar(1) = 1

[State 40, 変数];※システム用
type = VarSet
trigger1 = (command = "holdback")
sysvar(1) = -1

[State 40, 移動速度]
type = VelSet
trigger1 = var(0)=1
trigger1 = AnimTime = 0
x = const(velocity.jump.fwd.x)
y = const(velocity.jump.y)

[State 40, 移動速度]
type = VelSet
trigger1 = var(0)=0
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 振り返る]
type = Turn
triggerall = (PrevStateNo = 52)
trigger1 = (Time = 0) && (P2Dist X < 0)
Persistent = 0

[State 40, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
value = 0,17

[State 40, ステート変更]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;-------------------------------------------------------------------
;空中下降・改
[Statedef 51]
type     = A
movetype = I
physics  = A
ctrl     = 1
poweradd = 0

[State 51, アニメ変更]
type = ChangeAnim
trigger1 = (PrevStateNo = [700,701]) && (Time = 0)
trigger2 = (PrevStateNo = 800) && (Time = 0)
value = 41
elem = 5
Persistent = 0

;--------------------------------------------------------------------
;着地・改
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = 47

[State 52, 軸位置];地面に軸をリセットする
type = PosSet
trigger1 = 1
y = 0

[State 52, 移動速度];速度をリセットしている
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 52, コントロール]
type = CtrlSet
triggerall = (PrevStateNo = [600,699])
trigger1 = (Time > 0)
value = 1

[State 52, 振り返る]
type = Turn
trigger1 = (AnimTime = 0) && (P2Dist X < 0)
trigger2 = (AnimElemTime(1) = 0) && (P2Dist X < 0)

[State 52, エフェクト]
type = Explod
trigger1 = Time = 0
anim = 20034
postype = p1
pos = 0,0
scale = 0.5,0.5
sprpriority = -1
ownpal = 1
ID = 4020

[State 52, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
value = 52,0

[State 52, ステート変更]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
; 前ダッシュ
[Statedef 2999]
type = S
movetype = I
physics = N
ctrl = 0
anim = 100
facep2 = 1
sprpriority = 1

[State 100, posset]
type = posset
trigger1 = animelem = 1
y = 0

[State 100, VelSet]
type = VelSet
trigger1 = Animelem = 2
x = 20
y = -2

[State 52, 音を鳴らす]
type = PlaySnd
trigger1 = Animelem = 2
value = 4,0

[State 100, VelSet]
type = Veladd
trigger1 = Animelem = 2,>=0
y = 0.6

[State 100, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, ステート変更]
type = ChangeState
trigger1 = animelem = 4,>=0
trigger1 = vel X > 0
trigger1 = pos Y >= 0
value = 101
;+++++++++++++++++++++++++
[Statedef 101]
type    = S
physics = N
ctrl = 0
anim = 101
sprpriority = 1

[State 101, posset]
type = posset
trigger1 = time = 0
y = 0
[State 101, VelSet]
type = VelSet
trigger1 = time = 0
x = 0
y = 0

[State 52, エフェクト]
type = Explod
trigger1 = Time = 0
anim = 20034
postype = p1
pos = 0,0
scale = 0.5,0.5
sprpriority = -1
ownpal = 1
ID = 4020

[State , Ctrlset]
type = Ctrlset
trigger1 = AnimelemTime(3) >= 0
value = 1

[State 101, ステート変更]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;--------------------------------------------------------------------
; ※１：AssertSpecial
;
; 　他のコントローラでは設定出来ない『特殊な効果』を指定する命令。
; 　設定したトリガーが有効になってる間だけ一時的に適用される。
;
; 　適用出来るパラメータはこのコントローラを一つ設置する場合、最大３つまで。
; 　書式としては「flag」「flag2」「flag3」を順に加えていく形。
; 　flag2とflag3はオプション。ではその特殊効果を全て紹介。
;
; 　Intro          = イントロ（試合開始前の登場演出アクション）の状態になる。イントロステート専用。
; 　Invisible      = 自分の姿を消す。しかし残像（AfterImage）は消せない。
; 　RoundNotOver   = 現在のラウンドを過ぎない。勝利ポーズ専用。
; 　NoBarDisplay   = ライフバーを非表示にする。
; 　NoBG           = ステージの奥の画像を非表示にし、「真っ黒の背景」にする。
; 　NoFG           = ステージの手前の画像を非表示にする。
; 　NoStandGuard   = 立ちガードが出来なくなる。
; 　NoCrouchGuard  = しゃがみガードが出来なくなる。
; 　NoAirGuard     = 空中ガードが出来なくなる。
; 　NoAutoTurn     = 自動で振り向かない。
; 　NoJuggleCheck  = ジャグルをチェックしない。（ジャグルポイントが減らなくなる）
; 　NoKOSnd        = ＫＯ時の音声（11,0）を鳴らさないようにする。画面中に存在する全員に有効なので注意。
; 　NoKOSlow       = ＫＯ時のスローモーションを無効にする。（ＫＯ直前に有効にしないといけない）
; 　NoShadow       = 自分の影を消す。
; 　GlobalNoShadow = 画面中に存在する全てのプレイヤー（ヘルパーとProjectileも含む）の影を消す。
; 　NoMusic        = 演奏しているＢＧＭを止める。（プラグインによってはＢＧＭがバグるので要注意）
; 　NoWalk         = 歩かない。（前か後ろのキーを入力中コントロールが可能の時に勝手に[Statedef 20]にならない）
; 　TimerFreeze    = タイムカウント（制限時間）を停止する。
; 　UnGuardable    = 自分の全ての攻撃が『ガード不可』になる。
;
;--------------------------------------------------------------------
;バックステップ・改
[Statedef 105]
type     = A
movetype = I
physics  = A
anim     = 105
ctrl     = 0
sprpriority = 1

[State 105, 移動速度]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State ,無敵]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 1

[State 52, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 1
value = 4,0

[State 105, ステート変更]
type = ChangeState
trigger1 = (Time > 0) && (Pos Y >= 0)
value = 52

;------------------------------------------------------------
; SGUARDHIT (shaking)
[Statedef 150]
type    = S
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = ChangeAnim
trigger1 = 1
value = 150

[state ]
type = PalFX
triggerall = var(8) > 0
trigger1 = TIME = 0
time = 10
add = 200,200,200
persistent = 0
ignorehitpause=1

[State 150, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 150, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 150, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 3

;--------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type    = C
movetype= H
physics = N
velset = 0,0

[State 152, 1]
type = ChangeAnim
trigger1 = 1
value = 151

[state ]
type = PalFX
triggerall = var(8) > 0
trigger1 = TIME = 0
time = 10
add = 200,200,200
persistent = 0
ignorehitpause=1

[State 152, 3]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2*(command = "holddown")

[State 152, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 152, 4]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4

;-------------------------------------------------------------------
; AGUARDHIT (shaking)
[Statedef 154]
type    = A
movetype= H
physics = N
velset = 0,0

[State 154, 1]
type = ChangeAnim
trigger1 = 1
value = 152

[state ]
type = PalFX
triggerall = var(8) > 0
trigger1 = TIME = 0
time = 10
add = 200,200,200
persistent = 0
ignorehitpause=1

[State 154, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 155 ;AGUARDHIT2

[State 154, 3]
type = ForceFeedback
trigger1 = time = 0
waveform = square
time = 4








;---------------------------------------------------------------------------
; SGUARDHIT2 (knocked back)
[Statedef 151]
type    = S
movetype= H
physics = S
anim = 150

[State 151, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 151, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
trigger3 = (palno = [7,12])
trigger3 = var(9) = 10
trigger3 = Time >= floor(GetHitVar(slidetime)-3)/2
x = 0



[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
trigger2 = (palno = [1,6])
trigger2 = var(9) = 10
trigger2 = Time >= GetHitVar(ctrltime)-5
trigger3 = (palno = [7,12])
trigger3 = var(9) = 10
trigger3 = Time >= GetHitVar(ctrltime)-3
value = 1

[State 151, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 151, 4]
type = ChangeState
trigger1 = HitOver
trigger2 = var(9) = 10
trigger2 = Time >= GetHitVar(ctrltime)-5
value = 130
ctrl = 1

;---------------------------------------------------------------------------
; CGUARDHIT2 (knocked back)
[Statedef 153]
type    = C
movetype= H
physics = C
anim = 151

[State 153, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 151, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
trigger3 = var(9) = 10
trigger3 = Time >= floor(GetHitVar(slidetime)-3)/2
x = 0

[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
trigger2 = var(9) = 10
trigger2 = Time >= GetHitVar(ctrltime)-3
value = 1

[State 153, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
statetype = S
physics = S

[State 153, 4]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1
;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type    = A
movetype= H
physics = N
anim = 152

[State 155, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 155, 2]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)

[State 155, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
trigger2 = var(9) = 10
trigger2 = Time >= GetHitVar(ctrltime)-3
value = 1

[State 155, 4]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0) && (vel y > 0)

[State 155, 5]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 155, 6]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

[State 155, 7]
type = ChangeState
trigger1 = sysvar(0)
value = 52










;=====================================================================
;勝利ポーズ分岐（common1.cnsには無いけど、これもコモンステート）
[Statedef 180]
type = S
ctrl = 0

;ストーリーボードを登録してない場合のキャラのエンディングは
;「Congratulations!」の文字が表示され勝利ポーズを取るものが
;デフォルトになります。
;***********************************
[State 180, ステート変更]
type = ChangeState
triggerall = (NumEnemy)
trigger1 = random < 330
value = 181

[State 180, ステート変更]
type = ChangeState
triggerall = (NumEnemy)
trigger1 = random < 500
value = 182

[State 180, ステート変更]
type = ChangeState
triggerall = (NumEnemy)
trigger1 = 1
value = 183
;--------------------------------------------------------------------
;--------------------------------------------------------------------
;勝利ポーズ１（I am your god）
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0
sprpriority = 1

[State 181, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
value = 0,9
Persistent = 0

[State 181, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 20
value = 0,14
Persistent = 0

[State 181, エフェクト]
type = Explod
trigger1 = (Time = 20)
anim = 20007
postype = p1
pos = 45,-100
removetime = 500
scale = 0.5,0.5
sprpriority = 2
ownpal = 1
Persistent = 0

[State 181, エフェクト]
type = Explod
trigger1 = (Time = 20)
anim = 20007
postype = p1
pos = -50,-100
removetime = 500
scale = 0.5,0.5
sprpriority = 2
ownpal = 1
Persistent = 0

[State 181, 特殊効果];これが有効な間は次のラウンドへは進まない
type = AssertSpecial
trigger1 = Time = [0,220]
flag = RoundNotOver ;現在のラウンドを過ぎない

;--------------------------------------------------------------------
;勝利ポーズ２（後ろ向き）
[Statedef 182]
type = S
ctrl = 0
anim = 181
velset = 0,0
sprpriority = -4

[State 182, 特殊効果]
type = AssertSpecial
trigger1 = Time = [0,260]
flag = RoundNotOver

[State 182, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 1
value = 50003,3

[State 182, エフェクト];かつら
type = Explod
trigger1 = animelem = 10
anim = 10181
removetime = 5000
postype = p1
pos = 0,0
scale = 0.9,1.05
sprpriority = 2
ownpal = 1

[State 182, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 20
value = 4,0
Persistent = 0

[State 182, 音を鳴らす]
type = PlaySnd
trigger1 = animelem = 36
value = 50003,1
Persistent = 0

[State ]
type = Envshake
trigger1 = animelem = 36
time = 10
freq = 120
ampl = -5

[State 182, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 5
value = 0,23
Persistent = 0
;--------------------------------------------------------------------
;勝利ポーズ３（ジャンプした後ガッツポーズ）
[Statedef 183]
type    = S
physics = N
ctrl    = 0
anim    = 195
velset  = 0,0
sprpriority = 1

[State 183, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 1
value = 0,13

[State 183, 特殊効果]
type = AssertSpecial
trigger1 = (Time = [0,170])
flag = RoundNotOver


;=====================================================================
;イントロ分岐・改
[Statedef 190]
type = S
ctrl = 0

;「Name」はdefファイルで設定した『キャラの名前（Name）』を、
;「AuthorName」は同じくdefファイルで設定した『キャラの作成者（Author）』を判断。

[State 190, ステート変更];固有の相手を特定する手段
type = ChangeState
trigger1 = random < 600
value = 192

[State 190, ステート変更];固有の相手を特定する手段
type = ChangeState
trigger1 = 1
value = 191

;--------------------------------------------------------------------
;イントロ（試合開始前の登場演出アクション）
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0
sprpriority = -1

[State 191, 特殊効果];試合が開始するまではこのコントローラを使おう
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態

[State 191, エフェクト];
type = Explod
trigger1 = animelem = 1
anim = 2000
postype = p1
pos = 0,-1
scale = 0.9,1.05
sprpriority = 3

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
trigger2 = Time = 1
value = 0,8

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
value = 0,14

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 125
value = 191,0
freqmul = 0.5
volume = 250

[State 191, エフェクト];後光
type = Explod
trigger1 = time > 120
anim = 20043
postype = p1
pos = -10,-90
scale = 0.5,0.5
sprpriority = -2
persistent = 20

[State 191, ステート変更]
type = ChangeState
trigger1 = (animtime = 0)
value = 0
;--------------------------------------------------------------------
;イントロ
[Statedef 192]
type = S
ctrl = 0
anim = 191
velset = 0,0
sprpriority = -1

[State 193, 特殊効果]
type = AssertSpecial
trigger1 = (animtime != 0)
flag = Intro

[State 191, 音を鳴らす]
type = PlaySnd
trigger1 = Time = 0
value = 0,7

[State 191, エフェクト];
type = Explod
trigger1 = time = 0
anim = 2050
postype = p1
pos = 0,0
scale = 0.9,1.05
sprpriority = 2
persistent = 0

[State 191, ステート変更]
type = ChangeState
trigger1 = (animtime = 0)
value = 0
;--------------------------------------------------------------------
;ＡＩ用歩き
[Statedef 6000]
type    = S
physics = S
anim = 20
ctrl = 0
sprpriority = 1

[State 20, 移動速度]
type = VelSet
trigger1 = 1
x = const(Velocity.walk.fwd.x)

[State 20, ステート変更]
type = ChangeState
trigger1 = P2dist X < 0
value = 0
ctrl = 1
;--------------------------------------------------------------------
;ＡＩ用歩き２
[Statedef 6001]
type    = S
physics = S
anim = 21
ctrl = 0
sprpriority = 1

[State 20, 移動速度]
type = VelSet
trigger1 = 1
x = const(Velocity.walk.back.x)

[State 20, ステート変更]
type = ChangeState
trigger1 = P2dist X < 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------

