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

[State 0, 1]
type = destroyself 
trigger1 = ishelper

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

[State 0, 1]
type = ChangeAnim
trigger1 = var(13)
trigger1 = prevstateno = 3500
value = 3505

[State 100, 1]
type = Velset
trigger1 = !var(5)
trigger1 = time = 0
trigger1 = Vel X <= 3.1
x = 0

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

[State 100, 1]
type = Velmul
trigger1 = !var(5)
trigger1 = time >= 0
trigger1 = Vel X > 0
x = 0.9

[State 100, 1]
type = Velmul
trigger1 = var(5)
trigger1 = time >= 0
trigger1 = Vel X > 0
x = 0.98

[State 100, 2]
type = Velset
trigger1 = time >= 1
trigger1 = Vel X <= 0.01
x = 0

[State -1]
type = Posset
trigger1 = time = 0
y = 0

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

[State 0, 4] ;Are you free?
type = ChangeState
trigger1 = time >=1020
trigger1 = random < 8
value = 2
;---------------------------------------------------------------------------
; Stand
[Statedef 2]
type = S
physics = S
sprpriority = 0
anim = 2

[State 0, 4]
type = Changeanim
trigger1 = prevstateno = 3
trigger1 = Time = 0
value = 2
elem = 5

[State 0, 1]
type = destroyself
trigger1 = ishelper

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

[State 100, 1]
type = Velmul
trigger1 = time >= 0
trigger1 = Vel X > 0
x = 0.9

[State 100, 2]
type = Velset
trigger1 = time >= 1
trigger1 = Vel X <= 0.01
x = 0

[State -1]
type = Posset
trigger1 = time = 0
y = 0

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

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = time >=390
trigger1 = random < 10
value = 3

;---------------------------------------------------------------------------
; Stand
[Statedef 3]
type = S
physics = S
sprpriority = 0
anim = 3

[State 0, 1]
type = destroyself
trigger1 = ishelper

[State -1]
type = Posset
trigger1 = time = 0
y = 0

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = time >=220
trigger1 = random < 20
value = ifelse(prevstateno=4,2,4)
;---------------------------------------------------------------------------
; Stand
[Statedef 4]
type = S
physics = S
sprpriority = 0
anim = 4

[State 193, 5]
type = PlaySnd
trigger1 = time = 0
value = 182, +7random%5
channel = 0
lowpriority = 0

[State 0, 1]
type = destroyself
trigger1 = ishelper

[State -1]
type = Posset
trigger1 = time = 0
y = 0

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = time >=120
value = 3
;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = C
anim = 10

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

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

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

[state a]
type = velmul
trigger1 = 1
x = 0.95

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

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

[State 12, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State -1, AI]
Type = ChangeState
Value = 105
TriggerAll = Var(58)
TriggerAll = StateType != A
Trigger1 = P2MoveType = A
Trigger1 = EnemyNear,HitDefAttr = SCA, NT, ST, HT
Trigger1 = Time = 0

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

[State 20, 1]
type = VelSet
Trigger1= Var(58)
Trigger1= P2StateType != L
Trigger2= Var(58)
Trigger2= P2StateType = L
Trigger2= P2BodyDist X >= 70
Trigger3= Var(58)
Trigger3= P2MoveType = H
Trigger3= P2StateNo = 1255
Trigger3= P2BodyDist X >= 56
x = const(velocity.walk.fwd.x)

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

[State 20, 2]
type = VelSet
Trigger1 = Var(58)
Trigger1 = P2StateType != L
Trigger1 = Var(57) = [80,99]
Trigger2 = Var(58)
Trigger2 = P2StateType = L
Trigger2 = P2BodyDist X <= 50
x = const(velocity.walk.back.x)

[State 20, 1]
type = VelSet
Trigger1 = Var(58)
Trigger1 = P2StateType != L
Trigger1 = Var(57) = [0,79]
Trigger2 = Var(58)
Trigger2 = P2StateType != L
Trigger3 = Var(58)
Trigger3 = P2StateType = L
Trigger3 = P2BodyDist X >= 60
x = const(velocity.walk.fwd.x)

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

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

[State -1, AI]
Type = ChangeState
TriggerAll = Var(58)
Trigger1 = P2StateType != L
Trigger1 = P2BodyDist X < 0
Trigger2 = P2StateType = L
Trigger2 = P2BodyDist X = [50,70]
Value = 0
Ctrl = 1
IgnoreHitPause = 1
;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[state a];ハイジャンプエフェクト
type = Helper
trigger1 = var(3) = 1
trigger1 = time = 0
id = 6000
name = "jump"
pos = 0 , 0
postype = p1
stateno = 6000
helpertype = normal
pausemovetime = 0
persistent = 0
ignorehitpause = 1
keyctrl = 0 
ownpal = 1

[State 40 , 0]
type = PlaySnd
trigger1 = animtime = 0
value = s41,0
persistent=0

[State 40 , 0];ハイジャンプ時
type = PlaySnd
trigger1 = var(3) = 1
trigger1 = animtime = 0
value = s41,1
persistent=0

[State 40 , 0]
type = Explod
trigger1 = animtime = 0
anim = 9660
id = 800
postype = p1
pos = 0,17
sprpriority = 12
bindtime = 1
persistent = 0
ownpal = 1
scale = 0.5,0.5

[State 40, 1]
type = VarSet
triggerall = P2StateNo != 5120
triggerall = Time = 0
Trigger1 = Var(58)
Trigger1 = P2MoveType = H 
Trigger1 = P2StateType = A
Trigger1 = P2BodyDist X = [-20,-10]
Trigger2 = P2MoveType != H
Trigger2 = Var(57) = [0,49]
Trigger2 = P2BodyDist X = [0,80]
Trigger2 = Var(58)
Trigger3 = P2MoveType != H
Trigger3 = Var(57) = [0,39]
Trigger3 = P2BodyDist X > 80
Trigger3 = Var(58)
Trigger4 = !Var(58)
sysvar(1) = 0


[State 40, 2]
type = VarSet
Trigger1 = Var(58)
Trigger1 = P2MoveType = H 
Trigger1 = P2StateType = A
Trigger1 = P2BodyDist X > -10
Trigger2 = Var(58)
trigger2 = var(3) = [1,2]
Trigger3 = Var(58)
Trigger3 = P2MoveType != H
Trigger3 = Var(57) = [50,59]
Trigger3 = P2BodyDist X = [0,80]
Trigger4 = Var(58)
Trigger4 = P2MoveType != H
Trigger4 = Var(57) = [40,89]
Trigger4 = P2BodyDist X > 80
Trigger5 = Var(58)
Trigger5 = P2StateNo = 5120
Trigger6 = var(58) = 0
trigger6 = command = "holdfwd"
sysvar(1) = 1

[State 40, 3]
type = VarSet
triggerall = P2StateNo != 5120
triggerall = Time = 0
Trigger1 = Var(58)
Trigger1 = P2MoveType = H 
Trigger1 = P2StateType = A
Trigger1 = P2BodyDist X < -20
Trigger2 = Var(58)
Trigger2 = P2MoveType != H
Trigger2 = Var(57) = [60,99]
Trigger2 = P2BodyDist X = [0,80]
Trigger3 = Var(58)
Trigger3 = P2MoveType != H
Trigger3 = Var(57) = [90,99]
Trigger3 = P2BodyDist X > 80
Trigger4 = Var(58)
Trigger4 = P2MoveType != H
Trigger4 = PrevStateNo = [200,499]
Trigger5 = var(58) = 0
trigger5 = command = "holdback"
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)+ ifelse(var(8),-2,0)

[State 40, 4]
type = velset
trigger1 = AnimTime = 0
trigger1 = prevstateno != 100
trigger1 = prevstateno != 103
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))

[State 40, 4]
type = velset
trigger1 = AnimTime = 0
trigger1 = prevstateno = 103
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))+ifelse(sysvar(1)=-2,0,1.4)

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

[State 40, 5]
type = Velset
trigger1 = AnimTime = 0
trigger1 = var(5)=1
X = 10

[State 40, 5]
type = Velset
trigger1 = AnimTime = 0
trigger1 = var(5)=2
X = 12.5

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

;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
;velset = 0,0

[State 45, 0];空中ダッシュのときダッシュvarリセット
type = VarSet
trigger1 = Time >= 0
trigger1 = var(4) >= 1
var(9) = 0

[State 45, 0]
type = VarSet
trigger1 = Time >= 0
trigger1 = var(2) = 1
var(2) = 2

[State 45, 0]
type = VarSet
trigger1 = Time >= 0
trigger1 = var(48) = 3
var(48) = 4

[State 45 , 0]
type = PlaySnd 
trigger1 = time = 0
value = s41,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
trigger1 = command = "holdfwd"
sysvar(1) = 1

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

[State 45, 3]
type = VarSet
TriggerAll = Var(58) > 0
Trigger1 = P2MoveType = H
Trigger1 = P2StateType = A
Trigger1 = P2BodyDist X = [-20,-10]
trigger1 = Time = 0
Trigger2 = P2MoveType != H
Trigger2 = Var(57) = [0,4]
trigger2 = Time = 0
sysvar(1) = 0

[State 45, 4]
type = VarSet
TriggerAll = Var(58) > 0
Trigger1 = P2MoveType = H 
Trigger1 = P2StateType = A
trigger1 = Time = 0
Trigger1 = P2BodyDist X > -10
Trigger2 = P2MoveType != H
Trigger2 = Var(57) = [5,14]
trigger2 = Time = 0
trigger3 = P2MoveType = H
trigger3 = P2StateNo = [120,155]
sysvar(1) = 1

[State 45, 5]
type = VarSet
TriggerAll = Var(58) > 0
Trigger1 = P2MoveType = H 
Trigger1 = P2StateType = A
trigger1 = Time = 0
Trigger1 = P2BodyDist X < -20
Trigger2 = P2MoveType != H
Trigger2 = Var(57) = [15,19]
trigger2 = Time = 0
Trigger3 = P2MoveType = A
Trigger3 = PrevStateNo = [600,699]
trigger3 = Time = 0
sysvar(1) = -1


[State 45, 6];ダッシュ前
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) = 1
trigger1 = vel X > 2.2
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)
y = const(velocity.airjump.y)

[State 45, 6];ダッシュ前
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) = 1
trigger1 = vel X  <= 2.2
trigger1 = sysvar(1) = 1
x = const(velocity.airjump.fwd.x)
y = const(velocity.airjump.y)

[State 45, 6];ダッシュ垂直
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) = 1
trigger1 = sysvar(1) = 0
x = const(velocity.airjump.neu.x)
y = const(velocity.airjump.y)


[State 45, 6];ダッシュ後ろ
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) = 1
trigger1 = sysvar(1) = -1
trigger1 = vel X >= -2.25
x = const(velocity.airjump.back.x)
y = const(velocity.airjump.y)

[State 45, 6];ダッシュ後ろ
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) = 1
trigger1 = vel X < -2.25
trigger1 = sysvar(1) = -1
x = -4.1
y = const(velocity.airjump.y)

[State 45, 6]
type = VelSet
trigger1 = Time = 2
trigger1 = var(9) != 1
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)



[State 50, 5];ハイジャンプ時垂直
type = veladd
trigger1 = vel X = 0
trigger1 = var(3)
y = -1.6

[State 50, 5];ハイジャンプ時前
type = veladd
trigger1 = vel X > 0
trigger1 = var(3)
x = 1
y = -1.6

[State 50, 5];ハイジャンプ時後ろ
type = veladd
trigger1 = vel X < 0
trigger1 = var(3)
x = -1
y = -1.6

[State 50, 4];ハイジャンプ時
type = varset
trigger1 = time = 2
v = 3
value = 0


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

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

[State 50, 0];二段ジャンプ
type = ChangeState
triggerall = command = "holdup"
triggerall = command != "z"
triggerall = Ctrl = 1
trigger1 = numhelper(6030) = 0
trigger1 = var(2) = 1
trigger2 = var(48) = 3
value = 45
ctrl = 1

[State 54, 0]
type = VarSet
trigger1 = command != "holdup"
trigger1 = var(2) = 0
var(2) = 1

[State 54, 0]
type = VarSet
trigger1 = command != "holdup"
trigger1 = var(48) = 2
var(48) = 3

[State 50, 4];ハイジャンプ時
type = varset
trigger1 = time = 2
v = 3
value = 0

[State 50, 5];ハイジャンプ時垂直
type = veladd
trigger1 = vel X = 0
trigger1 = var(3) = 1
trigger1 = stateno = 50
y = -1.6

[State 50, 5];ハイジャンプ時前
type = veladd
trigger1 = vel X > 0
trigger1 = var(3) = 1
trigger1 = stateno = 50
x = 1
y = -1.6

[State 50, 5];ハイジャンプ時後ろ
type = veladd
trigger1 = vel X < 0
trigger1 = var(3) = 1
trigger1 = stateno = 50
x = -1
y = -1.6

[State 50, 5];ハイジャンプ、ランジャンプ時
type = veladd
trigger1 = var(3) = 1
trigger1 = var(9) = 1
trigger1 = stateno = 50
x = 1
y = -1.6

[State 50, 6];ハイジャンプ時
type = AfterImage
trigger1 = var(3) = 1
trigger2 = var(8)
time = 9999
trans = add1
timegap = 1
framegap = 3
length = 12
palbright = 0,0,0
palcontrast = 200,200,200
palpostbright = 0,0,0
paladd = 0,0,0
palmul = 0.7,0.7,0.7

[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 = ChangeAnim
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
anim = 44

[State 50, 0];二段ジャンプ
type = ChangeState
trigger1 = command = "holdup"
trigger1 = var(2) = 1
trigger1 = Ctrl = 1
value = 45
ctrl = 1

[State 54, 0]
type = VarSet
trigger1 = command != "holdup"
trigger1 = var(2) = 0
var(2) = 1

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

[State 50, 0];二段ジャンプ
type = ChangeState
trigger1 = command = "holdup"
trigger1 = var(2) = 1
trigger1 = Ctrl = 1
value = 45
ctrl = 1

[State 54, 0]
type = VarSet
trigger1 = command = "holdup"
trigger1 = var(2) = 0
var(2) = 1

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

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

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

;---------------------[効果音]
[State 191, Snd 1];着地
type = PlaySnd
trigger1 = time = 0
value = 47,0

;---------------------[ヘルパー]
[state a];着地エフェクト
type = Helper
trigger1 = time = 0
id = 6005
name = "land"
pos = 0 , 0
postype = p1
stateno = 6005
helpertype = normal
pausemovetime = 0
persistent = 0
ignorehitpause = 1
keyctrl = 0 
ownpal = 1

[State -2, 0]
type = turn
triggerall = p2dist X < -1
trigger1 = time = 2

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

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

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

[State 100 , 0]
type = Explod
trigger1 = time >= 0
trigger1 = Time%7 = 6
anim = 6010
postype = p1
pos = 0,6
sprpriority = 8
bindtime = 1
ownpal = 1
scale = 0.5,0.5
ID = 6010

[State 200, 1]
type = PlaySnd
trigger1 = Time%10 = 5
value = s100, 1

[State 100, 1]
type = VelSet
trigger1 = time >= 0
x = const(velocity.run.fwd.x)+ifelse(Time <= 25,Time * 0.2,5)

[State 100, 1]
type = VelSet
trigger1 = Vel X >= (const(velocity.run.fwd.x)+5)
x = (const(velocity.run.fwd.x)+5)

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

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

[State 100 , 5]
type = ChangeState
triggerall = var(58) = 0
trigger1 = command != "holdfwd"
trigger2 = command = "holddown"
value = 103
;ctrl = 1

[State 100, DashStop]
type = ChangeState
triggerall = var(58) = 1&&prevstateno!=[120,155]
triggerall = var(26) = 0
;triggerall = (ダッシュストップ条件)
trigger1 = inguarddist
trigger2 = p2MoveType = A
Trigger2 = P2BodyDist X = [-90,90]
trigger3 = P2BodyDist X <= 30
trigger3 = P2BodyDist Y >= -50
trigger4 = P2BodyDist X <= -25
value = 103
;ctrl = 1

[State 100, 3]
type = ChangeState
triggerall = var(58) = 0
trigger1 = command = "holdup"
value = 40

;---------------------------------------------------------------------------------------------
;ダッシュストップ
[Statedef 103]
type    = S
physics = N
Anim = 103
ctrl = 0

[State 100, 0]
type = PlaySnd
trigger1 = Animelem = 1
value = 100, 2

[State 100, 3]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 1]
type = Velmul
trigger1 = time >= 0
trigger1 = Vel X > 0
x = 0.9

[State 100, 2]
type = Velset
trigger1 = time = 0
x = 5

[State 100, 2]
type = Velset
trigger1 = time >= 1
trigger1 = Vel X <= 0.01
x = 0

[State 100, 3]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1

[State 100, 3]
type = ChangeState
trigger1 = command = "holdup"
value = 40

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

[State 00]
type = PlaySnd
trigger1 = time = 0
value = 100, 0

[State 00]
type = PlaySnd
trigger1 = time = 0
value = 101, random%4
channel = 0
lowpriority = 1

[state 7000,]
type = varadd
Trigger1 = var(33)
trigger1 = time <= 6
trigger1 = p2BodyDist X < 30
trigger1 = p2BodyDist Y = [-60,60]
fvar(30) = 0.03
persistent = 0

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

[State 105, 0]
type = NotHitBy
trigger1 = time <= 8
value = ,NA,SA,HA,NP,SP,HP
time = 1

[State 105, 1]
type = Veladd
trigger1 = Time >= 0
y =  .2

[State 105, 11] ;終了
type = ChangeState
trigger1 = time > 5
trigger1 = Pos Y > 0
value = 52

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

;---------------------[音]
[State 00]
type = PlaySnd
trigger1 = animelem = 1
value = 47, 0

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

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

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

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

;---------------------------------------------------------------------------
; RUN_UP
[Statedef 110]
type    = S
physics = N

[State 110, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 110, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 110, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 110, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = -7

[State 110, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 110, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 110, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 110, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; RUN_DOWN
[Statedef 115]
type    = S
physics = N

[State 115, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 115, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 115, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 115, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = 7

[State 115, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 115, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 115, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 115, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, 1];フォルトレスディフェンス時
type = ChangeAnim
triggerall= Var(26)
trigger1 = Time = 0
value = 130 + (statetype = C) + (statetype = A)*2

[State 120, 1];フォルトレスディフェンスじゃない時
type = ChangeAnim
triggerall= Var(26) = 0
trigger1 = Time = 0
value = 120 + (statetype = C) + (statetype = A)*2

[State type];フォルトレスディフェンス時
type = StateTypeSet
;triggerall = var(26)
trigger1 = var(58) = 0
trigger1 = statetype != A
trigger1 = command !="holddown"
trigger2 = var(58) = 1
trigger2 = statetype != A
statetype = S

[State type]];フォルトレスディフェンス時
type = StateTypeSet
;triggerall = var(26)
trigger1 = var(58) = 0
trigger1 = statetype != A
trigger1 = command ="holddown"
trigger2 = var(58) = 1
trigger2 = statetype != A
statetype = C

[State 120, 2];フォルトレスディフェンスじゃない時
type = StateTypeSet
;triggerall = var(26) = 0
trigger1 = Time = 0 && statetype = S
physics = S

[State 120, 3];フォルトレスディフェンスじゃない時
type = StateTypeSet
;triggerall = var(26) = 0
trigger1 = Time = 0 && statetype = C
physics = C

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(58)
TriggerAll = StateType != A
Trigger1 = P2StateType = A
StateType = S
Physics = S
IgnoreHitPause = 1

[State -1, AI]
Type = StateTypeSet
TriggerAll = Var(58)
TriggerAll = StateType != A
Trigger1 = P2StateType = C
StateType = C
Physics = C
IgnoreHitPause = 1

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

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

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

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

[State 120, Stop Guarding];レバーはなすか　ガード距離じゃなければ終了へ（WINのみ
type = ChangeState
triggerall = 1
trigger1 = command != "holdback"
trigger2 = var(45) < 2
trigger2 = !inguarddist
value = 140
;---------------------------------------------------------------------------
; STAND GUARD (guarding)
[Statedef 130]
type    = S
physics = S

[State 130] 
type = ChangeState 
trigger1 = var(58) = 0
Trigger1 = command = "holddown"
trigger2 = var(58) = 1
trigger2 = P2StateType = C
value = 131

[State 120, 4];動けなくなるバグの応急処置
type = null;Ctrlset
triggerall = time = 0
trigger1 = var(9) != 0
value = 1

[State -1, AI]
type = ChangeState
TriggerAll = Var(58)
TriggerAll = EnemyNear,MoveType = A
Trigger1 = P2StateType = C
Value = 131

[State 130, 1];ガード硬直以外から来た場合
type = ChangeAnim
triggerall = prevstateno != [150,153]
trigger1 = Anim != 130&& Anim != 6000
trigger1 = AnimElemNo(0) != 4
value = 130

[State 130, 1];ガード硬直からそのまま来た場合
type = ChangeAnim
triggerall = time = 0
trigger1 = prevstateno = [150,153]
trigger2 = var(45) = 3 
value = 130

;-----終了条件部、SBの3でも３０Fで0にされるので140に戻ってしまうデバック時ここもつぶして
;----AI時は・・52が0ならぷれいやーである・・？
[State 130, Hi to Lo];SB以外で・・
type = ChangeState
triggerall = var(45) < 3
trigger1 = command = "holddown"
trigger1 = !var(58)
;trigger2 = var(58)
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = var(45) < 2
trigger2 = !inguarddist
value = 140
;---------------------------------------------------------------------------
; CROUCH GUARD (guarding)
[Statedef 131]
type    = C
physics = C

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

[State 131] 
type = ChangeState 
trigger1 = var(58) = 0
Trigger1 = command != "holddown"
trigger2 = var(58) = 1
trigger2 = p2statetype != C
value = 130

[State 120, 4];動けなくなるバグの応急処置
type = Ctrlset
triggerall = time = 0
trigger1 = var(9) != 0
value = 1

[State -1, AI]
type = ChangeState
TriggerAll = Var(58)
TriggerAll = EnemyNear,MoveType = A
Trigger1 = P2StateType = A
Value = 130

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

[State 130, 1];ガード硬直以外から来た場合
type = ChangeAnim
triggerall = prevstateno != [150,153]
trigger1 = Anim != 130
value = 131

[State 130, 1];ガード硬直からそのまま来た場合
type = ChangeAnim
triggerall = time = 0
trigger1 = prevstateno = [150,153]
trigger1 = time = 0
trigger2 = var(45) = 3 && time = 0
value = 131

[State 131, Lo to Hi]
type = ChangeState
triggerall = var(45) < 3
trigger1 = command != "holddown"
trigger1 = !var(58)
value = 130

[State 130, Stop Guarding];----AI時、V52で判断ができない、なぜ？
type = ChangeState
triggerall = var(45) < 3
trigger1 = command != "holdback"
trigger2 = var(45) < 2
trigger2 = !inguarddist
value = 140

;---------------------------------------------------------------------------
; AIR GUARD (guarding)
[Statedef 132]
type    = A
physics = N

[State 130, 1];ガード硬直以外から来た場合
type = ChangeAnim
triggerall = prevstateno != [150,153]
trigger1 = Anim != 132 && Anim != 6003
trigger1 = AnimElemNo(0) != 4
value = 132

[State 130, 1];ガード硬直からそのまま来た場合（FDしっぱなし)
type = ChangeAnim
trigger1 = prevstateno = [150,153]
trigger1 = time = 0
trigger2 = var(45) = 3 && time = 0
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, 7]
type = ChangeState
trigger1 = sysvar(0)
trigger1 = command = "holdback"
value = 130

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

[State 132, Stop Guarding];レバーはなしなどで終了
type = ChangeState
trigger1 = command != "holdback"
trigger2 = var(45) < 2
trigger2 = !inguarddist
value = 140
;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, 1]
type = Changestate
trigger1 = Time = 0 && statetype = S
value = 0
anim = 0
ctrl = 1

[State 140, 1]
type = Changestate
trigger1 = Time = 0 && statetype = c
value = 11
anim = 11
ctrl = 1

[State 140, 1]
type = Changestate
trigger1 = Time = 0 && statetype = A
value = 51
anim = 41

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

[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
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, 5] ;Implemented within engine
;type = ChangeState
;trigger1 = AnimTime = 0
;value = (statetype = C)*11 + (statetype = A)*51

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

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

[state 120x,];----FD距離強制のばし、POSADD ちぇんすてふれーむで ２p側だと逆転してる気がする基本値設定して符号を乗算
type = posadd
triggerall = var(26)
trigger1 = HitShakeOver
x = -15 * ifelse(gethitvar(xvel) <= 0,1,-1) * facing
ignorehitpause = 1
persistent = 0

;--------------本体で引き戻しできる相手いない？確認できない
[state 120x,];----FD距離強制のばし、画面背のとき	擬似相手押し返し画面はし引き戻しのときはどうなる？相手は？
type =  width
triggerall = 0;var(25) = 2 
triggerall = BackEdgeBodyDist < 35
trigger1 = HitShakeOver
player = 35,0
ignorehitpause = 1
persistent = 1

;-----------------------JUSTガード　直前ガード
;-------------------------直前ガード 専用実行
[state 120x,]
type = varset
triggerall = var(45) <= 2
triggerall = var(36) <= 1
trigger1 = var(35) > 22
trigger1 = time = 0
var(36) = 1
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(36) = 1
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State 1540, 4];光る
type = palfx
triggerall = var(36) = 1
trigger1 = time = 0
time = 8
add = 0,0,255
ignorehitpause = 1
persistent = 0

[State snd]
type = playsnd
triggerall = var(36) = 1
trigger1 = time = 0
value = 5200,0

[State 1540, 4];ＪＤ	テンション獲得。
type = poweradd
triggerall = var(36) = 1
trigger1 = time = 0
value = 40
ignorehitpause = 1
persistent = 0

[State 1540, 4];ＪＤ受付リセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(35) = 0
ignorehitpause = 1
persistent = 0

;-----------------------摩擦調整
;---原作と離れ方違う、仕方ないね。ガードはX０でも普通後ろに下がるはず
;--ADｄやめ、初速乗算でいいや　Jd,SBなら低く、他なら長くー＞見た目原作の長さになる
[State 1540, 4];でふぉると	
type = varset
trigger1 = time = 0
fvar(13) = ifelse(var(36)=1&&!var(26),0.9,1.2)
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = !var(36)
trigger1 = time = 0
fvar(13) = 2
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(13) = 6
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State 120]
type =  width
triggerall = var(26)
triggerall = var(36)
triggerall = BackEdgeBodyDist < 45
trigger1 = time = 0
player = 85,0
ignorehitpause = 1
persistent = 1
;-----------------------------------------
;-----------------------ガードこうちょく計算部　ひとつですませられるかな？
[State 150, 2];がード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	保険として必ずだいにゅー
type = varset
triggerall = !hitshakeover
trigger1 = time = 0
var(37) = GetHitVar(ctrltime)
ignorehitpause = 1

;----以下は、システムの違いでずれはあるでしょうが、しょうがないよ？
[State 150, 2];JUSTガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	2,3,3,4,4減る
type = varset
triggerall = !hitshakeover
triggerall = var(36) = 1
triggerall = !var(26)
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) - ifelse(GetHitVar(animtype) = 0,4,ifelse(GetHitVar(animtype) = 1,6,8))
ignorehitpause = 1

[State 150, 2];FDガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5 2,3,3,4,5増
type = varset
triggerall = !hitshakeover
triggerall = var(36) = 2
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) + ifelse(GetHitVar(animtype) = 0,2,ifelse(GetHitVar(animtype) = 1,3,4))
ignorehitpause = 1

[State 1540, 4];計算すんだら　ＪＤ受付フラグリセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(36) = 0
ignorehitpause = 1
persistent = 0

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

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

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

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

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

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

[State 151, 1];ガード数値調整　
type = Velset
trigger1 = time = 0
x = vel x * fvar(13)
persistent = 0

;--------------------V25=0通常　1JD -2FD---3SB
;---スライド停止はさすがにmugenに従っとく？いやしかし・・
;--基本ctrltime=slidetimeであるはず
[State 151, 2];デフォルトの設定	完全にそっくりには無理
type = VelSet
trigger1 = Time >= GetHitVar(slidetime)
trigger1 = Time >= var(37)
trigger2 = HitOver
trigger2 = Time >= var(37)
trigger3 = numhelper(150)
x = 0

[State 151, 3];FD2,SB3はここでも再入力できるのでこの条件はまずい
type = CtrlSet
trigger1 = Time >= var(37)
value = 1

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

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

[State 151, 4];設定時間終了、SBなら通常	これここで入力追加あるから、３じゃだめかも13？
type = ChangeState
trigger1 = Time >= var(37)
value = 130
ctrl = 1

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

[State 151, 4]
type = null;ChangeState
trigger1 = Time >= GetHitVar(hittime)
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
ignorehitpause = 1

[state 120x,];----FD距離強制のばし、POSADD ちぇんすてふれーむで ２p側だと逆転してる気がする基本値設定して符号を乗算
type = posadd
triggerall = var(26)
trigger1 = HitShakeOver
x = -15 * ifelse(gethitvar(xvel) <= 0,1,-1) * facing
ignorehitpause = 1
persistent = 0

;--------------本体で引き戻しできる相手いない？確認できない
[state 120x,];----FD距離強制のばし、画面背のとき	擬似相手押し返し画面はし引き戻しのときはどうなる？相手は？
type =  width
triggerall = 0;var(25) = 2 
triggerall = BackEdgeBodyDist < 35
trigger1 = HitShakeOver
player = 35,0
ignorehitpause = 1
persistent = 1

;-----------------------JUSTガード　直前ガード
;----------v25=1　直前ガード成功	FDでもSBでもなくV23が23以上のとき（8F有効
;-------------------------直前ガード 専用実行
[state 120x,]
type = varset
triggerall = var(36) <= 1
triggerall = var(45) <= 2
trigger1 = var(35) > 22
trigger1 = time = 0
var(36) = 1
ignorehitpause = 1
persistent = 0

[State 1540, 4];光る
type = palfx
triggerall = var(36) = 1
trigger1 = time = 0
time = 8
add = 0,0,255
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(36) = 1
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State snd]
type = playsnd
triggerall = var(36) = 1
trigger1 = time = 0
value = 5200,0

[State 1540, 4];ＪＤ	テンション獲得。
type = poweradd
triggerall = var(36) = 1
trigger1 = time = 0
value = 40
ignorehitpause = 1
persistent = 0

[State 1540, 4];ＪＤ受付リセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(35) = 0
ignorehitpause = 1
persistent = 0

;-----------------------摩擦調整
;---原作と離れ方違う、仕方ない。ガードはX０でも普通後ろに下がるはず
;--ADｄやめ、初速乗算でいいや　Jd,SBなら低く、他なら長くー＞見た目原作の長さになる
[State 1540, 4];でふぉると	
type = varset
trigger1 = time = 0
fvar(13) = ifelse(var(36)=1&&!var(26),0.9,1.2)
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = !var(36)
trigger1 = time = 0
fvar(13) = 2
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(13) = 6
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State 120]
type =  width
triggerall = var(26)
triggerall = var(36)
triggerall = BackEdgeBodyDist < 45
trigger1 = time = 0
player = 85,0
ignorehitpause = 1
persistent = 1
;-----------------------------------------
;-----------------------ガードこうちょく計算部　ひとつですませられるかな？
[State 150, 2];がード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	保険として必ずだいにゅー
type = varset
triggerall = !hitshakeover
trigger1 = time = 0
var(37) = GetHitVar(ctrltime)
ignorehitpause = 1

;----以下は、システムの違いでずれはあるでしょうが、しょうがないよ？
[State 150, 2];JUSTガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	2,3,3,4,4減る
type = varset
triggerall = !hitshakeover
triggerall = var(36) = 1
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) - ifelse(GetHitVar(animtype) = 0,4,ifelse(GetHitVar(animtype) = 1,6,8))
ignorehitpause = 1

[State 150, 2];FDガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5 2,3,3,4,5増
type = varset
triggerall = !hitshakeover
triggerall = var(26)
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) + ifelse(GetHitVar(animtype) = 0,2,ifelse(GetHitVar(animtype) = 1,3,4))
ignorehitpause = 1

[State 1540, 4];計算すんだら　ＪＤ受付フラグリセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(36) = 0
ignorehitpause = 1
persistent = 0

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

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

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

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

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

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

[State 153, Hi to Lo]
type = StateTypeSet
trigger1 = statetype = S && command = "holddown"
trigger2 = var(58)
trigger2 = p2statetype = C
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
trigger1 = statetype = C && command != "holddown"
Trigger2 =! EnemyNear,HitDefAttr = , NT, ST, HT
Trigger2 = EnemyNear,MoveType = A
trigger2 = var(58)
statetype = S
physics = S

;----ガード調整
[State 151, 1];
type = Velset
trigger1 = time = 0
x = vel x * fvar(13)
persistent = 0

[State 153, 2]
type = VelSet
trigger1 = Time >= GetHitVar(slidetime)
trigger1 = Time >= var(37)
trigger2 = HitOver
trigger2 = Time >= var(37)
trigger3 = numhelper(150)
x = 0

[State 151, 3];
type = CtrlSet
trigger1 = Time >= var(37)
value = 1

[State 151, 4];設定時間終了、131とかにもどすとややこしくなる
type = ChangeState
trigger1 = Time >= var(37)
value = 131
ctrl = 1

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

[State 153, 4]
type = null;ChangeState
trigger1 = Time >= GetHitVar(hittime)
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 120x,];----FD距離強制のばし、画面背のとき	擬似相手押し返し画面はし引き戻しのときはどうなる？相手は？
type =  width
triggerall = 0;var(25) = 2 
triggerall = BackEdgeBodyDist < 35
trigger1 = HitShakeOver
player = 35,0
ignorehitpause = 1
persistent = 1

;-----------------------JUSTガード　直前ガード
;----------v25=1　直前ガード成功	FDでもSBでもなくV23が23以上のとき（8F有効
;-------------------------直前ガード 専用実行
[state 120x,]
type = varset
triggerall = var(36) <= 1
triggerall = var(45) <= 2
trigger1 = var(35) > 22
trigger1 = time = 0
var(36) = 1
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(36) = 1
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State 1540, 4];光る
type = palfx
triggerall = var(36) = 1
trigger1 = time = 0
time = 8
add = 0,0,255
ignorehitpause = 1
persistent = 0

[State snd]
type = playsnd
triggerall = var(36) = 1
trigger1 = time = 0
value = 5200,0

[State 1540, 4];ＪＤ	テンション獲得。
type = poweradd
triggerall = var(36) = 1
trigger1 = time = 0
value = 40
ignorehitpause = 1
persistent = 0

[State 1540, 4];ＪＤ受付リセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(35) = 0
ignorehitpause = 1
persistent = 0

;-----------------------摩擦調整
;---原作と離れ方違う、仕方ない。ガードはX０でも普通後ろに下がるはず
;--ADｄやめ、初速乗算でいいや　Jd,SBなら低く、他なら長くー＞見た目原作の長さになる
[State 1540, 4];でふぉると	
type = varset
trigger1 = time = 0
fvar(13) = ifelse(var(36)=1&&!var(26),0.9,1.2)
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = !var(36)
trigger1 = time = 0
fvar(13) = 2
ignorehitpause = 1
persistent = 0

[State 1540, 4]
type = varset
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(13) = 6
ignorehitpause = 1
persistent = 0

[state 7000,]
type = varadd
triggerall = var(26)
triggerall = var(36)
trigger1 = time = 0
fvar(30) = 0.01
persistent = 0

[State 120]
type =  width
triggerall = var(26)
triggerall = var(36)
triggerall = BackEdgeBodyDist < 45
trigger1 = time = 0
player = 85,0
ignorehitpause = 1
persistent = 1
;-----------------------------------------
;-----------------------ガードこうちょく計算部　ひとつですませられるかな？
[State 150, 2];がード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	保険として必ずだいにゅー
type = varset
triggerall = !hitshakeover
trigger1 = time = 0
var(37) = GetHitVar(ctrltime)
ignorehitpause = 1

;----以下は、システムの違いでずれはあるでしょうが、しょうがないよ？
[State 150, 2];JUSTガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5	2,3,3,4,4減る
type = varset
triggerall = !hitshakeover
triggerall = var(36) = 1
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) - ifelse(GetHitVar(animtype) = 0,4,ifelse(GetHitVar(animtype) = 1,6,8))
ignorehitpause = 1

[State 150, 2];FDガード硬直数値格納 (animtype)L0 M1 H2 B3 U4 D5 2,3,3,4,5増
type = varset
triggerall = !hitshakeover
triggerall = var(36) = 2
trigger1 = time = 0
var(37) = GetHitVar(ctrltime) + ifelse(GetHitVar(animtype) = 0,2,ifelse(GetHitVar(animtype) = 1,3,4))
ignorehitpause = 1

[State 1540, 4];計算すんだら　ＪＤ受付フラグリセット	成功時のみ。
type = varset
triggerall = var(36) = 1
trigger1 = time = 0
var(36) = 0
ignorehitpause = 1
persistent = 0

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

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

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

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

[State 151, 1];ガード数値調整　
type = Velset
trigger1 = time = 0
x = vel x * fvar(13)
persistent = 0

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

[State 151, 3];
type = CtrlSet
trigger1 = Time >= var(37)
value = 1

[State 153, 2]
type = VelSet
trigger1 = numhelper(150)
x = 0

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

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

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

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

[State 155, 8]
type = ChangeState
trigger1 = sysvar(0)
value = 130


;--------------------------------がーどここまで











;---------------------------------------------------------------------------
; LOSE (Time over)
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

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

;---------------------------------------------------------------------------
; DRAWGAME (Time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 175, 1] ; If no anim, use go to lose state.
type = ChangeState
trigger1 = Time = 0
trigger1 = !SelfAnimExist(175)
value = 170

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 175

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

;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 191, 1]
type = ChangeState
trigger1 = Time = 0
value = 191
;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 0, 1]
type = destroyself 
trigger1 = ishelper

[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
type = a

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

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

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

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

[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

;---------------------------------------------------------------------------
; 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]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5011 ;HITC_SLIDE

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

[State 5010, FFB Light]
type = ForceFeedback
trigger1 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5022
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

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

[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


;---------------------------------------------------------------------------
; 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 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; 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)

;---------------------------------------------------------------------------
; 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

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

[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

;---------------------------------------------------------------------------
; 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 = Command = "recover"
Trigger2 = Var(58) = 1
value = 5200 ;HITFALL_RECOVER

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recover"
Trigger2 = Var(58) = 1
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recover"
Trigger2 = Var(58) = 1
value = 5210 ;HITFALL_AIRRECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recover"
Trigger2 = Var(58) = 1
value = 5210 ;HITFALL_AIRRECOVER

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

;---------------------------------------------------------------------------
; 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 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

[State -1, VarSet]
Type = VarSet
Trigger1 = 1
FV = 39
Value = 1
;---------------------------------------------------------------------------
; 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 -1, VarSet]
Type = VarSet
Trigger1 = 1
FV = 39
Value = 1
;---------------------------------------------------------------------------
; 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 -1, VarSet]
Type = VarSet
Trigger1 = 1
FV = 39
Value = 1
;---------------------------------------------------------------------------
; 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 -1, VarSet]
Type = VarSet
Trigger1 = 1
FV = 39
Value = 1
;---------------------------------------------------------------------------
; 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 -1]
Type = null;ChangeState
Trigger1 = Anim = 5070
Trigger1 = PrevStateNo != 5071
Value = 5110

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
;trigger1 = GetHitVar(fall.yvel) = 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 = ifelse(Anim=5070,5101,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 = 61
;pos = 0, 0
;under = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 10

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

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
;value = F7, 0 ;Hit ground
value = 5100, 0

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

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

[State 5100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

[State -1, VarSet]
Type = VarSet
Trigger1 = Anim = 5101
FV = 39
Value = 2

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


[State 5101, 0]
type = ChangeAnim
triggerall = Time = 0
trigger1 = Anim = 5101
trigger1 = SelfAnimExist(5171 + (anim % 10))
value = 5171

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0 && Anim != 5171
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

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

[State -1, VarSet]
Type = VarSet
Trigger1 = Anim = 5101
FV = 39
Value = 2

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

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = FVar(39) = 2
value = 5171

[State -1, VarSet]
Type = VarSet
Trigger1 = Time = 0
FV = 39
Value = 0

[State 5110, 0]
type = ChangeAnim
persistent = 0
triggerAll = FVar(39) != 2
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = Anim = [5070,5079]
trigger2 = Anim = 5171;PrevStateNo = 5101
value = 5111

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

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerAll = FVar(39) != 2
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 = FVar(39) != 2
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 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = FVar(39) = 2
value = 5171

[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 5110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 5100,0;F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[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 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

;---------------------------------------------------------------------------
; HIT_GETUP
[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 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = [-1,0]
value2 = , NT,ST,HT
time = 8

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = [-1,0]
value = SCA
time = 3

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

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

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[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 camera]
type = ScreenBound
trigger1 = !alive
value = 0
;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 2 ,2]
type = PlaySnd
trigger1 = time = 0
value = 5200, 0

[state a]
type = Helper
trigger1 = time = 0
id = 6020
name = "recover"
pos = 0 , -80
postype = p1
stateno = 6020
helpertype = normal
pausemovetime = 0
persistent = 0
ignorehitpause = 1
keyctrl = 0 
ownpal = 1

[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 5201, 4]
type = NotHitBy
trigger1 = Time >= 0
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 2

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

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

[State 5201, 4]
type = NotHitBy
trigger1 = Time >= 0
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 2

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

[State 5210, 1]
type = Velset
trigger1 = Time = 0
y = .50

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -5
y = -4.5

[State 5210, 2]
type = Gravity
trigger1 = Time >= 0

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

[state a]
type = Helper
trigger1 = time = 0
id = 6020
name = "recover"
pos = 0 , -80
postype = p1
stateno = 6020
helpertype = normal
pausemovetime = 0
persistent = 0
ignorehitpause = 1
keyctrl = 0 
ownpal = 1

[State 5201, 6]
type = GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

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

[State 2 ,2]
type = PlaySnd
trigger1 = time = 0
value = 5200, 0

[state a]
type = Helper
trigger1 = time = 0
id = 6020
name = "recover"
pos = 0,-80
postype = p1
stateno = 6020
helpertype = normal
pausemovetime = 0
persistent = 0
ignorehitpause = 1
keyctrl = 0 
ownpal = 1

[State 5210, 0]
type = Varset
trigger1 = ctrl = 1
trigger1 = Var(2) = 0
v = 2
value = 4

[State 5201, 4]
type = NotHitBy
trigger1 = Time < 20
value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = 2

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 2
add = 200,200,200 

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

[State 5210, 1]
type = Velset
trigger1 = Time = 0
y = .50

[State 5210, 2];前の場合
type = Velset
trigger1 = Time = 1
trigger1 = Command = "holdfwd"
x = 3
y = -8.5

[State 5210, 2];後ろの場合
type = Velset
trigger1 = Time = 1
trigger1 = Command = "holdback"
x = -4
y = -6.5

[State 5210, 2]
type = Gravity
trigger1 = Time >= 0

[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, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMP_LAND
ctrl = 1

;---------------------------------------------------------------------------
; Continue?
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, 1] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

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

[State -3]
Type = VarSet
Trigger1 = 1
fvar(8) = 1/const(size.xscale)*0.5

[State -3]
Type = VarSet
Trigger1 = 1
fvar(9) = 1/const(size.yscale)*0.5

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundno = 1
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundno = 1
fvalue = 0


;ゲージ位置調整

;-------------------------援軍ゲージ 1P X Default  20
[state 5900,burst x];fvar(28) is burst Gauge X
type = varset
trigger1 = time = 0
fvar(28) = 20

;-------------------------援軍ゲージ 1P2P Y Default 40
[state 5900,burst 1p2pY];fvar(29) is burst Gauge Y
type = varset
trigger1 = time = 0
fvar(29) = 40

[state 5900,burst 1p2pY]
type = varset
trigger1 = time = 0
fvar(10) = 40



[state 5900,burst 1p2pY];fvar(29) is burst Gauge Y
type = varset
triggerall = numpartner
trigger1 = partner,ID < ID
fvar(29) = fvar(29) + 40

[State 5900, 3] ;Intro
type = ChangeState
trigger1 = roundno = 1
value = 190