; CNSファイルはカンフーマンの定数（基本データ）と
; 状態（各動作）を記述するものです。
; キャラクターの心臓とも言える部分なのでとても重要です。
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;基本データ部分
[Data]
life              = 1000    ;体力ゲージの最大値を決めます
power             = 5000    ;パワーゲージ最大値（デフォルトは 3000 = Lv.3 になります・オプション）
attack            = 50     ;攻撃力パーセンテージ（デフォルトは 100% になります）
defence           = 100     ;防御力パーセンテージ（デフォルトは 100% になります）
fall.defence_up   = 50      ;一時的に上昇するダウン時の防御力パーセンテージ
liedown.time      = 50      ;倒れてから起き上がるまでの時間
airjuggle         = 99999      ;ジャグルポイント限界値　★１
sparkno           = 1       ;デフォルトのヒットスパーク番号（fightfx.airか、キャラのairから呼び出す）
guard.sparkno     = 40      ;デフォルトのガードスパーク番号（fightfx.airか、キャラのairから呼び出す）
KO.echo           = 0       ;ＫＯ時の声にエコーを掛けるかどうか（0=しない・1=する）
volume            = 50      ;キャラの音量　255が最高
intpersistindex   = 0      ;Varを次のラウンドへ持ち越しが可能 (最小=0, 最大=59)  ★２
floatpersistindex = 0      ;FVarを次のラウンドへ持ち越しが可能 (最小=0, 最大=39) ★２

;---------------------------------------------------------------------------
;サイズ設定
[Size]
xscale           = 1        ;キャラ画像の横のスケール
yscale           = 1        ;キャラ画像の縦のスケール
ground.back      = 15       ;キャラの幅（地上後方）
ground.front     = 16       ;キャラの幅（地上前方）
air.back         = 12       ;キャラの幅（空中後方）
air.front        = 12       ;キャラの幅（空中前方）
height           = 60       ;跳び越す相手のためのキャラの高さ
attack.dist      = 160      ;攻撃を出した時に相手がガード体勢に入る最低の距離
proj.attack.dist = 90       ;相手がガード体勢に入る発射物との最低の距離
proj.doscale     = 0        ;xscaleとyscaleが発射物のスケールにも影響するかどうか（0=しない・1=する）
head.pos         = 0, -90  ;BindToTargetの時に必要な頭の座標
mid.pos          = 0, -60  ;BindToTargetの時に必要な体中心の座標
shadowoffset     = 0        ;影の垂直方向の位置
draw.offset      = 0,0      ;キャラ描画表示位置（Ｘ軸,Ｙ軸）

;---------------------------------------------------------------------------
;移動速度設定
[Velocity]
walk.fwd     = 3.0          ;前進歩行速度
walk.back    = -3.0         ;後退歩行速度
run.fwd      = 6.6, 0       ;前に走る時の速度（Ｘ軸,Ｙ軸）
run.back     = -5.8,-4      ;後ろに走る時の速度（Ｘ軸,Ｙ軸）
jump.neu     = 0,-9         ;垂直ジャンプ速度（Ｘ軸,Ｙ軸）
jump.back    = -3.6         ;後ジャンプ速度
jump.fwd     = 3.7          ;前ジャンプ速度
runjump.back = -4.65,-10.5   ;後ろに走りながらのジャンプ速度（オプション）
runjump.fwd  = 4.65,-10.5     ;前に走りながらのジャンプ速度（オプション）
airjump.neu  = 0,-8.2       ;空中垂直ジャンプ速度（オプション）
airjump.back = -2.55         ;空中後ジャンプ速度（オプション）
airjump.fwd  = 2.5           ;空中前ジャンプ速度（オプション）

;---------------------------------------------------------------------------
;動作設定
[Movement]
airjump.num     = 0      ;空中ジャンプが出来る回数（オプション）
airjump.height  = 35     ;空中ジャンプするために必要な最低限の高さ（オプション）
yaccel          = .6    ;重力（垂直下降加速度）
stand.friction  = .85    ;立ち状態の摩擦係数
crouch.friction = .82    ;しゃがみ状態の摩擦係数
 
;---------------------------------------------------------------------------
; Varの使用状況
; ここに自分が使ったvarをメモしておくといろいろと好都合です。
; var(1)  - コマンドファイルのコンボ用
; var(3)  - ハイジャンプ
; var(4)  - 小ジャンプ
; var(5)  - 対戦キャラ判別
; var(6)  - 受身処理用
; var(15) - 百八拾弐式　強弱判別用
; var(16) - コマンド入力用
; var(17) - 七拾五式・改　ヒット判定用
; var(18) - 毒咬み〜荒咬み判定用
; var(20) - 行動制限用
; var(21) - Random var用
; var(22) - Lifeの初期値保存用
; var(25) - 大蛇薙　溜め判定用
; var(30) - スパキャン判定用
; var(32) - 無式・壱之段挑発用
; var(33) - どこキャンモードタイムカウント用

;---------------------------------------------------------------------------
;「ステート」の説明と基本的な使い方
;---------------------------------------------------------------------------
;■ステートとは「状態」を意味しますが、
;　ＭＵＧＥＮでは通常攻撃や必殺技などの枠にはまらない
;「ゲーム中における全ての行動を決めるプログラム」の事を指します。
;「ゲージ消費が必要無く、一撃で相手を倒せる攻撃」なども簡単に作成出来るので注意です。
;　１ステート（一つの行動）ずつに対して必ず番号（アドレス）が割り当てられます。
;　俗に「ステートナンバー」と呼ばれています。
;
;■基本的な設定の例
; [Statedef STATENO]       一つの行動を定義する記述です。「STATENO」に必ず番号を設定してください
; type = ?      S/C/A/L/U  キャラの状態を指定
; S=立ち　C=しゃがみ　A=空中　L=倒れている　U=前のステートの状態を引き継ぐ
;
; movetype = ?  I/A/H      キャラの行動内容を指定
; I=何もしない　A=攻撃している　H=攻撃を食らっている
;
; physics = ?   S/C/A/N/U  キャラの物理的な体勢
; S=立ち　C=しゃがみ　A=空中　N=重力や摩擦の影響を受けない　U=前のステートの体勢を引き継ぐ
;
; juggle = ?               攻撃を当てた時に溜まるジャグルポイントの設定
;
; [State STATENO, ?]      「ステートコントローラ」と呼ばれるステートの色々な操作を定義し、設置や追加をします
; type = ?                 ステートコントローラの種類をこの部分に状況に応じて入れます
; 　                       トリガーで条件を指定し、様々な効果を適用させて行きます
;
;
; ※１ステートには必ず一つはステートコントローラを設置する必要があります。
;
; 後は実際に使われているステートを参照してください。（[Statedef 200]に更に詳しい説明もあります）
;
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; 基本行動のステート
;---------------------------------------------------------------------------
; タイムオーバー時
; CNS レベル: 基本

[Statedef 170]
type = S
ctrl = 0     ;ここでCtrlSetを簡略化できます。　1=自由に動かせる
anim = 170
velset = 0,0 ;ここでVelSetを簡略化できます。　x方向,y方向 の順

[State 1000, ]
type = Varset
trigger1 = 1
var(33) = 0

[State 170, 無敵]
type = NotHitBy
trigger1 = 1 ;1にするといかなる条件でも有効で、0にするといかなる条件でも無効
value = SCA  ;※
time = 1

;---------------------------------------------------------------------------
; 勝利ポーズ分岐
; CNS レベル: 基本
;
;ここで勝利ポーズを選択する。　MatchOverは試合終了を判定するので、
;一回目と二回目勝利を別のポーズにしたい時に便利。

[Statedef 180]
type = S

[State 1000, ]
type = Varset
trigger1 = 1
var(33) = 0

[State 180,]
type = VarRandom
trigger1 = 1
v = 21
range = 0,2

[State 180,]
type = ChangeState
trigger1 = Time = 1
trigger1 = var(5) = 1
value = 184

[State 180,]
type = ChangeState
trigger1 = Time = 1
trigger1 = var(21) = 0
value = 181

[State 180,]
type = ChangeState
trigger1 = Time = 1
trigger1 = var(21) = 1
value = 182

[State 180,]
type = ChangeState
trigger1 = Time = 1
trigger1 = var(21) = 2
value = 183

;---------------------------------------------------------------------------
; 勝利ポーズ1
; CNS レベル: 基本

[Statedef 181]
type = S
ctrl = 0
anim = 181
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 2
trigger1 = Alive
value = 10,6

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 8
trigger1 = Alive
value = 10,7

[State 700, エフェクト表示]
type = Explod
trigger1 = AnimElem = 3
anim = 182
postype = P1
pos = 0, 0
sprpriority = 5
ownpal = 1

[State 181, 特殊効果]
type = AssertSpecial
trigger1 = time = [0,200]
flag = roundnotover

;---------------------------------------------------------------------------
; 勝利ポーズ2
; CNS レベル: 基本

[Statedef 182]
type = S
ctrl = 0
anim = 183
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 2
trigger1 = Alive
value = 10,4

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 7
trigger1 = Alive
value = 10,5

[State 181, 特殊効果]
type = AssertSpecial
trigger1 = time = [0,200]
flag = roundnotover

;---------------------------------------------------------------------------
; 勝利ポーズ3
; CNS レベル: 基本

[Statedef 183]
type = S
ctrl = 0
anim = 185
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 3
trigger1 = Alive
value = 10,28

[State 181,]
type = PlaySnd
trigger1 = AnimElemtime(6) = 50
trigger1 = Alive
value = 10,29

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 6
trigger1 = Alive
value = 12,0

[State 700, エフェクト表示]
type = Explod
trigger1 = AnimElem = 6
anim = 2220
postype = P1
pos = 0, -30
sprpriority = 5
ownpal = 1

[State 810,]
type = EnvShake
trigger1 = AnimElem = 6
ampl = 3
freq = 95
time = 10

[State 181, 特殊効果]
type = AssertSpecial
trigger1 = time = [0,200]
flag = roundnotover

;---------------------------------------------------------------------------
; 勝利ポーズ ＶＳ八神
; CNS レベル: 基本

[Statedef 184]
type = S
ctrl = 0
anim = 184
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 2
trigger1 = Alive
value = 10,8

[State 181, 特殊効果]
type = AssertSpecial
trigger1 = time = [0,200]
flag = roundnotover

;---------------------------------------------------------------------------
; イントロ分岐
; CNS レベル: 基本
;
; ここでは変数(var)を使っていますが、詳しい説明は後ほど。
; VarRandomはrangeで指定された範囲からひとつを選ぶので、
; いろいろな分岐に便利です。

;イントロ選択
[Statedef 190]
type = S
ctrl = 0
anim = 0
velset = 0,0

[State 1000, ]
type = Varset
trigger1 = 1
var(33) = 0

[State 190,対八神]
type = ChangeState
trigger1 = p2name = "iori" | p4name = "iori"
trigger2 = p2name = "yagami" | p4name = "yagami"
trigger3 = p2name = "iori yagami" | p4name = "iori yagami"
trigger4 = p2name = "d-Yagami" | p4name = "d-Yagami"
trigger5 = p2name = "Yagami-AKOF" | p4name = "Yagami-AKOF"
value = 192

[State 190,対克隆草]
type = ChangeState
trigger1 = p2name = "Kyo" | p4name = "Kyo"
trigger2 = p2name = "Kyo Kusanagi" | p4name = "Kyo Kusanagi"
trigger3 = p2name = "Kusanagi" | p4name = "Kusanagi"
trigger4 = p2name = "KUSANAGI" | p4name = "KUSANAGI"
trigger5 = p2name = "Kyo Clone-57" | p4name = "Kyo Clone-57"
trigger6 = p2name = "Kyo Clone-10" | p4name = "Kyo Clone-10"
trigger7 = p2name = "Kyo-EX_Neixus" | p4name = "Kyo-EX_Neixus"
trigger8 = p2name = "Kyo-1" | p4name = "Kyo-1"
trigger9 = p2name = "Kyo-2" | p4name = "Kyo-2"
trigger10 = p2name = "KUSANAGI-wl" | p4name = "KUSANAGI-wl"
trigger11 = p2name = "Kyo-2-wl" | p4name = "Kyo-2-wl"
trigger12 = p2name = "Kyo Clone10-wl" | p4name = "Kyo Clone10-wl"
value = 193

[State 190,対魂八]
type = ChangeState
trigger1 = p2name = "Iori Clone-42" | p4name = "Iori Clone-42"
value = 194

[State 190,対念草]
type = ChangeState
trigger1 = p2name = "Kyo-CI" | p4name = "Kyo-CI"
value = 196

[State 190,対魂?草]
type = ChangeState
trigger1 = p2name = "kyo_SL" | p4name = "kyo_SL"
value = 198

[State 190,]
type = ChangeState
trigger1 = Time = 1
value = ifelse(Random <= 500,191,198)
;---------------------------------------------------------------------------
; イントロ（試合開始直前のアクション）
; CNS レベル: 基本

[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0

[State 191, 特殊効果] ;「ROUND1, FIGHT!」のアナウンスが始まるまでは、このコントローラを使ってください
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態になります

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 6
value = s10,9

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 6
value = s12,0

[State 700, エフェクト表示]
type = Explod
trigger1 = AnimElem = 3
anim = 191
postype = P1
pos = 0, 0
sprpriority = 5
ownpal = 1

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

;---------------------------------------------------------------------------
; イントロ　ＶＳ八神
; CNS レベル: 基本

[Statedef 192]
type = S
ctrl = 0
anim = 193
velset = 0,0

[State 181,]
type = Varset
trigger1 = 1
var(5) = 1

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 2
value = s10,88

[State 191, 特殊効果] ;「ROUND1, FIGHT!」のアナウンスが始まるまでは、このコントローラを使ってください
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態になります

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

;---------------------------------------------------------------------------
; イントロ　ＶＳ克隆草
; CNS レベル: 基本

[Statedef 193]
type = S
ctrl = 0
anim = 2400
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 4
value = s10,23
[State 181,]
type = PlaySnd
trigger1 = AnimElem = 8
value = s0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 7
value = s10,95
[State 191, 特殊効果] ;「ROUND1, FIGHT!」のアナウンスが始まるまでは、このコントローラを使ってください
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態になります

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

;---------------------------------------------------------------------------
; イントロ　ＶＳ魂印八神
; CNS レベル: 基本
[Statedef 194]
type = S
ctrl = 0
anim = 70005
velset = 0,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 5
value = s192,33

[State 191, 特殊効果] ;「ROUND1, FIGHT!」のアナウンスが始まるまでは、このコントローラを使ってください
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態になります

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

[Statedef 196]
type = S
ctrl = 0
anim = 196
velset = 0, 0

[State 191, assert special]
type = assertSpecial
trigger1 = 1
flag = Intro
flag2 = nobardisplay

[State 191, play voice]
type = playSnd
trigger1 = animElem = 10
value = 10,117

[State 191, play voice]
type = playSnd
trigger1 = animElem = 30
value = 10,118

[State 191, play se]
type = playSnd
trigger1 = animElem = 32
value = 12,8

[State 192, hair band]
type = explod
trigger1 = animElem = 30
anim = 197
sprpriority = 1
pos = 0, 0
postype = p1
bindtime = -1
ownpal = 0
scale = const(size.xscale), const(size.yscale)
removeongethit = 1
ignorehitpause = 1

[State 191, state end]
type = changeState
trigger1 = animTime = 0
value = 0

[Statedef 198]
type = S
ctrl = 0
anim = 198
velset = 0,0

[State 191, 特殊効果] ;「ROUND1, FIGHT!」のアナウンスが始まるまでは、このコントローラを使ってください
type = AssertSpecial
trigger1 = 1
flag = Intro ;イントロの状態になります

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 7
value = s10,80

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 7
value = s12,0

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 7
value = s8000,0
channel = 2

[State 700, エフェクト表示]
type = Explod
trigger1 = AnimElem = 4
anim = 191
postype = P1
pos = 0, 0
sprpriority = 5
ownpal = 1

[State 1100, エフェクト表示]
type = Explod
trigger1 = AnimElem = 2
persistent = 0
anim = 11000
sprpriority = 11
postype = back
pos = 0,0
scale = 1.06,1.075
bindtime = -1
ownpal = 1
removeongethit = 1
supermove = 1
supermovetime = 9999
pausemovetime = 9999

[State 1100, エフェクト表示]
type = Explod
trigger1 = AnimElem = 2
persistent = 0
anim = 199
sprpriority = -5
postype = back
pos = 0,0
scale = 1.06,1.075
bindtime = -1
ownpal = 1
removeongethit = 1
supermove = 1
supermovetime = 9999
pausemovetime = 9999

[State 1100, エフェクト表示]
type = Explod
trigger1 = AnimElem = 7
persistent = 0
anim = 18023
sprpriority = 11
postype = back
pos = 0,0
scale = 1.06,1.075
bindtime = -1
ownpal = 1
removeongethit = 1
supermove = 1
supermovetime = 9999
pausemovetime = 9999

[State 1100, エフェクト表示]
type = Explod
trigger1 = AnimElem = 2
persistent = 0
anim = 11102
sprpriority = 12
postype = back
pos = 0,0
scale = 1.06,1.075
bindtime = -1
ownpal = 1
removeongethit = 1
supermove = 1
supermovetime = 9999
pausemovetime = 9999

[State 191, ステート変更]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; 挑発
; CNS レベル: 基本
[Statedef 195]
type     = S
movetype = I
physics  = S
anim     = 195
velset   = 0,0
ctrl     = 0
sprpriority = 2 ;ここで表示優先度を決定できます。　範囲は-5〜5、大きいほど手前に表示される
facep2 = 1      ;相手の方を向いてから挑発（結構重要）

[State 195, コントロール可否]
type = CtrlSet
triggerall = !winko
trigger1 = AnimElem = 10
value = 1

[State 181,]
type = PlaySnd
trigger1 = AnimElem = 2
value = s10,3

[State 195, ステート変更]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

;暘?????
[State 0, DestroySelf]
type = DestroySelf
trigger1 = IsHelper

[State 0, ??]
type = AfterImage
trigger1 = time = 0
time = 1

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = C
anim = 10

[State 10, 1]
type = VelMul
trigger1 = Time = 0
x = 0

[State 10, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
anim = 11
sprpriority = 0

[State 11, 0]
type = VelSet
trigger1 = Time = 0
x = 0

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Walk(AI?斈?)
[Statedef 21]
type    = S
physics = S
sprpriority = 0
ctrl = 0

[State 20, Turn]
Type = Turn
Trigger1 =!Ctrl
Trigger1 = P2Dist X < 0
Trigger1 = Anim = 20 || Anim = 21

[State 20, AI ??]
Type = VelSet
triggerall = var(59)
triggerall = Vel X >= 0
triggerall =(PrevStateNo != [140,155]) || P2BodyDist X > 140
trigger1 =(P2BodyDist X = [20,120]) || enemynear(var(58)),facing = facing
trigger2 = P2BodyDist X > 140
x = const(velocity.walk.fwd.x)

[State 20, AI ??]
Type = VelSet
triggerall = var(59)
triggerall = Vel X <= 0
triggerall = enemynear(var(58)),facing != facing
triggerall = enemynear(var(58)),MoveType != H
trigger1 = P2BodyDist X = [0,60]
trigger2 = P2BodyDist X = [90,160]
trigger3 = enemynear(var(58)),MoveType = I || enemynear(var(58)),StateNo >= 1000
trigger4 =(PrevStateNo = [140,155]) && P2BodyDist X <= 140
x = const(velocity.walk.back.x)

[State 20, 1]
type = VelSet
triggerall = !var(59)
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
triggerall = !var(59)
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 20, 5]
type = ChangeState
trigger1 = Vel X = 0
trigger2 = frontedgebodydist < 10
trigger3 = roundstate != 2
trigger4 = inguarddist
trigger4 = EnemyNear(var(58)),facing != facing
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Walk(AI??????????)
[Statedef 22]
Type    = S
physics = S
sprpriority = 0
ctrl = 0

[State 20, Turn]
Type = Turn
Trigger1 =!Ctrl
Trigger1 = P2Dist X < 0
Trigger1 = Anim = 20 || Anim = 21

[State 20, ??]
Type = VelSet
triggerall = var(59)
trigger1 = var(44) = 1
trigger1 = P2BodyDist X > 40
trigger2 = var(44) != 1
trigger2 = P2BodyDist X > 60
x = const(velocity.walk.fwd.x)

[State 20, ??]
Type = VelSet
triggerall = var(59)
trigger1 = var(44) = 1
trigger1 = P2BodyDist X < 20
trigger2 = var(44) != 1
trigger2 = P2BodyDist X < 40
x = const(velocity.walk.back.x)

[State 20, 1]
type = VelSet
triggerall = !var(59)
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
triggerall = !var(59)
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

[State 20, 5]
type = ChangeState
trigger1 = Vel X = 0
trigger2 = frontedgebodydist < 10
trigger3 = roundstate != 2
trigger4 = inguarddist
trigger4 = EnemyNear(var(58)),facing != facing
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_FWD(AI)
[Statedef 99]
type    = S
physics = S
anim = 100
sprpriority = 1
ctrl = 0

[State 100, 1]
type = VelSet
trigger1 = animelem = 2,>0
x = const(velocity.run.fwd.x)

[State 100, 0]
type = PlaySnd
trigger1 = AnimElem = 1
value = s5,0
loop = 1
channel = 6

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn


[state 00,AI]
type = ctrlset
trigger1 = var(59)
trigger1 = RoundState = 2
value = 0

;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
physics = S
anim = 100
sprpriority = 1
ctrl = 1

[State 100, 1]
type = VelSet
trigger1 = AnimElemtime(2) >= 0
x = const(velocity.run.fwd.x)

[State 191,]
type = PlaySnd
triggerall = time = 1
trigger1 = Alive
loop = 1
value = s5,0
channel = 6

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

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = 105
sprpriority = 1

[State 191,]
type = PlaySnd
triggerall = AnimElem = 2
trigger1 = Alive
value = s5,1

[State 105, 1]
type = VelSet
trigger1 = AnimElem = 2
x = const(velocity.run.back.x)
y = const(velocity.run.back.y)

[State 105, 3]
type = ChangeState
trigger1 = AnimElemtime(2) >= 0
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 106

;---------------------------------------------------------------------------
; RUN_BACK2 (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 106

[State 191,]
type = PlaySnd
triggerall = AnimElem = 1
trigger1 = Alive
value = s4,0

[State 106, 1]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 106, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 106, 3]
type = MakeDust
trigger1 = Time = 0
pos = -5,-2
spacing = 1

[State 106, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;前高速低跳
[Statedef 58]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 0, Turn]
type = Turn
trigger1 = time = 0
trigger1 = p2dist x < 0

[State 53, 4]
type = PlaySnd
trigger1 = Time = 0
value = s3,1

[State 52, 2]
type = NotHitBy
trigger1 = 1
value = ,AT

[State 40, 1]
type = VarSet
trigger1 = time = 0
var(47) = 0

[State 40, 1];彫僕???
type = VarSet
trigger1 = time = 1
var(47) = 1

[State 40, 4];彫僕???
type = VelSet
trigger1 = AnimTime = 0
x = 8
;x = const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = -6
;y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = [99,100]
x = 13

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;前高速高跳
[Statedef 46]
type = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 52, 2]
type = NotHitBy
trigger1 = 1
value = , NT, ST, HT

[State 53, 4]
type = PlaySnd
trigger1 = Time = 0
value = s3,1

[State 40, 3]
type = VarSet
trigger1 = time = 0
var(47) = 1

[State 40, 4]
type = VarSet
trigger1 = time = 0
sysvar(1) = 1

[State 40, 6]
type = VelSet
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, 10]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1
;---------------------------------------------------------------------------
; Short jump
[Statedef 59]
type = A
movetype = I
physics = A
anim = 59

[State 950, 1]
type = VelSet
trigger1 = Time = 0
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-3.1,3.4))
y = -6.5

[State 950, 2]
type = VelSet
trigger1 = Time = 0 && var(47)
x = IfElse(vel x = 0,0,IfElse(vel x < 0,-5,5))

[State 950, 3]
type = AfterImage
trigger1 = Time = 0 && var(47) && Vel X != 0
time = 10
trans = add1
timegap = 1
framegap = 2
length = 8
palbright = 0,0,0
palcontrast = 128,128,128
palmul = 1,1,1

[State 950, 4]
type = ChangeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value = 52

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40, 1]
type = VarSet
trigger1 = time = 0
var(4) = 0

[State 40, 1];小ジャンプ
type = VarSet
trigger1 = command != "holdup"
var(4) = 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = Var(4) = 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, 4];小ジャンプ
type = VelSet
trigger1 = AnimTime = 0
trigger1 = Var(4) = 1
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 = -6

[State 40, 5]
type = null;VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 191,]
type = PlaySnd
triggerall = time = 0
;triggerall = Var(4) = 0
triggerall = Var(3) != 0
trigger1 = Alive
value = s3,0
channel = 4

[State 191,]
type = PlaySnd
triggerall = time = 0
triggerall = Var(4) = 0
triggerall = Var(3) = 0
trigger1 = Alive
value = s3,0
channel = 4

[State 191,]
type = PlaySnd
triggerall = time = 0
triggerall = Var(4) = 1
triggerall = Var(3) = 0
trigger1 = Alive
value = s3,0
channel = 4

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
;trigger1 = Var(4) = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 50, 3]
type = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = 47
veladd = 0,0

[State 191,]
type = PlaySnd
trigger1 = time = 0
value = s4,0

[State 52, 1]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 52, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, 3]
type = CtrlSet
trigger1 = Time = 3
value = 1

[State 52, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;ふっとばし
[Statedef 300]
type     = S
movetype = A
physics  = S
juggle   = ifelse(P2movetype=H,8,15)
poweradd = 0
ctrl     = 0
velset   = 0,0
anim     = 300
sprpriority = 3

[State 300,]
type = PowerAdd
trigger1 = prevstateno = [150,151]
trigger1 = time = 0
value = -1000

[State 300,]
type = NotHitBy
trigger1 = prevstateno = [150,151]
trigger1 = 1
value = SCA

[state 300,]
type = Posset
trigger1 = time = 0
y = 0

[State 2100, 移動終了]
type = VelSet
trigger1 = AnimElem = 5
x = 4.5

[State 2100, 移動終了]
type = VelSet
trigger1 = AnimElem = 6
x = 0

[State 300,]
type = palfx
trigger1 = prevstateno = [150,151]
trigger1 = time = 0
time = 5
add = 230,230,230

[State 300,]
type = AfterImage
trigger1 = prevstateno = [150,151]
trigger1 = time = 0
time = 38
trans = add1
timegap = 2
framegap = 2
length = 5
palbright = 12,12,12
palcontrast = 220,220,220
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 1,1,1

[State 300, ステート変更]
type = ChangeAnim
trigger1 = prevstateno = [150,151]
trigger1 = time = 0
value = 305

[State 300, ヒット定義]
type = HitDef
trigger1 = prevstateno = [150,151]
trigger1 = Time = 0
attr = S, NA
animtype  = Diagup
damage    = 10
pausetime = 16,18
sparkno = s4010
sparkxy = -20,-75
hitsound   = s1,4
ground.type = High
ground.slidetime = 16
ground.hittime  = 18
ground.velocity = -5,-5
air.velocity = -5,-5
fall = 1
fall.recover = 0
kill = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0

[State 300 , 1]
type = HitDef
trigger1 = prevstateno != [150,151]
trigger1 = time = 0
attr = S, NA
animtype  = Hard
damage    = 80
priority = 5
pausetime = 13,14
sparkno = s4010
guard.sparkno = s4110
sparkxy = -20,-75
hitsound = s1,4
hitflag = MAF
guardflag = MA
guardsound = s2,0
ground.type = High
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -5,-5
air.velocity = -5,-5
air.animtype = Back
fall = 1
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0

[State 300, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 4
value = s0,4

[State 300, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 4
value = s10,38

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

;---------------------------------------------------------------------------
;空中ふっとばし
[Statedef 650]
type     = A
movetype = A
physics  = A
juggle   = 7
poweradd = 0
ctrl     = 0
anim     = 650
sprpriority = 3

[State 240 , 1]
type = HitDef
trigger1 = time = 0
attr = A, NA
animtype  = Hard
damage    = 80
priority = 5
pausetime = 11,12
sparkno = s4010
guard.sparkno = s4110
sparkxy = -25,-60
hitsound = s1,4
hitflag = MAF
guardflag = MA
guardsound = s2,0
ground.type = High
ground.slidetime = 14
ground.hittime  = 14
ground.velocity = -5,-5
air.velocity = -5,-5
air.animtype = Back
fall = 1
fall.recover = 0
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0

[State 200, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 2
value = s0,4

[State 300, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 2
value = s10,38

;---------------------------------------------------------------------------
;緊急回避前

[Statedef 700]
type     = S
movetype = I
physics  = S
velset   = 0,0
anim     = 700
ctrl     = 0
velset   = 0,0
sprpriority = -1

[State 700,]
type = Poweradd
triggerall = time = 0
trigger1 = prevstateno = [150,151]
value = -1000

[State 200, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 2
value = s10,35
channel = 4

[State 2100, 残像]
type = AfterImage
triggerall = prevstateno = [150,151]
trigger1 = AnimElem = 2
time = 24
length = 6      ;残像の表示時間
timegap = 2     ;時間差
framegap = 2    ;フレーム差
palbright = 1, 1, 1
palcontrast = 128, 128, 128
paladd = 0, 0, 0
palmul = 1, 1, 1
trans = Add1

[State 2110, 無敵]
type = NotHitBy
trigger1 = 1
value = SCA
time = 5

[State 2100, 移動量]
type = VelSet
trigger1 = AnimElemTime(2) >= 0 && AnimElemTime(8) < 0
x = 5

[State 2100, 移動終了]
type = VelSet
trigger1 = AnimElem = 8
x = 0

[State 2100, 相手と重なった場合]
type = PlayerPush
trigger1 = AnimElemTime(1) > 0
value = 0

[State 2100, 終了]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;緊急回避後

[Statedef 710]
type     = S
movetype = I
physics  = S
velset   = 0,0
anim     = 710
ctrl     = 0
velset   = 0,0
sprpriority = -1

[State 700,]
type = Poweradd
triggerall = time = 0
trigger1 = prevstateno = [150,151]
value = -1000

[State 200, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 2
value = s10,35
channel = 4

[State 2110, 残像]
type = AfterImage
triggerall = prevstateno = [150,151]
trigger1 = AnimElem = 3
time = 24
length = 6
timeGap = 2
frameGap = 2
palBright = 0, 0, 0
palContrast = 128, 128, 128
palAdd = 0, 0, 0
palMul = 1, 1, 1	
trans = Add1


[State 2110, 無敵]
type = NotHitBy
trigger1 = 1
value = SCA
time = 5

[State 2110, 移動量]
type = VelSet
trigger1 = AnimElemTime(3) > 0 && AnimElemTime(8) < 0
x = -5

[State 2110, 移動終了]
type = VelSet
trigger1 = AnimElem = 8
x = 0

[State 2110, 相手と重なった時の処理]
type = PlayerPush
trigger1 = AnimElemTime(1) > 0
value = 0

[State 2110, 終了]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;受身

[Statedef 52000]
type     = S
movetype = I
physics  = S
velset   = 0,0
anim     = 5200
ctrl     = 0
sprpriority = 2

[State 5200]
type = Posset
trigger1 = time = 0
y = 0

[State 200, 音を鳴らす]
type = PlaySnd
trigger1 = AnimElem = 1
value = s10,35
channel = 4

[State 2110, 無敵]
type = NotHitBy
trigger1 = 1
value = SCA

[State 2110, ]
type = Varset
trigger1 = time = 0
trigger1 = command = "holdfwd"
var(6) = 1

[State 2110, ]
type = Varset
trigger1 = Animtime = 0
var(6) = 0

[State 2110, 移動量]
type = VelSet
trigger1 = AnimElemtime(1) >= 0 && AnimElemtime(4) <= 0
x = -4.8

[state 300,]
type = Veladd
triggerall = var(6) = 0
trigger1 = AnimElemtime(2) >= 0 && AnimElemtime(4) <= 0
x = .021

[State 2110, 移動量]
type = VelSet
triggerall = var(6) = 1
trigger1 = AnimElemtime(2) >= 0 && AnimElemtime(7) <= 0
x = 6

[State 2110, ]
type = ChangeAnim
triggerall = var(6) = 1
trigger1 = time = 0
value = 700

[State 2110, 移動終了]
type = VelSet
triggerall = var(6) = 0
trigger1 = AnimElem = 5
x = 0

[State 2110, 移動終了]
type = VelSet
triggerall = var(6) = 1
trigger1 = AnimElem = 8
x = 0

[State 2110, 相手と重なった時の処理]
type = PlayerPush
trigger1 = AnimElemTime(1) > 0
value = 0

[State 2110, 終了]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;この下、一行以上空ける事！
;----------------------------------------------------------------------------
[Statedef 5201]
type = S
physics = S
movetype = I
ctrl = 0

[State 5210, 0]
type = changeanim
trigger1 = anim != 5200
value = 5200
ignorehitpause = 1

[State 5210, 1]
type = PalFX
trigger1 = time = 0
time = 1
mul = 256,256,256

[State 5201,0]
type = playsnd
trigger1 = alive
trigger1 = time = 1
value = S10,0
volume = 255
channel = 0

[State 5201,1]
type = VelSet
trigger1 = Time <= 17
x = -4.0
y = 0

[State 5201,2]
type = VelSet
trigger1 = Time > 17
trigger1 = Vel X >= 0
x = 0
y = 0

[State 5201,3]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5201,4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 5

[State 5201,5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
[Statedef 5210]
type    = A
movetype= I
physics = N
ctrl = 0

[state 1]
type = StateTypeSet
trigger1 = time = 0 && vel y < 0
physics = A
ignorehitpause = 1

[State 5210, 0]
type = changeanim
trigger1 = anim != 5210
value = 5210
ignorehitpause = 1

[State 5210, 1]
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128

[State 5210, 1]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 2]
type = Turn
trigger1 = animTime = 0
trigger1 = p2dist X < 0

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
y = -4.5

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2]
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

[State 5210, 2]
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = 1.5

[State 5210, 2]
type = VelMul
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = 1

[State 5210, 2]
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = -1

[State 5210, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 20

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd
trigger1 = Time >= 4
y = .35

[State 5210, 5]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52
ctrl = 1

;---------------------------------------------------------------------------
;guard crash
[Statedef 5700]
type = S
movetype= H
physics = N
sprpriority = 1

[State 5700, ChangeAnim]
type = ChangeAnim2
trigger1 = Time = 0
value = 5700

[State 5700, VelSet]
type = VelSet
trigger1 = time = 1
x = 0

[State 5700, VelSet]
type = VelSet
trigger1 = time = 5
x = -6

[State 5700, VelMul]
type = VelMul
trigger1 = 1
x = 0.85

[State 5700, PosSet]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5700, VelSet]
type = VelSet
trigger1 = time = 16
x = 0

[State 5700, SelfState]
type = SelfState
trigger1 = time = 24
value = 0
ctrl = 1

