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

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 5 && AnimTime = 0
value = 7

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5  && Anim != 7
trigger2 = Anim = 7 && AnimTime = 0
value = 0

[State 0, stop]
type = posset
trigger1 = 1
y = 0

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

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

[State -3]
type = AfterImageTime
trigger1 = 1
time = 0

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

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

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

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

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

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

[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 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = (const(velocity.walk.fwd.x))*const(size.xscale)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = (const(velocity.walk.back.x))*const(size.xscale)

[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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; Walk(AI梡)
[Statedef 21]
type    = S
physics = N
ctrl = 0
sprpriority = 0

[State -2, VarSet]
type = VarSet
trigger1 = time = 0
fvar(12) = 0+(random<300)

[State -2, VarSet]
type = VarSet
trigger1 = time = 0
trigger1 = BackEdgeBodyDist <= 10
fvar(12) = -1

[State -2, VarSet]
type = VarSet
trigger1 = fvar(12) = 1
trigger1 = time = 0
fvar(11) = 0

[State -2, VarSet]
type = VarSet
trigger1 = fvar(12) = 1
trigger1 = fvar(11) <= 0
fvar(11) = 40+random%41

[State -2, VarAdd]
type = VarAdd
trigger1 = fvar(12) = 1
trigger1 = fvar(11) > 0
fvar(11) = -1

[State 20, 1]
type = VelSet
trigger1 = fvar(12) = [-1,0]
trigger1 = time = 0
trigger2 = fvar(12) = 1
trigger2 = fvar(11) >= 30
x = (const(velocity.walk.fwd.x))*const(size.xscale)

[State 20, 2]
type = VelSet
trigger1 = fvar(12) = 0
trigger1 = time = 0
trigger1 = BackEdgeBodyDist > 10
trigger1 = random < 200
trigger2 = fvar(12) = 1
trigger2 = fvar(11) < 30
x = (const(velocity.walk.back.x))*const(size.xscale)

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

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

[State 20, 5]
type = changestate
trigger1 = p2bodydist x < 60
trigger1 = random < 50
trigger2 = p2dist x < 0
trigger3 = time > 0 && vel X > 0 && FrontEdgeBodyDist <= 10
trigger4 = time > 0 && vel X < 0 && BackEdgeBodyDist <= 10
trigger5 = enemy,numproj > 0
trigger6 = InGuardDist
trigger7 = roundstate != 2
value = 0
ctrl = 1

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

[State 40, ChangeState]
type = ChangeState
trigger1 = var(50) = 1
trigger1 = var(40) = 0
trigger1 = time = 0
value = 21+(inguarddist)*99

[State 40, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 40

[State -2,longjump]
type = VarSet
trigger1 = !var(50)
trigger1 = time = 0
trigger1 = var(58) = [41,43]
var(3) = 1

[State -2,longjump]
type = VarSet
triggerall = var(50)
triggerall = time = 0
trigger1 = var(40) = 2
trigger1 = P2BodyDist X = [ceil(140*const(size.xscale)),ceil(200*const(size.xscale)))
trigger2 = var(40) != 2
trigger2 = random%8 = 0
var(3) = 1

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

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

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

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

[State 40, 2]
type = VarSet
trigger1 = !var(50)
trigger1 = command = "holdfwd" || var(58) = 42
trigger2 = var(50)
trigger2 = time = 0
trigger2 = var(40) = 2 || random = [0,700-(P2BodyDist X<=50)*200)
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = !var(50)
trigger1 = command = "holdback" || var(58) = 43
trigger2 = var(50)
trigger2 = time = 0
trigger2 = var(40) != 2
trigger2 = random = [900-(P2BodyDist X<=50)*200,1000)
sysvar(1) = -1

[State 40, 1]
type = VarSet
trigger1 = var(50)
trigger1 = var(40) = 1
trigger1 = Time = 0
sysvar(1) = 0-(random<300)

[State -2,VarSet]
type = VarSet
trigger1 = time = 0
var(40) = 0

[State 40, 4]
type = VelSet
trigger1 = var(3) = 0
trigger1 = Time = 4
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x),ifelse(sysvar(1)=1,const(velocity.jump.fwd.x),const(velocity.jump.back.x)))*const(size.xscale)
y = const(velocity.jump.y)*const(size.yscale)

[State 40, 4]
type = VelSet
trigger1 = var(3) = 1
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x),ifelse(sysvar(1)=1,const(velocity.jump.fwd.x)+1.1,const(velocity.jump.back.x)))*const(size.xscale)
y = (const(velocity.jump.y)-1.375)*const(size.yscale)

[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 = AfterImage
trigger1 = AnimTime = 0 && var(3) = 1
time = 4
length = 4
TimeGap  = 2
FrameGap = 2
palbright = 0,0,0
palcontrast = 255,255,255
paladd = 0,0,0
palmul = 1,1,1

[State 40, 6]
type = ChangeState
trigger1 = var(3) = 0
trigger1 = time = 4
trigger2 = var(3) = 1
trigger2 = AnimTime = 0
value = 50
ctrl = 1

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,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, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; Jump Up
[Statedef 50]
type    = A
physics = N

[State -3, 壒傪柭傜偡]
type = PlaySnd
trigger1 = Time = 0
value = 40, 0

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

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

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

[State -2, VelAdd]
type = VelAdd
trigger1 = 1
y = Const(movement.yaccel)*const(size.yscale)

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

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

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

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

[State -2, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = command = "holddown"
value = 10
elem = 2

[State -2, StateType]
type = StateTypeSet
trigger1 = anim = 10
StateType = C
Physics = C

[State -3]
type = AfterImageTime
trigger1 = time = 0
time = 0

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

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

[State 52, 4]
type = ChangeState
trigger1 = P2dist X < 0
trigger1 = anim = 47
trigger1 = Time >= 2
value = 0
ctrl = 1

[State 52, 4]
type = ChangeState
trigger1 = P2dist X < 0
trigger1 = anim = 10
trigger1 = Time >= 2
value = 11
ctrl = 1

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

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

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; Jump Land
[Statedef 53]
type    = S
physics = S
ctrl = 0
anim = 47

[State -2, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
trigger1 = command = "holddown"
value = 10
elem = 2

[State -2, StateType]
type = StateTypeSet
trigger1 = anim = 10
StateType = C
Physics = C

[State -3]
type = AfterImageTime
trigger1 = time = 0
time = 0

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

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

[State 52, 4]
type = ChangeState
trigger1 = P2dist X < 0
trigger1 = anim = 47
trigger1 = Time >= 2
value = 0
ctrl = 1

[State 52, 4]
type = ChangeState
trigger1 = P2dist X < 0
trigger1 = anim = 10
trigger1 = Time >= 2
value = 11
ctrl = 1

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

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

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; Jump Land
[Statedef 54]
type    = S
physics = S
ctrl = 0
anim = 47

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

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

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

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

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

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

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

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

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

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

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

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

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

[State 106, 1]
type = VelSet
trigger1 = Time = 0
y = 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
trigger1 = Time = 0
value = 120 + (statetype = C) + (statetype = A)*2

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

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

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

[State 120, Hi to Lo]
type = StateTypeSet
triggerall = statetype = S
trigger1 = var(50) = 0
trigger1 = command = "holddown"
trigger2 = var(50) = 1
trigger2 = EnemyNear,StateType != A
trigger2 = Random < 600
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = statetype = C
trigger1 = var(50) = 0
trigger1 = command != "holddown"
trigger2 = var(50) = 1
trigger2 = EnemyNear,StateType = A
trigger2 = Random < 200
statetype = S
physics = S

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

[State 120, Stop Guarding]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random < 10
trigger3 = !inguarddist
value = 140

[State 120, VarSet]
type = VarSet
trigger1 = enemy,statetype = A
trigger1 = enemynear,Pos Y <= -50
var(4) = 1

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; STAND GUARD (guarding)
[Statedef 130]
type    = S
physics = S

[State 130, 1]
type = ChangeAnim
trigger1 = var(4) = 0
trigger1 = Anim != 130
value = 130

[State 130, 1]
type = ChangeAnim
trigger1 = var(4) = 1
trigger1 = Anim != 9130
value = 9130

[State 130, Hi to Lo]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command = "holddown"
trigger2 = var(50) = 1
trigger2 = EnemyNear,StateType != A
trigger2 = Random < 600
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random < 10
trigger3 = !inguarddist
value = 140

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; CROUCH GUARD (guarding)
[Statedef 131]
type    = C
physics = C

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

[State 131, Lo to Hi]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command != "holddown"
trigger2 = var(50) = 1
trigger2 = EnemyNear,StateType = A
trigger2 = Random < 200
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random < 10
trigger3 = !inguarddist
value = 140

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

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

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

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

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

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

[State 132, 6]
type = ChangeState
triggerall = var(50) = 0
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = ifelse(command="holddown",131,130)

[State 132, 6]
type = ChangeState
triggerall = var(50) = 1
trigger1 = sysvar(0)
trigger1 = random = [0,700]
trigger1 = inguarddist
value = ifelse(p2statetype=C,131,130)

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

[State 132, Stop Guarding]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = command != "holdback"
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 = ChangeAnim
trigger1 = Time = 0 && statetype = S
value = ifelse(var(4) = 1,9140,140)

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0 && statetype = C
value = 141

[State 140, 1]
type = ChangeAnim
trigger1 = Time = 0 && statetype = A
value = 142

[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, CPU梡娷傓HtoL]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = S && command = "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = S && p2statetype = C
statetype = C
physics = C

[State 140, CPU梡娷傓LtoH]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = C && command != "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = C && p2statetype = A
trigger3 = Var(50) = 1
trigger3 = statetype = C && p2statetype = S
trigger3 = Var(51) = [0,19]
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 = prevstateno != 6150
trigger1 = time = 0
value = ifelse(var(4) = 1,9150,150)

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

[State 150, 2]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6150

[State 150, 2]
type = ChangeState
trigger1 = Var(50) = 0
trigger1 = GetHitvar(hitshaketime) = 0
value = 151 + 2*(command = "holddown")

[State 150, 2]
type = ChangeState
trigger1 = Var(50) = 1
trigger1 = GetHitvar(hitshaketime) = 0
value = 151 + 2*(p2statetype = C)

[State 150, CPU梡娷傓HtoL]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = S && command = "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = S && p2statetype = C
statetype = C
physics = C

[State 150, CPU梡娷傓LtoH]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = C && command != "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = C && p2statetype = A
trigger3 = Var(50) = 1
trigger3 = statetype = C && p2statetype = S
trigger3 = Var(51) = [0,19]
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

[State 150, 1]
type = ChangeAnim
trigger1 = prevstateno = 150
trigger1 = time = 0
value = ifelse(var(4) = 1,9150,150)

[State 151, VarSet]
type = VarSet
trigger1 = enemy,statetype = A
trigger1 = enemynear,Pos Y > -50
var(4) = 0

[State 151, 1]
type = HitVelSet
trigger1 = prevstateno = 150 || prevstateno = 152
trigger1 = time = 0
x = 1

[State 151, 2]
type = VelSet
trigger1 = fvar(3) >= GetHitvar(slidetime)
trigger2 = HitOver
x = 0

[State 151, 3]
type = CtrlSet
trigger1 = fvar(3) = GetHitvar(ctrltime)
value = 1

[State 151, CPU梡娷傓HtoL]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = S && command = "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = S && p2statetype = C
statetype = C
physics = C

[State 151, CPU梡娷傓LtoH]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = C && command != "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = C && p2statetype = A
trigger3 = Var(50) = 1
trigger3 = statetype = C && p2statetype = S
trigger3 = Var(51) = [0,19]
statetype = S
physics = S

[State 151, NotHitBy]
type = NotHitBy
trigger1 = HitOver
value = , NT,ST,HT
time = 6

[State 151, 4]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6151

[State 151, 4]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = HitOver
value = ifelse(command="holddown",131,130)
ctrl = 1

[State 151, 4]
type = ChangeState
trigger1 = var(50) = 1
trigger1 = HitOver
value = ifelse(p2statetype=C,131,130)
ctrl = 1

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

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

[State 152, 2]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6152

[State 152, 3]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = GetHitvar(hitshaketime) = 0
value = 151 + 2*(command = "holddown")

[State 152, 3]
type = ChangeState
trigger1 = var(50) = 1
trigger1 = GetHitvar(hitshaketime) = 0
value = 151 + 2*(p2statetype = C)

[State 152, CPU梡娷傓HtoL]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = S && command = "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = S && p2statetype = C
statetype = C
physics = C

[State 152, CPU梡娷傓LtoH]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = C && command != "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = C && p2statetype = A
trigger3 = Var(50) = 1
trigger3 = statetype = C && p2statetype = S
trigger3 = Var(51) = [0,19]
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 = prevstateno = 150 || prevstateno = 152
trigger1 = Time = 0
x = 1

[State 153, 2]
type = VelSet
trigger1 = fvar(3) = GetHitvar(slidetime)
trigger2 = HitOver
x = 0

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

[State 153, CPU梡娷傓HtoL]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = S && command = "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = S && p2statetype = C
statetype = C
physics = C

[State 153, CPU梡娷傓LtoH]
type = StateTypeSet
trigger1 = Var(50) = 0
trigger1 = statetype = C && command != "holddown"
trigger2 = Var(50) = 1
trigger2 = statetype = C && p2statetype = A
trigger3 = Var(50) = 1
trigger3 = statetype = C && p2statetype = S
trigger3 = Var(51) = [0,19]
statetype = S
physics = S

[State 153, NotHitBy]
type = NotHitBy
trigger1 = HitOver
value = , NT,ST,HT
time = 6

[State 153, 4]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6153

[State 153, 4]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = HitOver
value = ifelse(command="holddown",131,130)
ctrl = 1

[State 153, 4]
type = ChangeState
trigger1 = var(50) = 1
trigger1 = HitOver
value = ifelse(p2statetype=C,131,130)
ctrl = 1

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

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

[State 154, 2]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6154

[State 154, 2]
type = ChangeState
trigger1 = GetHitvar(hitshaketime) = 0
value = 155

[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 = prevstateno = 154
trigger1 = Time = 0
x = 1
y = 1

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

[State 155, 3]
type = CtrlSet
trigger1 = fvar(3) = GetHitVar(ctrltime)
value = 1

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

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

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

[State 155, 6]
type = ChangeState
triggerall = numhelper(30000)
triggerall = helper(30000),var(4) = 0
triggerall = !sysvar(0)
trigger1 = var(50) = 0
trigger1 = command != "holdback"
trigger2 = var(50) = 1
trigger2 = random <= 10+(palno=3)*90
value = 6155

[State 155, 6]
type = ChangeState
trigger1 = var(50) = 0
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = ifelse(command="holddown",131,130)

[State 155, 6]
type = ChangeState
trigger1 = var(50) = 1
trigger1 = sysvar(0)
trigger1 = random <= 10+(palno=3)*90
trigger1 = inguarddist
value = ifelse(p2statetype=C,131,130)

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; 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 190, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(190)
value = 190

[State 190, 2] ;Go straight to intro.
type = ChangeState
trigger1 = Time = 0
value = 191

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; INTRO (override this state to give character an intro)
[Statedef 191]
type = S
ctrl = 0

[State 191, 1]
type = ChangeState
trigger1 = Time = 0
value = 0

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

[State 5000, varset]
type = varset
trigger1 = time = 0
var(36) = GetHitVar(hitshaketime)
ignorehitpause = 1

[State 5000, stopsnd]
type = stopsnd
triggerall = Life <= 0
triggerall = prevstateno != 5190
triggerall = enemy,hitdefattr = S,NA || enemy,hitdefattr = C,NA || enemy,hitdefattr = A,NA
trigger1 = enemy,authorname = "GM" &&  enemy,name = "Hugo"
trigger1 = var(36) = [1,11-(enemy,hitdefattr=A,NA)*3]
trigger2 = var(36) = [1,7]
channel = 1
ignorehitpause = 1

[State 5000, changestate]
type = changestate
triggerall = Life <= 0
triggerall = prevstateno != 5190
triggerall = enemy,hitdefattr = S,NA || enemy,hitdefattr = C,NA || enemy,hitdefattr = A,NA
trigger1 = enemy,authorname = "GM" &&  enemy,name = "Hugo"
trigger1 = var(36) = [1,11-(enemy,hitdefattr=A,NA)*3]
trigger2 = var(36) = [1,7]
value = 5190
ignorehitpause = 1

[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),15000,15010) + GetHitVar(animtype)

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

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

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

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

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

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

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

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

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

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

[State 5001, 0]
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim != 15000+GetHitVar(animtype)+(GetHitVar(groundtype)=2)*10
value = 15000+GetHitVar(animtype)+(GetHitVar(groundtype)=2)*10

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

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

[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, NotHitBy]
type = NotHitBy
trigger1 = var(0) = 1
trigger1 = fvar(2) < 64
trigger1 = hitover
value = , AT
time = 6
persistent = 0

[State 5001, 6]
type = null;ChangeState
trigger1 = fvar(2) = 64
trigger1 = hitover
value = 5300

[State 200, Ctrlset]
type = Ctrlset
trigger1 = hitover
value = 1

[State 920]
type = StateTypeSet
trigger1 = hitover
movetype = I 

[State 5001, 6]
type = ChangeState
trigger1 = (anim = [15005,15007]) || (anim = [15015,15017])
trigger1 = animtime = 0
value = 0
ctrl = 1

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

[State 5000, varset]
type = varset
trigger1 = time = 0
var(36) = GetHitVar(hitshaketime)
ignorehitpause = 1

[State 5000, stopsnd]
type = stopsnd
triggerall = Life <= 0
triggerall = prevstateno != 5190
triggerall = enemy,hitdefattr = S,NA || enemy,hitdefattr = C,NA || enemy,hitdefattr = A,NA
trigger1 = enemy,authorname = "GM" &&  enemy,name = "Hugo"
trigger1 = var(36) = [1,11-(enemy,hitdefattr=A,NA)*3]
trigger2 = var(36) = [1,7]
channel = 1
ignorehitpause = 1

[State 5000, changestate]
type = changestate
triggerall = Life <= 0
triggerall = prevstateno != 5190
triggerall = enemy,hitdefattr = S,NA || enemy,hitdefattr = C,NA || enemy,hitdefattr = A,NA
trigger1 = enemy,authorname = "GM" &&  enemy,name = "Hugo"
trigger1 = var(36) = [1,11-(enemy,hitdefattr=A,NA)*3]
trigger2 = var(36) = [1,7]
value = 5190
ignorehitpause = 1

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

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

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

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

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

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

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

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

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

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

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

[State 5011, 0]
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim != 15020+GetHitVar(animtype)
value = 15020+GetHitVar(animtype)

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

[State 5011, 2]
type = ChangeAnim
trigger1 = hitover
value = 15025 + GetHitVar(animtype)
persistent = 0

[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 5001, NotHitBy]
type = NotHitBy
trigger1 = var(0) = 1
trigger1 = fvar(2) < 64
trigger1 = hitover
value = , AT
time = 6
persistent = 0

[State 5011, 6]
type = null;ChangeState
trigger1 = fvar(2) = 64
trigger1 = hitover
value = 5300

[State 200, Ctrlset]
type = Ctrlset
trigger1 = hitover
value = 1

[State 920]
type = StateTypeSet
trigger1 = hitover
movetype = I 

[State 5011, 6]
type = ChangeState
trigger1 = anim = [15025,15027]
trigger1 = animtime = 0
value = ifelse(command="holddown",11,0)
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, ChangeAnim]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != 5030
trigger1 = Anim != [5051,5059]
trigger1 = Anim != 5090
trigger1 = Anim != 5700
value = 5030

[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
trigger1 = Anim != 5700
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
trigger2 = fvar(2) = 64.0
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 = !var(0)
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
trigger2 = Anim != 5700
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 = null;ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1
triggerall = Pos Y < -20
triggerall = alive
triggerall = fvar(2) != 64
trigger1 = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

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

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

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

[State 5070, 1]
type = ChangeAnim
trigger1 = Time > 0
value = anim

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

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

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

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

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

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

[State -2, VarSet]
type = VarSet
Trigger1 = time = 0
var(7) = 0

[State -2, VarSet]
type = VarSet
triggerall = var(50) = 0
Triggerall = time <= 5
Trigger1 = command = "quick"
var(7) = 1

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

[State 5100, EnvShake]
type = EnvShake
trigger1 = Time = 0
time = 15
freq = 60
ampl = -3

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

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim != 5051 && anim != 5061 && anim != 5700
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim = 5051 || anim = 5061
value = 5101

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = anim = 5700
value = 5102

[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 = null;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 = null;GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State -2, Explod]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 6920
postype = p1
pos = 0, 0
persistent = 0
velocity = 0, 0
accel = 0, 0
ownpal = 1
sprpriority = -100
scale = const(size.xscale),const(size.yscale)

[State -2, Explod]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 6930
postype = p1
pos = 0, 0
persistent = 0
velocity = 0, 0
accel = 0, 0
ownpal = 1
sprpriority = -100
scale = const(size.xscale),const(size.yscale)

[State -2, helper]
type = helper
trigger1 = Time = 0
trigger1 = !SysVar(0)
stateno = 7700
id = 7700
pos = 0,0
postype = p1
sprpriority = 4
helpertype = normal
ownpal = 1
keyctrl = 0 
scale = const(size.xscale),const(size.yscale)

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

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = S5100, 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

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

[State -2, VarSet]
type = VarSet
Trigger1 = var(7) = -1
Trigger1 = time = 0
var(7) = 2

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != 5102
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = 5102
value = 5161

[State 5101, VelSet]
type = VelSet
trigger1 = Time = 0
x = ifelse(abs(vel X)<3.0,vel X,3.0*ifelse(vel X<0,-1,1))*const(size.xscale)
y = 0

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

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

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

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

[State 5101, 6] ;Hit ground
type = ChangeState
trigger1 = animelemtime(3) >= 3
value = 5110

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

[State 5100, ChangeState]
type = ChangeState
triggerall = prevstateno = 5101
triggerall = life > 0
triggerall = !loseko
triggerall = fvar(2) < 64
triggerall = var(7) != 2
triggerall = time = 0
trigger1 = var(50) = 0
trigger1 = var(7) = 1
trigger2 = var(50) = 1
trigger2 = random < 600
value = 5123+(p2dist X<0)

[State 5110, 6]
type = PlaySnd
trigger1 = prevstateno != 5101
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = S5100, 0

[State 5110, EnvShake]
type = EnvShake
trigger1 = prevstateno = 5071
trigger1 = Time = 0
trigger1 = !SysVar(0)
time = 15
freq = 60
ampl = -3

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = prevstateno != 5071
trigger1 = prevstateno != 5101
trigger1 = Time = 0
trigger1 = !SysVar(0)

[State 5100, ChangeState]
type = ChangeState
triggerall = prevstateno = 5101
triggerall = life > 0
triggerall = !loseko
triggerall = fvar(2) < 64
triggerall = var(7) = 2
trigger1 = time = 0
trigger1 = var(50) = 0
trigger1 = Command = "quick"
trigger2 = time = 0
trigger2 = var(50) = 1
trigger2 = random < 600
value = 5123+(p2dist X<0)

[State -2, VarSet]
type = VarSet
trigger1 = prevstateno = 5071
Trigger1 = time = 0
var(7) = 0

[State -2, VarSet]
type = VarSet
triggerall = prevstateno = 5071
Triggerall = time <= 5
Trigger1 = var(50) = 0
trigger1 = Command = "quick"
Trigger2 = var(50) = 1
trigger2 = random < 600
var(7) = 1

[State 5100, ChangeState]
type = ChangeState
triggerall = prevstateno = 5071
triggerall = life > 0
triggerall = !loseko
triggerall = fvar(2) < 64
triggerall = anim = 5075
triggerall = animelemtime(4) = 1
trigger1 = var(7) = 1
value = 5123+(p2dist X<0)

[State 5100, ChangeState]
type = ChangeState
triggerall = prevstateno != 5071 && prevstateno != 5101
triggerall = life > 0
triggerall = !loseko
triggerall = fvar(2) < 64
triggerall = var(7) = -1
Trigger1 = var(50) = 0
trigger1 = time = [1,5]
trigger1 = Command = "quick"
Trigger2 = var(50) = 1
trigger2 = time = 5
trigger2 = random < 600
value = 5123+(p2dist X<0)

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

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

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

[State 5110, 1] ;For hit up/up-diag type (from state 5071)
type = ChangeAnim
triggerall = time = 0
triggerall = (anim != [5110,5119]) && (anim != [5170,5179])
trigger1 = anim = 5070
trigger1 = SelfAnimExist(5075)
value = 5075

[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, 7]
type = null;GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State -2, Explod]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 6920
postype = p1
pos = 0, 0
persistent = 0
velocity = 0, 0
accel = 0, 0
ownpal = 1
sprpriority = -100
scale = const(size.xscale),const(size.yscale)

[State -2, Explod]
type = Explod
trigger1 = Time = 0
trigger1 = !SysVar(0)
anim = 6930
postype = p1
pos = 0, 0
persistent = 0
velocity = 0, 0
accel = 0, 0
ownpal = 1
sprpriority = -100
scale = const(size.xscale),const(size.yscale)

[State -2, helper]
type = helper
trigger1 = Time = 0
trigger1 = prevstateno = 5071
stateno = 7700
id = 7700
pos = 0,0
postype = p1
sprpriority = 4
helpertype = normal
ownpal = 1
keyctrl = 0 
scale = const(size.xscale),const(size.yscale)

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

[State 5110, 8]
type = VelMul
trigger1 = 1
x = .90

[State 5110, 8]
type = VelSet
trigger1 = anim = 5110
trigger2 = anim = 5170
trigger2 = animelemtime(2) >= 0
trigger3 = anim = 5075
trigger3 = animelemtime(2) >= 0
x = 0

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

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = (Anim != [5111,5119]) && (anim != 5075)
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 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[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 = AnimElemTime(10) < 0
value = SCA
time = 1

[State 5120, 4]
type = HitFallSet
trigger1 = AnimElemTime(9) = 0
value = 1

[State 5120]
type = StateTypeSet
trigger1 = AnimElemTime(9) = 0
statetype = S

[State 5120, 5] 
type = NotHitBy
trigger1 = fvar(2) < 64
trigger1 = AnimElemTime(10) = 0
value = , NT,ST,HT
time = 6

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = fvar(2) < 64
trigger1 = AnimElemTime(10) = 0
value2 = SCA
time = 2

[State 5120, 7]
type = ChangeState
trigger1 = fvar(2) = 64
trigger1 = AnimElemTime(10) = 0
value = 5300

[State 5120, 7]
type = ChangeState
trigger1 = fvar(2) < 64
trigger1 = p2dist X < 0
trigger1 = AnimElemTime(10) >= 0
value = 0
ctrl = 1

[State 5120, Ctrlset]
type = Ctrlset
trigger1 = fvar(2) < 64
trigger1 = AnimelemTime(10) = 0
value = 1

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
;僋僀僢僋僗僞儞僨傿儞僌(屻揮)
[Statedef 5123]
type    = L
movetype= I
physics = N
ctrl = 0
velset = 0,0
anim = 5400
sprpriority = 2
poweradd = 20

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

[State -2, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,1

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) < 0
value = SCA
time = 1

[State 5123,PosAdd]
type = PosAdd
trigger1 = AnimElemTime(3) = 0
x = -50

[State 5123,PosSet]
type = PosSet
trigger1 = time = 0
y = 0

[state 5123,VelSet]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 5120]
type = HitFallSet
trigger1 = AnimElemTime(9) = 0
value = 1

[State 5120]
type = StateTypeSet
trigger1 = AnimElemTime(9) = 0
statetype = S

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) = 0
value = , NT,ST,HT
time = 6

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) = 0
value2 = SCA
time = 2

[State 5123,VelSet]
type = VelSet
trigger1 = AnimElemTime(3) = 0
x = -2.2*const(size.xscale)

[State 5123,VelSet]
type = VelSet
trigger1 = AnimElemTime(7) = 0
x = 0

[State 5120, 7]
type = ChangeState
trigger1 = p2dist X < 0
trigger1 = AnimElemTime(10) >= 0
value = 0
ctrl = 1

[State 5123, Ctrlset]
type = Ctrlset
trigger1 = AnimelemTime(10) = 0
value = 1

[State 5123, Changestate]
type = Changestate
trigger1 = Animtime = 0
value = 0
ctrl = 1

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
;僋僀僢僋僗僞儞僨傿儞僌(慜揮)
[Statedef 5124]
type    = L
movetype= I
physics = N
ctrl = 0
velset = 3.3*const(size.xscale),0
anim = 5410
sprpriority = 2
poweradd = 20

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

[State -2, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S0,1

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) < 0
value = SCA
time = 1

[State 5123,PosSet]
type = PosSet
trigger1 = time = 0
y = 0

[State 5120]
type = HitFallSet
trigger1 = AnimElemTime(9) = 0
value = 1

[State 5120]
type = StateTypeSet
trigger1 = AnimElemTime(9) = 0
statetype = S

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) = 0
value = , NT,ST,HT
time = 6

[State 5123, NotHitBy]
type = NotHitBy
trigger1 = AnimElemTime(10) = 0
value2 = SCA
time = 2

[State 5123,VelSet]
type = VelSet
trigger1 = AnimElemTime(7) = 0
x = 0

[State 5120, 7]
type = ChangeState
trigger1 = p2dist X < 0
trigger1 = AnimElemTime(10) >= 0
value = 0
ctrl = 1

[State 5123, Ctrlset]
type = Ctrlset
trigger1 = AnimelemTime(10) = 0
value = 1

[State 5123, Changestate]
type = Changestate
trigger1 = Animtime = 0
value = 0
ctrl = 1

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

[State 5150, PlayerPush]
type = PlayerPush
trigger1 = prevstateno = 5190
value = 0

[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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; 嶍傝俲俷
[Statedef 5190]
type    = S
movetype= H
physics = N
velset = 0,0
sprpriority = -3

[State 5190, PlayerPush]
type = PlayerPush
trigger1 = animelemtime(9) >= 0
value = 0

[State 5190, 1]
type = posset
trigger1 = time = 0
y = 0

[State 5190, 2]
type = Changeanim
trigger1 = !HitShakeOver
value = 5000
elem = 1

[State 5190, 1]
type = VelSet
trigger1 = time = 0
x = -2.0

[State 5190, 1]
type = turn
trigger1 = anim = 5190
trigger1 = animelemtime(9) = 0

[State 5190, 1]
type = posadd
trigger1 = anim = 5190
trigger1 = animelemtime(9) = 0
x = -40*const(size.xscale)

[State 5190, 4]
type = playsnd
trigger1 = prevstateno = 5000 || prevstateno = 5010
trigger1 = time = 1
value = S11,2
channel = 1

[State 5190, 4]
type = playsnd
trigger1 = anim = 5190
trigger1 = animelemtime(9) = 0
value = S5100,0

[State 5190, 7] ;Friction
type = VelSet
trigger1 = HitOver
trigger2 = anim = 5190
persistent = 0
x = 0

[State 5190, 1]
type = velset
trigger1 = HitShakeOver
x = 0
y = 0

[State 5190, NotHitBy]
type = NotHitBy
trigger1 = anim = 5190
trigger1 = AnimelemTime(9) = 0
value = SCA
time = 32

[State 5190, StateTypeSet]
type = StateTypeSet
trigger1 = anim = 5190
trigger1 = AnimelemTime(9) >= 0
statetype = L 

[State 5190, 1]
type = ChangeAnim
trigger1 = HitShakeOver
trigger1 = anim != 5190
value = 5190
persistent = 0

[State 5190, Changeanim]
type = Changeanim
trigger1 = anim = 5190
trigger1 = animelemtime(10) = 0
value = 5170

[State 5190, ChangeState]
type = Changestate
trigger1 = anim = 5170
trigger1 = animtime = 0
value = 5150

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

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

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

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

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

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

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -.15
y = -3.5

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

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

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

[State 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 5210, 1]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 2]
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

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

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

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

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

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

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

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

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
;婥愨(奐巒)
[Statedef 5300]
type    = S
movetype= I
physics = N
ctrl    = 0
velset  = 0,0

[State 5300, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5300

[State 5300, varset]
type = VarSet
trigger1 = prevstateno != [5300,5301] 
trigger1 = time = 0
fvar(20) = 120+(random%4)*40
ignorehitpause = 1

[State 5300, varadd]
type = VarAdd
triggerall = fvar(20)
trigger1 = 1
fvar(20) = -1
ignorehitpause = 1

[State 5300, varadd]
type = VarAdd
triggerall = fvar(20)
trigger1 = command = "儗僶僈僠儍"
fvar(20) = -1
ignorehitpause = 1

[State 5300, varset]
type = VarSet
trigger1 = Time = 0
fvar(22) = 0
ignorehitpause = 1

[State 5300, varadd]
type = VarAdd
trigger1 = command = "儗僶僈僠儍"
fvar(22) = 1
ignorehitpause = 1

[state -2, helper]
type = helper
trigger1 = !numhelper(8550)
trigger1 = time = 0
ID = 8550
pos = 0,0
postype = p1
stateno = 8550
helpertype = normal
name = "Stun"
sprpriority = -5
ownpal = 1
keyctrl = 0
ignorehitpause = 1
scale = const(size.xscale),const(size.yscale)

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20)
trigger1 = animtime = 0
trigger1 = fvar(22) <= 9
value = 5300

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20)
trigger1 = animtime = 0
trigger1 = fvar(22) > 9
value = 5301

[State 5300, ChangeState]
type = ChangeState
value = Var(55)
triggerall = Var(55) = 195 || Var(55) = [1000,3200]
triggerall = roundstate = 2
triggerall = var(50) = 0
trigger1 = fvar(20) = 0
ignorehitpause = 0

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20) = 0
value = 0
ctrl = 1

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
[Statedef 5301]
type    = S
movetype= I
physics = N
ctrl    = 0
velset  = 0,0
sprpriority = -1

[State 5300, ChangeAnim]
type = ChangeAnim
trigger1 = time = 0
value = 5301

[State 5300, varadd]
type = VarAdd
triggerall = fvar(20)
trigger1 = 1
fvar(20) = -1
ignorehitpause = 1

[State 5300, varadd]
type = VarAdd
triggerall = fvar(20)
trigger1 = command = "儗僶僈僠儍"
fvar(20) = -1
ignorehitpause = 1

[State 5300, varset]
type = VarSet
trigger1 = Time = 0
fvar(22) = 0
ignorehitpause = 1

[State 5300, varadd]
type = VarAdd
trigger1 = command = "儗僶僈僠儍"
fvar(22) = 1
ignorehitpause = 1

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20)
trigger1 = animtime = 0
trigger1 = fvar(22) <= 5
value = 5300

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20)
trigger1 = animtime = 0
trigger1 = fvar(22) > 5
value = 5301

[State 5300, ChangeState]
type = ChangeState
value = Var(55)
triggerall = Var(55) = 195 || Var(55) = [1000,3200]
triggerall = roundstate = 2
triggerall = var(50) = 0
trigger1 = fvar(20) = 0
ignorehitpause = 0

[State 5300, ChangeState]
type = ChangeState
trigger1 = fvar(20) = 0
value = 0
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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; 摿庩斀揮嬄偗斀傝(HITSHAKE)3rd僉儍儔愱梡
[Statedef 5600]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5600

[State 5000, 1]
type = ChangeAnim
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger1 = !SelfAnimExist(5052)
trigger1 = 1
value = 5030

[State 5000, 1]
type = ChangeAnim
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger1 = SelfAnimExist(5052)
trigger1 = 1
value = 5052

[State 5000, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = authorname = "GM" && name = "Gill"
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5600+(facing=-1)*100000

[State 5000, 1]
type = ChangeAnim
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger1 = authorname = "GM" && name = "Gill"
value = 5030+(facing=-1)*100000

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

[State -2, posset]
type = posset
trigger1 = time = 0
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
y = 0

[State 5000, 5]
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5610

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

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

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; 摿庩斀揮嬄偗斀傝(HITBACK)3rd僉儍儔愱梡
[Statedef 5610]
type    = S
movetype= H
physics = S

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

[State 5001, 2]
type = ChangeAnim
trigger1 = GetHitVar(hittime) = 4
value = 5610

[State 5001, 4]
type = VelSet
trigger1 = Time >= GetHitVar(slidetime)
x = 0

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

[State 5001, NotHitBy]
type = NotHitBy
trigger1 = fvar(2) < 64
trigger1 = HitOver
value = , NT,ST,HT
time = 6

[State 5001, 6]
type = ChangeState
trigger1 = fvar(2) = 64
trigger1 = HitOver
value = 5300

[State 200, Ctrlset]
type = Ctrlset
trigger1 = HitOver
value = 1

[State 920]
type = StateTypeSet
trigger1 = HitOver
movetype = I 

[State 5001, 6]
type = ChangeState
trigger1 = anim = 5610
trigger1 = animtime = 0
value = 0
ctrl = 1

;仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮仮
; 摿庩悂偒旘傃(HITSHAKE)3rd僉儍儔愱梡
[Statedef 5700]
type    = A
movetype= H
physics = N
velset = 0,0

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

[State 5000, 1]
type = ChangeAnim
trigger1 = time = 0
trigger1 = authorname = "GM" && name = "Gill"
value = 5700+(facing=-1)*100000

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

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

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

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

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

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

[State 5900, 3]
type = ChangeState
trigger1 = RoundsExisted = 0
trigger1 = TeamMode = Turns
value = 190

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