; 斬鉄-05.CNS
;---------------------------------------------------------------------------
;パワーゲージ
[Statedef 20000]
type     = A
movetype = I
physics  = N
ctrl     = 0
anim = 20000

;===========================================================================
[State 20000, InGuardDist]
type = Turn
trigger1 = Facing * IfElse((Enemy(Root,Var(50)),Pos X - Pos X) >= 0, 1,-1) < 0
ignorehitpause = 1

[State 20000, InGuardDist]
type = VarSet
trigger1 = Enemy(Root,Var(50)),Facing * IfElse((Enemy(Root,Var(50)),Pos X - Root,Pos X) >= 0, 1,-1) <= 0
trigger2 = !Enemy(Root,Var(50)),HitDefAttr = A, NA, SA, HA
var(0) = 0
ignorehitpause = 1

[State 20000, InGuardDist]
type = VarSet
trigger1 = Enemy(Root,Var(50)),Facing * IfElse((Enemy(Root,Var(50)),Pos X - Root,Pos X) >= 0, 1,-1) > 0
trigger1 = Enemy(Root,Var(50)),HitDefAttr = A, NA, SA, HA
var(0) = 1
ignorehitpause = 1

[State 20000, InGuardDist]
type = PosSet
trigger1 = IsHelper
x = Root,Pos X + IfElse((Enemy(Root,Var(50)),Pos Y < 0 && Var(0) = 1),(Enemy(Root,Var(50)),Const(size.attack.dist)),(Enemy(Root,Var(50)),Const(size.proj.attack.dist))) * (Enemy(Root,Var(50)),Facing)
y = Root,Pos Y
ignorehitpause = 1

[State 20000, InGuardDist]
type = PosSet
trigger1 = IsHelper
trigger1 = BackEdgeBodyDist <= 0
x = IfElse(Facing = 1, -160, 160)
y = Root,Pos Y
ignorehitpause = 1

[State 20000, Helper_1]
type = VarSet
triggerall = Var(1) = 0
triggerall = EnemyNear,NumHelper > 0
triggerall = RoundState = 2 && Root,Ctrl = 1
trigger1 = Enemy,TeamMode = Single
trigger2 = Enemy,TeamMode = Turns
v = 1
value = EnemyNear,NumHelper

[State 20000, Helper_2]
type = VarSet
triggerall = Var(1) = 0
trigger1 = Enemy,TeamMode = Simul
trigger1 = enemy,NumHelper > 0
trigger1 = RoundState = 2 && Root,Ctrl = 1
v = 1
value = Enemy,NumHelper

[State 20000, Proj_1]
type = VarSet
triggerall = Var(2) = 0
triggerall = EnemyNear,NumProj > 0
triggerall = EnemyNear,PrevStateNo = [190,199]
trigger1 = Enemy,TeamMode = Single
trigger2 = Enemy,TeamMode = Turns
v = 2
value = EnemyNear,NumProj

[State 20000, Proj_2]
type = VarSet
triggerall = Var(2) = 0
trigger1 = Enemy,TeamMode = Simul
trigger1 = Enemy,NumProj > 0
trigger1 = EnemyNear,PrevStateNo = [190,199]
v = 2
value = Enemy,NumProj

[State 20000, GuardFlag]
type = Null
trigger1 = Enemy,NumHelper = Var(1)
trigger1 = Var(4) := 0 || 1
trigger2 = Var(4) >= 180
trigger2 = Var(1) := Var(1) - 1
trigger3 = Enemy,NumHelper < Var(1)
trigger3 = Var(4) := Var(4) + 1

[State 20000, GuardFlag]
type = Null
trigger1 = Enemy,NumProj = Var(2)
trigger1 = Var(5) := 0 || 1
trigger2 = Var(5) >= 120
trigger2 = Var(2) := Var(2) - 1
trigger3 = Enemy,NumProj < Var(2)
trigger3 = Var(5) := Var(5) + 1

[State 20000, GuardFlag]
type = Null
trigger1 = Enemy,NumHelper > Var(1)
trigger1 = !Root,InGuardDist && InGuardDist
trigger1 = Var(3) := 3
trigger2 = Enemy,NumProj > Var(2)
trigger2 = !Root,InGuardDist && InGuardDist
trigger2 = Var(3) := 3
trigger3 = Enemy,NumHelper > Var(1)
trigger3 = Root,InGuardDist
trigger3 = Var(3) := 2
trigger4 = Enemy,NumProj > Var(2)
trigger4 = Root,InGuardDist
trigger4 = Var(3) := 2
trigger5 = Enemy,NumHelper > Var(1)
trigger5 = !Root,InGuardDist
trigger5 = Var(3) := 1
trigger6 = Enemy,NumProj > Var(2)
trigger6 = !Root,InGuardDist
trigger6 = Var(3) := 1
trigger7 = Enemy,NumHelper = Var(1)
trigger7 = Root,Ctrl || (Root,StateNo != [120,155])
trigger7 = Var(3) := 0 || 1
trigger8 = Enemy,NumProj = Var(2)
trigger8 = Root,Ctrl || (Root,StateNo != [120,155])
trigger8 = Var(3) := 0 || 1

[State 20000, Invincible]
type = VarSet
trigger1 = P2StateType = L
var(10) = -1
ignorehitpause = 1

[State 20000, Invincible]
type = VarAdd
triggerall = Var(5) > 0
trigger1 = P2StateType != L
var(10) = -1
ignorehitpause = 1

[State 20000, Invincible]
type = VarSet
triggerall = Var(5) = -1
trigger1 = P2StateType != L
var(10) = 13
ignorehitpause = 1

[State 20000, AttackTime_1]
type = VarSet
triggerall = Var(13) != 0
trigger1 = EnemyNear(Root,Var(50)),MoveType != A
trigger2 = EnemyNear(Root,Var(50)),Time = 1
trigger2 = EnemyNear(Root,Var(50)),StateNo >= 200
trigger2 = EnemyNear(Root,Var(50)),PrevStateNo >= 200
trigger2 = EnemyNear(Root,Var(50)),PrevStateNo != EnemyNear(Root,Var(50)),StateNo
trigger2 = EnemyNear(Root,Var(50)),PrevStateNo + 1 != EnemyNear(Root,Var(50)),StateNo
trigger2 = EnemyNear(Root,Var(50)),PrevStateNo + 2 != EnemyNear(Root,Var(50)),StateNo
trigger3 = EnemyNear(Root,Var(50)),Time = 1
trigger3 = EnemyNear(Root,Var(50)),StateNo >= 200
trigger3 = EnemyNear(Root,Var(50)),PrevStateNo >= 200
trigger3 = EnemyNear(Root,Var(50)),PrevStateNo = EnemyNear(Root,Var(50)),StateNo
v = 13
value = 0
ignorehitpause = 1

[State 20000, AttackTime_2]
type = VarAdd
trigger1 = EnemyNear(Root,Var(55)),MoveType = A
v = 13
value = 1
ignorehitpause = 1

[State 20000, Hajiki]
type = VarSet
trigger1 = Root,StateNo = [8100,8120]
trigger1 = Root,Time = 1
v = 15
value = Var(14)
ignorehitpause = 1

[State 20000, Hajiki]
Type = VarAdd
TriggerAll = Root,Var(59) > 0
TriggerAll = Var(16) > 0
trigger1 = Var(14) != Var(15)
v = 16
value = 0
ignorehitpause = 1

[State 20000, Hajiki]
Type = VarAdd
TriggerAll = Root,Var(59) > 0
TriggerAll = Var(16) > 0
trigger1 = Root,StateNo = [8100,8120]
v = 16
value = -1
ignorehitpause = 1

[State 20000, Hajiki]
type = VarSet
triggerall = Root,Var(59) > 0
triggerall = Var(14) = Var(15)
trigger1 = Root,StateNo = [8100,8120]
v = 16
value = 120
ignorehitpause = 1

[State 20000, GuardState]
type = Null
trigger1 = Root,PrevStateNo != [120,159]
trigger1 = Root,StateNo != [5070,5071]
trigger1 = Root,StateNo  = [5000,5099]
trigger1 = Var(30) := 0 || 1
trigger2 = Root,PrevStateNo = [5070,5071]
trigger2 = Root,StateNo = 5110
trigger2 = Var(30) := 0 || 1
trigger3 = Root,PrevStateNo = [120,159]
trigger3 = Root,MoveType != H
trigger3 = Var(30) := 0; || 1
trigger4 = Root,StateNo = [120,159]
trigger4 = Root,StateType = S
trigger4 = Var(30) := 1
trigger5 = Root,StateNo = [120,159]
trigger5 = Root,StateType = C
trigger5 = Var(30) := 2
trigger6 = Root,StateNo = [120,159]
trigger6 = Root,StateType = A
trigger6 = Var(30) := 3

[State 20000, GuardState2-1]
type = VarSet
trigger1 = Var(29) = 1
trigger1 = Root,MoveType != H
var(29) = 0
ignorehitpause = 1

[State 20000, GuardState2-2]
type = VarSet
trigger1 = Var(29) = 0
trigger1 = EnemyNear(Root,Var(50)),HitDefAttr = SCA, NA, SA, HA
trigger1 = Root,MoveType = H
trigger1 = Root,StateNo != [120,159]
trigger1 = Root,StateNo != [5000,5099]
var(29) = 1
ignorehitpause = 1

[State 20000, Throw Learning]
type = VarSet
triggerall = Enemy,TeamMode = Single || Enemy,TeamMode = Turns
triggerall = Var(31) = 0
trigger1 = P2MoveType = A
trigger1 = EnemyNear(Root,Var(50)),HitDefAttr = SCA, NT, ST, HT
trigger1 = EnemyNear(Root,Var(50)),Time > 1
var(31) = P2StateNo
ignorehitpause = 1

[State 20000, Throw Learning]
type = VarSet
triggerall = Enemy,TeamMode = Single || Enemy,TeamMode = Turns
triggerall = Var(31) != 0 && Var(32) = 0
triggerall = P2StateNo != Var(31)
trigger1 = P2MoveType = A
trigger1 = EnemyNear(Root,Var(50)),HitDefAttr = SCA, NT, ST, HT
trigger1 = EnemyNear(Root,Var(50)),Time > 1
var(32) = P2StateNo
ignorehitpause = 1

[State 20000, Throw Learning]
type = Varset
triggerall = Enemy,TeamMode = Single || Enemy,TeamMode = Turns
triggerall = Var(31) != 0 && Var(32) != 0 && Var(33) = 0
triggerall = P2StateNo != Var(31) && P2StateNo != Var(32)
trigger1 = P2MoveType = A
trigger1 = EnemyNear(Root,Var(50)),HitDefAttr = SCA, NT, ST, HT
trigger1 = EnemyNear(Root,Var(50)),Time > 1
var(33) = P2StateNo
ignorehitpause = 1

;===========================================================================

;ゲージ消去
[State 200001];
type = RemoveExplod
trigger1 = Parent,Life <= (Parent,LifeMax / 4)
ID = 20001
Persistent = 0

;ゲージ消去
[State 200001];
type = RemoveExplod
trigger1 = Parent,Life > (Parent,LifeMax / 4)
ID = 20002
Persistent = 0

[State 20000]
type = Explod
trigger1 = Parent,Life > (Parent,LifeMax / 4)
trigger1 = NumExplod(20001) = 0
anim = ifelse((Parent,Var(58) = [1,2]),20001,ifelse((Parent,Var(58) = [3,4]),20003,20005))
postype = left
pos = ifelse(teamside = 1,10,280),200
sprpriority = 6
scale = 0.6, 0.6
OnTop = 1
supermove = 1
supermovetime = 99999999
pausemovetime = 99999999
bindtime = -1
removetime = -1
ownpal = 1
ID = 20001
IgnoreHitPause = 1
Persistent = 1

[State 20000]
type = Explod
trigger1 = Parent,Life <= (Parent,LifeMax / 4)
trigger1 = NumExplod(20002) = 0
anim = ifelse((Parent,Var(58) = [1,2]),20002,ifelse((Parent,Var(58) = [3,4]),20004,20006))
postype = left
pos = ifelse(teamside = 1,10,280),200
sprpriority = 6
scale = 0.6, 0.6
OnTop = 1
supermove = 1
supermovetime = 99999999
pausemovetime = 99999999
bindtime = -1
removetime = -1
ownpal = 1
ID = 20002
IgnoreHitPause = 1
Persistent = 1

[state 20000]
type = AssertSpecial
trigger1 = 1
flag = noshadow

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