;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S

[State 0, 1]
type = ChangeAnim
triggerall = !(prevstateno = 3705 && WinKO);死祀3Win
trigger1 = Anim != 0 && Anim != 5 && Anim != 1 && Anim != 184
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State ラウンド勝利まばたき]
type = ChangeAnim
trigger1 = !(prevstateno = 3705)
trigger1 = Anim = 0
trigger1 = Win
trigger1 = ctrl
trigger1 = RoundState = 3
trigger1 = !MatchOver
value = 184
persistent = 0
[State ラウンド勝利まばたき0へ戻る]
type = ChangeAnim
trigger1 = Anim = 184
trigger1 = AnimTime = 0
value = 0

[State 120, 2]
type = StateTypeSet
trigger1 = Anim != 1
MoveType = I

[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 寝る]
type = ChangeState
triggerall = roundstate = 2
trigger1 = Anim = 0 && time = 1080
trigger2 = var(46) = 6 || var(46) = 3;フォース中
trigger2 = Anim = 0 && AnimElemTime(2) = 0
value = 1

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

[State 0, DestroySelf]
Type = DestroySelf
Trigger1 = ishelper
;---------------------------------------------------------------------------
; 寝る
[Statedef 1]
type = S
physics = S
anim = 1
movetype = A

[State 相手ガードしない]
type = AttackDist
trigger1 = Anim = 1
value = 0
IgnoreHitPause = 1
persistent = 1

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
trigger1 = var(46) = 6 || var(46) = 3;フォース中
value = 2

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

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

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

[State 40, 6]
type = ChangeState
triggerall = Time = 0
trigger1 = abs(var(53)) >= 3
value = 0
ctrl = 1

[State 20, 3]
type = ChangeAnim
trigger1 = time = 0
value = 10

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

[State 雷　キァルトヴェルサ（フォース）];InGurdDist外で120を経由しない場合（端to端ビームなど）
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
trigger1 = command = "holdback"
;trigger1 = Anim = 21
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

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

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

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

[State 雷　キァルトヴェルサ（フォース）];InGurdDist外で120を経由しない場合（端to端ビームなど）
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
trigger1 = command = "holdback"
;trigger1 = Anim = 21
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
anim = 12

[State 雷　キァルトヴェルサ（フォース）];InGurdDist外で120を経由しない場合（端to端ビームなど）
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
trigger1 = command = "holdback"
;trigger1 = Anim = 21
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 12, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S

[State 前進速度]
type = VelSet
triggerall = command = "holdfwd"
trigger1 = var(46) = 0
trigger2 = var(46) = 5
x = const(velocity.walk.fwd.x)
[State 後退速度]
type = VelSet
triggerall = command = "holdback"
trigger1 = var(46) = 0
trigger2 = var(46) = 5
x = const(velocity.walk.back.x)

[State 前進速度フォース効果中]
type = VelSet
triggerall = command = "holdfwd"
trigger1 = var(46) = 1
trigger2 = var(46) = 2
trigger3 = var(46) = 3
trigger4 = var(46) = 4
trigger5 = var(46) = 6
x = const(velocity.walk.fwd.x)*ifelse(var(58) = 3,1.4,1.2)
[State 後退速度フォース効果中]
type = VelSet
triggerall = command = "holdback"
trigger1 = var(46) = 1
trigger2 = var(46) = 2
trigger3 = var(46) = 3
trigger4 = var(46) = 4
trigger5 = var(46) = 6
x = const(velocity.walk.back.x)*ifelse(var(58) = 3,1.4,1.2)

[State アニメ前進]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 5 && Anim != 20 && Anim != 22
trigger2 = Anim = 5 && AnimTime = 0
value = ifelse(var(46)=6||var(46)=3,22,20)
[State アニメ後退]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 5 && Anim != 21 && Anim != 23
trigger2 = Anim = 5 && AnimTime = 0
value = ifelse(var(46)=6||var(46)=3,23,21)

[State アニメ前進];フォース終了時、継続して歩いていたとき用
type = ChangeAnim
trigger1 = Anim = 22
trigger1 = var(46) = 5
value = 20
elem = AnimElemNo(0)
[State アニメ後退];フォース終了時、継続して歩いていたとき用
type = ChangeAnim
trigger1 = Anim = 23
trigger1 = var(46) = 5
value = 21
elem = AnimElemNo(0)

[State se足音]
type = PlaySnd
Trigger1 = Anim != 5
Trigger1 = AnimElemTime(3) = 0
Trigger2 = Anim = 20 || Anim = 22
Trigger2 = AnimElemTime(7) =4
Trigger3 = Anim = 21 || Anim = 23
Trigger3 = AnimElemTime(8) = 0
value = s0,2
channel = 4
freqmul = ifelse(var(46)=6||var(46)=3,1.05,1.0)
;lowpriority = 1

[State 雷　キァルトヴェルサ（フォース）];InGurdDist外で120を経由しない場合（端to端ビームなど）
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
trigger1 = command = "holdback"
;trigger1 = Anim = 21
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

;---------------------------------------------------------------------------
; ジャンプ
[Statedef 40]
type    = S
physics = S
Facep2 = 1
ctrl = 0

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
value = 40
elem = 2

[State 45, 3]
type = Varset
trigger1 = time = 0
var(29) = 1

[State 無敵　投げ]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

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

[State 40, 3]
type = VelSet
trigger1 = time = 0
y = 0

[State 40, 3]
type = PosSet
trigger1 = time = 0
y = 0

[State 40, 2]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdfwd"
sysvar(1) = 1
[State 40, 3]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdback"
sysvar(1) = -1

[State se]
type = PlaySnd
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
value = s0,0
channel = 3

[State 速度]
type = VelSet
trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
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)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))

[State 低空空中前ダッシュ予備動作]
type = ChangeState
trigger1 = var(16) = 5
trigger1 = AnimTime = 0
value = 112

[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
value = 50
ctrl = 1

;エフェクト消去----------------------
[State 5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 207
[State 6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 217
[State 5B　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 225
[State 3B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 235
[State 3B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 237
[State 5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 245
[State 5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 247

[State 5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 311
[State 5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 312
[State 2E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 315
[State 2E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 316

[State 2A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 407
[State 3A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 417
[State 2B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 427
[State 2C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 447

[State 1E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 461
[State 1E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 462

;エフェクト消去----------------------

;---------------------------------------------------------------------------
; ハイジャンプ
[Statedef 41]
type    = S
physics = S
Anim = 40
Facep2 = 1
ctrl = 0

[State ハイジャンプフラグ]
type = Varset
trigger1 = time = 0
var(9) = 1

[State 45, 3]
type = Varset
trigger1 = time = 0
var(29) = 1

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

[State 40, 3]
type = VelSet
trigger1 = time = 0
y = 0

[State 無敵　投げ]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

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

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

[State 801]
type = PlaySnd
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
value = s0,0
volume = 255
freqmul = 1.1
channel = 3

[State 40, 4]
type = VelSet
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
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)*1.25*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))

[State dust3]
type = Explod
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
Anim 			= 20992
PosType 		= P1
Pos 			= -25, -floor(const(velocity.jump.y)*1.25)
facing 			= 1
Scale 			= 0.5,0.7
BindTime 		= 1
OwnPal 			= 1
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 3
IgnoreHitPause = 1
Persistent = 0
ID = 20992

[State 残像]
type = Afterimage
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
Trans 		= add; add1 ;none
Time 		= 26
Length 		= 10
;TimeGap 	= 1
FrameGap 	= 1
PalBright 	= 0,0,0
PalContrast = 100,120,120
PalAdd 		= 0,0,0
PalMul 		= 0.75,0.75,0.75

[State 低空空中前ダッシュ予備動作]
type = ChangeState
trigger1 = var(16) = 5
Trigger1 = AnimTime = 0
value = 112

[State 40, 6]
type = ChangeState
Trigger1 = AnimTime = 0
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = AnimElemTime(2) = 3
value = 50
ctrl = 1

;エフェクト消去----------------------
[State 5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 207
[State 6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 217
[State 5B　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 225
[State 3B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 235
[State 3B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 237
[State 5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 245
[State 5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 247

[State 5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 311
[State 5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 312
[State 2E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 315
[State 2E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 316

[State 2A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 407
[State 3A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 417
[State 2B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 427
[State 2C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 447

[State 1E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 461
[State 1E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 462
;エフェクト消去----------------------

;---------------------------------------------------------------------------
; 空中ジャンプ
[Statedef 45]
type    = A
physics = N
Facep2 = 1
ctrl = 0

[State 45, 3]
type = Velset
trigger1 = Time = 0
x = 0
y = 0
IgnoreHitPause = 1
persistent = 0

[State レバー入力用]
type = Varset
trigger1 = time = 0
var(29) = 1

[State 空中ジャンプ回数用]
type = Varadd
trigger1 = Time = 0
var(13) = 1
IgnoreHitPause = 1
persistent = 0

[State 45, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(44)
value = 44
[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0
[State 45, 4]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdfwd"
sysvar(1) = 1
[State 45, 5]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdback"
sysvar(1) = -1

[State 801]
type = PlaySnd
Trigger1 = Time = 2
value = s0,1
channel = 3

[State 45, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.2,ifelse(var(46)=6&&var(58)!=3,1.15,1.0))

[State 45, 7]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1

;エフェクト消去----------------------
[State j_5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 607
[State j_6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 617
[State j_5B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 625
[State j_5B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 627
[State j_5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 645
[State j_5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 647
[State j_6C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 655
[State j_6C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 657
[State j_5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 661
[State j_5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 662
;エフェクト消去----------------------

;---------------------------------------------------------------------------
; 空中ハイジャンプ
[Statedef 46]
type    = A
physics = N
Facep2 = 1
ctrl = 0

[State 45, 3]
type = Velset
trigger1 = Time = 0
x = 0
y = 0
IgnoreHitPause = 1
persistent = 0

[State ハイジャンプフラグ]
type = Varset
trigger1 = time = 0
var(9) = 1

[State レバー入力用]
type = Varset
trigger1 = time = 0
var(29) = 1

[State 空中ジャンプ回数用]
type = Varadd
trigger1 = Time = 0
var(13) = 1
IgnoreHitPause = 1
persistent = 0

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
value = 49

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0
[State 45, 4]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdfwd"
sysvar(1) = 1
[State 45, 5]
type = VarSet
triggerall = var(53) = 0
trigger1 = command = "holdback"
sysvar(1) = -1

[State 801]
type = PlaySnd
Trigger1 = Time = 4
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = Time = 2
value = s0,1
volume = 255
freqmul = 1.1
channel = 3

[State 45, 6]
type = VelSet
trigger1 = Time = 4
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = Time = 2
x = 1.50*ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = 1.25*const(velocity.airjump.y)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.2,ifelse(var(46)=6&&var(58)!=3,1.15,1.0))

[State 残像]
type = Afterimage
trigger1 = Time = 4
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = Time = 2
Trans 		= add; add1 ;none
Time 		= 26
Length 		= 10
;TimeGap 	= 1
FrameGap 	= 1
PalBright 	= 0,0,0
PalContrast = 100,120,120
PalAdd 		= 0,0,0
PalMul 		= 0.75,0.75,0.75

[State 45, 7]
type = ChangeState
trigger1 = Time = 4
trigger2 = var(58) = 3
trigger2 = var(46) = 6 || var(46) = 3
trigger2 = Time = 2
value = 50
ctrl = 1

;エフェクト消去----------------------
[State j_5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 607
[State j_6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 617
[State j_5B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 625
[State j_5B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 627
[State j_5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 645
[State j_5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 647
[State j_6C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 655
[State j_6C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 657
[State j_5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 661
[State j_5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 662
;エフェクト消去----------------------

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

[State FaceP2]
type = Turn
triggerall = time = 0
triggerall = p2dist X < 0
trigger1 = PrevStateNo = 40
trigger2 = PrevStateNo = 41

[State ハイジャンプ時ターン]
type = Turn
trigger1 = var(9)
trigger1 = p2dist X < 0

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

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

[State 降下アニメ]
type = ChangeAnim
triggerall = var(46) = 6 || var(46) = 3;フォース効果中のみ
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A

[State 51, 1]
type = Null
trigger1 = 1

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

[State se靴音]
type = PlaySnd
Trigger1 = Time = 0
value = s0,2
channel = 4

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
trigger1 = RoundState = 2
trigger1 = command = "holddown"
value = 48

[State 状態]
type = StateTypeSet
trigger1 = anim = 48
statetype = C
physics = C

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

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

[State 防御できない]
type = AssertSpecial
trigger1 = time <= 1
Flag  = NoStandGuard
Flag2 = NoCrouchGuard


[State 151, 3]
type = CtrlSet
triggerall = roundstate = 2
trigger1 = time >= 6
trigger2 = time >= 4 && var(46) = 6
trigger3 = time >= 3 && (var(58) = 3 && (var(46) = 3 || var(46) = 6))
value = 1

[State 0/11へ]
type = ChangeState
trigger1 = AnimTime = 0
value = ifelse(StateType=C,11,0)
ctrl = 1

;エフェクト消去----------------------
[State j_5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 607
[State j_6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 617
[State j_5B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 625
[State j_5B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 627
[State j_5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 645
[State j_5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 647
[State j_6C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 655
[State j_6C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 657
[State j_5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 661
[State j_5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 662

[State j_投げ　剣閃・剣オーラエフェクト]
type = removeExplod
trigger1 = time = 0
ID = 760
IgnoreHitPause = 1

[State 空中A斯封　斯封エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 1266
[State 空中A斯封　斯封エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 1276
[State 空中B斯封　斯封エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 1267
[State 空中B斯封　斯封エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 1277

[State 空中AB斯封派生　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 1236
[State 空中AB斯封派生　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 1237

[State 天鎖　剣オーラelem1]
type = removeExplod
trigger1 = time = 0
ID = 1351
[State 天鎖　剣オーラelem2]
type = removeExplod
trigger1 = time = 0
ID = 1352
[State 天鎖　剣オーラelem3]
type = removeExplod
trigger1 = time = 0
ID = 1353
[State 天鎖　剣オーラelem4]
type = removeExplod
trigger1 = time = 0
ID = 1354

[State 逝斬　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 2151


;エフェクト消去----------------------


;---------------------------------------------------------------------------
;フロントステップ
;---------------------------------------------------------------------------
[Statedef 100]
type 		= S
physics 	= N
ctrl 		= 0

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
trigger1 = PrevStateNo != 320
;value = ifelse(var(46)=6||var(46)=3,101,100)
value = ifelse((var(46)=6||var(46)=3)&&var(58)=3,102,ifelse(var(46)=6&&var(58)!=3,101,100))

[State 進行状況リセット]
type = VarSet
trigger1 = time = 0
trigger1 = PrevStateNo != 320
var(24) = 0
[State 進行状況]
type = VarAdd
trigger1 = time >= 1
var(24) = 1

[State アニメ　相殺後]
type = ChangeAnim
triggerall = PrevStateNo = 320
triggerall = AnimElemTime(4) < 0
trigger1 = var(24) = 13
trigger2 = var(24) = 10 && var(46) = 6
value = anim
elem = 4

[State seステップ音]
type = PlaySnd
Trigger1 = var(58) != 2
Trigger1 = AnimElemTime(2) = 0
value = s0,3
channel = 3

[State 速度]
type = VelSet
trigger1 = AnimElemTime(2) = 0
x = const(velocity.run.fwd.x)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.30,ifelse(var(46)=6&&var(58)!=3,1.18,1.0))

[State 雷　エンスィーム用ヘルパー]
Type = Helper
Trigger1 = var(58) = 2
Trigger1 = AnimElemTime(2) = 0
Trigger1 = NumHelper(42010) = 0
StateNo 		= 42010
ID 				= 42010
name 			= "Kaminali efeect"
PosType 		= P1
IgnoreHitPause = 1
Persistent = 0

[State 雷　エンスィーム]
type = HitOverride
triggerall = var(58) = 2
triggerall = PrevStateNo != 320
trigger1 = var(46) != 6
trigger1 = AnimElemTime(2) >= 0
trigger1 = AnimElemTime(3) < 0
trigger2 = var(46) = 6
trigger2 = AnimElemTime(2) >= 0
trigger2 = AnimElemTime(4) < 0
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[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 状態]
type = StateTypeSet
trigger1 = AnimElemTime(4) >= 0
physics = S
Persistent = 0

[State コントロール]
type = CtrlSet
trigger1 = AnimElemTime(4) >= 0
value = 1
Persistent = 0

[State 0へ]
type = ChangeState
trigger1 = Animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;バックステップ
;---------------------------------------------------------------------------

[Statedef 105]
type    = A
physics = N
ctrl = 0
anim = 105

[State アニメ]
type = ChangeAnim
trigger1 = time = 0
value = ifelse((var(46)=6||var(46)=3)&&var(58)=3,107,ifelse(var(46)=6&&var(58)!=3,106,105))

[State se]
type = PlaySnd
Trigger1 = Time = 0
value = s0,4
channel = 3

[State 時カナ　塵染の意]
Type = Helper
trigger1 = time = 0
Trigger1 = var(58) = 3
StateNo 		= 43020
ID 				= 43020
name 			= "Ginsen No I"
PosType 		= P1
;Ownpal 			= 1
PauseMoveTime 	= Ifelse(var(35)>0,999999999999,0)
IgnoreHitPause = 1
Persistent = 0

[State 無敵　打・飛び]
type = NotHitBy
trigger1 = time = 0
value = ,AA,AP
time = 9

[State 速度　初速]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))
y = const(velocity.run.back.y)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))

[State 速度　X減速]
type = VelMul
trigger1 = Anim = 105
trigger1 = AnimElemTime(1) = 10
trigger2 = Anim = 106
trigger2 = AnimElemTime(1) = 8
trigger3 = Anim = 107
trigger3 = AnimElemTime(1) = 6
x = 0.65

[State 重力]
type = VelAdd
trigger1 = Anim = 105
y = 0.25
[State 重力]
type = VelAdd
trigger1 = Anim = 106
y = 0.35
[State 重力]
type = VelAdd
trigger1 = Anim = 107
y = 0.42

[State 着地アニメ]
type = ChangeAnim
trigger1 = (pos y >= 0) && (vel y > 0)
value = ifelse(var(46)=3,109,108)

[State 速度　0]
type = VelSet
trigger1 = Anim = [108,109]
x = 0
y = 0
persistent = 0

[State 状態]
type = StateTypeSet
trigger1 = Anim = [108,109]
StateType = S
physics = S

[State se靴音]
type = PlaySnd
trigger1 = Anim = [108,109]
value = s0,2
channel = 4
persistent = 0

[State ポス]
type = PosSet
trigger1 = Anim = [108,109]
y = 0

[State コントロール]
type = CtrlSet
trigger1 = Anim = [108,109]
trigger1 = AnimElemTime(2) = 0
value = 1

[State 0へ]
type = ChangeState
trigger1 = Anim = [108,109]
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;[State ダスト]
;type = MakeDust
;trigger1 = AnimElemTime(3) = 2
;pos = -5,-2
;spacing = 1
;SuperMoveTime 	= 999999;きかぬ
;PauseMoveTime 	= 999999;きかぬ

;[State ダスト]
;type = GameMakeAnim
;trigger1 = AnimElemTime(3) = 2
;value = 120
;under = 0
;pos = -10,2
;random = 0
;SuperMoveTime 	= 999999;標準ＯＮ
;PauseMoveTime 	= 999999;標準ＯＮ

;---------------------------------------------------------------------------
; 空中前ダッシュ
[Statedef 110]
type    = A
physics = N
anim = 110
velset = 0,0
ctrl = 0

[State ラインエフェ]
type = Explod
trigger1 = time = 0
Anim 			= 20905
PosType 		= P1
Pos 			= 0,-60
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 3
Anim 			= 20906
PosType 		= P1
Pos 			= 0,-80
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 6
Anim 			= 20907
PosType 		= P1
Pos 			= 0,-20
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 9
Anim 			= 20905
PosType 		= P1
Pos 			= 0,-70
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 12
Anim 			= 20906
PosType 		= P1
Pos 			= 0,-50
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 15
Anim 			= 20907
PosType 		= P1
Pos 			= 0,-40
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0

[State  空中ダッシュ回数用]
type = Varadd
trigger1 = Time = 0
var(12) = 1

[State se]
type = PlaySnd
Trigger1 = Time = 0
value = s0,5
channel = 3

[State 100, 1]
type = VelSet
trigger1 = time = 0
x = const(velocity.run.fwd.x)*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))

[State 151, 3]
type = CtrlSet
trigger1 = Animelem = 3
trigger2 = var(58) != 3 && var(46) = 6
trigger2 = time = 7
trigger3 = var(58) = 3 && (var(46) = 6 || var(46) = 3)
trigger3 = time = 5
value = 1

[State アニメ反対向き]
type = ChangeAnim
triggerall = var(9)
triggerall = p2dist X < 0
trigger1 = AnimElemTime(3) >= 1
trigger2 = var(58) != 3 && var(46) = 6
trigger2 = time = 7
trigger3 = var(58) = 3 && (var(46) = 6 || var(46) = 3)
trigger3 = time = 5
value = 111
elem = AnimElemNo(0)
Persistent = 0

[State ハイジャンプ時ターン]
type = turn
trigger1 = var(9)
trigger1 = anim = 111
Persistent = 0

[State 106, 4]
type = ChangeState
trigger1 = Animelem = 5
trigger2 = time = 16
trigger3 = var(58) != 3 && var(46) = 6
trigger3 = time = 14
trigger4 = var(58) = 3 && (var(46) = 6 || var(46) = 3)
trigger4 = time = 12
value = 111
ctrl = 1

;エフェクト消去----------------------
[State j_5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 607
[State j_6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 617
[State j_5B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 625
[State j_5B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 627
[State j_5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 645
[State j_5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 647
[State j_6C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 655
[State j_6C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 657
[State j_5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 661
[State j_5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 662

;エフェクト消去----------------------

;---------------------------------------------------------------------------
; 空中前ダッシュ続き
[Statedef 111]
type    = A
physics = A
ctrl = 1

[State 降下アニメ]
type = ChangeAnim
trigger1 = time = 0
value = anim
elem = 5

[State ハイジャンプ時ターン]
type = turn
trigger1 = var(9)
trigger1 = p2dist X < 0

[State 100, 1]
type = VelMul
trigger1 = time = 0
x = 0.675

;---------------------------------------------------------------------------
; 低空空中前ダッシュ予備動作
[Statedef 112]
type    = A
physics = A

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

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

[State 50, 3]
type = ChangeState
trigger1 = Pos y <= -60
value = 110

;---------------------------------------------------------------------------
; 空中後ろダッシュ
[Statedef 115]
type    = A
physics = N
anim = 115
velset = 0,0
ctrl = 0

[State ラインエフェ]
type = Explod
trigger1 = time = 0
Anim 			= 20905
PosType 		= P1
Pos 			= 0,-60
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 3
Anim 			= 20906
PosType 		= P1
Pos 			= 0,-80
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 6
Anim 			= 20907
PosType 		= P1
Pos 			= 0,-20
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 9
Anim 			= 20905
PosType 		= P1
Pos 			= 0,-70
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 12
Anim 			= 20906
PosType 		= P1
Pos 			= 0,-50
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0
[State ラインエフェ]
type = Explod
trigger1 = time = 15
Anim 			= 20907
PosType 		= P1
Pos 			= 0,-40
Scale 			= 0.5,0.5
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
SprPriority 	= 1
IgnoreHitPause = 1
Persistent = 0

[State  空中ダッシュ回数用]
type = Varadd
trigger1 = Time = 0
var(12) = 1

[State 100, 1]
type = VelSet
trigger1 = time = 0
x = -const(velocity.run.fwd.x)*0.7*ifelse((var(46)=6||var(46)=3)&&var(58)=3,1.3,ifelse(var(46)=6&&var(58)!=3,1.2,1.0))

[State se]
type = PlaySnd
Trigger1 = Time = 0
value = s0,5
channel = 3

[State 151, 3]
type = CtrlSet
trigger1 = time = 7
trigger2 = var(58) != 3 && var(46) = 6
trigger2 = time = 5
trigger3 = var(58) = 3 && (var(46) = 6 || var(46) = 3)
trigger3 = time = 3
value = 1

[State 106, 4]
type = ChangeState
trigger1 = Animelem = 3
trigger2 = var(58) != 3 && var(46) = 6
trigger2 = time = 16
trigger3 = var(58) = 3 && (var(46) = 6 || var(46) = 3)
trigger3 = time = 13
value = 116
ctrl = 1

;エフェクト消去----------------------
[State j_5A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 607
[State j_6A　剣オーラ]
type = removeExplod
trigger1 = time = 0
ID = 617
[State j_5B　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 625
[State j_5B　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 627
[State j_5C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 645
[State j_5C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 647
[State j_6C　剣オーラ1]
type = removeExplod
trigger1 = time = 0
ID = 655
[State j_6C　剣オーラ2]
type = removeExplod
trigger1 = time = 0
ID = 657
[State j_5E　鞘エフェクト1]
type = removeExplod
trigger1 = time = 0
ID = 661
[State j_5E　鞘エフェクト2]
type = removeExplod
trigger1 = time = 0
ID = 662

;エフェクト消去----------------------

;---------------------------------------------------------------------------
; 空中後ろダッシュ続き
[Statedef 116]
type    = A
physics = A
ctrl = 1

[State 降下アニメ]
type = ChangeAnim
trigger1 = time = 0
value = anim
elem = 3

[State ハイジャンプ時ターン]
type = turn
trigger1 = var(9)
trigger1 = p2dist X < 0

[State 100, 1]
type = VelMul
trigger1 = time = 0
x = 0.675

;---------------------------------------------------------------------------
; ガード (開始)
[Statedef 120]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = PrevStateNo != 320
value = 120+(statetype = C)+(statetype = A)*2

[State 120, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 120, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

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

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

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 120, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 130+(statetype = C)+(statetype = A)*2

[State 120, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140


;---------------------------------------------------------------------------
; 立ちガード (ガード中)
[Statedef 130]
type    = S
physics = S

[State 131, 1]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 130, Hi to Lo]
type = ChangeState
trigger1 = command = "holddown"
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140


;---------------------------------------------------------------------------
; しゃがみガード (ガード中)
[Statedef 131]
type    = C
physics = C

[State 131, 1]
type = ChangeAnim
trigger1 = Anim != 131
value = 131

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 131, Lo to Hi]
type = ChangeState
trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140


;---------------------------------------------------------------------------
; 空中ガード (ガード中)
[Statedef 132]
type    = A
physics = N

[State 132, 1]
type = ChangeAnim
trigger1 = Anim != 132
value = 132

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

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

[State 132, 4]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, 5]
type = PosSet
trigger1 = sysvar(0)
y = 0

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

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

[State 132, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; ガード (終了)
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, 2]
type = StateTypeSet
trigger1 = Time = 0 && statetype = S
physics = S

[State 140, 3]
type = StateTypeSet
trigger1 = Time = 0 && statetype = C
physics = C

[State 140, 4]
type = StateTypeSet
trigger1 = Time = 0 && statetype = A
physics = A

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

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

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 140 + (statetype = C) + (statetype = A)*2

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

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

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

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

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

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

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

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = Ctrl
var(10) = -Life

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

[State 151, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 151, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

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

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

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 151, 4]
type = ChangeState
trigger1 = HitOver
value = 130
ctrl = 1

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

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

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

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

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

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

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

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = Ctrl
var(10) = -Life

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

[State 153, 2]
type = VelSet
trigger1 = Time = GetHitVar(slidetime)
trigger2 = HitOver
x = 0

[State 153, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
value = 1

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

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

[State 雷　キァルトヴェルサ(フォース中)]
type = HitOverride
trigger1 = var(58) = 2
trigger1 = var(47)
attr = SCA,AA,AP
stateno = 320
time = 1
IgnoreHitPause = 1

[State 153, 4]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1

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

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

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

;---------------------------------------------------------------------------
; AGUARDHIT2 (knocked away)
[Statedef 155]
type    = A
movetype= H
physics = N
anim = 152

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = Ctrl
var(10) = -Life

[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)
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 根性値用ライフ反転]
Type = VarSet
Trigger1 = sysvar(0)
var(10) = -Life

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

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







;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;HITG_SLIDE

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5001]
type    = S
movetype= H
physics = S

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = HitOver
var(10) = -Life

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

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITC_SHAKE
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5010, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
triggerall = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;HITC_SLIDE

[State 5010, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITC_SLIDE
[Statedef 5011]
type    = C
movetype= H
physics = C

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = HitOver
var(10) = -Life

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

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITA_SHAKE
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

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

[State 5030, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5050 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;HITA_UP (transition)

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
value = 5035

[State 5035, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5035, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5035, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;HITA_FALL

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITA_RECOV (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= H
physics = N

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = HitOver
var(10) = -Life

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050

[State 5040, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim != 5040
trigger2 = Time = 0
trigger2 = Anim != 5035
value = 5040

[State 5040, 3]
type = CtrlSet
trigger1 = HitOver
value = 1

[State 5040, 4]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5040, 5]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5040, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMPLAND

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = var(53) = 0
trigger1 = Command = "Arcana_recovery"
value = 5200

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = var(53) = 0
trigger1 = Command = "recovery"
value = ifelse(Pos Y >= -20,5200,5210)

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

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

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

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type    = A
movetype= H
physics = N

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

[State 5071, 2] ;Acceleration
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 15
type = ChangeState
value = 5110

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type    = L
movetype= H
physics = C

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

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 5110 ;HIT_LIEDOWN

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5100]
type    = L
movetype= H
physics = N

[State 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5100, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5100, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5100, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5100, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = s0,6

[State 5100, 11]
type = PosFreeze
trigger1 = 1

[State 5100, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5101, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 5110

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State アニメ　マッチオバ];ハイパーKO用アニメ
type = ChangeAnim
trigger1 = Time = 0
trigger1 = MatchOver
value = 5171
persistent = 0

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5100, 10]
type = PlaySnd
trigger1 = !SysVar(0)
trigger1 = Time = 0
value = s0,6

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; 起きあがり
[Statedef 5120]
type    = L
movetype= I
physics = N

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

[State 5120, 2]
type = VelSet
trigger1 = Time = 0
x = 0

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

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

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "holdup" || command = "U"
;var(15) = 1
;
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "ハイジャンプ" && command != "ハイジャンプ失敗"
;var(15) = 41
;
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = ifelse(P2dist X >= 0,command = "前ダッシュ",command = "バックステップ")
;var(15) = 3
;
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = ifelse(P2dist X >= 0,command = "バックステップ",command = "前ダッシュ")
;var(15) = 4

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "a" && command = "x"
;trigger1 = command != "holdfwd" && command != "holdback"
;var(15) = 700

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "a" && command = "x"
;trigger1 = command = "holdfwd" || command = "holdback"
;var(15) = 720

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = Life > 1
;trigger1 = command = "弱功刀"
;var(15) = 1000
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = Life > 1
;trigger1 = command = "中功刀"
;var(15) = 1010
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = Life > 1
;trigger1 = command = "強功刀"
;var(15) = 1020

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "弱吐切"
;var(15) = 1400
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "中吐切"
;var(15) = 1410
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = command = "強吐切"
;var(15) = 1420
;[State 枯霊]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = var(48)
;trigger1 = command = "弱吐切"
;trigger2 = command = "中吐切"
;trigger3 = command = "強吐切"
;var(15) = 2200


;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = Ifelse(p2Dist X<0,command ="リバサ弱閏間",command="弱閏間")
;var(15) = 1100
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = Ifelse(p2Dist X<0,command ="リバサ中閏間",command="中閏間")
;var(15) = 1110
;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;trigger1 = Ifelse(p2Dist X<0,command ="リバサ強閏間",command="強閏間")
;var(15) = 1120
;[State 影宿]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = var(48)
;triggerall = StateNo != 5120
;trigger1 = Ifelse(p2Dist X<0,command ="リバサ弱閏間",command="弱閏間")
;trigger2 = Ifelse(p2Dist X<0,command ="リバサ中閏間",command="中閏間")
;trigger3 = Ifelse(p2Dist X<0,command ="リバサ強閏間",command="強閏間")
;var(15) = 2000

[State 40, 3]
type = VarSet
triggerall = var(53) = 0
trigger1 = Ifelse(p2Dist X<0,command = "弱天鎖",command = "弱斯封")
var(15) = 1200
[State 40, 3]
type = VarSet
triggerall = var(53) = 0
trigger1 = Ifelse(p2Dist X<0,command = "中天鎖",command = "中斯封")
var(15) = 1210
[State 40, 3]
type = VarSet
triggerall = var(53) = 0
trigger1 = Ifelse(p2Dist X<0,command = "強天鎖",command = "強斯封")
var(15) = 1220

;[State 40, 3]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = power >= 1000
;trigger1 = Ifelse(p2Dist X<0,command = "リバサ無怨",command = "無怨")
;var(15) = 3000

;[State 死祀1]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = var(46)=0 || var(46)=5
;triggerall = var(48) = 0
;trigger1 = command = "死祀"
;var(15) = 3500
;[State 死祀2]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = var(46)=0 || var(46)=5
;triggerall = var(48)
;trigger1 = command = "死祀"
;var(15) = 3600
;[State 死祀3]
;type = VarSet
;triggerall = var(53) = 0
;triggerall = var(46) = 1 || var(46) = 2 || var(46) = 3
;trigger1 = command = "死祀"
;var(15) = 3700

[State 40, 3]
type = VarSet
trigger1 = var(15) != 0
var(17) = 5

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 無敵　投げ] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value2 = ,AT
time = 12
;[State 無敵] ;Can't be hit right after getting up (short time)
;type = NotHitBy
;trigger1 = AnimTime = 0
;value2 = SCA
;time = 1


[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3

[State 5150, 5]
type = ChangeAnim
trigger1 = Time = 0
;trigger1 = MatchOver = 0
value = 5110
persistent = 0

[State アニメ　!マッチオバ]
type = ChangeAnim
trigger1 = MatchOver = 0
trigger1 = TeamMode = single
trigger1 = roundState = 4
trigger1 = Anim = 5110
trigger1 = time > 60
value = ifelse((100*enemyNear,life/enemyNear,LifeMax) >= 30,5141,5142)
persistent = 0

[State アニメ　!マッチオバターン用]
type = ChangeAnim
triggerall = P2Dist X < 0
trigger1 = Anim = 5142
value = 5143
persistent = 0

[State ターン]
type = Turn
triggerall = P2Dist X < 0
trigger1 = Anim = 5143
trigger1 = AnimElemTime(5) = 0
persistent = 0

;相手のライフ30%以上
[State vaice　ダメボイス]
type = PlaySnd
trigger1 = Anim = 5141
trigger1 = AnimElemTime(1) = 30
value = 5000,22
channel = 5
persistent = 0
;相手のライフ30%未満
[State vaice　なかなかにやるな]
type = PlaySnd
trigger1 = Anim = 5142
trigger1 = AnimElemTime(6) = 1
trigger2 = Anim = 5143
trigger2 = AnimElemTime(8) = 1
value = 111,16
channel = 5
persistent = 0


;enemy,hitdefattr P系(ヘルパのヒットデフアター)の検出ができないのでハイパーKOの判別できず。
[State アニメ　マッチオバ];マッチオバでハイパーKOを使う
type = ChangeAnim
triggerall = Time = 0
triggerall = PrevStateNo = 5110
triggerall = MatchOver
trigger1 = TeamMode = single
value = 5150
persistent = 0

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

[State 5150, 8]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 根性値用ライフ反転]
Type = VarSet
Trigger1 = Time = 0
var(10) = -Life

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

[State 5200, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5200, 3]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 10
value = 5201

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (on the ground)
[Statedef 5201]
type    = S
movetype= H
physics = S
anim = 5200

[State 5201, 0]
type = PlaySnd
trigger1 = time = 0
value = s111,13
channel = 0

[State se着地1]
type = PlaySnd
trigger1 = time = 0
value = s0,10
channel = 1
[State se着地靴音]
type = PlaySnd
trigger1 = AnimElemTime(5) = 0
value = s0,2
channel = 1

[State 地上受身エフェクト]
Type = Helper
trigger1 = Time = 0
StateNo 		= 20915
ID 				= 20915
name 			= "G recover"
PosType 		= p1
Pos 			= 0,-10
Ownpal 			= 1
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
IgnoreHitPause = 1
Persistent = 0

[State 空中受身エフェクト]
Type = Helper
trigger1 = Time = 0
StateNo 		= 20916
ID 				= 5201
name 			= "A recover"
PosType 		= p1
Pos 			= -10,-75
Ownpal 			= 1
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
IgnoreHitPause = 1
Persistent = 0

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5


[State 5201, 2]
type = VelSet
trigger1 = time = 0
trigger2 = time = 25
y = 0

[State 5201, 3]
type = PosSet
trigger1 = Time = 0
trigger2 = AnimElemTime(5) = 0
y = 0

[State 5201, 2]
type = VelSet
trigger1 = AnimElemTime(3) >= 1
trigger1 = AnimElemTime(5) < 0
x = -4.5

[State 5201, 2]
type = VelSet
trigger1 = AnimElemTime(3) = 0
y = -4.5

[State 5201, 2]
type = Veladd
trigger1 = AnimElemTime(3) >= 1
trigger1 = AnimElemTime(5) < 0
trigger1 = Pos Y < 0
y = 0.56


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

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5210, 5]
type = ChangeState
trigger1 = Animtime = 0
value = 0
ctrl = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0
;VelSet = 0,0

[State -2, 1]
type = PlaySnd
trigger1 = time = 0
value = s111,14
channel = 0

[State レバー入力用]
type = Varset
trigger1 = time = 0
var(29) = 1

[State 空中受身エフェクト]
Type = Helper
trigger1 = Time = 0
StateNo 		= 20916
ID 				= 5210
name 			= "A recover"
PosType 		= P1
Pos 			= 0,-55
Ownpal 			= 1
SuperMoveTime 	= 999999999999
PauseMoveTime 	= 999999999999
IgnoreHitPause = 1
Persistent = 0

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

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

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

[State 5210, 1] 
type = VelMul
trigger1 = Time = 0
x = .35
y = .35

[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] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

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

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

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

[State 無敵1]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15
[State 無敵2]
type = NotHitBy
trigger1 = Time = 0
value2 = ,AA,AP
time = 20

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

[State 5210, 5]
type = VelAdd
trigger1 = Time >= 4
y = Const(movement.yaccel)

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMP_LAND
ctrl = 1

[State 0, ヘルパー消去]
Type = DestroySelf
Trigger1 = ishelper

;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
first = 0
last = 49
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
first = 0
last = 39
fvalue = 0

[State システムディレクション]
Type = Helper
Trigger1 = time = 0
StateNo 		= 10101
ID 				= 10101
PosType 		= Left
SuperMoveTime 	= 99999
PauseMoveTime 	= 99999
IgnoreHitPause = 1
Persistent = 0

[State サバイバルバグ防止]
Type = Helper
Trigger1 = Var(53) != 0
StateNo 		= 10100
ID 				= 10100
PosType 		= Left
SuperMoveTime 	= 99999
PauseMoveTime 	= 99999
IgnoreHitPause = 1
Persistent = 0

;持ち越しVar(59)〜(34)
;Var(49)〜(34)一応リセット
[State リセット　超必殺技KO勝利演出]
type = Varset
trigger1 = var(34) != 0
var(34) = 0
[State リセット　時カナ　ホンフジョウノイ時間停止用]
type = Varset
trigger1 = var(35) != 0
var(35) = 0
[State リセット　時カナ　無量光の意シェイクタイム用]
type = Varset
trigger1 = var(36) != 0
var(36) = 0
[State リセット　ボタン連打用]
type = Varset
trigger1 = var(37) != 0
var(37) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(38) != 0
var(38) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(39) != 0
var(39) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(40) != 0
var(40) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(41) != 0
var(41) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(42) != 0
var(42) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(43) != 0
var(43) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(44) != 0
var(44) = 0
[State リセット　未使用]
type = Varset
trigger1 = var(45) != 0
var(45) = 0
[State リセット　フォース展開フラグ]
type = Varset
trigger1 = var(46) != 0
var(46) = 0
[State リセット　アルカナフォース時パワーゲージ]
type = Varset
trigger1 = var(47) != 0
var(47) = 0
[State リセット　功刀判定+増加攻撃力]
type = VarSet
trigger1 = var(48) != 0
var(48) = 0
[State リセット　功刀+増加攻撃力（強化技）]
type = VarSet
trigger1 = var(49) != 0
var(49) = 0

[State KOフラグリセット]
type = VarSet
Trigger1 = time = 0
var(50) = 0
IgnoreHitPause = 1


[State ホーミングゲージMAX]
type = Varset
trigger1 = 1
fvar(25) = 3000

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundsexisted = 0
value = 190
