; Common state file for M.U.G.E.N beta 2002.04.14
;
; System variables usage
; ----------------------
; Var name    Type   Purpose
; --------    ----   -------
; sysvar(0)   Temp   Set by state 5081 (HITL_SLIDE) to 1 to prevent
;                    showing ground hit frame in state 5110 (HIT_LIEDOWN).
;                    Used by guarding states.
; sysvar(1)   Temp   Used by state 40 (Jump Start) amd 45 (Air Jump Start)
;                    to keep track of which way to jump.
;                    Used by state 5100 and 5110 to remember downward
;                    velocity of player just before hitting the ground.
;                    Used in state 5080 for storing the anim # to display.

; The following states have special handling within MUGEN, and should be
; overridden with caution:
; Jump Start (40): airjumping bookkeeping at time = 0
; All guard states (120-155): guard handling throughout state
; Hit_trip, shaking (5070): defence increases at time = 0
; Hit_bounce (5100): defence increases at time = 0, player becomes
;                    invincible if within 10 ticks of getting up
; Hit_liedown (5110): player changes to get-up state (5120) when ready
; Hit_getup (5120): player's defence is restored to normal at time = 0
; Hitfall_recover (5200): player's defence is restored at time = 0
; Hitfall_airrecover (5210): player's defence is restored at time = 0

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 0
ignorehitpause = 1

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
trigger3 = PrevStateno = [198,199]
trigger3 = time = 0
value = 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 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

[State 0, 5]
type = DestroySelf
triggerall = IsHelper
triggerall = !IsHelper(1)
trigger1 = PrevStateno = [191,192]
trigger1 = time > 1
trigger2 = PrevStateno != [191,192]

[State 0, 6]
type = ChangeState
triggerall = Var(59) != 0
trigger1 = P2Movetype = A
trigger1 = P2BodyDist X < 0
trigger1 = Ctrl
value = 130
ignorehitpause = 1

[State 0, 7]
type = CtrlSet
trigger1 = PrevStateno = 5
trigger1 = RoundState = 2
value = 1

[State 0, 8]
type = CtrlSet
trigger1 = name != "Ayu Tukimiya"
value = 0

[State 0, 9]
type = LifeSet
trigger1 = name != "Ayu Tukimiya"
value = 0

[State 0, 10]
type = ChangeState
trigger1 = name != "Ayu Tukimiya"
trigger1 = !Alive
value = 20310

[State 0, 11]
type = CtrlSet
triggerall = Var(59) != 0
triggerall = Ctrl = 0
trigger1 = RoundState >= 3
value = 1

[State 0, 11]
type = CtrlSet
triggerall = Var(59) != 0
trigger1 = Enemynear,Name = "Shin" && Enemynear,Authorname = "Ahuron"
trigger1 = Enemynear,Stateno = 2200
value = 0

[State 0, 11]
type = AssertSpecial
triggerall = Var(59) != 0
trigger1 = Enemynear,Name = "Shin" && Enemynear,Authorname = "Ahuron"
trigger1 = Enemynear,Stateno = 2200 && Enemynear,Animelemtime(36) >= 0
flag = invisible
flag2 = noshadow

;---------------------------------------------------------------------------
; Stand
[Statedef 1]
type = S
movetype = A
physics = S
ctrl = 0
sprpriority = 0

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
triggerall = NumHelper(4) < 5
trigger1 = Gametime%5 = 0
helpertype = Player
name = "Clsh2"
ID = 4
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
triggerall = NumHelper(4) < 5
trigger1 = Gametime%5 = 1
helpertype = Player
name = "Clsh2"
ID = 4
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
triggerall = NumHelper(4) < 5
trigger1 = Gametime%5 = 2
helpertype = Player
name = "Clsh2"
ID = 4
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
triggerall = NumHelper(4) < 5
trigger1 = Gametime%5 = 3
helpertype = Player
name = "Clsh2"
ID = 4
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
triggerall = NumHelper(4) < 5
trigger1 = Gametime%5 = 4
helpertype = Player
name = "Clsh2"
ID = 4
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
trigger1 = NumHelper(5) = 0
helpertype = Player
name = "Clsh2"
ID = 5
stateno = 4
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -2, ????]
type = Helper
triggerall = !IsHelper
triggerall = Fvar(20) != 0
trigger1 = NumHelper(3) = 0
helpertype = Player
name = "Clsh2"
ID = 3
stateno = 3
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State -1]
type = DestroySelf
trigger1 = IsHelper
trigger1 = time > 0

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 0
ignorehitpause = 1

[State 1, 0]
type = ChangeAnim
trigger1 = !IsHelper || IsHelper(1)
value = 13000

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

[State 1, 2]
type = ChangeState
triggerall = NumEnemy = 1
trigger1 = RoundState >= 3
trigger2 = (Enemynear,name != "F1")
trigger2 = (Enemynear,name != "genjitsu")
trigger2 = (Enemynear,name != "")
trigger2 = (Enemynear,name != "Kyuketsuki") || (Enemynear,Palno != [6,11])
value = 0
ctrl = 1

[State 1, 2]
type = ChangeState
triggerall = NumEnemy > 1
trigger1 = RoundState >= 3
trigger2 = (Enemynear(0),name != "F1") && (Enemynear(1),name != "F1")
trigger2 = (Enemynear(0),name != "genjitsu") && (Enemynear(1),name != "genjitsu")
trigger2 = (Enemynear(0),name != "") && (Enemynear(1),name != "")
trigger2 = ((Enemynear(0),name != "Kyuketsuki") || (Enemynear(0),Palno != [6,11])) && ((Enemynear(1),name != "Kyuketsuki") || (Enemynear(1),Palno != [6,11]))
value = 0
ctrl = 1

[State 1, 3]
type = CtrlSet
trigger1 = 1
value = 0

;---------------------------------------------------------------------------
;アーマー
[Statedef 5]
type = U
movetype = H
physics = U

[State 5, 0]
type = Null;VarAdd
trigger1 = time = 0
var(21) = 1

[State -1]
type = VarSet
triggerall = time = 0
trigger1 = PrevStateno = [0,119]
var(22) = 1
ignorehitpause = 1

[State 5, 0]
type = VarAdd
trigger1 = time = 0
trigger1 = fvar(8) > 0.05
fvar(8) = -0.05
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = GetHitVar(Damage) < (Var(54)/10)
triggerall = GetHitVar(Damage) > 0
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = NumHelper(8888) = 0
trigger2 = NumHelper(8888) > 0
trigger2 = Helper(8888),Var(2) > 0
value = ceil(-GetHitVar(Damage)*Fvar(8))
kill = Var(53)
absolute = 0
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = GetHitVar(Damage) >= (Var(54)/10)
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = NumHelper(8888) = 0
trigger2 = NumHelper(8888) > 0
trigger2 = Helper(8888),Var(2) > 0
value = -1
kill = 0
absolute = 1
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = GetHitVar(Damage) < 0
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = NumHelper(8888) = 0
trigger2 = NumHelper(8888) > 0
trigger2 = Helper(8888),Var(2) > 0
value = 1
kill = 0
absolute = 1
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = NumHelper(8888) > 0
triggerall = Helper(8888),Var(2) = 0
triggerall = Life > LifeMax/10
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = GetHitVar(Damage) > 4
value = -5
kill = 0
absolute = 1
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = NumHelper(8888) > 0
triggerall = Helper(8888),Var(2) = 0
triggerall = Life > LifeMax/10
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = GetHitVar(Damage) < 5
trigger1 = GetHitVar(Damage) > 0
value = -GetHitVar(Damage)
kill = 0
absolute = 1
ignorehitpause = 1

[State 5, 1]
type = LifeAdd
triggerall = time = 0
triggerall = NumHelper(8888) > 0
triggerall = Helper(8888),Var(2) = 0
;triggerall = NumHelper(100999) = 0 || (NumHelper(100999) && Helper(100999),Var(6) = 0)
trigger1 = GetHitVar(Damage) < 0
value = 1
kill = 0
absolute = 1
ignorehitpause = 1

[State 5, 2]
type = PalFX
trigger1 = time = 0
time = 5
add = 256,0,0
mul = 256,256,256
sinadd = 0,0,0,0
invertall = 0
color = 256
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 5, 3]
type = PowerAdd
trigger1 = time = 0
value = GetHitVar(Damage)*2
ignorehitpause = 1

[State 5, 4]
type = VarAdd
triggerall = Fvar(21) = 0
trigger1 = time = 0
var(25) = 1
ignorehitpause = 1

[State 5, 4]
type = VarSet
triggerall = Fvar(21) != 0
trigger1 = time = 0
var(25) = 20
ignorehitpause = 1

[State 5, 5]
type = Helper
triggerall = Fvar(20) = 0
trigger1 = Var(25) >= 50
trigger1 = GetHitVar(Damage) >= Var(54)
trigger1 = NumHelper(8726) < 10
trigger1 = Fvar(25) = 0
helpertype = normal
name = "CLASH"
ID = 8726
stateno = 8726
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 5, 5]
type = Helper
triggerall = Fvar(20) = 0
trigger1 = Var(25) >= 50
trigger1 = GetHitVar(Damage) >= Var(54)
trigger1 = NumHelper(8726) < 10
trigger1 = Fvar(25) != 0
helpertype = Player
name = "CLASH"
ID = 8726
stateno = 8726
pos = 0,0
postype = p1
facing = 1
keyctrl = 0
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 5, 5]
type = ChangeState
trigger1 = Fvar(21) = 0
trigger1 = time = 0
trigger1 = Life <= 1
trigger1 = GetHitVar(Damage) < (Var(54)/10)
trigger1 = GetHitVar(Damage) > 0
trigger1 = Var(53) = 0
trigger1 = Var(52) = 1 || Var(56) = 1
value = 20000
ignorehitpause = 1

[State 5, 5]
type = ChangeState
trigger1 = Fvar(21) != 0
trigger1 = time = 0
trigger1 = Life <= 1
trigger1 = GetHitVar(Damage) < (Var(54)/10)
trigger1 = GetHitVar(Damage) > 0
trigger1 = Var(53) = 0
value = 20000
ignorehitpause = 1

[State 5, 5]
type = ChangeState
triggerall = time = 0
trigger1 = Var(53) = 1
trigger1 = !Alive
value = 5050
ignorehitpause = 1

[State 5, 5]
type = ChangeState
triggerall = time = 0
trigger1 = Alive
value = Var(20)
ctrl = Var(22)
ignorehitpause = 1

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 10
ignorehitpause = 1

[State 10, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 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
sprpriority = 0

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 11
ignorehitpause = 1

[State -1]
type = CtrlSet
trigger1 = PrevStateno = 5
trigger1 = RoundState = 2
value = 1

[State 11, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 11

[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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 12
ignorehitpause = 1

[State 12, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 12

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

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

[State 20, 0]
type = ChangeState
trigger1 = Var(59) != 0
value = 0
ctrl = 1
ignorehitpause = 1

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 20
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State -1]
type = CtrlSet
trigger1 = PrevStateno = 5
trigger1 = RoundState = 2
value = 1

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)+(PalNo=12)*3

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)-(PalNo=12)*3

[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 20, 5]
type = PlaySnd
trigger1 = Var(21)%20 = 1
value = s0,0
channel = 1

;---------------------------------------------------------------------------
;Walk(AI)
[Statedef 19]
type    = S
physics = S
ctrl = 1
sprpriority = 0

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 19
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State -1]
type = CtrlSet
trigger1 = PrevStateno = 5
trigger1 = RoundState = 2
value = 1

[State 19, 0]
type = ChangeState
triggerall = Var(59) = 0
trigger1 = time = 0
value = 20

[State 19, 1]
type = VelSet
triggerall = Var(59) != 0
triggerall = RoundState < 3
triggerall = P2Movetype != H
trigger1 = Var(57) = [0,299]
x = const(velocity.walk.fwd.x)+(PalNo=12)*3

[State 19, 2]
type = VelSet
triggerall = Var(59) != 0
triggerall = RoundState < 3
triggerall = P2Movetype != H
trigger1 = Var(57) = [300,399]
x = const(velocity.walk.back.x)-(PalNo=12)*3

[State 19, 3]
type = VelSet
triggerall = Var(59) != 0
triggerall = RoundState < 3
triggerall = P2Movetype = H
trigger1 = P2BodyDist X > 30
x = const(velocity.walk.fwd.x)+(PalNo=12)*3

[State 19, 4]
type = VelSet
triggerall = Var(59) != 0
triggerall = RoundState < 3
triggerall = P2Movetype = H
trigger1 = P2BodyDist X < 20
x = const(velocity.walk.back.x)-(PalNo=12)*3

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

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

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

[State 19, 6]
type = PlaySnd
trigger1 = Var(21)%20 = 1
trigger1 = Vel X != 0
value = s0,0
channel = 1

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
ctrl = 0
sprpriority = 1

[State -1]
type = ChangeState
trigger1 = Var(59) != 0
value = 0
ctrl = 1

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 40
ignorehitpause = 1

[State 40, -1]
type = NotHitBy
trigger1 = time = 0
value = ,NT,ST,HT
time = 2

[State 40, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 40

[State 40, 0]
type = ChangeState
triggerall = Var(59) != 0
trigger1 = time = 0
value = 41
ctrl = 0
ignorehitpause = 1

[State 40, 1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = Time = 0
sysvar(1) = 0

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

[State 40, 3]
type = VarSet
trigger1 = 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)+(PalNo=12)*3, const(velocity.jump.back.x)-(PalNo=12)*3))
y = const(velocity.jump.y)

[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, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Jump Start
[Statedef 41]
type    = S
physics = S
ctrl = 0
sprpriority = 1

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 41
ignorehitpause = 1

[State 41, -1]
type = NotHitBy
trigger1 = time = 0
value = ,NT,ST,HT
time = 2

[State 41, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 40

[State 41, 1]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X = [0,10]
trigger2 = Var(57) = [300,399]
trigger2 = PrevStateno != [600,620]
sysvar(1) = 0

[State 41, 2]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X > 20
trigger2 = Var(57) = [100,299]
trigger3 = PrevStateno = [600,620]
trigger4 = BackEdgeBodyDist < 40
trigger4 = Enemynear,Movetype = A
trigger4 = Enemynear,HitdefAttr = SCA,NT,ST,HT
trigger5 = InGuardDist
sysvar(1) = 1

[State 41, 3]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X = [0,20]
trigger2 = Var(57) = [0,99]
trigger2 = PrevStateno != [600,620]
sysvar(1) = -1

[State 41, 4]
type = null;VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype = H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X = [0,10]
sysvar(1) = 0

[State 41, 5]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype = H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = 1;P2BodyDist X > 10
sysvar(1) = 1

[State 41, 6]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)+(PalNo=12)*3, const(velocity.jump.back.x)-(PalNo=12)*3))
y = const(velocity.jump.y)

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

[State 41, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 45
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 45, 1]
type = ChangeAnim
triggerall = Var(21) = 0
trigger1 = SelfAnimExist(44)
value = 44

[State 45, 2]
type = ChangeAnim
triggerall = Var(21) = 0
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Var(21) = 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 = Var(21) = 2
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)+(PalNo=12)*3, const(velocity.jump.back.x)-(PalNo=12)*3))
y = const(velocity.airjump.y)

[State 45, 7]
type = ChangeState
trigger1 = Var(21) = 2
value = 50
ctrl = 1

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 46
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 46, 0]
type = ChangeState
triggerall = Var(59) != 0
trigger1 = time = 0
value = 47
ctrl = 0
ignorehitpause = 1

[State 46, 1]
type = ChangeAnim
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = SelfAnimExist(44)
value = 44

[State 46, 2]
type = ChangeAnim
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = !SelfAnimExist(44)
value = 41

[State 46, 3]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(2) = 1

[State 46, 4]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
sysvar(1) = 0

[State 46, 5]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

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

[State 46, 7]
type = VelSet
trigger1 = Var(21) >= 2
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)+(PalNo=12)*3, const(velocity.jump.back.x)-(PalNo=12)*3))
y = const(velocity.airjump.y)

[State 46, 8]
type = ChangeState
trigger1 = Var(21) >= 2
value = 50
ctrl = 1

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 47
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 47, 1]
type = ChangeAnim
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = SelfAnimExist(44)
value = 44

[State 47, 2]
type = ChangeAnim
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = !SelfAnimExist(44)
value = 41

[State 47, 3]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(2) = 1

[State 47, 4]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X = [0,10]
trigger2 = Var(57) = [300,399]
trigger2 = PrevStateno != [600,620]
sysvar(1) = 0

[State 47, 5]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X > 20
trigger2 = Var(57) = [100,299]
trigger3 = PrevStateno = [600,620]
trigger4 = BackEdgeBodyDist < 40
trigger4 = Enemynear,Movetype = A
trigger4 = Enemynear,HitdefAttr = SCA,NT,ST,HT
sysvar(1) = 1

[State 47, 6]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype != H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = P2BodyDist X = [0,20]
trigger2 = Var(57) = [0,99]
trigger2 = PrevStateno != [600,620]
sysvar(1) = -1

[State 47, 8]
type = VarSet
triggerall = Var(59) != 0
triggerall = P2Movetype = H
triggerall = PrevStateno != 5
triggerall = time = 0
trigger1 = 1
sysvar(1) = 1

[State 47, 9]
type = VelSet
trigger1 = Var(21) >= 2
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x)+(PalNo=12)*3, const(velocity.jump.back.x)-(PalNo=12)*3))
y = const(velocity.airjump.y)

[State 47, 10]
type = ChangeState
trigger1 = Var(21) >= 2
value = 50
ctrl = 1

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 50
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

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

[State 50, 2]
type = ChangeAnim
trigger1 = Var(21) = 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)
trigger1 = Anim != [44,46]
persistent = 0
value = Anim + 3

[State 50, 4]
type = PlaySnd
trigger1 = PrevStateno = [40,49]
trigger1 = time = 0
value = S0,2
channel = 1

[State 50, 5]
type = ChangeState
value = 610
triggerall = Var(59) > 0
triggerall = P2Movetype = H
triggerall = P2Statetype = A
triggerall = P2BodyDist X = [0,50]
triggerall = PrevStateno = 41 || PrevStateno = 800
trigger1 = (P2BodyDist Y = [-40,50]) && P2Stateno = 1990
trigger2 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger2 = (Enemynear,Vel Y >= -1.91 && Fvar(0) >= 0.8)
trigger3 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger3 = (Enemynear,Vel Y >= -1.83 && Fvar(0) >= 0.7)
trigger4 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger4 = (Enemynear,Vel Y >= -1.75 && Fvar(0) >= 0.6)
trigger5 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger5 = (Enemynear,Vel Y >= -1.62 && Fvar(0) >= 0.55) || Fvar(0) < 0.55
trigger6 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger6 = (Enemynear,Pos Y >= -30 && (Enemynear,Vel Y >= -0.2 || Fvar(0) < 0.55))

[State 50, 5]
type = ChangeState
value = 610
triggerall = Var(59) > 0
triggerall = P2Movetype = H
triggerall = P2Statetype = A
triggerall = P2BodyDist X = [0,50]
triggerall = PrevStateno = 47
trigger1 = (P2BodyDist Y = [-40,50]) && P2Stateno = 1990
trigger2 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger2 = (Enemynear,Vel Y >= 1.55 && Fvar(0) >= 0.8)
trigger3 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger3 = (Enemynear,Vel Y >= 1.62 && Fvar(0) >= 0.7)
trigger4 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger4 = (Enemynear,Vel Y >= 1.73 && Fvar(0) >= 0.6)
trigger5 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger5 = (Enemynear,Vel Y >= 1.86 && Fvar(0) >= 0.55) || Fvar(0) < 0.55
trigger6 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger6 = (Enemynear,Pos Y >= -30 && (Enemynear,Vel Y >= -0.2 || Fvar(0) < 0.55))
trigger7 = (P2BodyDist Y = [-30,50]) && P2Stateno != 1990
trigger7 = Enemynear,Pos Y <= -80 && time > 5

[State 50, 6]
type = ChangeState
value = 620
triggerall = Var(59) > 0
triggerall = P2Movetype = H
triggerall = P2Statetype = A
triggerall = P2BodyDist X = [50,70]
trigger1 = (P2BodyDist Y = [-70,30]) && P2Stateno = 1990
trigger2 = (P2BodyDist Y = [-50,30]) && P2Stateno != 1990
trigger2 = (Enemynear,Vel Y >= -0.25 && Fvar(0) >= 0.8)
trigger3 = (P2BodyDist Y = [-50,30]) && P2Stateno != 1990
trigger3 = (Enemynear,Vel Y >= -0.32 && Fvar(0) >= 0.7)
trigger4 = (P2BodyDist Y = [-50,30]) && P2Stateno != 1990
trigger4 = (Enemynear,Vel Y >= -0.41 && Fvar(0) >= 0.6)
trigger5 = (P2BodyDist Y = [-50,30]) && P2Stateno != 1990
trigger5 = (Enemynear,Vel Y >= -0.45 && Fvar(0) >= 0.55) || Fvar(0) < 0.55
trigger6 = (P2BodyDist Y = [-50,30]) && P2Stateno != 1990
trigger6 = (Enemynear,Pos Y >= -30 && (Enemynear,Vel Y >= -0.2 || Fvar(0) < 0.55))

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

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 52
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 52, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 47

[State 52, 1]
type = VelSet
triggerall = PrevStateno != 5
trigger1 = Time = 0
y = 0

[State 52, 2]
type = PosSet
triggerall = PrevStateno != 5
trigger1 = Time = 0
y = 0

[State 52, 3]
type = CtrlSet
triggerall = PrevStateno != 5
trigger1 = Var(21) = 3
value = 1

[State 52, 4]
type = PlaySnd
triggerall = PrevStateno != 5
trigger1 = time = 0
value = s3,0
channel = 3

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

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

[Statedef 53]
movetype = I

[State -1]
type = VarSet
trigger1 = 1
var(53) = 0
ignorehitpause = 1

[State 53, -1]
type = VarRandom
trigger1 = IsHelper
v = 57
range = 0,399
ignorehitpause = 1

[State 53, -1]
type = ChangeState
trigger1 = 1
value = 0+((Pos Y<0)*50)
ctrl = 1

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

[Statedef 54]
type = A
movetype = I
physics = A
ctrl = 0
anim = 44

[State 54, -1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 10

[State 54, -1]
type = CtrlSet
trigger1 = 1
value = 0

[State 54, -1]
type = PosSet
trigger1 = time = 0
x = (Random%160)*ifelse(Random%2=0,-1,1)
y = -1000

[State 54, -1]
type = VarSet
trigger1 = IsHelper
v = 59
value = Var(58)

[State 54, -1]
type = VarRandom
trigger1 = time = 0
v = 57
range = 0,399
ignorehitpause = 1

;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = A
physics = N
sprpriority = 1
ctrl = 0

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 100, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 100

[State 100, 1]
type = VelSet
triggerall = PrevStateno != 5
trigger1 = time = 0
x = const(velocity.run.fwd.x)+(PalNo=12)*3
y = const(velocity.run.fwd.y)

[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 = PlaySnd
triggerall = PrevStateno != 5
trigger1 = time = 0
value = s0,1
channel = 1

[State 100, 5]
type = AfterImage
trigger1 = time = 0
time = -1
timeGap = 1
trameGap = 3
trans = Add1
length = 12
paladd = 0,0,0
palmul = 1,1,1
removeongethit = 1

[State 100, 6]
type = Explod
triggerall = PrevStateno != 5
trigger1 = time = 0
anim = 7000
ID = 7000
sprpriority = 0
postype = p1
pos = -10,0
ownpal = 1
facing = 1

[State 100, 7]
type = CtrlSet
trigger1 = Var(21) >= 13
value = 1

[State 100, 8]
type = Explod
trigger1 = Var(21) >= 5
anim = 80
ID = 80
sprpriority = 3
postype = p1
pos = -40+Random%10,-80+Random%50
vel = -1,0.5
accel = -0.14,0.08
ownpal = 1
persistent = 3

[State 100, 9]
type = VelAdd
trigger1 = Var(21) > 13
y = Const(movement.yaccel)*0.2

[State 100, 10]
type = ChangeState
trigger1 = Var(21) >= 30
trigger2 = Var(59) = 0
trigger2 = Var(21) >= 13
trigger2 = command != "holdfwd"
trigger3 = Var(59) != 0
trigger3 = Var(21) >= 13
trigger3 = inguarddist
value = 101
ctrl = 1

;---------------------------------------------------------------------------
;ダッシュ後落下
[Statedef 101]
type    = A
physics = A

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 101
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 101, 1]
type = VarSet
trigger1 = Var(21) = 0
sysvar(1) = 0

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

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

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

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 105, 0]
type = ChangeAnim
triggerall = PrevStateno != 5
trigger1 = time = 0
value = 105

[State 105, 1]
type = VelSet
triggerall = PrevStateno != 5
trigger1 = Time = 0
x = const(velocity.run.back.x)-(PalNo=12)*3
y = const(velocity.run.back.y)

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

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

[State 105, 4]
type = PlaySnd
triggerall = PrevStateno != 5
trigger1 = time = 0
value = s0,1
channel = 1

[State 105, 5]
type = AfterImage
trigger1 = time = 0
time = -1
timeGap = 1
trameGap = 3
trans = Add1
length = 12
paladd = 0,0,0
palmul = 1,1,1
removeongethit = 1

[State 105, 6]
type = Explod
triggerall = PrevStateno != 5
trigger1 = time = 0
anim = 7000
ID = 7000
sprpriority = 0
postype = p1
pos = -10,0
ownpal = 1
facing = -1

[State 105, 7]
type = CtrlSet
trigger1 = Var(21) >= 14
value = 1

[State 105, 8]
type = Explod
trigger1 = Var(21) >= 5
anim = 80
ID = 80
sprpriority = 3
postype = p1
pos = -40+Random%10,-60+Random%40
vel = 1,0.5
accel = 0.14,0.08
ownpal = 1
persistent = 3

[State 105, 9]
type = VelAdd
trigger1 = Var(21) > 13
y = Const(movement.yaccel)*0.2

[State 105, 10]
type = ChangeState
trigger1 = Var(21) >= 30
trigger2 = Var(59) = 0
trigger2 = Var(21) >= 14
trigger2 = command != "holdback"
trigger3 = Var(59) != 0
trigger3 = Var(21) >= 14
trigger3 = inguarddist
value = 106
ctrl = 1

;---------------------------------------------------------------------------
;ダッシュ後落下
[Statedef 106]
type    = A
physics = A

[State -1]
type = VarSet
trigger1 = time = 0
var(20) = 106
ignorehitpause = 1

[State -1]
type = VarAdd
trigger1 = 1
var(21) = 1

[State -1]
type = VarSet
triggerall = PrevStateno != 5
trigger1 = time = 0
var(21) = 0

[State 106, 1]
type = VarSet
trigger1 = Var(21) = 0
sysvar(1) = 0

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

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

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

[State 120, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 120, 0]
type = NotHitBy
trigger1 = time = 0
value = ,NT,ST,HT
time = 5

[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(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
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(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 120, Stop Guarding]
type = null;ChangeState
triggerall = Var(59) != 0
trigger1 = !inguarddist
value = 140

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

[State 130, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

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

[State 130, Hi to Lo]
type = ChangeState
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 130, Stop Guarding]
type = null;ChangeState
triggerall = Var(59) != 0
trigger1 = enemynear,Movetype != A
trigger1 = !inguarddist
value = 140

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

[State 131, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

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

[State 131, Lo to Hi]
type = ChangeState
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 131, Stop Guarding]
type = null;ChangeState
triggerall = Var(59) != 0
;trigger1 = Var(57) = [0,100]
trigger1 = enemynear,Movetype != A
value = 140

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

[State 132, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

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

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

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

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

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

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

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

[State 132, Stop Guarding]
type = ChangeState
trigger1 = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

[State 132, Stop Guarding]
type = null;ChangeState
triggerall = Var(59) != 0
;trigger1 = Var(57) = [0,100]
trigger1 = enemynear,Movetype != A
value = 140

;---------------------------------------------------------------------------
; GUARD (end)
[Statedef 140]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged
ctrl = 1

[State 140, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[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
triggerall = Statetype = S
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
statetype = S
physics = S

[State 140, 5] ;Implemented within engine
type = ChangeState
triggerall = Var(59) != 0
trigger1 = inguarddist
value = 120

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

[State 150, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 150, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

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

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

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = Statetype = S
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
statetype = S
physics = S

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

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

[State 151, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 151, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

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

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

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

[State 150, Hi to Lo]
type = StateTypeSet
triggerall = Statetype = S
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
statetype = S
physics = S

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

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

[State 152, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 152, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

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

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

[State 152, Hi to Lo]
type = StateTypeSet
triggerall = Statetype = S
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
statetype = S
physics = S

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

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

[State 153, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 153, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

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

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

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

[State 153, Hi to Lo]
type = StateTypeSet
triggerall = Statetype = S
trigger1 = Var(59) = 0 && command = "holddown"
trigger2 = Var(59) != 0 && P2Statetype != A
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
triggerall = Statetype = C
trigger1 = Var(59) = 0 && command != "holddown"
trigger2 = Var(59) != 0 && P2Statetype = A
statetype = S
physics = S

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

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

[State 154, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 154, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

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

[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= I
physics = N
anim = 152

[State 155, -1]
type = StateTypeSet
trigger1 = Fvar(21) != 0
movetype = I

[State 155, 0]
type = StateTypeSet
trigger1 = Var(56) = 0
movetype = H

[State 155, 1]
type = HitVelSet
trigger1 = Time = 0
trigger1 = Fvar(21) = 0
x = 1
y = 1

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

[State 155, 3]
type = CtrlSet
trigger1 = Time = GetHitVar(ctrltime)
trigger2 = Fvar(21) != 0
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 = Sysvar(0)
triggerall = inguarddist
trigger1 = Var(59) = 0
trigger1 = command = "holdback"
trigger2 = var(59) != 0
trigger2 = inguarddist
value = 130
ctrl = 1

[State 155, 7]
type = ChangeState
trigger1 = Sysvar(0)
value = 50
ctrl = 1

;---------------------------------------------------------------------------
;リコイルガード
[Statedef 160]
type = U
physics = U
ctrl = 0

[State 160, 0]
type = ChangeAnim
trigger1 = time = 0
value = 160 + (statetype = C) + (statetype = A)*2

[State 160, 1]
type = Explod
trigger1 = time = 0
anim = 7200
ID = 7200
sprpriority = 2
postype = p1
pos = 0,0
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 160, 2]
type = PlaySnd
trigger1 = time = 0
value = s3,3
channel = 6

[State 160, 3]
type = Pause
trigger1 = time = 0
time = 20 + (statetype = C)*2 + (statetype = A)*2
movetime = 20 + (statetype = C)*2 + (statetype = A)*2

[State 160, 4]
type = VelSet
trigger1 = ctrl = 0
x = 0
y = 0

[State 160, 5]
type = VarSet
trigger1 = time = 0
fv = 1
value = Vel X

[State 160, 6]
type = VarSet
trigger1 = time = 0
fv = 2
value = Vel Y

[State 160, 7]
type = VelSet
trigger1 = ctrl = 1
x = Fvar(1)
y = Fvar(2)

[State 160, 8]
type = CtrlSet
trigger1 = Statetype = S
trigger1 = time < 20
value = 0

[State 160, 8]
type = CtrlSet
trigger1 = Statetype = S
trigger1 = time >= 20
value = 1

[State 160, 9]
type = CtrlSet
trigger1 = Statetype != S
trigger1 = time < 19
value = 0

[State 160, 9]
type = CtrlSet
trigger1 = Statetype != S
trigger1 = time >= 19
value = 1

[State 160, 10]
type = VarAdd
trigger1 = time = 0
trigger1 = Var(51) = 0
trigger1 = Var(42) = 0 || Var(19) >= 2
var(50) = 20*Var(11)

[State 160, 11]
type = LifeAdd
trigger1 = time = 0
trigger1 = Var(42) = 0 || Var(19) >= 2
value = (Var(54)/100)*Var(11)
kill = 0

[State 160, 12]
type = PowerAdd
trigger1 = time = 0
trigger1 = Var(42) = 0 || Var(19) >= 2
value = Const(Data.Power)/100*Var(11)

[State 160, 13]
type = CtrlSet
trigger1 = Var(59) = 0
trigger1 = command = "holdfwd" || command = "holdback" || command = "holddown"
trigger2 = Var(59) != 0
trigger2 = inguarddist
value = 0

[State 160, 14]
type = ChangeState
trigger1 = Animtime = 0
value = 120
ctrl = 1

[State 160, 15]
type = ChangeState
triggerall = ctrl
triggerall = AnimTime = 0
trigger1 = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = Var(59) != 0
trigger2 = !inguarddist
value = 130 + (statetype = C) + (statetype = A)*2

[State 160, 16]
type = ChangeState
triggerall = ctrl
trigger1 = Var(59) = 0
trigger1 = command != "holdback"
trigger2 = Var(59) != 0
trigger2 = !inguarddist
value = 140

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

[State 170, 2]
type = VarSet
trigger1 = 1
var(55) = 1

[State 170, 3]
type = ChangeState
trigger1 = MatchOver = 0
value = 5151

[State 170, 4]
type = ChangeState
trigger1 = MatchOver = 1
value = 5152

;---------------------------------------------------------------------------
; 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 = VarSet
trigger1 = 1
var(55) = 1

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

[State 175, 5]
type = ChangeState
trigger1 = MatchOver = 0
value = 5151

[State 175, 6]
type = ChangeState
trigger1 = MatchOver = 1
value = 5152

;---------------------------------------------------------------------------
; 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, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

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

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

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

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

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

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

[State 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] ;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 = 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  ;.
trigger3 = time = 0
trigger3 = PrevStateno = 5
value = 5050 ;HITA_FALL

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

[State 5030, 6]
type = ChangeState
trigger1 = name != "Ayu Tukimiya"
value = 38533

;---------------------------------------------------------------------------
; 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 = VelSet
trigger1 = time = 0
y = -3

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

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

[State 5040, 8]
type = Explod
trigger1 = time = 0
anim = 7300
ID = 7300
sprpriority = 1
postype = p1
pos = 0,0
ownpal = 1

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

[State 5050, 0]
type = StatetypeSet
trigger1 = RoundState >= 3
movetype = I

[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
trigger3 = time = 0
trigger3 = PrevStateno = 5
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 = "recovery"
value = 5200 ;HITFALL_RECOVER

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

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

;---------------------------------------------------------------------------
; 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 5070]
type = PalFX
trigger1 = IsHelper
trigger1 = Root,Name != "Ayu Tukimiya"
time = -1
add = Random%256,Random%256,Random%256
mul = Random%256,Random%256,Random%256
sinadd = 0,0,0,0
invertall = 0
color = 256
ignorehitpause = 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 5071]
type = PalFX
trigger1 = IsHelper
trigger1 = Root,Name != "Ayu Tukimiya"
time = -1
add = Random%256,Random%256,Random%256
mul = Random%256,Random%256,Random%256
sinadd = 0,0,0,0
invertall = 0
color = 256
ignorehitpause = 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

;---------------------------------------------------------------------------
; 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 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

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

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

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

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

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

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

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

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

[State 5100, 8]
type = Explod
trigger1 = time = 0
anim = 7400
ID = 7400
sprpriority = 1
postype = p1
pos = 0,0
ownpal = 1

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

[State 5100, 10]
type = PlaySnd
trigger1 = time = 0
value = s3,1
channel = 2

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

[State 5100, 12]
type = null;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 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

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

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

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

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

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

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

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

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

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

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

[State 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
value = s3,1
channel = 2

[State 5110, 7]
type = Explod
trigger1 = time = 0
anim = 7400
ID = 7400
sprpriority = 1
postype = p1
pos = 0,0
ownpal = 1

[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

[State 5110]
type = ChangeState
trigger1 = IsHelper
trigger1 = Root,Name != "Ayu Tukimiya"
value = 5150

[State 5110]
type = PalFX
trigger1 = IsHelper
trigger1 = Root,Name != "Ayu Tukimiya"
time = -1
add = Random%256,Random%256,Random%256
mul = Random%256,Random%256,Random%256
sinadd = 0,0,0,0
invertall = 0
color = 256
ignorehitpause = 1

;---------------------------------------------------------------------------
; 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 = 0
value = , NT,ST,HT
time = 12

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

[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 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
triggerall = Anim != 5153
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 2] ;Hit up type anim
type = ChangeAnim
trigger1 = (name = "Ayu Tukimiya" && Authorname = "shikkoku") = 0
trigger1 = time = 0
value = ifelse(SelfAnimExist(5150),5150,0)

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
triggerall = name = "Ayu Tukimiya" && Authorname = "shikkoku"
triggerall = Anim != 5153
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
triggerall = name = "Ayu Tukimiya" && Authorname = "shikkoku"
triggerall = Anim != 5153
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
triggerall = name = "Ayu Tukimiya" && Authorname = "shikkoku"
triggerall = Anim != 5153
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 5150, 9]
type = VarSet
trigger1 = time = 0
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
fvar(4) = 1

[State 5150, 10]
type = VarSet
trigger1 = time = 0
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
var(55) = 1

[State 5150, 11]
type = Width
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
value = 20,20

[State 5150, 12]
type = ChangeState
trigger1 = !IsHelper
trigger1 = RoundState = 4
trigger1 = MatchOver = 0
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
value = 5151

[State 5150, 13]
type = ChangeState
trigger1 = !IsHelper
trigger1 = RoundState = 3
trigger1 = MatchOver = 1
trigger1 = RoundNo >= 3
trigger1 = Var(53) = 1
trigger1 = Anim != 5153
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
trigger1 = Var(6) != 12
value = 5153

[State 5150, 13]
type = ChangeState
trigger1 = !IsHelper
trigger1 = RoundState = 4
trigger1 = MatchOver = 1
trigger1 = Anim != 5153
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
value = 5152

[State 5150, 14]
type = VelSet
trigger1 = PrevStateno = [20300,20310]
x = 0
y = 0

[State 5150, 15]
type = PosSet
triggerall = !IsHelper
trigger1 = PrevStateno = [20300,20310]
trigger2 = name != "Ayu Tukimiya"
y = 300

[State 5150, 16]
type = ScreenBound
trigger1 = PrevStateno = [20300,20310]
trigger2 = name != "Ayu Tukimiya"
value = 0
movecamera = 0,0

[State 5150, 17]
type = AssertSpecial
triggerall = !IsHelper
trigger1 = PrevStateno = [20300,20310]
trigger2 = name != "Ayu Tukimiya"
flag = invisible
flag2 = noshadow

[State 5150, 18]
type = LifeSet
trigger1 = PrevStateno = [20300,20310]
trigger2 = name != "Ayu Tukimiya"
value = 0

[State 5150, 18]
type = PowerSet
trigger1 = PrevStateno = [20300,20310]
trigger2 = name != "Ayu Tukimiya"
value = 0

[State 5150, 19]
type = DestroySelf
trigger1 = IsHelper
trigger1 = !IsHelper(1)
trigger1 = Root,Name = "Ayu Tukimiya"
trigger2 = IsHelper(1)
trigger2 = RoundState = 4
trigger2 = Root,Name = "Ayu Tukimiya"

[State 5150, 20]
type = AssertSpecial
trigger1 = Anim = 5153
flag = globalnoshadow
flag2 = invisible
flag3 = nobardisplay

[State 5150, 21]
type = ChangeState
trigger1 = Alive
trigger1 = name = "Ayu Tukimiya" && Authorname = "shikkoku"
value = 5120

[State 5150, 22]
type = DestroySelf
trigger1 = IsHelper
trigger1 = Root,Name != "Ayu Tukimiya"

;---------------------------------------------------------------------------
;特殊演出(決着前)
[Statedef 5151]
type = L
movetype = H
physics = N
sprpriority = 3

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

[State 5151, 1]
type = PosSet
trigger1 = 1
y = 0

[State 5151, 2]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 5151, 3]
type = PlaySnd
trigger1 = time = 0
value = S11,1
channel = 8

[State 5151, 4]
type = Turn
trigger1 = P2BodyDist X < 0
persistent = 0

[State 5151, 5]
type = Width
trigger1 = 1
value = 20,20

[State 5151, 6]
type = VarSet
trigger1 = time = 0
var(55) = 1

[State 5151, 7]
type = VarSet
trigger1 = time = 0
fvar(4) = 1

[State 5151, 8]
type = AssertSpecial
trigger1 = time = [0,200]
flag = roundnotover

;---------------------------------------------------------------------------
;特殊演出(決着後)
[Statedef 5152]
type = L
movetype = H
physics = N
sprpriority = 3

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

[State 5152, 1]
type = PosSet
trigger1 = 1
y = 0

[State 5152, 2]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 5152, 3]
type = PlaySnd
trigger1 = time = 0
value = S11,2
channel = 8

[State 5152, 4]
type = Turn
trigger1 = P2BodyDist X < 0
persistent = 0

[State 5152, 5]
type = Width
trigger1 = 1
value = 20,20

[State 5152, 6]
type = VarSet
trigger1 = time = 0
var(55) = 1

[State 5152, 7]
type = VarSet
trigger1 = time = 0
fvar(4) = 1

[State 5152, 8]
type = AssertSpecial
trigger1 = time = [0,300]
flag = roundnotover

;---------------------------------------------------------------------------
;特殊演出(最終決着)
[Statedef 5153]
type = L
movetype = H
physics = N
sprpriority = 3

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

[State 5153, 1]
type = PosSet
trigger1 = 1
y = 0

[State 5153, 2]
type = VelSet
trigger1 = 1
x = 0
y = 0

[State 5153, 3]
type = PlaySnd
trigger1 = Animelem = 2
value = S11,3
channel = 10

[State 5153, 4]
type = Turn
trigger1 = P2BodyDist X < -20
persistent = 0

[State 5153, 5]
type = Width
trigger1 = 1
value = 20,20

[State 5153, 6]
type = VarSet
trigger1 = time = 0
var(55) = 1

[State 5153, 7]
type = VarSet
trigger1 = time = 0
fvar(4) = 1

[State 5153, 8]
type = AssertSpecial
trigger1 = 1
flag = globalnoshadow
flag2 = nobardisplay

[State 5153, 9]
type = ChangeState
trigger1 = time >= 320
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 = VelSet
trigger1 = time = 0
y = -3

[State 5200, 3]
type = SelfState
trigger1 = time = 0
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 = Explod
trigger1 = time = 0
anim = 7300
ID = 7300
sprpriority = 1
postype = p1
pos = 0,0
ownpal = 1

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

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

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

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

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

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
y = -4.5

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

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

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

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

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

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

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

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

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

[State 5210, 5]
type = VelAdd;Gravity
trigger1 = Time >= 4
y = .35

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

[State 5210, 6]
type = Explod
trigger1 = time = 0
anim = 7300
ID = 7300
sprpriority = 1
postype = p1
pos = 0,0
ownpal = 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

[State 5500, 2]
type = Explod
trigger1 = time = 0
anim = 9600
ID = 9600
sprpriority = -1
postype = left
pos = -160,-240
;ontop = 1
ownpal = 1
bindtime = -1
scale = 0.5,0.5
removetime = -1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

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

[State 5900, 0]
type = ChangeAnim
trigger1 = Anim != 0
value = 0

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

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

[State 5900, 3]
type = ChangeState
triggerall = RoundState < 2
triggerall = Var(56) = 0
trigger1 = Var(59) >= 2
trigger1 = Var(55) = 1
value = 30000

[State 5900, 4]
type = ChangeState
triggerall = RoundState < 2
triggerall = Var(52) = 0
trigger1 = Var(59) >= 2
trigger1 = Var(55) = 1
value = 10000

[State 5900, 5]
type = ChangeState
triggerall = PrevStateno != 33000
triggerall = RoundState < 2
triggerall = Var(41) = 0
triggerall = Var(56) = 1
triggerall = Var(55) = 1
trigger1 = Var(59) >= 5
trigger1 = Var(19) >= 2
trigger1 = RoundNo >= 3
trigger2 = Var(59) = 6
value = 33000

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

[State 5900, 7]
type = ChangeState
trigger1 = Roundno > 1
value = 0
ctrl = 0

;---------------------------------------------------------------------------
;無効化
[Statedef 8726]
type = A
movetype = A
physics = N
ctrl = 0
anim = 20500

[State 8726, -1]
type = HitOverRide
trigger1 = 1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
time = -1
stateno = 8726
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8726, 0]
type = Reversaldef
trigger1 = IsHelper(8726)
reversal.attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAFD
sparkno = -1
sparkxy = 0,0
pausetime = 0,0
hitsound = -1
priority = 7,Hit
getpower = 0,0
givepower = 0,0
numhits = 0

[State -2]
type = BindToParent
trigger1 = 1
time = 2

[State 8726, 1]
type = DestroySelf
trigger1 = RoundState >= 3

;---------------------------------------------------------------------------
;バリア
[Statedef 8888]
type = S
movetype = A
physics = N
ctrl = 0

[State 8888, -2]
type = DisplayToClipboard
trigger1 = 1
text = "Var(0)=%d,Var(1)=%d,Var(2)=%d,Var(3)=%d,Var(4)=%d"
params = Var(0),Var(1),Var(2),Var(3),Var(4)

[State 8888, -1]
type = VarSet
trigger1 = time = 0
var(0) = 0
ignorehitpause = 1

[State 8888, -1]
type = VarRandom
trigger1 = time = 0
v = 1
range = 100,300
ignorehitpause = 1

[State 8888, -1]
type = VarSet
trigger1 = time = 0
var(2) = 0
ignorehitpause = 1

[State 8888, -1]
type = VarSet
trigger1 = time = 0
var(3) = 0
ignorehitpause = 1

[State 8888, 0]
type = ChangeAnim
trigger1 = time = 0
trigger1 = Anim != 35300
value = 35300

[State 8888, 1]
type = BindtoRoot
trigger1 = 1
time = -1
facing = 1
pos = 0,0

[State 8888, 2]
type = HitOverRide
trigger1 = 1
time = -1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
stateno = 8888
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8888, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 8888, 4]
type = PosFreeze
trigger1 = 1
value = 1

[State 8888, 5]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible

[State 8888, 6]
type = Reversaldef
trigger1 = Statetype = S
trigger1 = Var(2) = 0
trigger1 = Var(4) = 0
reversal.attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAFDP
sparkno = -1
sparkxy = 0,0
pausetime = 0,0
hitsound = -1
priority = 7,Hit
numhits = 0

[State 8888, 7]
type = Explod
trigger1 = MoveHit
anim = 7200
ID = 7200
sprpriority = 3
postype = p1
pos = 0,0
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8888, 8]
type = PlaySnd
trigger1 = MoveHit
value = S3,3
channel = 6
ignorehitpause = 1

[State 8888, 9]
type = VarAdd
trigger1 = MoveHit
var(0) = 1
ignorehitpause = 1

[State 8888, 9]
type = VarSet
trigger1 = MoveHit
trigger1 = Var(0) > Var(1)
var(2) = 1
ignorehitpause = 1

[State 8888, 10]
type = VarAdd
trigger1 = Var(2) = 1
var(3) = 1
ignorehitpause = 1

[State 8888, 9]
type = VarSet
trigger1 = Var(2) = 1
var(0) = 0
ignorehitpause = 1

[State 8888, 10]
type = VarRandom
trigger1 = Var(3) >= 600
v = 1
range = 100,300
ignorehitpause = 1

[State 8888, 10]
type = VarSet
trigger1 = Var(3) >= 600
var(2) = 0
ignorehitpause = 1

[State 8888, 10]
type = VarSet
trigger1 = Var(2) = 0
trigger1 = !MoveHit
var(3) = 0
ignorehitpause = 1

[State 8888, 11]
type = MoveHitReset
trigger1 = MoveContact
ignorehitpause = 1

[State 8888, 12]
type = Explod
trigger1 = NumExplod(8888) = 0
trigger1 = RoundState < 3
trigger1 = Var(2) = 0
trigger1 = Var(4) = 0
anim = 8888
ID = 8888
sprpriority = 3
postype = p1
pos = 0,Const(size.mid.pos.y)
ontop = 1
ownpal = 0
removetime = -1
bindtime = -1
scale = 0.5,0.5
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8888, 12]
type = RemoveExplod
triggerall = NumExplod(8888) > 0
trigger1 = Var(2) = 1
trigger2 = RoundState > 2
trigger3 = Var(4) = 1
ID = 8888
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8888, 13]
type = AssertSpecial
trigger1 = Var(2) = 0
trigger1 = Gametime%10 != 0
flag = timerfreeze
ignorehitpause = 1

[State 8888, 14]
type = TargetDrop
trigger1 = NumTarget > 0
ignorehitpause = 1

[State 8888, 15]
type = VarSet
trigger1 = NumHelper(2) = 0
trigger1 = Root,Stateno != 31000
trigger1 = Root,Stateno != [35000,35400]
trigger1 = Root,Stateno != [36000,36300]
trigger1 = Root,Stateno != [36500,36800]
trigger1 = Root,Stateno != 37000
var(4) = 0
ignorehitpause = 1

[State 8888, 15]
type = VarSet
trigger1 = NumHelper(2) > 0
trigger1 = Helper(2),Var(0) = 1
trigger1 = Root,Stateno != 31000
trigger1 = Root,Stateno != [35000,35400]
trigger1 = Root,Stateno != [36000,36300]
trigger1 = Root,Stateno != [36500,36800]
trigger1 = Root,Stateno != 37000
var(4) = 0
ignorehitpause = 1

[State 8888, 15]
type = VarSet
trigger1 = NumHelper(2) > 0
trigger1 = Helper(2),Var(0) = 0
trigger2 = NumHelper(24) > 0
trigger3 = Root,Stateno = 31000
trigger4 = Root,Stateno = [35000,35400]
trigger5 = Root,Stateno = [36000,36300]
trigger6 = Root,Stateno = [36500,36800]
trigger7 = Root,Stateno = 37000
var(4) = 1
ignorehitpause = 1

[State 8888, 16]
type = StatetypeSet
trigger1 = Var(2) != 0
trigger2 = Var(4) != 0
statetype = A
ignorehitpause = 1

[State 8888, 16]
type = StatetypeSet
trigger1 = Var(2) = 0
trigger1 = Var(4) = 0
statetype = S
ignorehitpause = 1

[State 8888, 17]
type = DestroySelf
trigger1 = !Root,Alive
ignorehitpause = 1

[State 8888, 18]
type = ChangeState
trigger1 = p2name = "New_Shiki_Nanaya"
value = 8889
ignorehitpause = 1

;---------------------------------------------------------------------------
;バリア
[Statedef 8889]
type = S
movetype = A
physics = N
ctrl = 0

[State 8889, 0]
type = ChangeAnim
trigger1 = time = 0
trigger1 = Anim != 35300
value = 35300

[State 8889, 1]
type = BindtoRoot
trigger1 = 1
time = -1
facing = 1
pos = 0,0

[State 8889, 2]
type = HitOverRide
trigger1 = 1
time = -1
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
stateno = 8888
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8889, 3]
type = PlayerPush
trigger1 = 1
value = 0

[State 8889, 4]
type = PosFreeze
trigger1 = 1
value = 1

[State 8889, 5]
type = AssertSpecial
trigger1 = 1
flag = noshadow
flag2 = invisible

[State 8889, 6]
type = Reversaldef
trigger1 = 1
reversal.attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAFDP
sparkno = -1
sparkxy = 0,0
pausetime = 0,0
hitsound = -1
priority = 7,Hit
numhits = 0

[State 8889, 7]
type = Explod
trigger1 = MoveHit
anim = 7200
ID = 7200
sprpriority = 3
postype = p1
pos = 0,0
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8889, 8]
type = PlaySnd
trigger1 = MoveHit
value = S3,3
channel = 6
ignorehitpause = 1

[State 8889, 9]
type = Explod
trigger1 = NumExplod(8888) = 0
trigger1 = RoundState < 3
anim = 8888
ID = 8888
sprpriority = 3
postype = p1
pos = 0,Const(size.mid.pos.y)
ontop = 1
ownpal = 0
removetime = -1
bindtime = -1
scale = 0.5,0.5
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8889, 10]
type = RemoveExplod
triggerall = NumExplod(8888) > 0
trigger1 = Var(2) = 1
trigger2 = RoundState > 2
trigger3 = Var(4) = 1
ID = 8888
ignorehitpause = 1
pausemovetime = 99999
supermovetime = 99999

[State 8889, 11]
type = AssertSpecial
trigger1 = Var(2) = 0
trigger1 = Gametime%10 != 0
flag = timerfreeze
ignorehitpause = 1

[State 8889, 12]
type = TargetState
trigger1 = MoveHit
value = 8890
ignorehitpause = 1

[State 8889, 13]
type = TargetLifeAdd
trigger1 = MoveHit
value = -999999999999999999999999999999999999
absolute = 1
ignorehitpause = 1

[State 8889, 14]
type = SuperPause
trigger1 = MoveHit
time = 2
movetime = 2
sound = -1
anim = -1
pos = 0,0
darken = 0
ignorehitpause = 1

[State 8889, 15]
type = MoveHitReset
trigger1 = MoveContact
ignorehitpause = 1

[State 8889, 16]
type = DestroySelf
trigger1 = !Root,Alive
ignorehitpause = 1

;---------------------------------------------------------------------------
;殺
[Statedef 8890]
type = A
movetype = H
physics = N
ctrl = 0

[State 8890, -1]
type = LifeSet
trigger1 = (Name = "Ayu Tukimiya" && Authorname = "shikkoku") = 0
value = 0
ignorehitpause = 1

[State 8890, -1]
type = LifeAdd
trigger1 = (Name = "Ayu Tukimiya" && Authorname = "shikkoku") = 0
value = -999999999999999999999999999999999999
absolute = 1
ignorehitpause = 1

[State 8890, -1]
type = PowerSet
trigger1 = (Name = "Ayu Tukimiya" && Authorname = "shikkoku") = 0
value = 0
ignorehitpause = 1

[State 8890, -1]
type = PowerAdd
trigger1 = (Name = "Ayu Tukimiya" && Authorname = "shikkoku") = 0
value = -999999999999999999999999999999999999
ignorehitpause = 1

[State 8890, -1]
type = ChangeState
trigger1 = !Alive
value = 5150

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