; 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 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
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

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

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

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

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
anim = 11
sprpriority = 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)*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,3.5,1)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,5,1)

[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

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

[State 40, 6]
type = changeanim
trigger1 = time = 0
trigger1 = command = "28"
value = 60 + ifelse(var(1) = 12,1,0)
persistent = 0

[State 40, 6]
type = changestate
trigger1 = anim = [60,61]
trigger1 = inguarddist
trigger1 = command = "holdback"
value = 120

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

[State 40, 2]
type = VarSet
Trigger1 = command = "holdfwd"
var(3) = 1

[State 40, 3]
type = VarSet
Trigger1 = command = "holdback"
var(3) = -1

[State 40, 5]
type = Varset
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
v = 4
value = 1

[STate 40, 6]
type = NotHitBy
trigger1 = 1
value = ,AT
ignorehitpause = 1

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

;---------------------------------------------------------------------------
; AirJump
[Statedef 45]
type    = A
physics = A
ctrl = 1

[State 45, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,4
channel = 3
volume = var(21)
persistent = 0

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

[State 45, 4]
type = VarSet
trigger1 = Time = 0
trigger1 = command = "holdfwd"
sysvar(1) = 1

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

[State 45, 1]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse(sysvar(1) = 0, 51,ifelse(sysvar(1) = 1, 52, 53))

[State 45, 6]
type = Velset
trigger1 = Time = 0
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)
y = ifelse(sysvar(1)=0, const(velocity.jump.y), ifelse(sysvar(1)=1, -8.5,-7.5))

[State 45, 4]
type = velset
triggerall = var(6) >= 1
trigger1 = time = 0
x = ifelse(sysvar(1) = 0, 0, ifelse(sysvar(1)=1, 6.2, -4.275))*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)
y = ifelse(sysvar(1) = 0, -12.2, ifelse(sysvar(1)=1, -9.5, -8.5))


[State 45, 7]
type = turn
trigger1 = time = 0
trigger1 = p2dist x < 0
persistent = 0

[State 45, 7]
type = turn
trigger1 = var(6) >= 1
trigger1 = p2dist x < 0

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

[State 45, 3]
type = varset
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
v = 7
value = 2

[State 45, 4]
type = varadd
trigger1 = time = 0
v = 5
value = 1
persistent = 0

[State 45, 5]
type = changestate
trigger1 = var(1) = 1
trigger1 = var(7) = 2
trigger1 = command = "holdup"
value = 46

[State 45, 4]
type = helper
trigger1 = time%40 = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0


;---------------------------------------------------------------------------
; トラペズィオ
[Statedef 46]
type    = A
physics = A
ctrl = 1
anim = 62

[State 45, 1]
type = turn
trigger1 = p2dist x < 0

[State 46, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S21,0
channel = 6
volume = var(21)
persistent = 0

[State -2, 1]
type = Explod
trigger1 = time = 0
trigger1 = Numexplod(10192) = 0
anim = 10192
ID = 10192
pos = -3,20
postype = p1
facing = ifelse(facing = 1,1,-1)
bindtime = 1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5, 0.1
sprpriority = 4
ownpal = 1
removeongethit = 1
ignorehitpause = 1
persistent = 0

[State 10110, 2]
type = Explod
trigger1 = time >= 21
trigger1 = time%5 = 0
anim = 10112 + random%4
ID = 10111
pos = 0, -80
postype = p1
facing = 1
bindtime = 1
vel = ifelse(vel x = 0,(-2+random%5),-1*vel x), -1*(1+random%2+random%10*0.1)*vel y
accel = 0, 0
random = 50, 10
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0.5, 0.5
sprpriority = 2
ontop = 0
shadow = 0, 0, 0
ownpal = 0
removeongethit = 1

[State 46, 3]
type = velset
trigger1 = command = "holdfwd"
x = 1.5*ifelse(palno=12,2,1)
[State 46, 3]
type = velset
trigger1 = command = "holdback"
x = -1.5*ifelse(palno=12,2,1)
[State 46, 3]
type = velmul
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
x = 0.98

[State 46, 3]
type = velset
trigger1 = 1
y = 0.9

[State 46, 4]
type = changestate
trigger1 = command != "holdup"
trigger2 = var(1) != 1
value = 51
ctrl = 1

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

[State 50, 1]
type = varset
trigger1 = time = 0
v = 6
value = ifelse(anim = 60,1,ifelse(anim = 61,2,0))
persistent = 0

[State 50, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,3
channel = 3
volume = var(21)
persistent = 0

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

[State 50, 4]
type = VelSet
trigger1 = Anim = [41,42]
trigger1 = AnimElemTime(1) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
x = ifelse(var(3)=0, const(velocity.jump.neu.x), ifelse(var(3)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)
y = ifelse(var(3)=0, const(velocity.jump.y), ifelse(var(3)=1, -8.5,-7.5))

[State 50, 4]
type = velset
triggerall = var(6) = 1
trigger1 = Anim = [41,42]
trigger1 = AnimElemTime(1) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
x = ifelse(anim = 41, 0, ifelse(anim = 42, 6.2, -4.275))*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)
y = ifelse(anim = 41, -12.2, ifelse(anim = 42, -9.5, -8.5))

[State 50, 4]
type = velset
triggerall = var(6) = 2
trigger1 = Anim = [41,42]
trigger1 = AnimElemTime(1) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
x = ifelse(anim = 41, 0, ifelse(anim = 42, 6.2, -4.275))*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)
y = ifelse(anim = 41, -14.586, ifelse(anim = 42, -12.155, -10.725))


[State 50, 1]
type = StateTypeSet
trigger1 = Anim = [41,42]
trigger1 = AnimElemTime(1) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
StateType = A
physics = A

[State 50, 1]
type = ctrlset
trigger1 = Anim = [41,42]
trigger1 = AnimElemTime(1) = 0
trigger2 = Anim = 43
trigger2 = AnimElemTime(1) = 0
value = 1

[State 50, 4]
type = velset
trigger1 = Anim = 42
trigger1 = AnimElemTime(2) = 0
trigger1 = var(4) = 1
x = const(velocity.runjump.fwd.x)*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)

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

[State 50, 3]
type = varset
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
v = 7
value = 1

[State 50, 4]
type = turn
trigger1 = p2dist x < 0
trigger1 = var(6) >= 1

[State 50, 4]
type = helper
trigger1 = time%40 = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0

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

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

[State 51, 1]
type = velmul
trigger1 = prevstateno = 2100
trigger1 = time <= 10
x = 0.96
y = 0.97



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

[State 52, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,2
channel = 3
volume = var(21)
persistent = 0

[State 52, 1]
type = turn
trigger1 = time = 0
trigger1 = p2dist x < 0
persistent = 0

[State 52, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 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, 3]
type = changestate
trigger1 = 1
trigger1 = command = "holdfwd" || command = "holdback"
value = 20
ctrl = 1

[State 52, 3]
type = changestate
trigger1 = time >= 7
trigger1 = command = "u" || command = "holdup"
value = 40

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

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

[State 100, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,0
channel = 1
volume = var(21)
persistent = 0

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

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

[State 100, 3]
type = velset
trigger1 = 1
x = 7.2*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,2,1)

[State 100, 4]
type = helper
trigger1 = time = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 100, 5]
type = ChangeState
trigger1 = Time = 20
value = 101


;---------------------------------------------------------------------------
; RUN_FWD_STOP
[Statedef 101]
type = S
physics = S
anim = 101
sprpriority = 1
ctrl = 1

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

[State 101, 2] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 101, 3]
type = null;velmul
trigger1 = 1
x = 0.92

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

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = S
physics = S
ctrl = 0
anim = 105
sprpriority = 1

[State 105, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,1
channel = 3
volume = var(21)
persistent = 0

[State 105, 1]
type = StateTypeSet
trigger1 = time = 0
StateType = A
physics = A

[state 105, 2]
type = velset
trigger1 = time = 0
x = -2.1*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,4,1)
y = -3.85

[State 105, 5]
type = ChangeState
trigger1 = time = 16
;trigger1 = animelemtime(2) >= 1
;trigger1 = pos y >= 0
value = 106
ctrl = 1

[State 105, 1]
type = helper
trigger1 = time = 7
trigger1 = var(1) = 3
trigger1 = Numhelper(10760) = 0
helpertype = normal
name = "jinsen"
ID = 10760
pos = 0,0
postype = p1
stateno = 10760
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 105, 4]
type = helper
trigger1 = time = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0


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

[State 106, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,2
channel = 1
volume = var(21)
persistent = 0

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

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

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

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

;---------------------------------------------------------------------------
; AIR_DASH
[Statedef 110]
type    = A
physics = N
ctrl = 0
velset = 0,0
anim = 110

[State 110, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,5
channel = 3
volume = var(21)
persistent = 0

[State 110, 1]
type = varadd
trigger1 = time = 0
v = 2
value = 1
persistent = 0

[State 110, 1]
type = velset
trigger1 = 1
x = 6*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,1.5,1)

[State 110, 2]
type = Explod
trigger1 = time%2 = 0
anim = 6030
ID = 110
pos = -85,-65
postype = p1
facing = 1
bindtime = -1
removetime = -2
random = 60,60
supermovetime = 0
pausemovetime = 0
scale = 0.5, 0.5
sprpriority = 2
ownpal = 1
removeongethit = 1
ignorehitpause = 1

[State 110, 2]
type = ctrlset
trigger1 = time > 4
trigger1 = palno <= 11
trigger2 = palno = 12
value = 1

[State 110, 4]
type = helper
trigger1 = time%40 = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 110, 3]
type = changestate
trigger1 = time >= 16
value = 111
ctrl = 1

;---------------------------------------------------------------------------
; AIR_DASH_STOP
[Statedef 111]
type    = A
physics = A
ctrl = 1
anim = 111

[State 111, 1]
type = velmul
trigger1 = 1
x = 0.975



;---------------------------------------------------------------------------
; AIR_BACK_DASH
[Statedef 115]
type    = A
physics = N
ctrl = 0
velset = 0,0
anim = 115

[State 115, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,5
channel = 3
volume = var(21)
persistent = 0

[State 115, 1]
type = varadd
trigger1 = time = 0
v = 2
value = 1
persistent = 0

[State 115, 1]
type = velset
trigger1 = 1
x = -2.7*ifelse(var(1) = 5 && var(29) = 1,0.7,1)*ifelse(palno=12,3.5,1)

[State 115, 2]
type = Explod
trigger1 = 1
anim = 6030
ID = 110
pos = 85,-70
postype = p1
facing = 1
bindtime = -1
removetime = -2
random = 60,70
supermovetime = 0
pausemovetime = 0
scale = 0.4, 0.4
sprpriority = 2
ownpal = 1
removeongethit = 1
ignorehitpause = 1


[State 115, 4]
type = helper
trigger1 = time%40 = 0
trigger1 = var(1) = 6 && var(31) > 0
helpertype = normal
name = "fire"
ID = 11660
pos = 0,-50
postype = p1
stateno = 11660
keyctrl = 0
ownpal = 1
facing = 1
size.xscale = 0.75
size.yscale = 0.75
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 115, 2]
type = ctrlset
trigger1 = time > 6
trigger1 = palno <= 11
trigger2 = palno = 12
value = 1

[State 115, 3]
type = changestate
trigger1 = time >= 12
value = 116
ctrl = 1

;---------------------------------------------------------------------------
; AIR_BACK_DASH_STOP
[Statedef 116]
type    = A
physics = A
ctrl = 1
anim = 116

[State 116, 1]
type = velmul
trigger1 = 1
x = 0.99


;---------------------------------------------------------------------------
; 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 = command = "holddown"
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
Trigger1 = command != "holddown"
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 = command != "holdback"
trigger2 = !inguarddist
value = 140


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

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

[State 130, Hi to Lo]
type = ChangeState
Trigger1 = command = "holddown"
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

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

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

[State 131, Lo to Hi]
type = ChangeState
Trigger1 = command != "holddown"
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = command != "holdback"
trigger2 = !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)

[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
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

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

[State 132, Stop Guarding]
type = ChangeState
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
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 = command = "holddown"
statetype = C
physics = C

[State 140, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
Trigger1 = command != "holddown"
statetype = S
physics = S

;[State 140, 5] ;Implemented within engine
;type = ChangeState
;trigger1 = AnimTime = 0
;value = (statetype = C)*11 + (statetype = A)*51

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

[State 150, 1]
type = LifeAdd
trigger1 = time = 0
value = GetHitVar(damage)

[State 150, 1]
type = varrandom
trigger1 = time = 0
trigger1 = Ishelper = 0
v = 27
range = 3,5

[State 150, 1]
type = null;PlaySnd
trigger1 = Ishelper = 0
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 499
value = S6,var(27)
cannel = 0
volume = var(21)
persistent = 0

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

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

[State 150, Hi to Lo]
type = StateTypeSet
TriggerAll=Statetype = S
triggerall = Ishelper = 0
Trigger1 = command = "holddown"
statetype = C
physics = C

[State 150, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
triggerall = Ishelper = 0
Trigger1 = command != "holddown"
statetype = S
physics = S

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

[State 150, 1]
type = varset
trigger1 = Ishelper = 0
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1



[State 150, 1]
type = Sprpriority
trigger1 = Ishelper = 1
value = 4

[State 150, 1]
type = AssertSpecial
trigger1 = Ishelper(11350) = 1
flag = invisible
flag2 = noshadow
ignorehitpause = 1

[State 150, 1]
type = AssertSpecial
trigger1 = Ishelper(11352) = 1
flag = noshadow
ignorehitpause = 1

[State 150, 1]
type = BindToParent
trigger1 = Ishelper = 1
pos = 0,0
ignorehitpause = 1

[State 150, 1]
type = changeanim
triggerall = Ishelper(11350) = 1
trigger1 = 1
value = parent,anim
elem = parent,animelemno(0)
ignorehitpause = 1

[State 150, 1]
type = changeanim
triggerall = Ishelper(11352) = 1
trigger1 = time = 0
value = 2501
ignorehitpause = 1
persistent = 0

[State 150, 1]
type = changeanim
triggerall = Ishelper(11352) = 1
trigger1 = parent,command != "hold_x"
value = 2502
ignorehitpause = 1
persistent = 0

[State 150, 1]
type = HitBy
trigger1 = Ishelper = 1
value = SA,AA,AP
ignorehitpause = 1

[State 150, 1]
type = destroyself
triggerall = Ishelper(11350) = 1
trigger1 = parent,stateno = 600
trigger1 = parent,animelemtime(5) >= 1
trigger2 = parent,stateno != 600
ignorehitpause = 1

[State 150, 1]
type = destroyself
triggerall = Ishelper(11352) = 1
trigger1 = anim = 2502
trigger1 = animtime = 0
trigger2 = parent,stateno != [2500,2510]

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

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

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

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

[State 151, Hi to Lo]
type = StateTypeSet
TriggerAll=Statetype = S
Trigger1 = command = "holddown"
statetype = C
physics = C

[State 151, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
Trigger1 = command != "holddown"
statetype = S
physics = S

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

[state 151, 1]
type = varset
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; CGUARDHIT (shaking)
[Statedef 152]
type    = C
movetype= H
physics = N
velset = 0,0

[State 150, 1]
type = LifeAdd
trigger1 = time = 0
value = GetHitVar(damage)

[State 152, 1]
type = varrandom
triggerall = Ishelper = 0
trigger1 = time = 0
v = 27
range = 3,5

[State 152, 1]
type = null;PlaySnd
triggerall = Ishelper = 0
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 499
value = S6,var(27)
cannel = 0
volume = var(21)
persistent = 0

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

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

[State 152, Hi to Lo]
type = StateTypeSet
TriggerAll=Statetype = S
triggerall = Ishelper = 0
Trigger1 = command = "holddown"
statetype = C
physics = C

[State 152, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
triggerall = Ishelper = 0
Trigger1 = command != "holddown"
statetype = S
physics = S

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

[state 152, 1]
type = varset
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1


[State 152, 1]
type = AssertSpecial
trigger1 = Ishelper = 1
flag = invisible
flag2 = noshadow
ignorehitpause = 1

[State 152, 1]
type = BindToParent
trigger1 = Ishelper = 1
pos = 0,0
ignorehitpause = 1

[State 152, 1]
type = changeanim
triggerall = Ishelper = 1
trigger1 = 1
value = parent,anim
elem = parent,animelemno(0)
ignorehitpause = 1

[State 152, 1]
type = HitBy
trigger1 = Ishelper = 1
value = C,AA,AP
ignorehitpause = 1

[State 152, 1]
type = destroyself
triggerall = Ishelper = 1
trigger1 = parent,stateno = 1000
trigger1 = parent,animelemtime(1) >= 2
trigger2 = parent,stateno != 1000
ignorehitpause = 1


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

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

[State 153, 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 = command = "holddown"
statetype = C
physics = C

[State 153, Lo to Hi]
type = StateTypeSet
TriggerAll=Statetype = C
Trigger1 = command != "holddown"
statetype = S
physics = S

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

[state 153, 1]
type = varset
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1

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

[State 150, 1]
type = LifeAdd
trigger1 = time = 0
value = GetHitVar(damage)

[State 154, 1]
type = varrandom
trigger1 = time = 0
v = 27
range = 3,5

[State 154, 1]
type = null;PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 499
value = S6,var(27)
cannel = 0
volume = var(21)
persistent = 0

[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

[state 154, 1]
type = varset
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1

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

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

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

[State 155, 3]
type = CtrlSet
trigger1 = Time = 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
trigger1 = sysvar(0)
trigger1 = command = "holdback"
trigger1 = inguarddist
value = 130

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

[state 155, 1]
type = varset
trigger1 = time = 0
v = 12
value = 1
ignorehitpause = 1

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

[State 175, 1]
type = AssertSpecial
trigger1 = anim = 170
trigger1 = AnimElemTime(24) <= 60
trigger2 = anim = 172
trigger2 = time <= 181
flag = roundnotover

[State 170, 1]
type = changeanim
trigger1 = time = 0
trigger1 = random <= 529
value = 172
persistent = 0

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

[State 170, 1]
type = PlaySnd
trigger1 = time = 0
value = S14, ifelse(anim = 170,6,7)
channel = 0
volume = var(21)
persistent = 0

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

[State 175, 1]
type = AssertSpecial
trigger1 = AnimElemTime(15) <= 120
flag = roundnotover

[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, 1]
type = PlaySnd
trigger1 = time = 0
value = S14, 5
channel = 0
volume = var(21)
persistent = 0

[State 175, 1]
type = PlaySnd
trigger1 = time = 0
value = S1, 0
channel = 1
volume = var(21)
persistent = 0

[State 175, 1]
type = PlaySnd
trigger1 = animelemtime(11) = 0
value = S1, 1
channel = 1
volume = var(21)
persistent = 0

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

;---------------------------------------------------------------------------
; WIN
[Statedef 180]
type = S
physics = S
anim = 180
ctrl = 0
sprpriority = 1
velset = 0,0

[State 180, 1]
type = AssertSpecial
trigger1 = animelemTime(13) < 0
flag = roundnotover

[State 180, 2]
type = varrandom
trigger1 = time = 0
v = 27
range = 1,7
persistent = 0

[State 180, 2]
type = changestate
trigger1 = var(27) = [6,7]
value = 182

[State 180, 2]
type = PlaySnd
trigger1 = time = 0
trigger1 = var(27) = [1,4]
value = S15, 0
channel = 0
volume = var(21)
persistent = 0

[State 180, 2]
type = PlaySnd
trigger1 = time = 0
trigger1 = var(27) = 5
value = S15, 5
channel = 0
volume = var(21)
persistent = 0

[State 180, 2]
type = PlaySnd
trigger1 = animelemtime(12) = 10
trigger1 = var(27) = [1,4]
value = S15, var(27)
channel = 0
volume = var(21)
persistent = 0

[State 180, 2]
type = PlaySnd
trigger1 = animelemtime(6) = 1
value = S1, 9
channel = 1
volume = var(21)
persistent = 0

[State 180, 2]
type = PlaySnd
trigger1 = animelemtime(10) = 1
value = S1, 3
channel = 6
volume = var(21)
persistent = 0


; WIN2
[Statedef 182]
type = S
physics = S
anim = 182
ctrl = 0
sprpriority = 1
velset = 0,0

[State 182, 1]
type = helper
trigger1 = time = 0
trigger1 = Numhelper(7025) = 0
helpertype = normal
name = "hayata"
ID = 7025
pos = 0,0
postype = p1
stateno = 7025
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 182, 2]
type = AssertSpecial
trigger1 = Time < 521
flag = roundnotover

[State 182, 3]
type = PlaySnd
trigger1 = animelemtime(3) = 1
value = S1, 4
channel = 1
volume = var(21)
persistent = 0

[State 182, 3]
type = PlaySnd
trigger1 = animelemtime(10) = 1
value = S1, 1
channel = 1
volume = var(21)
persistent = 0

[State 182, 4]
type = PlaySnd
trigger1 = animelemtime(12) = 4
value = S15, 6
channel = 0
volume = var(21)
persistent = 0

;---------------------------------------------------------------------------
;イントロ
; PREINTRO
[Statedef 190]
type = S
physics = S
anim = 190
ctrl = 0
sprpriority = 1
velset = 0,0

[State 190, 3]
type = changestate
trigger1 = time = 0
trigger1 = palno = 12
value = 198

[State 190, 3]
type = changestate
trigger1 = time = 0
trigger1 = p2name = "Kamui" || p2name = "Kamui_Tokinomiya"
value = 194

[State 190, 3]
type = changestate
trigger1 = time = 0
trigger1 = p2name = "Konoha" || p2name = "KONOHA-SS"
value = 195

[State 190, 3]
type = changestate
trigger1 = time = 0
trigger1 = p2name = "Akane Inuwaka"
value = 196

[State 190, 3]
type = changestate
trigger1 = time = 0
trigger1 = p2name = "Maori"
value = 197

[State 190, 1]
type = varrandom
trigger1 = time = 0
v = 27
range = 0,3
persistent = 0

[State 190, 2]
type = changestate
trigger1 = time = 0
trigger1 = var(27) >= 1
value = 190 + var(27)

[State 190, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 190, 1]
type = PlaySnd
trigger1 = animelemtime(2) = 0
value = S13,0
channel = 0
volume = var(21)
persistent = 0

[State 190, 1]
type = PlaySnd
trigger1 = animelemtime(9) = 0
value = S13,1
channel = 0
volume = var(21)
persistent = 0

[State 190, 1]
type = PlaySnd
trigger1 = animelemtime(31) = 0
value = S13,2
channel = 0
volume = var(21)
persistent = 0

[State 190, 1]
type = PlaySnd
trigger1 = animelemtime(29) = 0
value = S1,1
channel = 2
volume = var(21)
persistent = 0

[State 190, 1]
type = PlaySnd
trigger1 = animelemtime(46) = 0
value = S1,3
channel = 6
volume = var(21)
persistent = 0


;はやた
[State -2, 1]
type = helper
trigger1 = time = 0
trigger1 = Numhelper(7021) = 0
helpertype = normal
name = "hayata"
ID = 7021
pos = 0,0
postype = p1
stateno = 7021
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

;ふすみ
[State -2, 1]
type = helper
trigger1 = animelemtime(6) = 5
trigger1 = Numhelper(7050) = 0
helpertype = normal
name = "husumi"
ID = 7050
pos = -15,-105
postype = p1
stateno = 7022
keyctrl = 0
ownpal = ifelse(palno <= 9,1,0)
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

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

;---------------------------------------------------------------------------
; INTRO1 (override this state to give character an intro)
;あかねが出てくるやつ
[Statedef 191]
type = S
physics = S
anim = 191
ctrl = 0
sprpriority = 1
velset = 0,0

[State 191, 1]
type = PlaySnd
trigger1 = animelemtime(1) = 173
value = S13, 4
channel = 0
volume = var(21)
persistent = 0

[State 191, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 191, 1]
type = ScreenBound
trigger1 = animelemtime(9) <= 3
value = 0

[State 191, 1]
type = ScreenBound
trigger1 = animelemtime(10) >= 0
value = 1

[State 191, 2]
type = helper
trigger1 = time = 0
helpertype = normal
name = "akanee"
ID = 7024
pos = 0,0
postype = p1
stateno = 7024
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 0
pausemovetime = 0
persistent = 0

[State 191, 2]
type = posset
trigger1 = time = 0
x = ifelse(teamside = 1,-240,240)

[State 191, PlaySnd]
type = PlaySnd
trigger1 = animelemtime(2) = 0
value = S3,0
channel = 1
volume = var(21)
persistent = 0

[State 191, 3]
type = velset
trigger1 = animelemtime(2) >= 0
trigger1 = animelemtime(5) <= 2
x = 7.2

[State 191, 1]
type = velset
trigger1 = animtime = 0
x = 0

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

;--------------------------------------------------------------------------
; PREINTRO2
[Statedef 192]
type = S
physics = S
anim = 192
ctrl = 0
sprpriority = 1
velset = 0,0

[State 192, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 192, 2]
type = PlaySnd
trigger1 = animelemtime(1) = 21
value = S13,6
channel = 0
volume = var(21)
persistent = 0

[State 192, 3]
type = PlaySnd
trigger1 = animelemtime(8) = 0
value = S1,1
channel = 2
volume = var(21)
persistent = 0

[State 192, 3]
type = PlaySnd
trigger1 = animelemtime(19) = 0
value = S1,3
channel = 6
volume = var(21)
persistent = 0

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


;--------------------------------------------------------------------------
; PREINTRO3
[Statedef 193]
type = S
physics = S
anim = 193
ctrl = 0
sprpriority = 1
velset = 0,0

[State 193, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 193, 2]
type = PlaySnd
trigger1 = animelemtime(4) = 1
value = S13,7
channel = 0
volume = var(21)
persistent = 0

[State 193, 3]
type = varset
trigger1 = var(20) = 48
v = 20
value = 0

[State 193, 3]
type = Explod
trigger1 = animelemtime(5) >= 0
trigger1 = animelemtime(7) <= 1
trigger1 = NumExplod(7028) = 0
anim = 7028
ID = 7028
pos = 0,0
postype = p1
facing = 1
bindtime = -1
removetime = -1
supermovetime = 0
pausemovetime = 0
scale = 0, 0
sprpriority = 0
ownpal = 1
removeongethit = 1
ignorehitpause = 1

[State 193, 3]
type = varadd
trigger1 = NumExplod(7028) = 1
v = 20
value = 1

[State -2, 1];サイズ変化
type = ModifyExplod
trigger1 = NumExplod(7028) = 1
ID = 7028
scale = 1*var(20)*0.04, 0.4*var(20)*0.04
removeongethit = 1
ignorehitpause = 1

[State 193, 3]
type = changeanim
trigger1 = time <= 224
trigger1 = animelemtime(6) = 1
value = 193
elem = 5

[State 193, 3]
type = RemoveExplod
trigger1 = animelemtime(7) = 6
ID = 7028

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



;--------------------------------------------------------------------------
; PREINTRO4
;対神依
[Statedef 194]
type = S
physics = S
anim = 194
ctrl = 0
sprpriority = 1
velset = 0,0

[State 194, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 194, 2]
type = PlaySnd
trigger1 = time = 0
value = S14,0
channel = 0
volume = var(21)
persistent = 0

[State 194, 2]
type = PlaySnd
trigger1 = animelemtime(60) = 1
value = S1,1
channel = 2
volume = var(21)
persistent = 0

[State 194, 2]
type = PlaySnd
trigger1 = animelemtime(60) = 1
value = S2,0
channel = 4
volume = var(21)
persistent = 0

;はやた
[State -2, 1]
type = Explod
trigger1 = animelemtime(44) = 0
trigger1 = NumExplod(7031) = 0
anim = 7031
ID = 7031
pos = 0,0
postype = p1
facing = 1
bindtime = -1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0, 0
sprpriority = 0
ownpal = 1
removeongethit = 1
ignorehitpause = 1
persistent = 0

;ふすみ
[State -2, 1]
type = helper
trigger1 = animelemtime(60) = 3
trigger1 = Numhelper(7050) = 0
helpertype = normal
name = "husumi"
ID = 7050
pos = -15,-105
postype = p1
stateno = 7022
keyctrl = 0
ownpal = ifelse(palno <= 9,1,0)
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 194, 5]
type = changestate
trigger1 = animtime = 0
value = 0


;---------------------------------------------------------------------------
; INTRO5 (override this state to give character an intro)
;対このは
[Statedef 195]
type = S
physics = S
anim = 195
ctrl = 0
sprpriority = 1
velset = 0,0

[State 195, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 195, 1]
type = PlaySnd
trigger1 = animelemtime(1) = 1
value = S14, 2
channel = 0
volume = var(21)
persistent = 0

[State 195, 1]
type = ScreenBound
trigger1 = animelemtime(9) <= 3
value = 0

[State 195, 1]
type = ScreenBound
trigger1 = animelemtime(10) >= 0
value = 1

[State 195, 2]
type = posset
trigger1 = time = 0
x = ifelse(teamside = 1,-240,240)

[State 195, PlaySnd]
type = PlaySnd
trigger1 = animelemtime(2) = 0
value = S3,0
channel = 1
volume = var(21)
persistent = 0

[State 195, 3]
type = velset
trigger1 = animelemtime(2) >= 0
trigger1 = animelemtime(5) <= 2
x = 7.2

[State 195, 1]
type = velset
trigger1 = animtime = 0
x = 0

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



;---------------------------------------------------------------------------
; INTRO6 (override this state to give character an intro)
;対あかね
[Statedef 196]
type = S
physics = S
anim = 0
ctrl = 0
sprpriority = 1
velset = 0,0

[State 196, 1]
type = AssertSpecial
trigger1 = anim = 196
trigger1 = AnimTime <= 0
trigger2 = anim = 0
flag = intro

[State 196, 1]
type = changeanim
trigger1 = time = 284
value = 196
persistent = 0

[State 196, 1]
type = PlaySnd
trigger1 = anim = 196
trigger1 = animelemtime(1) = 1
value = S14, 4
channel = 0
volume = var(21)
persistent = 0

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



;--------------------------------------------------------------------------
; PREINTRO7
;対舞織
[Statedef 197]
type = S
physics = S
anim = 197
ctrl = 0
sprpriority = 1
velset = 0,0

[State 197, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 197, 2]
type = PlaySnd
trigger1 = time = 0
value = S14,3
channel = 0
volume = var(21)
persistent = 0

[State 197, 2]
type = PlaySnd
trigger1 = animelemtime(56) = 1
value = S1,1
channel = 2
volume = var(21)
persistent = 0

[State 197, 2]
type = PlaySnd
trigger1 = animelemtime(56) = 1
value = S2,0
channel = 4
volume = var(21)
persistent = 0

;はやた
[State -2, 1]
type = Explod
trigger1 = animelemtime(40) = 0
trigger1 = NumExplod(7036) = 0
anim = 7036
ID = 7036
pos = 0,0
postype = p1
facing = 1
bindtime = -1
removetime = -2
supermovetime = 0
pausemovetime = 0
scale = 0, 0
sprpriority = 0
ownpal = 1
removeongethit = 1
ignorehitpause = 1
persistent = 0

;ふすみ
[State -2, 1]
type = helper
trigger1 = animelemtime(56) = 3
trigger1 = Numhelper(7050) = 0
helpertype = normal
name = "husumi"
ID = 7050
pos = -15,-105
postype = p1
stateno = 7022
keyctrl = 0
ownpal = ifelse(palno <= 9,1,0)
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 197, 5]
type = changestate
trigger1 = animtime = 0
value = 0


;--------------------------------------------------------------------------
; PREINTRO8
;12Pカラー用
[Statedef 198]
type = S
movetype = I
physics = S
velset = 0,0
anim = 8200
sprpriority = 1
ctrl = 0

[State 198, 1]
type = AssertSpecial
trigger1 = AnimTime <= 0
flag = intro

[State 8200, 1]
type = varset
trigger1 = time = 0
v = 20
value = 2
persistent = 0

[State 8200, 1]
type = varset
triggerall = animelemtime(1) <= 40
triggerall = command = "a" && command != "b" && command != "c"
trigger1 = Numhelper(8210) >= 1
trigger1 = helper(8210),stateno != 3910
trigger2 = Numhelper(8211) >= 1
trigger2 = helper(8211),stateno != 3910
trigger3 = Numhelper(8212) >= 1
trigger3 = helper(8212),stateno != 3910
trigger4 = Numhelper(8213) >= 1
trigger4 = helper(8213),stateno != 3910
trigger5 = Numhelper(8214) >= 1
trigger5 = helper(8214),stateno != 3910
trigger6 = Numhelper(8215) >= 1
trigger6 = helper(8215),stateno != 3910
trigger7 = Numhelper(8210)+Numhelper(8211)+Numhelper(8212)+Numhelper(8213)+Numhelper(8214)+Numhelper(8215) = 0
v = 20
value = 1

[State 8200, 1]
type = varset
triggerall = animelemtime(1) <= 40
triggerall = command = "b" && command != "a" && command != "c"
trigger1 = Numhelper(8210) >= 1
trigger1 = helper(8210),stateno != 4010
trigger2 = Numhelper(8211) >= 1
trigger2 = helper(8211),stateno != 4010
trigger3 = Numhelper(8212) >= 1
trigger3 = helper(8212),stateno != 4010
trigger4 = Numhelper(8213) >= 1
trigger4 = helper(8213),stateno != 4010
trigger5 = Numhelper(8214) >= 1
trigger5 = helper(8214),stateno != 4010
trigger6 = Numhelper(8215) >= 1
trigger6 = helper(8215),stateno != 4010
trigger7 = Numhelper(8210)+Numhelper(8211)+Numhelper(8212)+Numhelper(8213)+Numhelper(8214)+Numhelper(8215) = 0
v = 20
value = 2

[State 8200, 1]
type = varset
triggerall = animelemtime(1) <= 40
triggerall = command = "c" && command != "a" && command != "b"
trigger1 = Numhelper(8210) >= 1
trigger1 = helper(8210),stateno != 4110
trigger2 = Numhelper(8211) >= 1
trigger2 = helper(8211),stateno != 4110
trigger3 = Numhelper(8212) >= 1
trigger3 = helper(8212),stateno != 4110
trigger4 = Numhelper(8213) >= 1
trigger4 = helper(8213),stateno != 4110
trigger5 = Numhelper(8214) >= 1
trigger5 = helper(8214),stateno != 4110
trigger6 = Numhelper(8215) >= 1
trigger6 = helper(8215),stateno != 4110
trigger7 = Numhelper(8210)+Numhelper(8211)+Numhelper(8212)+Numhelper(8213)+Numhelper(8214)+Numhelper(8215) = 0
v = 20
value = 3


[State 8200, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,8
channel = 1
volume = var(21)
persistent = 0

[State 8200, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S9,5
channel = 0
volume = var(21)
persistent = 0

[State 8200, PlaySnd]
type = PlaySnd
trigger1 = animelemtime(8) = 1
value = S2,6
channel = 4
volume = var(21)
persistent = 0

[State 8200, 2];カットインエフェクト
type = Explod
trigger1 = time = 0
anim = 6103
ID = 6103
pos = 0,-72
postype = p1
facing = 1
bindtime = -1
removetime = -2
supermovetime = 9999
pausemovetime = 9999
scale = 0.5, 0.5
sprpriority = 5
ownpal = 1
removeongethit = 1
;ignorehitpause = 1
persistent = 0

[State 8200, 2];背景1
type = Explod
trigger1 = time = 0
anim = 6101
ID = 6101
pos = 0,240
postype = back
facing = 1
bindtime = -1
removetime = 70
supermovetime = 9999
pausemovetime = 9999
scale = 0.5, 0.5
sprpriority = -2
ownpal = 1
removeongethit = 1
;ignorehitpause = 1
persistent = 0

[State 8200, 2];背景2
type = Explod
trigger1 = time = 0
anim = 6102
ID = 6102
pos = 0,240
postype = back
facing = 1
bindtime = -1
removetime = 70
supermovetime = 9999
pausemovetime = 9999
scale = 0.5, 0.5
sprpriority = -2
ownpal = 1
removeongethit = 1
;ignorehitpause = 1
persistent = 0

;カットインはヘルパー

[State 8200, 3]
type = SuperPause
trigger1 = time = 0
time = 40
anim = -1
;sound = S100,1
pos = 0,0
movetime = 40
darken = 0
p2defmul = 1
poweradd = -1000
unhittable = 1
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
trigger1 = Numhelper(8210) = 0
helpertype = normal
name = "tyou_big0"
ID = 8210
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
helpertype = normal
name = "tyou_big1"
ID = 8211
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
helpertype = normal
name = "tyou_big2"
ID = 8212
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
helpertype = normal
name = "tyou_big3"
ID = 8213
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
helpertype = normal
name = "tyou_big4"
ID = 8214
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 4]
type = helper
trigger1 = animelemtime(8) = 1
helpertype = normal
name = "tyou_big5"
ID = 8215
pos = 2,-85
postype = p1
stateno = 8210
keyctrl = 0
ownpal = 1
facing = 1
;size.xscale = 1
;size.yscale = 1
supermovetime = 9999
pausemovetime = 9999
persistent = 0

[State 8200, 5]
type = changestate
trigger1 = animtime = 0
value = 0


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

[State 5000, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5000, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5000, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5010, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5010, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5010, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1
;---------------------------------------------------------------------------
; 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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HITA_SHAKE
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5020, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5020, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5030, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5030, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 0

[State 5030, 1]
type = VelAdd;Gravity
trigger1 = 1
y = GetHitVar(yaccel)

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

[State 5030, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5040 ;HITA_RECOV

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = 5050 ;HITA_FALL

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5035, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5035, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 0

[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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5040, PlaySnd]
type = PlaySnd
trigger1 = time = 1
value = S3,6
channel = 1
volume = var(21)
persistent = 0

[State 5040, 1]
type = varrandom
trigger1 = time = 0
v = 27
range = 6,7

[State 5040, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 0

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050

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

[State 5040, 3]
type = CtrlSet
trigger1 = HitOver
value = 1

[State 5040, 4]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5040, 5]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5050, 4] ;Recover near ground
type = ChangeState
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5070, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) <= 1
v = 27
range = 0,2

[State 5070, 1]
type = varrandom
trigger1 = time = 0
trigger1 = GetHitVar(animtype) >= 2
v = 27
range = 3,5

[State 5070, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
trigger1 = random <= 299
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 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 -3, 1]
type = destroyself
trigger1 = Ishelper = 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 -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type    = L
movetype= H
physics = C

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

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = 5110 ;HIT_LIEDOWN

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

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

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

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

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

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

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

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

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; 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
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

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

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

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

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

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5120]
type    = L
movetype= I
physics = N

[State 5120, 1]
type = null;varrandom
trigger1 = time = 0
v = 27
range = 6,7

[State 5120, 1]
type = null;PlaySnd
trigger1 = Alive = 1
trigger1 = AnimElemTime(5) = 1
value = S6,var(27)
cannel = 0
volume = var(21)
persistent = 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 = 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
value2 = SCA
time = 3

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

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

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

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

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

[State 5150, 6]
type = null;changeanim
trigger1 = time = 0
trigger1 = var(26) = 1
value = 5151

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = ifelse(anim = 5151, 0.9, 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 -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5201, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,6
channel = 3
volume = var(21)
persistent = 0

[State 5201, 1]
type = varrandom
trigger1 = time = 0
v = 27
range = 6,7

[State 5201, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 0

[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

[State -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

[State 5210, PlaySnd]
type = PlaySnd
trigger1 = time = 0
value = S3,6
channel = 3
volume = var(21)
persistent = 0

[State 5210, 1]
type = varrandom
trigger1 = time = 0
v = 27
range = 6,7

[State 5210, 1]
type = PlaySnd
trigger1 = Alive = 1
trigger1 = time = 1
value = S7,var(27)
cannel = 0
volume = var(21)
persistent = 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 -3, 1]
type = destroyself
trigger1 = Ishelper = 1

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

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

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

[State 5900, 3]
type = powerset
trigger1 = var(29) = 1 || (var(29) = [3,4])
value = 0

[State 5900, 1]
type = varset
trigger1 = 1;roundsexisted = 0
v = 0
value = 0

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

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

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = 1;roundsexisted = 0
fvalue = 0
first = 10
last = 39


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



