; 斬鉄-03.CNS「弾き」
;---------------------------------------------------------------------------
;弾き 立ち 開始-終わり
[Statedef 8100]
type    = S
movetype= A
physics = S
ctrl = 0
anim = 8100
velset = 0,0

[state 8100, Palfx]
type     = PalFx
trigger1 = time = 0
add      = 35, 35, 100
Time     = 6
ignorehitpause = 1

[State 8100, 1]
type = AfterImage
trigger1 = AnimElem = 2
palcontrast = 200,180,240
palbright = 70,60,80
time = 28
length = 12
framegap = 4
trans = none

;#1
[State 8100, 2]
type = ReversalDef
trigger1 = Time <= 5
poweradd = 50,0
attr = S, NT
reversal.attr = SA, NA, SA, HA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8101
P2StateNo = 8102

;#2
[State 8100, 3]
type = ReversalDef
trigger1 = Time >= 6
poweradd = 50,0
attr = S, NT
reversal.attr = SA, NA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8101
P2StateNo = 8102

[STate -2]
type = AfterImagetime
trigger1 = Movetype = H
time = 0

[State 8100, 4]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;弾き 返し
[Statedef 8101]
type    = S
movetype= A
physics = S
ctrl = 0
anim = 8101
velset = 0,0

[State 8101, 1]
type = PlaySnd
trigger1 = Time = 2
value = s2,4+floor(Random/500)

[State 8101, 2]
type = BGPalFX
Trigger1 = time = 0
ignorehitpause = 1
add = -128,-128,128
time = 1

[State 8101, 3]
type = BGPalFX
Trigger1 = time = 2
ignorehitpause = 1
add = 256,256,256
time = 1

[State 8101, 4]
type = BGPalFX
Trigger1 = time = 4
ignorehitpause = 1
add = -128,-128,128
time = 1

[State 8101, 5]
type = BGPalFX
Trigger1 = time = 6
ignorehitpause = 1
add = 256,256,256
time = 1

[State 8101, 6]
type = explod
trigger1 = AnimElem = 2
postype = p1
pos = 50,-70
bindtime = 1
sprpriority = 1
anim = 7101
persistent = 0
ignorehitpause = 1

[State 8101, 7]
type = CtrlSet 
Trigger1 = Time = 10
Value = 1

;追加技
[State 8101, 8]
type = ChangeState
triggerall = time >= 3
trigger1 = command = "b"
value = 8130

;追加技
[State 8101, 8]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = Alive
triggerall = RoundState = 2
triggerall = Time >= 3
triggerall = Random <= Var(59) * 100
trigger1 = Var(55) = 0
trigger1 = Var(58) = [1,2]
trigger2 = Var(58) = 3 || Var(58) = 5
trigger2 = !(Power >= 2000 || ((Life <= LifeMax / 4) && Power >= 1000))
trigger3 = Var(58) = 4 || Var(58) = 6
trigger3 = Power < 3000
trigger4 = Var(58) != [1,2]
trigger4 = ((EnemyNear(Var(50)),Life * 1000) / EnemyNear(Var(50)),LifeMax) < 400
trigger5 = Var(58) != [1,2]
trigger5 = Time >= 15 - Floor(EnemyNear(Var(50)),Pos Y / 10)
trigger6 = Var(55) != 0
trigger6 = P2BodyDist X >= 40 + ((EnemyNear(Var(50)),BackEdgeBodyDist < 20) * 20)
value = 8130

[STate -2]
type = AfterImagetime
trigger1 = Time = 0
time = 0

[State 8101, 9]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
;敵 地上
[Statedef 8102]
type    = S
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8102, 1]
type = destroyself
trigger1 = time = 0

[State 8102, 2]
type = ChangeState
trigger1 = Pos Y < 0
value = 8103

[State 8102, 3]
type = Changeanim2
trigger1 = Time = 0
value = 8102

[State 8102, 5]
type = SelfState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;敵 空中
[Statedef 8103]
type    = A
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8103, 0]
type = destroyself
trigger1 = time = 0

[State 8103, 1]
type = Changeanim2
trigger1 = Time = 0
value = 8103

[State 8103, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 8104

;[State 8103, 2]
;type = SelfState
;trigger1 = AnimTime = 0
;value = 5040

;---------------------------------------------------------------------------
;敵 空中着地
[Statedef 8104]
type    = A
movetype= H
physics = N

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

[State 8104, 1]
type = Velset
trigger1 = Time = 0
x = ifelse(p2dist X >= 0,-1,1)
y = -6

[State 8104, 2]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 8104, 3]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 8104, 4]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52

;---------------------------------------------------------------------------
;弾き しゃがみ 開始-終わり
[Statedef 8110]
type    = C
movetype= A
physics = C
ctrl = 0
anim = 8110
velset = 0,0

[state 8110, Palfx]
type     = PalFx
trigger1 = time = 0
add      = 35, 35, 100
Time     = 6
ignorehitpause = 1

[State 8110, 1]
type = AfterImage
trigger1 = AnimElem = 2
palcontrast = 200,180,240
palbright = 70,60,80
time = 22
length = 12
framegap = 4
trans = none

;#1
[State 8110, 2]
type = ReversalDef
trigger1 = Time <= 3
poweradd = 50,0
attr = C, NT
reversal.attr = SC, NA, SA, HA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8111
P2StateNo = 8112

;#2
[State 8110, 3]
type = ReversalDef
trigger1 = Time >= 4
poweradd = 50,0
attr = C, NT
reversal.attr = SC, NA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8111
P2StateNo = 8112

[STate -2]
type = AfterImagetime
trigger1 = Movetype = H
time = 0

[State 8110, 4]
type = ChangeState
trigger1 = animtime = 0
value = 11
ctrl = 1

;---------------------------------------------------------------------------
;弾き しゃがみ 返し
[Statedef 8111]
type    = C
movetype= A
physics = c
ctrl = 0
anim = 8111
velset = 0,0

[State 8111, 1]
type = PlaySnd
trigger1 = Time = 2
value = s2,4+floor(Random/500)

[State 8111, 2]
type = BGPalFX
Trigger1 = time = 0
ignorehitpause = 1
add = -128,-128,128
time = 1
[State 8111, 3]
type = BGPalFX
Trigger1 = time = 2
ignorehitpause = 1
add = 256,256,256
time = 1
[State 8111, 4]
type = BGPalFX
Trigger1 = time = 4
ignorehitpause = 1
add = -128,-128,128
time = 1
[State 8111, 5]
type = BGPalFX
Trigger1 = time = 6
ignorehitpause = 1
add = 256,256,256
time = 1

[State 8111, 6]
type = explod
trigger1 = AnimElem = 2
postype = p1
pos = 50,-70
bindtime = 1
sprpriority = 1
anim = 7101
persistent = 0
ignorehitpause = 1

[State 8110, 7]
type = CtrlSet 
Trigger1 = Time = 10
Value = 1

;追加技
[State 8111, 10]
type = ChangeState
triggerall = time >= 3
trigger1 = command = "b"
value = 8130

;追加技
[State 8111, 10]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = Alive
triggerall = RoundState = 2
triggerall = Time >= 3
triggerall = Random <= Var(59) * 100
trigger1 = Var(55) = 0
trigger1 = Var(58) = [1,2]
trigger2 = Var(58) = 3 || Var(58) = 5
trigger2 = !(Power >= 2000 || ((Life <= LifeMax / 4) && Power >= 1000))
trigger3 = Var(58) = 4 || Var(58) = 6
trigger3 = Power < 3000
trigger4 = Var(58) != [1,2]
trigger4 = ((EnemyNear(Var(50)),Life * 1000) / EnemyNear(Var(50)),LifeMax) < 400
trigger5 = Var(58) != [1,2]
trigger5 = Time >= 15 - Floor(EnemyNear(Var(50)),Pos Y / 10)
trigger6 = Var(55) != 0
trigger6 = P2BodyDist X >= 40 + ((EnemyNear(Var(50)),BackEdgeBodyDist < 20) * 20)
value = 8130

[STate -2]
type = AfterImagetime
trigger1 = Time = 0
time = 0

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

;---------------------------------------------------------------------------
;敵 しゃがみ 地上
[Statedef 8112]
type    = S
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8112, 1]
type = destroyself
Trigger1 = time = 0

[State 8112, 2]
type = ChangeState
Trigger1 = Pos Y <  0
Value = 8113

[State 8112, 3]
type = Changeanim2
Trigger1 = Time = 0
Value = 8112

[State 8112, 4]
type = posadd
trigger1 = time = [0,15]
x = -1.5

[State 8112, 5]
type = SelfState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;敵 しゃがみ 空中
[Statedef 8113]
type    = A
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8113, 1]
type = destroyself
Trigger1 = time = 0

[State 8113, 2]
type = Changeanim2
Trigger1 = Time = 0
Value = 8113

;[State 8113, 3]
;type = SelfState
;trigger1 = AnimTime = 0
;value = 5040

[State 8113, 3]
type = ChangeState
trigger1 = AnimTime = 0
value = 8114

;---------------------------------------------------------------------------
;敵 空中着地
[Statedef 8114]
type    = A
movetype= H
physics = N

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

[State 8114, 1]
type = Velset
trigger1 = Time = 0
x = ifelse(p2dist X >= 0,-1,1)
y = -6

[State 8114, 2]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 8114, 3]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 8114, 4]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52

;---------------------------------------------------------------------------
;追加技
[Statedef 8130]
type    = S
movetype= A
physics = S
juggle  = 4
poweradd= 65
ctrl = 0
velset = 10,0
anim = 8130
sprpriority = -1

[State 8130, Width]
type = Width
trigger1 = (AnimElemTime (2) >= 0) && (AnimElemTime (7) < 0)
value = 15,0

[State 8130, 1]
type = PlaySnd
trigger1 = AnimElem = 5
value = S1,0

[State 8130, hd1]
type = HitDef
trigger1 = Var(58) = [1,2]
trigger1 = AnimElem = 9
attr = S, NA
damage   = (Ceil((141*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41), (Ceil((8*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41)
animtype = diagup
hitflag = MAF
guardflag = HA
priority = 6, Hit
pausetime = 14,14
sparkno = S7100
guard.sparkno = S7300
sparkxy = -10,-75
hitsound = s3,6+floor(Random/500)
guardsound = s2,4+floor(Random/500)
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1.4,-9
p2stateno = 8135

[State 8130, hd1]
type = HitDef
trigger1 = Var(58) = [3,4]
trigger1 = AnimElem = 9
attr = S, NA
damage   = (Ceil((113*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41), (Ceil((8*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41)
animtype = diagup
hitflag = MAF
guardflag = HA
priority = 6, Hit
pausetime = 14,14
sparkno = S7100
guard.sparkno = S7300
sparkxy = -10,-75
hitsound = s3,6+floor(Random/500)
guardsound = s2,4+floor(Random/500)
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1.4,-9
p2stateno = 8135

[State 8130, hd1]
type = HitDef
trigger1 = Var(58) = [5,6]
trigger1 = AnimElem = 9
attr = S, NA
damage   = (Ceil((137*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41), (Ceil((8*FVar(0))*FVar(1))-((Var(42)>=2)*1))*Var(41)
animtype = diagup
hitflag = MAF
guardflag = HA
priority = 6, Hit
pausetime = 14,14
sparkno = S7100
guard.sparkno = S7300
sparkxy = -10,-75
hitsound = s3,6+floor(Random/500)
guardsound = s2,4+floor(Random/500)
ground.type = High
ground.slidetime = 15
ground.hittime  = 20
ground.velocity = -1.4,-9
p2stateno = 8135

[State 8130, 2]
type = explod
trigger1 = movehit
postype = p2
pos = -10, -75
sprpriority = 6
anim = 7405
ID = 7405
ignorehitpause = 1
bindtime = -1
ownpal = 1
persistent = 0

[State 8130, 5]
type = VarSet
trigger1 = AnimElem = 9
v = 10
value = 1

[State 8130, 0]
type = VarSet
trigger1 = Time = 0
trigger2 = AnimElem = 10
v = 10
value = 0

[State 8130, 1]
type = Explod
triggerall = var(15) = 0
trigger1 = Var(10) = 1
persistent = 2
ignorehitpause = 1
anim = 6010
pos = 0,0
sprpriority = 3
removetime = 1
bindtime = -1
ownpal = 1

[State 8130, 1]
type = Explod
trigger1 = Var(10) = 0
persistent = 2
ignorehitpause = 1
anim = 6666
pos = 0,0
sprpriority = 3
removetime = 1
bindtime = -1
ownpal = 1

[State 8130, 4]
type = SprPriority
trigger1 = AnimElem = 5
value = 2

[State 8130, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------
; 追加技_相手
[Statedef 8135]
type = A
movetype = H
physics = N
velset = 0,0

[State 8135, ca_2-1]
type = ChangeAnim2
trigger1 = Time = 0
value = 1001

[State 8135, ca2]
type = ChangeAnim
trigger1 = Time = 14
value = 5030

[State 8135, ca4]
type = ChangeAnim
trigger1 = Anim = 5030
trigger1 = AnimTime = 0
value = 5050

[State 8135, va1]
type = VelAdd
trigger1 = Time = 14
x = -6.5
y = -6.5

[State 8135, va2]
type = VelAdd
trigger1 = Time > 14
y = .7

[State 8135, ss]
type = ChangeState
trigger1 = Time > 16
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 1013

;---------------------------------------------------------------------------
;弾き 空中 開始-終わり
[Statedef 8120]
type    = A
movetype= A
physics = A
ctrl = 0
anim = 8120
;velset = 0,0

[state 8120, Palfx]
type     = PalFx
trigger1 = time = 0
add      = 35, 35, 100
Time     = 6
ignorehitpause = 1

[State 8120, 1]
type = AfterImage
trigger1 = AnimElem = 2
palcontrast = 200,180,240
palbright = 70,60,80
time = 22
length = 12
framegap = 4
trans = none

;#1
[State 8120, 2]
type = ReversalDef
trigger1 = Time <= 3
poweradd = 50,0
attr = A, NT
reversal.attr = SA, NA, SA, HA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8121
P2StateNo = 8122

;#2
[State 8120, 3]
type = ReversalDef
trigger1 = Time >= 4
poweradd = 50,0
attr = A, NT
reversal.attr = SA, NA
numhits = 0
pausetime = 2,2
sparkno = -1
P1StateNo = 8121
P2StateNo = 8122

;---------------------------------------------------------------------------
;弾き 空中 返し
[Statedef 8121]
type    = A
movetype= A
physics = A
ctrl = 0
anim = 8121
velset = 0,0

[State 8121, 1]
type = PlaySnd
trigger1 = Time = 2
value = s2,4+floor(Random/500)

;画面フラッシュ
[State 8121, 1]
type = BGPalFX
Trigger1 = time = 0
ignorehitpause = 1
add = -128,-128,128
time = 1

[State 8121, 2]
type = BGPalFX
Trigger1 = time = 2
ignorehitpause = 1
add = 256,256,256
time = 1

[State 8121, 3]
type = BGPalFX
Trigger1 = time = 4
ignorehitpause = 1
add = -128,-128,128
time = 1

[State 8121, 4]
type = BGPalFX
Trigger1 = time = 6
ignorehitpause = 1
add = 256,256,256
time = 1

[State 8110, 5]
type = explod
trigger1 = AnimElem = 3
postype = p1
pos = 50,-80
bindtime = 1
sprpriority = 1
anim = 7101
persistent = 0
ignorehitpause = 1

[State 8121, 6]
type = CtrlSet 
Trigger1 = Time = 12
Value = 1

[State 1001, 0]
type = VelSet
trigger1 = Time = 0
x = 1
y = -6.5

[STate -2]
type = AfterImagetime
trigger1 = Movetype = H
time = 0

[State 8121, 50]
type = ChangeState
trigger1 = AnimTime = 0
value = 50

;---------------------------------------------------------------------------
;弾き 空中 敵 地上
[Statedef 8122]
type    = S
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8122, 0]
type = destroyself
Trigger1 = time = 0

[State 8122, 0]
type = ChangeState
Trigger1 = Pos Y <  0
Value = 8123

[State 8122, 1]
type = Changeanim2
Trigger1 = Time = 0
Value = 8122

[State 8122, 5]
type = posadd
trigger1 = time = [0,15]
x = -1.5

[State 8122, 3]
type = SelfState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;弾き 空中 敵 空中
[Statedef 8123]
type    = A
movetype= H
physics = N
ctrl = 0
velset = 0,0

[State 8123, 0]
type = destroyself
Trigger1 = time = 0

[State 8123, 0]
type = Changeanim2
Trigger1 = Time = 0
Value = 8123

;[State 8123, 50]
;type = SelfState
;trigger1 = AnimTime = 0
;value = 5040

[State 8123, 50]
type = ChangeState
trigger1 = AnimTime = 0
value = 8124

;---------------------------------------------------------------------------
;敵 空中着地
[Statedef 8124]
type    = A
movetype= H
physics = N

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

[State 8124, 1]
type = Velset
trigger1 = Time = 0
x = ifelse(p2dist X >= 0,-1,1)
y = -6

[State 8124, 2]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 8124, 3]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 8124, 4]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52

;---------------------------------------------------------------------
; ガードキャンセル・弾き
[Statedef 8140]
type = S
movetype = A
physics = S
anim = 8140
velset = 0
ctrl = 0
poweradd = ifelse((var(58)=1||var(58)=3||var(58)=5),-1000,-3000)

[State 8140, 1]
type = PlaySnd
trigger1 = Time = 2
value = s2,4+floor(Random/500)

[State 8140, 1]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 11

[State 8140, 2]
type = BGPalFX
Trigger1 = Time = 0
ignorehitpause = 0
add = -128,-128,128
persistent = 1
time = 1

[State 8140, 3]
type = BGPalFX
Trigger1 = Time = 2
ignorehitpause = 0
add = 256,256,256
persistent = 1
time = 1

[State 8140, 4]
type = BGPalFX
Trigger1 = Time = 4
ignorehitpause = 0
add = -128,-128,128
persistent = 1
time = 1

[State 8140, 5]
type = BGPalFX
Trigger1 = Time = 6
ignorehitpause = 0
add = 256,256,256
persistent = 1
time = 1

[State 8140, 6]
type = explod
trigger1 = AnimElem = 2
postype = p1
pos = 50,-70
bindtime = 1
sprpriority = 1
anim = 7101
persistent = 0
ignorehitpause = 0

[State 8140, 3]
type = HitDef
trigger1 = AnimElem = 3
attr = S, NA
damage = 0
getpower = 0,0
animtype = back
guardflag =
hitflag = MAF
priority = 7
getpower = 0,0
pausetime = 0,10
sparkno = S7015
guard.sparkno = S7025
sparkxy = -10, -70
hitsound = -1
guardsound = -1
ground.type = Low
ground.slidetime = 16
ground.hittime  = 30
ground.velocity = -2,-7
air.velocity = -1.6,-6
air.hittime  = 30
yaccel = .46
kill = 0

[State 8140, 7]
type = CtrlSet
Trigger1 = Time = 12
Value = 1

;追加技
[State 8140, 10]
type = ChangeState
triggerall = !var(59)
triggerall = Time >= 3
trigger1 = command = "b"
value = 8130

;追加技
[State 8140, 10]
type = ChangeState
triggerall = Var(59) = [1,10]
triggerall = Time >= 3
trigger1 = P2BodyDist X = [70,90]
trigger1 = Random <= Var(59) * 100
value = 8130

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