; Common state file for M.U.G.E.N 1.0
;
; 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.
; sysvar(3)   Perm   Used to remember initial facing for gethits
; sysvar(4)   Perm   Timer for exp friction calculations in gethits

; 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): defense increases at time = 0
; Downed get-hit (hit ground from fall) (5100):
;   defense 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 = N
sprpriority = 0
velset = 0,0
;movetype = A

[State 800, VarSet]
type = VarSet
trigger1 = !time
var(4) = 0
;----------------------------------------
;Scramble
[State 0, CtrlSet]
type = CtrlSet
trigger1 = AILevel
trigger1 = var(42) = 1
value = 0
;----------------------------------------

[State 0, 1]
type = HitBy
trigger1 = 1
value = SCA,AA,AT,AP

[State -3,STOP]
type = StopSnd
trigger1 = prevstateno = [191,194]
trigger1 = roundstate = 2
channel = 0

[State -3,STOP]
type = StopSnd
trigger1 = prevstateno = [191,194]
trigger1 = roundstate = 2
channel = 1

[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = roundstate < 3
trigger1 = var(42) = 2
trigger1 = prevstateno = 8001
value = 8001
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

;================================================================================
; Scramble Overrides
;================================================================================
;----------------------------------------
;Turning
[State 1300, ChangeAnim]
type = ChangeAnim
triggerall = AILevel
triggerall = var(42) = 1
trigger1 = anim != 5
trigger1 = P2Dist X < 0 
value = 5
[State 1300, Turn]
type = Turn
triggerall = AILevel
triggerall = var(42) = 1
trigger1 = anim = 5
trigger1 = animelem = 1
;----------------------------------------
;Jumping
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holdup";(helper(10371),sysvar(1))&16
value = 40
;----------------------------------------
;Walking
[State 0, 4] ;Are you dead?
type = ChangeState
triggerall = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&2
trigger2 = (helper(10371),sysvar(1))&4
value = 22
;----------------------------------------
;Crouching
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holddown";(helper(10371),sysvar(1))&8
value = 10

[State -2, Change if Intro is Skipped]
type = ChangeState
triggerall = teammode = simul
triggerall = var(42) = 2
trigger1 = roundstate < 3
value = 8001

[State 0, 1]
type = ChangeAnim
trigger1 = var(42)
trigger1 = roundstate = 3
trigger1 = prevstateno = 8001
value = 1

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

[State 8001, PosSet]
type = PosSet
trigger1 = var(42)
trigger1 = roundstate = 3
trigger1 = prevstateno = 8001
x = (Screenpos X)-48
y = 0

[State 195, Go to winpose, moron. This better not work] ;IT DID
type = CtrlSet
trigger1 = prevstateno = 8001
trigger2 = roundstate = 3
value = 1

[State 181, ScreenBound] ;Might Remove 
type = ScreenBound
trigger1 = var(42)
trigger1 = roundstate = 3
trigger1 = prevstateno = 8001
value = 0
movecamera = 0,0

;---------------------------------------------------------------------------
; Stand to Crouch
; - Set vel to 0,0 at start
; - Simulate the no crouch if opponent is dead
; ~ Thanks, Scal!
[Statedef 10]
type    = C
physics = N
anim = 10
velset = 0,0

;----------------------------------------
;Scramble
[State 20, CtrlSet]
type = CtrlSet
trigger1 = AIlevel && var(42) = 1 
value = 0

[State 10, 1]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 10, CrouchAnim]
type = ChangeAnim
trigger1 = Anim != 10 && RoundState < 3
value = 10

[State 10, NoCrouchAnim]
type = ChangeAnim
trigger1 = (Anim != 0) && RoundState > 2
value = 0
value = 0

[State 10, SetStandState]
type = StateTypeSet
trigger1 = RoundState > 2
statetype = S
physics = S

[State 10, GoToCrouch]
type = ChangeState
trigger1 = RoundState < 3
trigger1 = !AnimTime
value = 11

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

;----------------------------------------
;Scramble
[State 20, CtrlSet]
type = CtrlSet
trigger1 = AIlevel && var(42) = 1 
value = 0

[State 11, 0]
type = ChangeAnim
trigger1 = PrevStateNo = [10,12]
trigger1 = Anim != [10,11]
trigger1 = Anim != 6
value = 10

[State 0, 1]
type = AssertSpecial
trigger1 = !time
trigger1 = Anim = 10
flag = NoAutoTurn

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

;================================================================================
; Scramble Overrides
;================================================================================
;----------------------------------------
;Turning
[State 1300, ChangeAnim]
type = ChangeAnim
triggerall = AILevel
triggerall = var(42) = 1
trigger1 = anim != 6
trigger1 = P2Dist X < 0 
value = 6
[State 1300, Turn]
type = Turn
triggerall = AILevel
triggerall = var(42) = 1
trigger1 = anim = 6
trigger1 = animelem = 1
;----------------------------------------
;Crouch to stand
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = !((helper(10371),sysvar(1))&8)
value = 12

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

;----------------------------------------
;Scramble
[State 20, CtrlSet]
type = CtrlSet
trigger1 = AIlevel && var(42) = 1 
value = 0

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

;================================================================================
; Scramble Overrides
;================================================================================
;----------------------------------------
;Jumping
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&16
value = 40
;----------------------------------------
;Walking
[State 0, 4] ;Are you dead?
type = ChangeState
triggerall = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&2
trigger2 = (helper(10371),sysvar(1))&4
value = 22

;---------------------------------------------------------------------------
; Run to Crouch (STOLEN FROM SCAL) D:
;---------------------------------------------------------------------------
[Statedef 15]
type = C
physics = C
anim = 15
velset = 0,0
ctrl = 1

[State 15, GoToCrouch]
type = ChangeState
trigger1 = !AnimTime
value = ifelse(Command = "holddown",11,0)
ctrl = 1
;---------------------------------------------------------------------------

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

;----------------------------------------
;Scramble
[State 20, CtrlSet]
type = CtrlSet
trigger1 = AIlevel && var(42) = 1 
value = 0

[State 20, 1]
type = VelSet
trigger1 = !AILevel
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
trigger1 = !AILevel
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)

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

;---------------------------------------------------------------------------
; AI Walk
[Statedef 21]
type    = S
physics = N
sprpriority = 0
ctrl = 0
velset = 0,0

[State 21, Turn]
type = Turn
trigger1 = p2dist X < 0

[State 20, 1]
type = VelSet
trigger1 = !time
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
triggerall = !time
trigger1 = enemy,movetype =A || (p2statetype=L  && p2bodydist x <20) || random%6<=2
x = const(velocity.walk.back.x)
[State 20, 1]
type = VelSet
trigger1 = p2bodydist X > 160
x = const(velocity.walk.fwd.x)
persistent = 0

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

;Thank you, Warusaki!
[State 21, ChangeState]
type = ChangeState
trigger1 = time > 20 ;Fail safe
trigger1 = P2bodydist x <= 50 && anim = 20
trigger2 = time > 20
trigger2 = P2bodydist x >= 150 && anim = 21
trigger3 = inguarddist
trigger4 = roundstate != 2
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; AI Partner Walk
[Statedef 22]
type    = S
physics = N
sprpriority = 0
ctrl = 0
velset = 0,0

[State 21, Turn]
type = Turn
trigger1 = p2dist X < 0

[State 20, 1]
type = VelSet
;Scramble
trigger1 = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&2
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
;Scramble
trigger1 = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&4
x = const(velocity.walk.back.x)

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

[State 0, 4] ;Are you dead?
type = ChangeState
triggerall = AILevel && var(42) = 1
trigger1 =!((helper(10371),sysvar(1))&2)
trigger1 =!((helper(10371),sysvar(1))&4)
value = 0
;----------------------------------------
;To jump
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holdup";(helper(10371),sysvar(1))&16
value = 40
;----------------------------------------
;Crouching
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holddown";(helper(10371),sysvar(1))&8
value = 10

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

[State 100, Kino]
type = VarSet
triggerall = !AILevel
trigger1 = !time
var(4) = 0
[State 100, Karin]
type = VarSet
triggerall = !AILevel
trigger1 = command = "x"
var(4) = 1
[State 100, Karin]
type = VarSet
triggerall = !AILevel
trigger1 = command = "a"
var(4) = 2
[State 100, Karin]
type = VarSet
triggerall = !AILevel
trigger1 = command = "y"
var(4) = 3
[State 100, Karin]
type = VarSet
triggerall = !AILevel
trigger1 = command = "b"
var(4) = 4
[State 100, Karin]
type = VarSet
triggerall = !AILevel
trigger1 = command = "z"
var(4) = 5

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

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

[State 40, 2]
type = VarSet
trigger1 = !AILevel
trigger1 = command = "holdfwd"
;Scramble
trigger2 = AILevel && var(42) = 1
trigger2 = (helper(10371),sysvar(1))&2
sysvar(1) = 1
[State 40, 3]
type = VarSet
trigger1 = !AILevel
trigger1 = command = "holdback"
;Scramble
trigger2 = AILevel && var(42) = 1
trigger2 = (helper(10371),sysvar(1))&4
sysvar(1) = -1

[State 40, 2]
type = VarSet
triggerall = AILevel && !var(42)
trigger1 = (p2bodydist x = [10,150]) || p2movetype = H
trigger2 = enemy,backedgedist <40
sysvar(1) = 1
[State 40, 3]
type = VarSet
triggerall = AILevel && !var(42)
trigger1 = p2bodydist x < 15 && p2movetype =A && p2statetype!=C
sysvar(1) = -1

[State 40, 1]
type = VarSet
triggerall = sysvar(1)
trigger1 = !AILevel && command = "hijump" && command != "ChargedDU"
trigger2 = !AILevel && PrevStateNo = 101 && sysvar(1) = 1
trigger3 = AILevel && !var(42) && p2bodydist x > 130 
trigger4 = AILevel && !var(42) 
trigger4 = p2stateno =5120 ||(p2movetype=A && p2statetype!=A)
;Scramble
trigger5 = AILevel && var(42) = 1
trigger5 = partner,command = "hijump" 
trigger5 = partner,command != "ChargedDU"
trigger6 = AILevel && var(42) = 1
trigger6 = PrevStateNo = 101 && sysvar(1) = 1
var(2) = 1
[State 40, 1]
type = VarSet
trigger1 = PrevStateNo = 101 && sysvar(1) = -1
var(2) = 0

[State 40, 4]
type = VarSet
trigger1 = Time = 0
var(3) = 0
[State 40, 5]
type = VarSet
trigger1 = !AILevel && command != "holdup"
trigger2 = ((p2statetype=C&&p2movetype!=A)) && AILevel && !var(42) && p2bodydist x <70 && time = 0
trigger3 = p2statetype=S && p2movetype=I && AILevel && !var(42) && time=0
;Scramble
trigger4 = AILevel && var(42) = 1
trigger4 = partner,command != "holdup"
var(3) = 2

[State 40, 6]
type = VelSet
triggerall = !var(2)
trigger1 = AnimTime = 0
trigger2 = var(4) && time > 0
x = ifelse(!sysvar(1), 0, ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))

[State 40, 7]
type = VelSet
triggerall = var(2)
trigger1 = AnimTime = 0
trigger2 = var(4) && time > 0
x = ifelse(!sysvar(1), 0, ifelse(sysvar(1)=1, const(velocity.runjump.fwd.x), const(velocity.runjump.back.x)))

[State 40, 8]
type = VelSet
trigger1 = AnimTime = 0
trigger2 = var(4) && time > 0
y = ifelse (var(3), const(velocity.airjump.y), const(velocity.jump.y))

[State 40, 8];Fail safe
type = statetypeset
trigger1 = AnimTime = 0
trigger2 = var(4) && time > 0
statetype = A

[State 40, PlaySnd]
type = PlaySnd
trigger1 = !animtime
trigger2 = var(4) && time > 0
value = 12,3+var(2)

;--------------------------[APPROPIATE ATTACK STATE]----------------------------
;Jumping Light Punch
[State -1, Jumping Light Punch]
type = ChangeState
value = 600
triggerall = !AILevel
trigger1 = var(4) = 1 && time > 0
;Jumping Light Kick
[State -1, Jumping Light Kick]
type = ChangeState
value = 620
triggerall = !AILevel
trigger1 = var(4) = 2 && time > 0
;Jumping Hard Punch
[State -1, Jumping Hard Punch]
type = ChangeState
value = 610
triggerall = !AILevel
trigger1 = var(4) = 3 && time > 0
;Jumping Hard Kick
[State -1, Jumping Light Kick]
type = ChangeState
value = 630
triggerall = !AILevel
trigger1 = var(4) = 4 && time > 0
;Jumping CD Attack
[State -1, Jumping CD Attack]
type = ChangeState
value = 990
triggerall = !AILevel
trigger1 = var(4) = 5 && time > 0
;-------------------------------------------------------------------------------

[State 40, Jump!]
type = ChangeState
triggerall = AnimTime = 0 
trigger1 = !AILevel && command = "holdup"
trigger2 = AILevel && !var(42) && !var(3)
;Scramble
trigger3= AILevel && var(42) = 1
trigger3 = (helper(10371),sysvar(1))&16
value = 50
ctrl = 1
[State 40, Hop!]
type = ChangeState
trigger1 = AnimTime = 0 && Var(3) = 2
value = 41
ctrl = 1

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

[State 810, 1]
type = AfterImage
trigger1 = !time && var(2) && sysvar(1) 
time = 10
length = 9
framegap = 3
palcontrast = 256,256,256
paladd = 0,0,0
palmul = 1,1,1

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

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

[State 50, VelAdd]
type = VelAdd
trigger1 = time > 0
y = const(movement.yaccel)

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

[State 50, Transition]
type = PosAdd
trigger1 = Vel Y > 0
x = Vel X
persistent = 0
[State 50, Transition]
type = VelAdd
trigger1 = Vel Y > 0
y = const(movement.yaccel)
persistent = 0

[State 40, 6]
type = ChangeState
trigger1 = Pos Y + Vel Y >= 0
value = 52

;---------------------------------------------------------------------------
; Short Jump
[Statedef 41]
type = A
physics = N

[State 810, 1]
type = AfterImage
trigger1 = !time && var(2) && sysvar(1) 
time = 10
length = 9
framegap = 3
palcontrast = 256,256,256
paladd = 0,0,0
palmul = 1,1,1

[State 1101, pos]
type = Veladd
trigger1 = time > 0
y = const(movement.yaccel)

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

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 51, ifelse((vel x)>0, 52, 53))

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

[State 50, Transition]
type = PosAdd
trigger1 = Vel Y > 0
x = Vel X
persistent = 0
[State 50, Transition]
type = VelAdd
trigger1 = Vel Y > 0
y = const(movement.yaccel)
persistent = 0

[State 40, 6]
type = ChangeState
trigger1 = Pos Y + Vel Y >= 0
value = 52
ctrl = 1

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

;----------------------------------------
;Scramble
[State 20, CtrlSet]
type = CtrlSet
trigger1 = AIlevel && var(42) = 1 
value = 0

[State -3, hop]
type = PlaySnd
trigger1 = !time 
value = 12,2

[State 1000, remove fx]
type = RemoveExplod
trigger1 = !time 
ID = 1000

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

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

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

;================================================================================
; Scramble Overrides
;================================================================================
;----------------------------------------
;Jumping
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = time
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holdup";(helper(10371),sysvar(1))&16
value = 40
;----------------------------------------
;Walking
[State 0, 4] ;Are you dead?
type = ChangeState
triggerall = time
triggerall = AILevel && var(42) = 1
trigger1 = (helper(10371),sysvar(1))&2
trigger2 = (helper(10371),sysvar(1))&4
value = 22
;----------------------------------------
;Crouching
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = time
trigger1 = AILevel && var(42) = 1
trigger1 = partner,command = "holddown";(helper(10371),sysvar(1))&8
value = 10

;---------------------------------------------------------------------------
; Wall Jump
[Statedef 42]
type = A
physics = N
velset = 0,0
anim = 60
ctrl = 0

[State 60, 0]
type = Turn
trigger1 = FrontEdgeBodyDist < 8 && time = 0

[State 60, 1]
type = PosAdd
trigger1 = AnimTime = 0
x = 20

[State 60, 1]
type = VelSet
trigger1 = AnimTime = 0
x = const(velocity.jump.fwd.x)
y = const(velocity.jump.y)

[State 40, PlaySnd]
type = PlaySnd
trigger1 = !animtime
value = F2+(var(32)*10),2

[State 60, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1

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

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

;---------------------------------------------------------------------------
; DASH_FWD
[Statedef 100]
type    = S
physics = N
anim = 99
ctrl = 0
velset = 0
sprpriority = 1
facep2 = 1

[State 100, ChangeAnim]
type = ChangeAnim
trigger1 = prevstateno != 780
value = 99
persistent = 0

[State 100, Kino]
type = VarSet
trigger1 = !time
var(4) = 0
[State 100, Karin]
type = VarSet
triggerall = !AILevel
triggerall = prevstateno != 780
trigger1 = command = "x"
var(4) = 1
[State 100, Karin]
type = VarSet
triggerall = !AILevel
triggerall = prevstateno != 780
trigger1 = command = "a"
var(4) = 2
[State 100, Karin]
type = VarSet
triggerall = !AILevel
triggerall = prevstateno != 780
trigger1 = command = "y"
var(4) = 3
[State 100, Karin]
type = VarSet
triggerall = !AILevel
triggerall = prevstateno != 780
trigger1 = command = "b"
var(4) = 4
[State 100, Karin]
type = VarSet
triggerall = !AILevel
triggerall = prevstateno != 780
trigger1 = command = "z"
var(4) = 5

[State 220,2]
type = ChangeState
trigger1 = AnimTime = 0
value = 101

[Statedef 101]
type    = S
physics = N
anim = 100
ctrl = 0
velset = 0
sprpriority = 1

[State -3, dash]
type = PlaySnd
trigger1 = time = 1
value = 2+(var(32)*10),8
volume = 200
loop = 1
channel = 27

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

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

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

[State 100, VarSet]
type = VarSet
trigger1 = !time && prevstateno != 102
var(26) = 0
[State 100, VarSet]
type = VarSet
trigger1 = time > 10
var(26) = 1

;--------------------------[APPROPIATE ATTACK STATE]----------------------------

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

[State 220,2]
type = ChangeState
trigger1 = !AILevel 
trigger1 = command = "holdup"
;----------------------------------------
;Scramble
trigger2 = AILevel && var(42) = 1
trigger2 = (helper(10371),sysvar(1))&16
value = 40

[State 101, 6]
type = ChangeState
triggerall = Time > 9
triggerall = var(41) != [900,1000] ;Special run flags for AI
trigger1 = !AILevel && command != "holdfwd"
trigger2 = AILevel && !var(42)
trigger2 = time > 75 || (p2bodydist x < 25 && p2statetype!=A) ||(p2bodydist x < 8 && p2statetype=A)
;----------------------------------------
;Scramble
trigger3 = p2dist X >= 0
trigger3 = AILevel && var(42) = 1
trigger3 = !((helper(10371),sysvar(1))&2)
trigger4 = p2dist X < 0
trigger4 = AILevel && var(42) = 1
trigger4 = !((helper(10371),sysvar(1))&4)
value = 102

[Statedef 102]
type    = S
physics = S
anim = 101
ctrl = 0
velset = 0
sprpriority = 1

[State 100, 4]
type = ChangeState
trigger1 = var(26)
trigger1 = !AIlevel 
trigger1 = command = "holdfwd"
trigger2 = AILevel && var(42) = 1
trigger2 = (helper(10371),sysvar(1))&2
value = 101

[State 220,2]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
;Used OrochiKOF's code as a reference.
;RUN BACK
[Statedef 105]
type    = S
physics = S
ctrl = 0
anim = 105
velset = 0
sprpriority = 1
facep2 = 1

[State 105, 3]
type = ChangeState
trigger1 = animtime = 0
value = 106

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

[State 105, 1]
type = VelSet
trigger1 = 1
x = (const(velocity.run.back.x)*exp((const(velocity.airjump.back.x))*(time)))

[State 105, 1]
type = VelSet
trigger1 = !time
y = const(velocity.run.back.y)

[State 105, VelAdd]
type = VelAdd
trigger1 = time > 0
y = const(velocity.airjump.fwd.x)

[State -3, hop]
type = PlaySnd
trigger1 = !time
value = 2+(var(32)*10),12

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

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

[State -3, land]
type = PlaySnd
trigger1 = !time
value =  2+(var(32)*10),2

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

[State 107, CtrlSet]
type = CtrlSet
trigger1 = !AIlevel || AIlevel && !var(42) 
trigger1 = time = 2
value = 1

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

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

; GUARD (start)
; Modify to:
; - Enable guarding projectile with var(32)
[Statedef 120]
type = U
physics = U
ctrl = !AILevel

[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
trigger1 = !AILevel
trigger1 = statetype = S && command = "holddown"
trigger2 = AILevel && !var(42)
trigger2 = statetype = S && p2statetype = C
trigger3 = AILevel && !var(42)
trigger3 = statetype = S && p2bodydist X > 100
statetype = C
physics = C

[State 120, Lo to Hi]
type = StateTypeSet
trigger1 = !AILevel
trigger1 = statetype = C && command != "holddown"
trigger2 = AILevel && !var(42)
trigger2 = statetype = C && P2statetype = S && p2bodydist x <= 100
trigger2 = random < 200
trigger3 = AILevel && !var(42)
trigger3 = statetype = C && P2statetype = A && p2bodydist x <= 100
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 = !AILevel
trigger1 = command != "holdback"
trigger2 = !AILevel
trigger2 = !inguarddist && !var(32)
trigger3 = AILevel && !var(42) && p2movetype != A
trigger4 = AILevel && !var(42) && !inguarddist 
value = 140

;---------------------------------------------------------------------------
; STAND GUARD (guarding)
; Modify to:
; - Enable guarding projectile with var(32)
[Statedef 130]
type    = S
physics = S

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

[State 130, Hi to Lo]
type = ChangeState
trigger1 = !AILevel
trigger1 = command = "holddown"
trigger2 = AILevel && !var(42)
trigger2 = p2statetype = C
trigger3 = AILevel && !var(42)
trigger3 = p2bodydist x > 100 
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = !AILevel
trigger1 = command != "holdback"
trigger2 = !AILevel
trigger2 = !inguarddist 
trigger3 = AILevel && !var(42) && p2movetype != A
trigger4 = AILevel && !var(42) && !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 = !AILevel
trigger1 = command != "holddown"
;rigger2 = AILevel && !var(42)
trigger2 = p2statetype = S && p2bodydist x <= 100
trigger2 = random%9 <= AILevel
trigger3 = AILevel && !var(42)
trigger3 = p2statetype = A && p2bodydist x <= 100
value = 130

[State 131, Stop Guarding]
type = ChangeState
trigger1 = !AILevel
trigger1 = command != "holdback"
trigger2 = !AILevel
trigger2 = !inguarddist 
trigger3 = AILevel
trigger3 = !var(42) && p2movetype != A
trigger4 = AILevel
trigger4 = !var(42) && !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
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

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

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

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

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

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

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

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

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

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

[State 5001, VarSet]
type = VarSet
trigger1 = !time
sysvar(3) = ifelse((facing=enemynear,facing),1,-1) 
[State 1402, VelSet]
type = VelSet
trigger1 = Time != GetHitVar(slidetime)
trigger1 = !HitOver
x = sysvar(3)*(abs(gethitvar(xvel))*exp((-0.1886)*(time+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
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

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

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

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

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

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

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

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

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

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

[State 5001, VarSet]
type = VarSet
trigger1 = !time
sysvar(3) = ifelse((facing=enemynear,facing),1,-1) 
[State 1402, VelSet]
type = VelSet
trigger1 = Time != GetHitVar(slidetime)
trigger1 = !HitOver
x = sysvar(3)*(abs(gethitvar(xvel))*exp((-0.1886)*(time+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
trigger1 = statetype = S && command = "holddown"
statetype = C
physics = C

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

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

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

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

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

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

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

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

[State 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

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

;---------------------------------------------------------------------------
; Draw game (time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

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

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

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

;---------------------------------------------------------------------------
; Pre-intro
[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

;---------------------------------------------------------------------------
; 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, 4]
type = VarSet
trigger1 = Time = 0
var(4) = 0

[State 5050, 4]
type = VarSet
trigger1 = Vel Y > 0
trigger1 = (Vel Y + Pos Y) >= -32
trigger1 = command = "recovery2"
var(4) = 1

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

[State 5050, 6]
type = ChangeState
triggerall = CanRecover
trigger1 = Time > 0
trigger1 = Vel Y + Pos Y >= 0
trigger1 = var(4)
trigger1 = Life > 0
value = 5201

[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(0)  = Vel X
[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(1) = GetHitVar(yaccel)

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y + Pos Y >= 0
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; 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 = time > 0
y = GetHitVar(yaccel)

[State 5050, 4]
type = VarSet
trigger1 = Time = 0
var(4) = 0

[State 5050, 4]
type = VarSet
trigger1 = Vel Y > 0
trigger1 = (Vel Y + Pos Y) >= -32
trigger1 = command = "recovery2"
var(4) = 1

[State 5050, 6]
type = ChangeState
trigger1 = Time > 0
trigger1 = Vel Y + Pos Y >= 0
trigger1 = var(4)
trigger1 = Life > 0
value = 5201

[State 5071, 3] ;Hit ground
trigger1 = Vel Y + Pos Y >= 0
type = ChangeState
value = 5100

;---------------------------------------------------------------------------
; 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, Explod]
type = Explod
triggerall = anim != [5171,5172]
trigger1 = !time && (sysvar(1) >= 14)
anim = 12001+(var(31)*10000)
pos = 0,0
postype = p1  ;p2,front,back,left,right
sprpriority = 2
[State 5100, Explod]
type = Explod
triggerall = anim != [5171,5172]
trigger1 = !time && (sysvar(1) >= 14)
anim = 12002+(var(31)*10000)
pos = 0,0
postype = p1  ;p2,front,back,left,right
sprpriority = 0
ownpal = 1
[State 5100, Explod]
type = Explod
triggerall = anim != [5171,5172]
trigger1 = !time && (sysvar(1) < 14)
anim = 12000
pos = 0,0
postype = p1  ;p2,front,back,left,right
sprpriority = -4
ownpal = 1

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

[State 5100, 10]
type = PlaySnd
;triggerall = anim != [5171,5172]
trigger1 = Time = 1
value = 2+(var(32)*10),9

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

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

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

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

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = anim != [5171,5172]
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 = anim != [5171,5172]
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)
[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = anim = [5171,5172]
trigger1 = time = 0
value = 5163

;ifelse(gethitvar(xvel)!=0,(abs(gethitvar(xvel))/gethitvar(xvel)),-1)
[State 5101, 4]
type = VelSet
trigger1 = Time = 0
y = -3
[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = time > 0
y = gethitvar(yaccel)

;[State 5101, 4]
;type = VelSet
;trigger1 = !time
;x = sysfvar(0)
;y = gethitvar(fall.yvel)
;[State 5101, 5] ;Acceleration
;type = VelAdd
;trigger1 = time > 0
;y = sysfvar(1)

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

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N
[State 5110, 0]
type = ChangeState
trigger1 = 1
value = 5111
;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5111]
type    = L
movetype= H
physics = N
velset = 0,0

[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) -(anim=5163))
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) -(anim=5163))
value = 5170 + (anim % 10) -(anim=5163)

[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 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = 2+(var(32)*10),5
channel = 1
volume = 200

[State 5100, Explod]
type = Explod
trigger1 = !time
anim = 12004
pos = 36-((anim!=5170)*72),-2
postype = p1  ;p2,front,back,left,right
sprpriority = 3
ownpal = 1
facing = 1
persistent = 0

[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, 11] ;If just died
type = ChangeState
trigger1 = time = 10 + 10*(anim=5111||anim=5112)
value = 5120

[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

;---------------------------------------------------------------------------
; Downed get-hit (lying defeated)
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3
ctrl = 0

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

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

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

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = PrevStateno != 5950
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 = abs(Vel x) < Const(movement.down.friction.threshold)
persistent = 0
x = 0

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

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

[State 5201, 1]
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

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

[State 5201, VelSet]
type = VelSet
trigger1 = !time
x =-11.5
y = 0

[State 5201, VelSet]
type = VelSet
trigger1 = time = 1
x = -7.921875

[State 5201, VelMul]
type = VelMul
trigger1 = 1
x = 0.8125

[State 750, Push]
type = PlayerPush
trigger1 = 1
value = 0

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

[State 705, 1]
type = SelfState
trigger1 = Animtime = 0
value = 0
ctrl = 1

;================================================================================
[Statedef 5205]
type= A
physics= N
movetype= H
 
[State 5205, End]
type= selfstate
trigger1= 1
value= ifelse(pos y<-30, 5210, 5200)

;================================================================================
; ------- KOF Universal Custom States --------
;===============================================================================
[Statedef 5950]
type=S
movetype=H
physics=S
anim=5950
velset=0,0

[State 5950, NHB]
type=nothitby
trigger1= 1
value=SCA

[State 5950, KO Snd]
type=assertspecial
trigger1= 1
flag=nokosnd

[State 5950, KO Snd]
type=stopsnd
trigger1= !time && !alive
channel=0

[State 5950, KO Snd]
type=playsnd
trigger1= animelem=2 && !alive
value=5950,0

[State 1510, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger2 = AnimElemTime(AnimElemNo(0)+1)=0
value = IfElse((anim =5950&&SelfAnimExist(5112)),5112,5110)
persistent = 0

[State 5950, End]
type=changestate
trigger1= AnimElemTime(AnimElemNo(0)+1)=0
value=ifelse(alive,5110,5150)


;Aerial gethit with juggle kill.
;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 10000]
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, 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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air get-hit (KOF)
[Statedef 10010]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

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

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0
y = GetHitVar(yaccel)

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10020 ;HITA_FALL

[State 5035, 1]
type = ChangeAnim
trigger1 = animtime = 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
persistent = 0

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

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10020]
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);ifelse(anim = 5050, Const720p(4), Const720p(-8))
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0 
y = GetHitVar(yaccel)

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

[State 5050, 6]
type = SelfState
trigger1 = Vel Y + Pos Y >=0
;trigger1 = Vel Y > 0
;trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;Downed get-hit (hit ground from fall)
;---------------------------------------------------------------------------
;Aerial launcher
;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 10030]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5001, VarSet]
type = VarSet
trigger1 = !time
sysvar(3) = ifelse((facing=enemynear,facing),1,-1) 

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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air get-hit (KOF)
[Statedef 10040]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 1402, exp timer]
type = VarSet
trigger1 = !time
sysvar(4) = 0
[State 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1

[State 5030, 3]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1
[State 1402, VelSet]
type = PosAdd
trigger1 = !time
y = -6
persistent = 0

;0.8277740478515625
;0.6036376953125
;0.4084014892578125
;0.2383270263671875
;0.090179443359375
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08;sysvar(4) < 22
y = (2.341064453125)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)))
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08
y = 0.625

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10050 ;HITA_FALL

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno+5 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 10045]
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 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08
y = (2.341064453125)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)))
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08
y = 0.625

[State 5035, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[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 >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = stateno+5 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10050]
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);ifelse(anim = 5050, Const720p(4), Const720p(-8))
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08
y = (2.341064453125)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)))
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08
y = 0.625

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

[State 5050, 4] ;Recover near ground
type = SelfState
triggerall = Vel Y > 0
triggerall = Pos Y >= -30
triggerall = alive
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER
 
[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(0) = Vel X
[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(1) = 0.625
[State 5050, 6]
type = SelfState
trigger1 = Vel Y + Pos Y >=0
value = 5100 ;Downed get-hit (hit ground from fall)

;---------------------------------------------------------------------------
;Bounce and heavy in-spot fall
;---------------------------------------------------------------------------
; HITA_UP (initial going up)
[Statedef 10060]
type    = U;A
movetype= H
physics = N
ctrl = 0
 
[State 5030, 4]
type = ChangeState
trigger1 = !alive
trigger1 = !time
trigger1 = statetype != A
value = 10170
ignorehitpause = 1
[State 5030, 4]
type = SelfState
trigger1 = !time
trigger1 = statetype != A && statetype != L
trigger1 = gethitvar(xvel) != 0
value = 5000 ;HITA_FALL
[State 5030, 4]
type = ChangeState
trigger1 = !time
trigger1 = statetype = L
value = 10300 ;HITA_FALL
[State 5030, 4]
type = ChangeState
trigger1 = !time
trigger1 = Alive
trigger1 = statetype != A
value = stateno + 4 ;HITA_FALL
 
[State 1250, StateTypeSet]
type = StateTypeSet
trigger1 = !time
statetype = A       ;S,A,C,L
 
[State 1250, ChangeAnim]
type = ChangeAnim
trigger1 = !hitshakeover;!time
value = 5030
 
[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1
 
[State 1107, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1
 
[State 5030, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = stateno + 1 ;HITA_FALL
;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 10061]
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, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [105050,105059]
trigger1 = Vel Y >= ifelse(anim = 105050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y + Pos Y >= 0
value = stateno + 1 ;HIT_BOUNCE

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

[State 1352, NotHitBy]
type = NotHitBy
trigger1 = time < 6
value = SCA
time = 1

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

[State 3000, EnvShake]
type = EnvShake
trigger1 = Time = 0
time = 14
freq = 180
ampl = -4
persistent = 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 = ChangeAnim2
trigger1 = !time
value = stateno
[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
trigger1 = SelfAnimExist(5430)
value = 5430
[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = Name = "cvsfelicia" && authorname = "Jesuszilla"
trigger1 = !time
value = 5100

[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, 9]
type = HitFallDamage
trigger1 = Time = 3

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

[State 5100, 12]
type = ChangeState
trigger1 = time = 5
value = stateno + 1

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

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

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

[State 1207, VelSet]
type = VelSet
triggerall = numenemy
trigger1 = time = 0
x = ifelse((facing=enemynear,facing),-gethitvar(fall.xvel),gethitvar(fall.xvel))
y = gethitvar(fall.yvel)

[State 5101, 4]
type = PosSet
trigger1 = !time
y = 0

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = time > 0
y = 0.625

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

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 10163]
type    = L
movetype= H
physics = N
velset = 0,0

[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, 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 = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 11] ;If just died
type = SelfState
trigger1 = time = 20
value = 5120

;---------------------------------------------------------------------------
; HITG_SHAKE
[Statedef 10064]
type    = U
movetype= H
physics = N
velset = 0,0
p2facing = 1

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

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [0,5]
value = ifelse(selfanimexist(5111),5012,5002)

[State 5000, 1] ;KOF
type = ChangeAnim
trigger1 = SelfAnimExist(5420+(statetype=C))
trigger1 = GetHitVar(animtype) = [0,5]
value = 5420+(statetype=C)

[State 5000, 1] ;CvS
type = ChangeAnim
trigger1 = !SelfAnimExist(5160 + (anim % 10))
trigger1 = SelfAnimExist(5070)
trigger1 = GetHitVar(animtype) = [0,5]
value = 5070

[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, 7]
type = ChangeState
trigger1 = HitShakeOver
value = stateno + 1

[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
;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 10065]
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 3000, EnvShake]
type = EnvShake
trigger1 = Time = 0
time = 14
freq = 180
ampl = -4
persistent = 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 = !SelfAnimExist(5422)
value = ifelse(SelfAnimExist(5102),5102,ifelse(SelfAnimExist(5101),5101,5100))
[State 5000, 1] ;KOF
type = ChangeAnim
triggerall = time = 0
trigger1 = SelfAnimExist(5422)
value = 5422

[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 = SelfState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;HIT_LIEDOWN

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

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

[State 5100, 12]
type = ChangeState
trigger1 = 5100 + (anim % 10)
trigger1 = time = 4
trigger1 = anim != 5422
trigger2 = anim = 5422
trigger2 = animtime = 0 || time = 12 ;safety
value = ifElse(Anim = 5100, stateno + 3, stateno + 1);5101

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

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

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = !SelfAnimExist(5423)
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))

[State 5000, 1] ;KOF
type = ChangeAnim
triggerall = time = 0
trigger1 = SelfAnimExist(5423)
value = 5423

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

[State 5100, 2] ;Hit ground anim (normal)
type = PosSet
triggerall = anim = 5160 + (anim % 10)
trigger1 = !time
y = 20

[State 5101, 6] ;Hit ground
trigger1 = 5160 + (anim % 10)
trigger1 = time = 4
trigger1 = anim != 5423
trigger2 = anim = 5423
trigger2 = animtime = 0 || time = 12 ;safety
type = ChangeState
value = 10067

;---------------------------------------------------------------------------
[Statedef 10067]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 964, PosToGround]
type = PosSet
trigger1 = !Time
y = 0

[State 6123, BounceAnim]
type = ChangeAnim
trigger1 = !time
value = ifelse(SelfAnimExist(5112),5112,ifelse(SelfAnimExist(5111),5111,5110))

[State 964, GoToBounce]
type = ChangeState
trigger1 = time = 8
value = 10068

;---------------------------------------------------------------------------
[Statedef 10068]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 966, PosToGround]
type = PosSet
trigger1 = !Time
y = -1

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = !time
trigger1 = SelfAnimExist(5424)
value = 5424

[State 6123, BounceAnim]
type = ChangeAnim
trigger1 = !time
trigger1 = !SelfAnimExist(5424)
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))

[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = [5161,5162]
value = Anim
elem = ifelse((AnimElem=5,<0),5,ifelse((AnimElem=4,<0),4,ifelse((AnimElem=3,<0),3,ifelse((AnimElem=2,<0),2,1))))
persistent = 0

[State 966, StartVels]
type = VelSet
trigger1 = !Time
y = ifelse(prevstateno=(stateno - 3),-3.25,-2)

[State 966, Gravity]
type = Veladd
trigger1 = Time
y = .625

[State 5050, 6]
type = VarSet
trigger1 = authorname = "Vans" || authorname = "KoopaKoot" || authorname = "nazo"
trigger1 = SelfAnimExist(5420+(statetype=C))
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
sysfvar(1) = 0.625
[State 5050, 6]
type = VarSet
trigger1 = authorname = "Vans" || authorname = "KoopaKoot" || authorname = "nazo"
trigger1 = SelfAnimExist(5420+(statetype=C))
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
sysfvar(0)  = Vel X

[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = 5424
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))

[State 966, PosAdd]
type = PosAdd
trigger1 = !Time
y = 20
[State 966, GoToBounce]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = 5110

;---------------------------------------------------------------------------
; Air slide get-hit (PAUSETIME) (KOF)
[Statedef 10070]
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, 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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air slide get-hit (AIRTIME) (KOF)
[Statedef 10080]
type    = A
movetype= H
physics = N
ctrl = 0

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

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

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

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0
y = GetHitVar(yaccel)

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10090 ;HITA_FALL

;[State 5035, 1]
;type = ChangeAnim
;trigger1 = animtime = 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
;persistent = 0

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno+5 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 10085]
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 = time > 0
y = GetHitVar(yaccel)

[State 5035, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[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 >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = stateno+5 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10090]
type    = A
movetype= H
physics = N

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

[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);ifelse(anim = 5050, Const720p(4), Const720p(-8))
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

;7.3828125
;7.2674560546875
;7.153900146484375
;7.0421142578125
;6.9320831298828125
;6.8237762451171875
;6.7171478271484375
;6.6121978759765625
;6.508880615234375
;6.4071807861328125
;6.30706787109375
;6.208526611328125
;6.11151123046875
;6.016021728515625
;5.922027587890625
;5.829498291015625
;5.7384185791015625
;5.6487579345703125

;5.1875 ??
;4.701171875 <- ?
;4.26043701171875
;3.86102294921875
;3.499053955078125
;0.984375

;0.90625

;3.499053955078125
;3.1710205078125

[State 105, 1]
type = VelSet
trigger1 = numenemy
x = ifelse((facing=enemynear,facing),1,-1)*(abs(gethitvar(xvel))*exp((-0.01574835696813916860754951146083)*(time)))

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0 
y = GetHitVar(yaccel)
;[State 3030, VelMul]
;type = VelMul
;trigger1 = time > 0 
;x = 0.984375

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y + Pos Y >=0
value = stateno+1 ;Downed get-hit (hit ground from fall)

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

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

[State 1352, NotHitBy]
type = NotHitBy
trigger1 = time < 6
value = SCA
time = 1

[State 3030, VelMul]
type = VelSet
triggerall = numenemy
trigger1 = time = 1 
x = ifelse((facing=enemynear,facing),5.1875,-5.1875)
[State 3030, VelMul]
type = VelMul
trigger1 = time > 0 
x = 0.90625

[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 = ChangeAnim2
trigger1 = GetHitVar(animtype) = [3,5]
trigger1 = !time
trigger2 = (GetHitVar(animtype) = [4,5]) 
trigger2 = !SelfAnimExist(5161) 
trigger2 = !time
value = stateno

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = Name = "cvsfelicia" && authorname = "Jesuszilla"
trigger1 = !time
value = 5100

[State 811]
type = posset
trigger1 = !time
y = 0

[State 811]
type = posset
trigger1 = (GetHitVar(animtype) = [4,5]) 
trigger1 = SelfAnimExist(5101)
trigger1 = SelfAnimExist(5161)
Trigger1 = Time = 9
y = 20

[State 811]
type = posset
trigger1 = SelfAnimExist(5101)
trigger1 = SelfAnimExist(5161)
trigger1 = time = 17
y = 0

[State 1505, Anim 5050] 
type = ChangeAnim
Trigger1 = !Time
trigger1 = (GetHitVar(animtype) = [4,5]) 
trigger1 = SelfAnimExist(5101)
trigger1 = SelfAnimExist(5161)
value = 5101

[State 1505, Anim 5050] 
type = ChangeAnim
triggerall = anim = 5101
Trigger1 = Time = 9
trigger1 = SelfAnimExist(5161)
trigger1 = SelfAnimExist(5111)
value = 5161

[State 700,0]
type = ChangeAnim
triggerall = anim = 5101
trigger1 = time < 17
value = anim

[State 1505, Anim 5050] 
type = ChangeAnim
triggerall = anim = 5161
Trigger1 = Time = 17
trigger1 = SelfAnimExist(5111)
value = 5111

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

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

[State 5100, 7]
type = ChangeState
trigger1 = Time = 20
value = stateno+1 ;HIT_LIEDOWN

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

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

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 10092]
type    = L
movetype= H
physics = N
velset = 0,0

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

[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, 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 = SelfState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 11] ;If just died
type = SelfState
trigger1 = time = 9
value = 5120

[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

;A.Launcher spinning fall
;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 10100]
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, 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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air get-hit (KOF)
[Statedef 10110]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = !time
trigger1 = SelfAnimExist(5250) && SelfAnimExist(5251)
value = 5250

[State 5030, 1]
type = ChangeAnim
trigger1 = !time
trigger1 = SelfAnimExist(5061)
trigger1 = !SelfAnimExist(5250)
trigger1 = !SelfAnimExist(5251)
value = 5061

[State 5030, 1]
type = ChangeAnim
trigger1 = !time
trigger1 = !SelfAnimExist(5061)
trigger1 = !SelfAnimExist(5250)
trigger1 = !SelfAnimExist(5251)
value = 5050

[State 5030, 1]
type = ChangeAnim2
triggerall = anim != 5250
trigger1 = time = 7
value = 10100

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

[State 3030, VelMul]
type = VelMul
trigger1 = time > 0
y = 0.86426783794678849771566783122816

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10120 ;HITA_FALL

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno+5 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 10115]
type    = A
movetype= H
physics = N

[State 3030, VelMul]
type = VelMul
trigger1 = time > 0
y = 0.86426783794678849771566783122816

[State 5035, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[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 >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = stateno+5 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10120]
type    = A
movetype= H
physics = N

[State 5030, 1]
type = ChangeAnim
trigger1 = !time
trigger1 = anim = 5250
trigger1 = selfAnimExist(5251)
value = 5251

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0 && Vel Y >= 0
y = 0.625
[State 3030, VelMul]
type = VelMul
trigger1 = time > 0 && Vel Y < 0
y = 0.86426783794678849771566783122816
[State 3030, VelMul]
type = VelSet
trigger1 = time > 0 && Vel Y > -0.5 && Vel Y < 0
y = -Vel Y

[State 100050, NotHitBy]
type = NotHitBy
trigger1 = CanRecover
value = SCA
time = 1
 
[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Vel Y + Pos Y >=0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030
[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Vel Y + Pos Y >=0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type
[State 5050, 6]
type = SelfState
trigger1 = Vel Y + Pos Y >=0
value = 5100 ;Downed get-hit (hit ground from fall)

;---------------------------------------------------------------------------
; Stagger get-hit Type 1(shaking) 
[Statedef 10150]
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 = 5000 + 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, 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

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 10155 ;Stand get-hit (knocked back)

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

; Stagger get-hit Type 2(shaking) 
[Statedef 10151]
type    = S
movetype= H
physics = N
velset = 0,0

[State 700,0]
type = ChangeAnim
trigger1 = !HitShakeOver
value = anim
elem = AnimElemNo(0)

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = HitShakeOver
trigger1 = GetHitVar(animtype) != [3,5]
value = 5002

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

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

[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, 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

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 10155 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Stagger get-hit (knocked back)
[Statedef 10155]
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 = 5017

[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 = SelfState
trigger1 = HitOver
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; Air slide get-hit (PAUSETIME) (KOF) (DEAD AFTER HARD KNOCK DOWN)
[Statedef 10170]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5120, 4]
type = HitFallSet
trigger1 = time = 0
value = 1

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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air slide get-hit (AIRTIME) (KOF)
[Statedef 10180]
type    = A
movetype= H
physics = N
ctrl = 0

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

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 105, 1]
type = VelSet
trigger1 = numenemy
x = (ifelse((facing=enemynear,facing),7.3828125,-7.3828125)*exp((-0.15764085357327987476627784162604)*(time)))

[State 3030, VelMul]
type = VelSet
trigger1 = !time
y = -4.5

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0 
y = .5

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10190 ;HITA_FALL

;[State 5035, 1]
;type = ChangeAnim
;trigger1 = animtime = 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
;persistent = 0

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno+5 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 10185]
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 = time > 0
y = .5

[State 5035, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[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 >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = stateno+5 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10190]
type    = A
movetype= H
physics = U

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

[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);ifelse(anim = 5050, Const720p(4), Const720p(-8))
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

;7.3828125
;7.2674560546875
;7.153900146484375
;7.0421142578125
;6.9320831298828125
;6.8237762451171875
;6.7171478271484375
;6.6121978759765625
;6.508880615234375
;6.4071807861328125
;6.30706787109375
;6.208526611328125
;6.11151123046875
;6.016021728515625
;5.922027587890625
;5.829498291015625
;5.7384185791015625
;5.6487579345703125

;5.1875 ??
;4.701171875 <- ?
;4.26043701171875
;3.86102294921875
;3.499053955078125
;0.984375

;0.90625

;3.499053955078125
;3.1710205078125

[State 3030, VelMul]
type = VelAdd
trigger1 = time > 0 
y = .5
;[State 3030, VelMul]
;type = VelMul
;trigger1 = time > 0 
;x = 0.984375

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y + Pos Y >=0
value = 10091 ;Downed get-hit (hit ground from fall)

;================================================================================
;---------------------------------------------------------------------------
;DIAGUP VER A(shaking)
;================================================================================
;================================================================================
;DIAGUP HIT SHAKE
[Statedef 10200]
type    = A
movetype= H
physics = N
velset = 0,0

[State 10200, Anim];Custom animation
type = ChangeAnim
trigger1 = selfanimexist(5052)
trigger1 = !time
value = 5052
[State 10200, Anim];No Custom animation
type = ChangeAnim
trigger1 = !selfanimexist(5052)
trigger1 = !time
value = 5030
[State 10200, Anim];loop
type = ChangeAnim
triggerall = anim = [5030,5052]
trigger1 = HitShakeOver != 1
value = anim

[State 10900, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 10201

;================================================================================
;DIAGUP HIT FLYING 
[Statedef 10201]
type    = A
movetype= H
physics = N

[State 10100, Anim]
type = ChangeAnim
triggerall = anim = 5030
trigger1 = !time 
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = 5052
trigger1 = (GetHitVar(animtype) = [0,3]) && time = 13 
value = 5050
persistent = 0

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = 5052
trigger1 = (GetHitVar(animtype) = [4,5]) && animtime = 0
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 10900, 1]
type = HitVelSet
trigger1 = !time
y = 1
[State 10900, 1]
type = VelSet
trigger1 = time < 6
x = ifelse((facing=enemynear,facing),((abs(gethitvar(xvel))*exp((-0.20763936477824450161544104426739)*(time+1)))),(-(abs(gethitvar(xvel))*exp((-0.20763936477824450161544104426739)*(time+1)))))

[State 10900, VelMul]
type = VelAdd
trigger1 = time > 0
y = GetHitVar(yaccel)

[State 5050, 4] ;Recover near ground
type = SelfState
triggerall = Vel Y > 0
triggerall = Pos Y >= -30
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

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

[State 10900, Hit ground]
type = ChangeState
trigger1 = (GetHitVar(animtype) = [4,5])
trigger1 = Vel Y + Pos Y >= 0
value = 10202

[State 10900, Hit ground]
type = SelfState
trigger1 = time
trigger1 = Vel Y + Pos Y >= 0
value = 5100

;================================================================================
;DIAGUP HIT Downed get-hit (hit ground from fall)
[Statedef 10202]
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 = SelfState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;Downed get-hit (lying down)

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

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

[State 5100, 12]
type = ChangeState
trigger1 = time = 4
value = 10203

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

;================================================================================
; DIAGUP HIT HIT_BOUNCE (bounce into air)
[Statedef 10203]
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 = VelSet
trigger1 = Time = 0
y = -3.5

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = time > 0
y = .625

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

[Statedef 10204]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 964, PosToGround]
type = PosSet
trigger1 = !Time
y = 0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
triggerall = SelfAnimExist(5171)
trigger1 = anim = [5101,5102]
trigger2 = anim = [5161,5163]
trigger3 = anim = [5111,5112]
trigger4 = anim = [5171,5172]
trigger5 = anim = [5422,5424]
value = 5171

[State 964, HitGroundAnim]
type = ChangeAnim2
trigger1 = !Time && anim != 5171
value = 10302

[State 964, GoToBounce]
type = ChangeState
trigger1 = time = 4
value = 10205

[Statedef 10205]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 966, PosToGround]
type = PosSet
trigger1 = !Time
y = -1

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = !time
trigger1 = SelfAnimExist(5424)
value = 5424

[State 6123, BounceAnim]
type = ChangeAnim
trigger1 = !time
trigger1 = !SelfAnimExist(5424)
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))
 
[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = [5161,5162]
value = Anim
elem = ifelse((AnimElem=5,<0),5,ifelse((AnimElem=4,<0),4,ifelse((AnimElem=3,<0),3,ifelse((AnimElem=2,<0),2,1))))
persistent = 0

[State 966, StartVels]
type = VelSet
trigger1 = !Time 
x = ifelse((facing=enemynear,facing),3,-3)
y = -2

[State 966, Gravity]
type = Veladd
trigger1 = Time
y = .625

[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = 5424
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))
 
[State 966, PosAdd]
type = PosAdd
trigger1 = !Time
y = 20
[State 966, GoToBounce]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = 5110



;================================================================================
;---------------------------
; OTG - Opponent Hit
;---------------------------
[Statedef 10300]
type = A
physics = N
movetype = H
ctrl = 0
velset = 0,0

[State 962, PosToGround]
type = PosSet
trigger1 = !hitshakeover ;1
y = 0
ignorehitpause = 1

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
triggerall = SelfAnimExist(5420+(statetype=C))
triggerall = SelfAnimExist(5081)
trigger1 = anim = [5101,5102]
trigger2 = anim = [5161,5163]
trigger3 = anim = [5111,5112]
trigger4 = anim = [5171,5172]
trigger5 = anim = [5422,5424]
value = 5081
[State 962, HitAnim];Freeze Anim
type = ChangeAnim2
trigger1 = time && anim != 5081
value = 10300

[State 962, GoToRebound]
type = ChangeState
trigger1 = HitShakeOver
value = 10301

;-------------------------------
; OTG - Opponent rebound
;-------------------------------
[Statedef 10301]
type = L
physics = N
movetype = H
ctrl = 0

[State 3000, EnvShake]
type = FallEnvShake
trigger1 = Time = 0
;time = 14
;freq = 180
;ampl = -4
persistent = 0

[State 963, PosToGround]
type = PosAdd
trigger1 = !Time
y = -10
ignorehitpause = 1

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = SelfAnimExist(5420)
trigger1 = anim = 5081 && !animtime
value = 5163
[State 963, BounceAnim]
type = ChangeAnim2
trigger1 = !Time
trigger1 = anim = 10300
value = 10301

[State 1402, exp timer]
type = VarSet
trigger1 = !time
sysvar(4) = 0
[State 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1

[State 963, StartVels]
type = VelSet
trigger1 = !Time
x = ifelse((facing=enemynear,facing),3,-3)
y = -7.75341796875

[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.1
y = 2.24658203125*0.8359391980004349**(sysvar(4))
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.09
y = 0.625

[State 963, GoToBounce]
type = ChangeState
triggerall = time > 1
trigger1 = Vel Y > 0
trigger1 = Pos Y + Vel Y >= 0 
value = 10302

;--------------------------------------
; OTG - Opponent hit the ground
;--------------------------------------
[Statedef 10302]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 964, PosToGround]
type = PosSet
trigger1 = !Time
y = 0

[State 964, HitGroundAnim]
type = ChangeAnim2
trigger1 = !Time && anim != 5163
value = 10302
[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = !time
trigger1 = anim = 5163
value = 5171

[State 964, GoToBounce]
type = ChangeState
trigger1 = anim = 10302 || anim = 5171
trigger1 = !AnimTime
value = 10303

;------------------------------
; OTG - Opponent bounce
;------------------------------
[Statedef 10303]
type = A
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 966, PosToGround]
type = PosSet
trigger1 = !Time
y = -1

[State 963, BounceAnim]
type = ChangeAnim2
trigger1 = !Time
trigger1 = anim != 5171
trigger1 = anim = 10300
value = 10303
[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = authorname = "Vans" || authorname = "KoopaKoot" || authorname = "nazo"
trigger1 = SelfAnimExist(5420+(statetype=C))
trigger1 = anim = 5171
value = 5163

[State 966, StartVels]
type = VelSet
trigger1 = !Time 
x = ifelse((facing=enemynear,facing),3,-3)
y = -2

[State 966, Gravity]
type = Veladd
trigger1 = Time
y = .625

[State 966, GoToBounce]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y >= 0
value = 5110

;================================================================================
[Statedef 10400]
type = U
physics = N
movetype = H
ctrl = 0
velset = 0,0
facep2 = 1

[State 1023, Air]
type = StateTypeSet
trigger1 = pos y >= 0
statetype = S
physics = N

[State 0, HitFallSet]
type = HitFallSet
trigger1 = !HitShakeOver
trigger1 = pos y >= 0
value = 0

[State 0, PosSet]
type = posset
trigger1 = pos y >= 0
y = 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 0, HitFallSet]
type = HitFallSet
trigger1 = HitShakeOver
value = 1
[State 5000, 7]
type = SelfState
trigger1 = HitShakeOver
value = 5030


;================================================================================
;UP Type Hard Knockdown
[Statedef 10500]
type    = U;A
movetype= H
physics = N
ctrl = 0
 
[State 5030, 4]
type = ChangeState
trigger1 = !alive
trigger1 = !time
trigger1 = statetype != A
value = 10170
ignorehitpause = 1
[State 5030, 4]
type = SelfState
trigger1 = !time
trigger1 = statetype != A && statetype != L
trigger1 = gethitvar(xvel) != 0
value = 5000 ;HITA_FALL
[State 5030, 4]
type = ChangeState
trigger1 = !time
trigger1 = statetype = L
value = 10300 ;HITA_FALL
[State 5030, 4]
type = ChangeState
trigger1 = !time
trigger1 = Alive
trigger1 = statetype != A
value = 10064
 
[State 1250, StateTypeSet]
type = StateTypeSet
trigger1 = !time
statetype = A       ;S,A,C,L
 
[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 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1
 
[State 1107, PosFreeze]
type = PosFreeze
trigger1 = 1
value = 1
 
[State 5030, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10  ;.
value = stateno + 1 ;HITA_FALL

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

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = time = 2
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 = time = 2
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y + Pos Y >= 0
value = stateno + 1 ;HIT_BOUNCE

;Downed get-hit (hit ground from fall)
[Statedef 10502]
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 = SelfState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5110 ;Downed get-hit (lying down)

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

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

[State 5100, 12]
type = ChangeState
trigger1 = time = 4
value = 10503

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

;================================================================================
; DIAGUP HIT HIT_BOUNCE (bounce into air)
[Statedef 10503]
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 = VelSet
trigger1 = Time = 0
y = -6

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = time > 0
y = .625

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

[Statedef 10504]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 964, PosToGround]
type = PosSet
trigger1 = !Time
y = 0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
triggerall = SelfAnimExist(5171)
trigger1 = anim = [5101,5102]
trigger2 = anim = [5161,5163]
trigger3 = anim = [5111,5112]
trigger4 = anim = [5171,5172]
trigger5 = anim = [5422,5424]
value = 5171

[State 964, HitGroundAnim]
type = ChangeAnim2
trigger1 = !Time && anim != 5171
value = 10302

[State 964, GoToBounce]
type = ChangeState
trigger1 = time = 4
value = 10505

[Statedef 10505]
type = L
physics = N
movetype = H
velset = 0,0
ctrl = 0

[State 966, PosToGround]
type = PosSet
trigger1 = !Time
y = -1

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = !time
trigger1 = SelfAnimExist(5424)
value = 5424

[State 6123, BounceAnim]
type = ChangeAnim
trigger1 = !time
trigger1 = !SelfAnimExist(5424)
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))
 
[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = [5161,5162]
value = Anim
elem = ifelse((AnimElem=5,<0),5,ifelse((AnimElem=4,<0),4,ifelse((AnimElem=3,<0),3,ifelse((AnimElem=2,<0),2,1))))
persistent = 0

[State 966, StartVels]
type = VelSet
trigger1 = !Time 
x = ifelse((facing=enemynear,facing),3,-3)
y = -2

[State 966, Gravity]
type = Veladd
trigger1 = Time
y = .625

[State 6123, SelectBounceFrame]
type = ChangeAnim
trigger1 = Anim = 5424
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = ifelse(SelfAnimExist(5162),5162,ifelse(SelfAnimExist(5161),5161,5160))
 
[State 966, PosAdd]
type = PosAdd
trigger1 = !Time
y = 20
[State 966, GoToBounce]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Vel Y + Pos y - 20 >= 0
value = 5110

;---------------------------------------------------------------------------
;Aerial launcher DM Type
;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 10530]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5001, VarSet]
type = VarSet
trigger1 = !time
sysvar(3) = ifelse((facing=enemynear,facing),1,-1) 

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

[State 5000, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

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

;---------------------------------------------------------------------------
; Air get-hit (KOF)
[Statedef 10540]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 1402, exp timer]
type = VarSet
trigger1 = !time
sysvar(4) = 0
[State 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1

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

;21
;18.1689453125
;15.7028350830078125
;13.55462646484375
;11.6833343505859375
;10.0532684326171875
;8.633331298828125
;7.3964385986328125
;6.3189849853515625
;5.3804168701171875
;4.562835693359375
;3.85064697265625
;3.2302703857421875
;2.6898651123046875
;2.2191162109375
;1.809051513671875
;1.45184326171875
;1.14068603515625
;0.8696441650390625
;0.633544921875
;0.427886962890625
;0.2487335205078125
;0.15606689453125
;0.0926666259765625
;+0.3317108154296875

;VelAdds
;3.25
;First one: 2.8310546875 (Let's find out what the root value is)
;2.4661102294921875
;2.1482086181640625
;1.8712921142578125
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08;925
y = (3.25)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)+1))
[State 1402, VelSet]
type = PosAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = -2
persistent = 0
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = 0.625

[State 5030, 4]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= 10;Const(movement.air.gethit.groundlevel)
value = 10550 ;HITA_FALL

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = stateno+5 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; Air get-hit (transition)
[Statedef 10545]
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 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08;925
y = (3.25)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)+1))
[State 1402, VelSet]
type = PosAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = -2
persistent = 0
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = 0.625

[State 5035, 3]
type = SelfState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;Air get-hit (recovering in air, not falling)

[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 >= Const(movement.air.gethit.groundlevel)
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = stateno+5 ;Air get-hit (falling)

;---------------------------------------------------------------------------
; Air get-hit (falling) (KOF)
[Statedef 10550]
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);ifelse(anim = 5050, Const720p(4), Const720p(-8))
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 1402, exp timer]
type = Varadd
trigger1 = time
sysvar(4) = 1

[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y < -0.08;925
y = (3.25)*exp((-0.13800)*(sysvar(4)-1-1*(!alive)+1))
[State 1402, VelSet]
type = PosAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = -2
persistent = 0
[State 1402, VelSet]
type = VelAdd
trigger1 = time
trigger1 = Vel Y >= -0.08;925
y = 0.625
[State 100050, NotHitBy]
type = NotHitBy
trigger1 = CanRecover
value = SCA
time = 1
 
[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(0) = Vel X
[State 5050, 6]
type = VarSet
trigger1 = Vel Y + Pos Y >=0
sysfvar(1) = 0.625
[State 5050, 6]
type = SelfState
trigger1 = Vel Y + Pos Y >=0
value = 5100 ;Downed get-hit (hit ground from fall)

;---------------------------------------------------------------------------
; Tripped get-hit (shaking)
[Statedef 10600]
type    = A
movetype= H
physics = N
velset = 0,0
 
[State 5001, VarSet]
type = VarSet
trigger1 = !time
sysvar(3) = ifelse((facing=enemynear,facing),1,-1)
 
[State 5070, 1]
type = ChangeAnim
trigger1 = 1
value = 5070
 
[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 10601
 
[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140
 
;---------------------------------------------------------------------------
; Tripped get-hit (knocked away)
[Statedef 10601]
type    = A
movetype= H
physics = N
 
[State 5071, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
 
[State 1402, VelSet]
type = VelSet
trigger1 = Vel Y < -0.1
trigger2 = !time
y = (gethitvar(yvel))*exp((-0.2076)*(time))
 
[State 1402, VelSet]
type = VelAdd
trigger1 = time;Vel Y >= -0.1
y = 0.625
;trigger1 = time
;y = 0.625
;0.81684098052288204200200009524263
 
;10.25341796875
;8.3754119873046875
;6.805511474609375
;5.4931793212890625
;4.396148681640625
;3.479095458984375
;2.712493896484375
;2.0716552734375
;1.53594970703125
;1.088134765625
;0.7137451171875
;0.4008636474609375
;0.1392822265625
;0.079376220703125
 
;yaccel = 0.625
 
;0.704376220703125
 
[State 5050, 4] ;Recover near ground
type = SelfState
triggerall = Vel Y > 0
triggerall = Pos Y >= -30
triggerall = alive
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER
 
[State 5071, 3] ;Hit ground
trigger1 = Vel Y + Pos Y >= 0
type = SelfState
value = 5100


;================================================================================
;Counter Wire HIT SHAKE
[Statedef 10900]
type    = A
movetype= H
physics = N
velset = 0,0
[State 10900, Anim];Custom animation
type = ChangeAnim
trigger1 = selfanimexist(5900)
trigger1 = !time
value = 5900
[State 10900, Anim];No Custom animation
type = ChangeAnim2
trigger1 = !selfanimexist(5900)
trigger1 = !time
value = 10900
[State 10900, State]
type = ChangeState
trigger1 = HitShakeOver = 1
value = 10901

;================================================================================
;Counter Wire FLYING TO WALL
[Statedef 10901]
type    = A
movetype= H
physics = N

[State 10900, 1]
type = VelSet
trigger1 = numenemy
x = ifelse((facing=enemynear,facing),((abs(gethitvar(xvel))*exp((-0.01574835696813916860754951146083)*(time)))),(-(abs(gethitvar(xvel))*exp((-0.01574835696813916860754951146083)*(time)))))
y = -4.5

[State 10900, VelMul]
type = VelAdd
trigger1 = time > 0
y = GetHitVar(yaccel)

[State 10900, Hit wall]
type = ChangeState
trigger1 = BackEdgeBodyDist <= 32
trigger2 = FrontEdgeBodyDist <= 32
value = 10902

[State 10900, Hit ground];P2 IS HEAVY OR SOMETHING 
type = SelfState
trigger1 = Vel Y + Pos Y >= 0
value = 5100
;================================================================================
;Counter Wire HIT WALL
[Statedef 10902]
type    = A
movetype= H
physics = N

[State 0, turn]
type = turn
triggerall = numenemy
triggerall = facing=enemynear,facing
trigger1 = !Time 

[State 0, Pos]
type = PosAdd
trigger1 = Time = 0
x = -15 

[State 0, Stop moving]
type = PosFreeze
trigger1 = 1
x = 1
y = 1

[State 0, No scroll]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,0

[State 0, VelSet]
type = VelSet
trigger1 = !time 
y = -14.908935546875

[State 0, Anim]
type = ChangeAnim2
trigger1 = !time
value = 10901

[State 0, State]
type = ChangeState
trigger1 = AnimTime = 0
value = 10903
;================================================================================
;Counter Wire REBOUND OFF WALL
[Statedef 10903]
type    = A
movetype= H
physics = N
p2facing = 1

[State 10900, Anim]
type = ChangeAnim
trigger1 = !time
value = 5030

[State 10900, Anim]
type = ChangeAnim
trigger1 = time = 8
value = 5050

[State 10900, Turn]
type = Turn
trigger1 = !time

[State 10900, 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 10900, 2]
type = SelfState
Triggerall = time > 1
trigger1 = Vel Y + Pos Y >= 0
value = 5100

[State 10900, VelSet]
type = VelSet
trigger1 = !time 
x = -2

[State 10900, VelMul]
type = VelAdd
trigger1 = time > 0 && Vel Y >= 0
y = 0.625
[State 10900, VelMul]
type = VelMul
trigger1 = time > 0 && Vel Y < 0
y = 0.86426783794678849771566783122816
[State 10900, VelMul]
type = VelSet
trigger1 = time > 0 && Vel Y > -0.5 && Vel Y < 0
y = -Vel Y

[State 10900, 2]
type = SelfState
Triggerall = time > 1
trigger1 = Vel Y + Pos Y >= 0
value = 5100

;---------------------------[EXPLOSION SYSTEM FOR FIRE USERS]-------------------
;-------------------------------------[VIOLET]----------------------------------
 ;Double Expl
[Statedef 12500]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 2
anim = 12500
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12500
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12500
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12500
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12500
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12500
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 6

;Normal Expl
[Statedef 12501]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 2
anim = 12501
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12501
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12501
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12501
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12501
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12501
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Pyro Expl
[Statedef 12502]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12502
pos = (-41-var(0)),-53
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12502
pos = (-30-var(0)),-46
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12502
pos = (26-var(0)),-15
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12502
pos = (10-var(0)),-94
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12502
pos = (-19-var(0)),-63
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12502
pos = (1-var(0)),-59
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Multi Small Expl
[Statedef 12503]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12503
pos = (-41-var(0)),(-53+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12503
pos = (-30-var(0)),(-46+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12503
pos = (26-var(0)),(-15-var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12503
pos = (10-var(0)),(-94+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12503
pos = (-19-var(0)),(-63+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12503
pos = (1-var(0)),(-59+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Small Expl
[Statedef 12504]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 2
trigger2 = time = 16
trigger3 = time = 40
anim = 12504
pos = (-41-var(0)),(-53+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 4
trigger2 = time = 20
trigger3 = time = 44
anim = 12504
pos = (-30-var(0)),(-46+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 6
trigger2 = time = 24
trigger3 = time = 48
anim = 12504
pos = (26-var(0)),(-15-var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 8
trigger2 = time = 28
trigger3 = time = 52
anim = 12504
pos = (10-var(0)),(-94+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 10
trigger2 = time = 32
trigger3 = time = 56
anim = 12504
pos = (-19-var(0)),(-63+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 12
trigger2 = time = 36
trigger3 = time = 60
anim = 12504
pos = (1-var(0)),(-59+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 62

;------------------------------------[CRIMSON]----------------------------------
 ;Double Expl
[Statedef 12505]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12506, Explod]
type = Explod
	triggerall = random <= 250
trigger1 = time = 2
anim = 12505
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12505
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12505
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12505
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12505
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12505
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 6

;Normal Expl
[Statedef 12506]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 2
anim = 12506
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12506
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12506
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12506
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12506
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12506
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Pyro Expl
[Statedef 12507]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12507
pos = (-41-var(0)),-53
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12507
pos = (-30-var(0)),-46
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12507
pos = (26-var(0)),-15
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12507
pos = (10-var(0)),-94
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12507
pos = (-19-var(0)),-63
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12507
pos = (1-var(0)),-59
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Multi Small Expl
[Statedef 12508]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12508
pos = (-41-var(0)),(-53+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12508
pos = (-30-var(0)),(-46+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12508
pos = (26-var(0)),(-15-var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12508
pos = (10-var(0)),(-94+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12508
pos = (-19-var(0)),(-63+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12508
pos = (1-var(0)),(-59+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Small Expl
[Statedef 12509]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12506, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 2
trigger2 = time = 16
trigger3 = time = 40
anim = 12509
pos = (-41-var(0)),(-53+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 4
trigger2 = time = 20
trigger3 = time = 44
anim = 12509
pos = (-30-var(0)),(-46+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 6
trigger2 = time = 24
trigger3 = time = 48
anim = 12509
pos = (26-var(0)),(-15-var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 8
trigger2 = time = 28
trigger3 = time = 52
anim = 12509
pos = (10-var(0)),(-94+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 10
trigger2 = time = 32
trigger3 = time = 56
anim = 12509
pos = (-19-var(0)),(-63+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12506, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 12
trigger2 = time = 36
trigger3 = time = 60
anim = 12509
pos = (1-var(0)),(-59+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 62

;-------------------------------------[GREEN]-===-------------------------------
 ;Double Expl
[Statedef 12510]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 2
anim = 12515
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12515
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12515
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12515
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12515
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12515
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 6

;Normal Expl
[Statedef 12511]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 2
anim = 12516
pos = (-4-var(0)),-35
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 3
anim = 12516
pos = (-40-var(0)),-120
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 4
anim = 12516
pos = (-17-var(0)),-98
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 5
anim = 12516
pos = (-25-var(0)),-48
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 6
anim = 12516
pos = (-45-var(0)),-114
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 250
trigger1 = time = 8
anim = 12516
pos = (-15-var(0)),-110
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Pyro Expl
[Statedef 12512]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5

[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12517
pos = (-41-var(0)),-53
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12517
pos = (-30-var(0)),-46
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12517
pos = (26-var(0)),-15
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12517
pos = (10-var(0)),-94
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12517
pos = (-19-var(0)),-63
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12517
pos = (1-var(0)),-59
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Multi Small Expl
[Statedef 12513]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 2
anim = 12518
pos = (-41-var(0)),(-53+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 3
anim = 12518
pos = (-30-var(0)),(-46+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 4
anim = 12518
pos = (26-var(0)),(-15-var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 5
anim = 12518
pos = (10-var(0)),(-94+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 6
anim = 12518
pos = (-19-var(0)),(-63+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 150
trigger1 = time = 8
anim = 12518
pos = (1-var(0)),(-59+var(1))
postype = p1  ;p2,front,back,left,right
bindtime = 4
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 20

;Small Expl
[Statedef 12514]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 2
trigger2 = time = 16
trigger3 = time = 40
anim = 12519
pos = (-41-var(0)),(-53+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 4
trigger2 = time = 20
trigger3 = time = 44
anim = 12519
pos = (-30-var(0)),(-46+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 6
trigger2 = time = 24
trigger3 = time = 48
anim = 12519
pos = (26-var(0)),(-15-var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 8
trigger2 = time = 28
trigger3 = time = 52
anim = 12519
pos = (10-var(0)),(-94+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 10
trigger2 = time = 32
trigger3 = time = 56
anim = 12519
pos = (-19-var(0)),(-63+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 500
trigger1 = time = 12
trigger2 = time = 36
trigger3 = time = 60
anim = 12519
pos = (1-var(0)),(-59+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 62

;------------------------[SPARK SYSTEM FOR LIGHTNING USERS]---------------------
;Small Expl
[Statedef 12520]
type    = A
movetype= A
physics = N
sprpriority = 1
velset = 0
facep2 = 1
anim = 1
ctrl = 0

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 65000: STAY PUT >(]
type = Bindtotarget
trigger1 = (!Time)
facing = 0
pos = -10,0
time = -1

[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 0
range = 5
[State 12501, VarRandom]
type = VarRandom
trigger1 = 1
v = 1
range = 20

[State 12501, Explod]
type = Explod
triggerall = random <= 200
trigger1 = time = 2
trigger2 = time = 16
trigger3 = time = 40
anim = 12530
pos = (-41-var(0)),(-53+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 300
trigger1 = time = 4
trigger2 = time = 20
trigger3 = time = 44
anim = 12530
pos = (-30-var(0)),(-46+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 200
trigger1 = time = 6
trigger2 = time = 24
trigger3 = time = 48
anim = 12530
pos = (26-var(0)),(-15-var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 300
trigger1 = time = 8
trigger2 = time = 28
trigger3 = time = 52
anim = 12530
pos = (10-var(0)),(-94+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 200
trigger1 = time = 10
trigger2 = time = 32
trigger3 = time = 56
anim = 12530
pos = (-19-var(0)),(-63+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1
[State 12501, Explod]
type = Explod
triggerall = random <= 100
trigger1 = time = 12
trigger2 = time = 36
trigger3 = time = 60
anim = 12530
pos = (1-var(0)),(-59+var(1))
postype = p2  ;p2,front,back,left,right
bindtime = 1
random = 50,50
sprpriority = 3
ownpal = 1

[State 1302, Destroy]
type = DestroySelf
trigger1 = time = 62
;---------------------------[DREAMCANCEL MARQUEE]-------------------------------
[Statedef 40000]
type = S
movetype = I
physics = S
ctrl = 0
velset = 0, 0
anim = 16003
sprpriority = -1

[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1

[State 1000, Explod] ;Black
type = Explod
trigger1 = !time
anim = 16002
ID = 16002
pos = 0,75
postype = right
supermove = 1
supermovetime = 68
pausemovetime = 68
scale = .5,.5
sprpriority = 775
bindtime = 68
ignorehitpause = 1
ontop = 1
persistent = 0
trans = addalpha
alpha = 128,128

[State 1000, Explod] ;DREAMCANCEL
type = Explod
trigger1 = !time
anim = 16000
ID = 16000
pos = 0,75;160     ;118 in KOFXI ...
facing = 1
postype = right
supermove = 1
supermovetime = 68
pausemovetime = 68
scale = .5,.5
sprpriority = 776
ignorehitpause = 1
persistent = 0
bindtime = 68
ontop = 1
ownpal = 1
removeongethit = 0

[State 1000, Explod] ;Marquee
type = Explod
trigger1 = !time
anim = 16001
ID = 16001
pos = 0,75
postype = right
supermove = 1
supermovetime = 68
pausemovetime = 68
scale = .5,.5
sprpriority = 777
bindtime = 68
ontop = 1
ignorehitpause = 1
persistent = 0

[State 65000: DestroySelf]
type = DestroySelf
trigger1 = time = 68

[Statedef 40002]
anim = 1

[State 13000, EnvColor]
type = EnvColor
triggerall = root,var(21)
trigger1 = !time
value = 255,255,255
time = 2
under = 1
ignorehitpause = 1
persistent = 0


[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15600
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15601
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15610
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15611
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15620
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15621
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15630
[State 40002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 15631

[State 40002, PlaySnd]
type = PlaySnd
trigger1 = !time
value = S14001,0
volume = 200

[State 40001, Glass Break]
type = Explod
triggerall = !numexplod(15640)
trigger1 = time = 2
anim = 15604
ID = 15640
pos = 0,0
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
scale = 1,1
sprpriority = -20
ownpal = 1
bindtime = -1
ignorehitpause = 1

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 3

;--------------------------[2002 UM MAX2 PORTRAIT]------------------------------
[Statedef 40003]
anim = 1

[State 40003, VarSet]
type = VarSet
triggerall = enemy, numhelper(40003)
triggerall = !enemy, numhelper(40004)
trigger1 = enemy, authorname = "Vans"
trigger2 = enemy, authorname = "K.O.D"
trigger3 = enemy, authorname = "K.O.D & Vans"
trigger4 = enemy, authorname = "OrochiKOF97"
trigger5 = enemy, authorname = "David Demianoff"
trigger6 = enemy, authorname = "Dark Saviour"
trigger7 = enemy, authorname = "Kung Fu Man"
trigger8 = enemy, authorname = "KoopaKoot"
trigger9 = enemy, authorname = "Anjel"
trigger10 = enemy, authorname = "David Demianoff & Kung Fu Man"
trigger11 = enemy, authorname = "LegendaryXM90"
trigger12 = enemy, authorname = "Raposo"
trigger13 = enemy, authorname = ".\/."
trigger14 = enemy, authorname = "nazo"
var(0) = 1

[State 40003, VarSet]
type = VarSet
triggerall = teamside = 2
triggerall = enemy, numhelper(40004)
trigger1 = enemy, authorname = "Vans"
trigger2 = enemy, authorname = "K.O.D"
trigger3 = enemy, authorname = "K.O.D & Vans"
trigger4 = enemy, authorname = "OrochiKOF97"
trigger5 = enemy, authorname = "David Demianoff"
trigger6 = enemy, authorname = "Dark Saviour"
trigger7 = enemy, authorname = "Kung Fu Man"
trigger8 = enemy, authorname = "KoopaKoot"
trigger9 = enemy, authorname = "Anjel"
trigger10 = enemy, authorname = "David Demianoff & Kung Fu Man"
trigger11 = enemy, authorname = "LegendaryXM90"
trigger12 = enemy, authorname = "Raposo"
trigger13 = enemy, authorname = ".\/."
trigger14 = enemy, authorname = "nazo"
var(0) = 1

[State 40001, P1 BG]
type = Explod
triggerall = !numexplod(15650)
triggerall = teamside = 1
trigger1 = !time
anim = 15605
ID = 15650
pos = 0,abs((240*var(0))-81)
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
sprpriority = -19
ownpal = 1
ignorehitpause = 1

[State 40001, P2 BG]
type = Explod
triggerall = !numexplod(15651)
triggerall = teamside = 2
trigger1 = !time
anim = 15606
ID = 15651
pos = 0,abs((240*var(0))-81)
postype = right  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
facing = -1
sprpriority = -19
ownpal = 1
ignorehitpause = 1

[State 40001, P1 PORTRAIT]
type = Explod
triggerall = !numexplod(15660)
triggerall = teamside = 1
trigger1 = !time
anim = 15607+root,var(1)
ID = 15660
pos = 0,abs((240*var(0))-81)
postype = left  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
sprpriority = -18
ownpal = 1
ignorehitpause = 1

[State 40001, P2 PORTRAIT]
type = Explod
triggerall = !numexplod(15661)
triggerall = teamside = 2
trigger1 = !time
anim = 15607+root,var(1)
ID = 15661
pos = 0,abs((240*var(0))-81)
postype = right  ;p2,front,back,left,right
pausemovetime = -1
supermovetime = -1
removetime = -2
bindtime = -1
scale = 1,1
facing = -1
sprpriority = -18
ownpal = 1
ignorehitpause = 1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15650
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15650
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15650
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15650
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15650
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15650
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15650
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15650
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15651
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15651
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15651
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15651
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15651
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15651
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15651
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15651
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15660
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15660
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15660
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15660
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15660
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15660
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15660
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15660
scale = 1,1

[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
ID = 15661
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
ID = 15661
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 15661
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 8
ID = 15661
scale = 1,1
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 56
ID = 15661
scale = 1,0.77
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 57
ID = 15661
scale = 1,0.54
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 58
ID = 15661
scale = 1,0.3
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 59
ID = 15661
scale = 1,1

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 60

[Statedef 40004]
anim = 1

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = time = 1

;---------------------------[KOF K.O. SYSTEM]-----------------------------------
;This is as accurate as it'll get with MUGEN's K.O. slow system.
[Statedef 50000]
ctrl = 0
anim = 1

[State 50000, VarSet]
type = VarSet
trigger1 = root, stateno = [200,991]
var(0) = 1

[State 50000, PlaySnd]
type = PlaySnd
trigger1 = IsHelper(50000) && !time
value = 3,18
volume = 255
channel = 1
ignorehitpause = 1

[State 50000, PlaySnd]
type = PlaySnd
trigger1 = IsHelper(50001) && !time
value = 3,19
volume = 255
channel = 1
ignorehitpause = 1

[State 3000, AssertSpecial]
type = AssertSpecial
triggerall = !var(0)
trigger1 = time = [0,17]
flag = noBG
flag2 = noFG
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = !time
value = 0,0,0
time = 0;6
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 1
value = 255,0,0
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 2
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 3
value = 255,0,0
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 4
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 5
value = 255,0,0
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 7
value = 255,255,255
time = 2
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 9
value = 255,0,0
time = 2
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 11
value = 255,255,255
time = 2
under = 1
ignorehitpause = 1

[State 3501, EnvColor]
type = EnvColor
triggerall = !var(0)
trigger1 = time = 13
value = 255,0,0
time = 2
under = 1
ignorehitpause = 1

[State 3501, EnvColor];Must last two ticks!
type = EnvColor
trigger1 = time = 15
value = 0,0,0
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor];One tick.
type = EnvColor
trigger1 = time = 16
value = 255,255,255
time = 1
under = 1
ignorehitpause = 1

[State 3501, EnvColor];One tick.
type = EnvColor
triggerall = !var(0)
trigger1 = time = 17
value = 255,0,0
time = 1
under = 1
ignorehitpause = 1

;---------------------------[SKILLBAR SYSTEM]-----------------------------------
[Statedef 70000]
ctrl = 0
anim = 1

[State 60000, Explod]
type = Explod
trigger1 = !NumExplod(14006)
trigger1 = TeamSide = 1
anim = 14009
ID = 14006
postype = Back
pos = 23,225+(root,var(25))
ownpal = 1
bindtime = -1
scale = 0.5,0.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
trigger1 = !NumExplod(14006)
trigger1 = TeamSide = 2
anim = 14010
ID = 14006
postype = Back
pos = 23,225+(root,var(25))
ownpal = 1
bindtime = -1
scale = 0.5,0.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) < 1000
trigger1 = !NumExplod(14000)
trigger1 = TeamSide = 1
anim = 14000
ID = 14000
postype = Back
pos = 37,229+(root,var(25))
ownpal = 1
bindtime = -1
scale = 1,0.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) < 1000
trigger1 = !NumExplod(14000)
trigger1 = TeamSide = 2
anim = 14000
ID = 14000
postype = Back
pos = 38,229+(root,var(25))
ownpal = 1
bindtime = -1
scale = 1,0.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1000
trigger1 = !NumExplod(14007)
trigger1 = TeamSide = 1
anim = 14000
ID = 14007
postype = Back
pos = 37,229+(root,var(25))
ownpal = 1
bindtime = -1
scale = 1,.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1000
trigger1 = !NumExplod(14007)
trigger1 = TeamSide = 2
anim = 14000
ID = 14007
postype = Back
pos = 38,229+(root,var(25))
ownpal = 1
bindtime = -1
scale = 1,.5
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1000
trigger1 = !NumExplod(14001)
trigger1 = TeamSide = 1
anim = 14001
ID = 14001
postype = Back
pos = 37,229+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1000
trigger1 = !NumExplod(14001)
trigger1 = TeamSide = 2
anim = 14001
ID = 14001
postype = Back
pos = 37,229+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod];Stock Numbah One
type = Explod
trigger1 = parent,fvar(5) > 1000
trigger1 = !NumExplod(14003)
trigger1 = TeamSide = 1
anim = 14003
ID = 14003
postype = Back
pos = 31,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 60000, Explod]
type = Explod
trigger1 = parent,fvar(5) > 1000
trigger1 = !NumExplod(14003)
trigger1 = TeamSide = 2
anim = 14006
ID = 14003
postype = Back
pos = 31,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 60000, Explod];Stock Numbah One Silver
type = Explod
trigger1 = parent,fvar(5) > 1999
trigger1 = !NumExplod(14005)
trigger1 = TeamSide = 1
anim = 14005
ID = 14005
postype = Back
pos = 31,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 60000, Explod]
type = Explod
trigger1 = parent,fvar(5) > 1999
trigger1 = !NumExplod(14005)
trigger1 = TeamSide = 2
anim = 14007
ID = 14005
postype = Back
pos = 31,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 6140, ModifyExplod]
type = ModifyExplod
triggerall = parent,fvar(5) < 1001
trigger1 = NumExplod(14000)
ID = 14000
scale = (parent,fvar(5))/1000.0,.5
ignorehitpause = 1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1999
trigger1 = !NumExplod(14002)
trigger1 = TeamSide = 1
anim = 14002
ID = 14002
postype = Back
pos = 37,229+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1

[State 60000, Explod]
type = Explod
triggerall = parent,fvar(5) > 1999
trigger1 = !NumExplod(14002)
trigger1 = TeamSide = 2
anim = 14002
ID = 14002
postype = Back
pos = 38,229+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1

[State 6140, ModifyExplod]
type = ModifyExplod
triggerall = parent,fvar(5) > 1000
trigger1 = NumExplod(14001)
ID = 14001
scale = ((parent,fvar(5)-1000)/1000.0),.5
ignorehitpause = 1

[State 6140, ModifyExplod]
type = ModifyExplod
triggerall = parent,fvar(5) > 1999
trigger1 = NumExplod(14002)
ID = 14002
scale = (parent,fvar(5)-1000)/1000.0,.5
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = parent,fvar(5) > 1000
trigger1 = NumExplod(14000)
ID = 14000
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = NumExplod(14001)
trigger1 = parent,fvar(5) > 1999
trigger2 = parent,fvar(5) < 999
ID = 14001
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = parent,fvar(5) < 1999
trigger1 = NumExplod(14002)
ID = 14002
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = NumExplod(14003)
trigger1 = parent,fvar(5) > 1999
trigger2 = parent,fvar(5) < 999
ID = 14003
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = parent,fvar(5) < 1999
trigger1 = NumExplod(14004)
ID = 14004
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = parent,fvar(5) < 1999
trigger1 = NumExplod(14005)
ID = 14005
ignorehitpause = 1

[State 6140, ModifyExplod]
type = RemoveExplod
triggerall = NumExplod(14007)
trigger1 = parent,fvar(5) > 1999
trigger2 = parent,fvar(5) < 999
ID = 14007
ignorehitpause = 1

[State 60000, Explod];Stock Numbah Two
type = Explod
trigger1 = parent,fvar(5) > 1999
trigger1 = !NumExplod(14004)
trigger1 = TeamSide = 1
anim = 14004
ID = 14004
postype = Back
pos = 24,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 60000, Explod]
type = Explod
trigger1 = parent,fvar(5) > 1999
trigger1 = !NumExplod(14004)
trigger1 = TeamSide = 2
anim = 14005
ID = 14004
postype = Back
pos = 25,228+(root,var(25))
ownpal = 1
bindtime = -1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
scale = .5,.5

[State 132121321, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "Gauge 2 = %d Gauge 1 = %d"
params = numexplod(14001), numexplod(14000)
;ignorehitpause =
;persistent =

;---------------------------[2002 UM MAX MODE]----------------------------------
[Statedef 70001]
ctrl = 0
anim = 1

[State 70001, PowerAdd]
type = PowerAdd
trigger1 = !time
trigger1 = root,var(42) != 2
value = -1000

[State 70001, PowerAdd]
type = PowerAdd
trigger1 = IsHelper(70002) && !time
trigger1 = root,var(42) != 2
value = -1000

[State 70001, VarSet]
type = VarSet
trigger1 = !time
var(0) = power
[State 70001, VarSet]
type = VarAdd
trigger1 = root,stateno = 751 && root,animelem = 1
var(0) = -1000

[State 70001, PowerSet]
type = PowerSet
trigger1 = root,var(42) != 2
trigger1 = root,stateno != [3000,3999]
value = var(0)

[State 40002, PlaySnd]
type = PlaySnd
trigger1 = !time
value = S0,0
volume = 200

[State 70001, ParentVarSet]
type = ParentVarSet
trigger1 = !time
var(51) = 753

[State 70001, MAX2 INDICATOR]
type = PalFX
trigger1 = root, life <= 300
time = 1
add = ceil(37/6*sin(pi*(root,var(51)))),ceil(-85*sin(pi*(root,var(51)))),ceil(-400*sin(pi*(root,var(51))))
mul = 256,128,128
invertall = 1
color = 256
ignorehitpause = 1

[State 60000, P1 MAX-ON !!]
type = Explod
trigger1 = !NumExplod(14110)
trigger1 = TeamSide = 1
anim = 14110
ID = 14110
postype = left
pos = 33,223-4
ownpal = 1
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 60000, P2 MAX-ON !!]
type = Explod
trigger1 = !NumExplod(14110)
trigger1 = TeamSide = 2
anim = 14110
ID = 14110
postype = right
pos = -(68+33),223-4
ownpal = 1
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = !time
trigger2 = time = 26
ID = 14110
scale = 1,0.14
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 1
trigger2 = time = 25
ID = 14110
scale = 1,0.29
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 2
trigger2 = time = 24
ID = 14110
scale = 1,0.43
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 3
trigger2 = time = 23
ID = 14110
scale = 1,0.57
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 4
trigger2 = time = 22
ID = 14110
scale = 1,0.71
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 5
trigger2 = time = 21
ID = 14110
scale = 1,0.86
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 6
ID = 14110
scale = 1,1

[State 60000, P1 HOLD]
type = Explod
trigger1 = !NumExplod(14100)
trigger1 = TeamSide = 1
trigger1 = time = 27
anim = 14100
ID = 14100
postype = left
pos = 33,223-4
ownpal = 1
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 60000, P2 HOLD]
type = Explod
trigger1 = !NumExplod(14100)
trigger1 = TeamSide = 2
trigger1 = time = 27
anim = 14101
ID = 14100
postype = right
pos = -(72+33),223-4
ownpal = 1
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 27
ID = 14100
scale = 1,0.14
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 28
ID = 14100
scale = 1,0.29
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 29
ID = 14100
scale = 1,0.43
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 30
ID = 14100
scale = 1,0.57
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 31
ID = 14100
scale = 1,0.71
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 32
ID = 14100
scale = 1,0.86
[State 40003, ModifyExplod]
type = ModifyExplod
trigger1 = time = 33
ID = 14100
scale = 1,1

[State 70001, P1 METER]
type = Explod
trigger1 = !NumExplod(14120)
trigger1 = TeamSide = 1
trigger1 = time = 27
anim = 14120
ID = 14120
postype = left
pos = 56,222-4
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
removetime = -1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 70001, P2 METER]
type = Explod
trigger1 = !NumExplod(14120)
trigger1 = TeamSide = 2
trigger1 = time = 27
anim = 14120
ID = 14120
postype = right
pos = -56,222-4
bindtime = -1
scale = 1,1
ignorehitpause = 1
ontop = 1
removetime = -1
facing = -1
pausemovetime = -1
supermovetime = -1
persistent = 0
[State 70001, ModifyExplod]
type = ModifyExplod
trigger1 = NumExplod(14120)
ID = 14120
scale = (root,var(51)/752.0)*0.96,1

;7 scale changes. Seventh change is a reset.
;Total time is 16 ticks*47 points, 752 ticks. Varadd should be 1 point
; every 16th tick
;Or... converted to MUGEN tick-wise system...
;Every MAX cancel should take 128 total points out of 752.
[State 40001, DestroySelf]
type = ChangeState
trigger1 = root,var(51) <= 0;time = 752
value = stateno+1

[Statedef 70002]
ctrl = 0
anim = 1

[State 70002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 14100
[State 70002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 14101
[State 70002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 14110
[State 70002, RemoveExplod]
type = RemoveExplod
trigger1 = !time
id = 14120

[State 40001, DestroySelf]
type = DestroySelf
trigger1 = !time

;---------------------------[ALL STANDARD PROJECTILES]-------------------

;108 Shiki: Yami Barai (KYO)
[Statedef 7000]
type = A
movetype = A
physics = N
ctrl = 0
velset = 0, 0
anim = 7000
sprpriority = 4
juggle = 10
[State 7001, Assert]
type = AssertSpecial
trigger1 = 1
flag = noshadow
ignorehitpause = 1
[State 1050, VelSet]
type = VarSet
trigger1 = !time && !prevstateno
var(15) = root,var(15)
[State 1050, VelSet]
type = VelSet
trigger1 = time = 1
x = var(15)
[State 1005, HitOverride]
type=hitoverride
trigger1= 1
attr=SCA,AA,AP,AT
time=-1
stateno=stateno+1
ignorehitpause=1
[State 1005, HB]
type=hitby
trigger1= 1
value=SCA,NP,SP,HP
time=-1
ignorehitpause=1
[State 65000: AfterImage]
type = AfterImage
trigger1 = (!Time)
trigger1 = root, var(20) = 1
time = 999
length = 4
palbright = 216,8,0
palcontrast = 128,64,0
paladd = 0,0,0
timegap = 2
framegap = 1
trans = add
[State 1050, Trans]
type = Trans
trigger1 = root, var(27)
trans = add1
[State 12003, Explod]
type = Explod
trigger1 = animtime = 0
anim = 12003
ID = 12003
pos = 0,0
postype = p1  ;p2,front,back,left,right
bindtime = 1
removetime = -2
sprpriority = 2
ownpal = 1

[State -2, Damage Dampener]; Helper set
type= attackmulset
trigger1 = 1
value= 1.0*ifelse(root,var(51),0.63,1)
ignorehitpause= 1
persistent = 0
[State 210, 1]
type = HitDef
trigger1 = !root, var(55)
attr = S, SP
damage = floor(83*ifelse(root,var(56),1.25,1)),10
animtype = Hard
air.animtype = back
guardflag = MA
hitflag = MAF
priority = 3, Hit
sparkno = -1;s17002+(root,var(31)*10000)
sparkxy = -10, -40
hitsound = -1
guardsound = s3+(root,var(32)*2), 13
guard.sparkno = s17502+(root,var(31)*10000)
ground.type = Low
pausetime = 1,12
guard.pausetime = 0,11
ground.slidetime = 17
ground.hittime = 16
guard.hittime = 16
guard.slidetime = 17
guard.ctrltime = 24
ground.velocity =  -13.5
guard.velocity = -13.5
air.type = High
air.velocity =-14,-7
air.hittime = 13
air.juggle = 0
getpower = 0,0
givepower = 16,16
id = 1000
air.fall = 1
ground.cornerpush.veloff = 0
guard.cornerpush.veloff = 0
air.cornerpush.veloff = 0
Palfx.time       = 28
Palfx.add       = 231,79,0
Palfx.sinadd   = 40,30,0,10
Palfx.color     = 128
Palfx.invertall = 0
yaccel = 0.5

[State 3000, ContactSpark]
type = Explod
trigger1 = movehit && numtarget
anim = 17002+(root,var(31)*10000)
ID = 1000
pos = 16 ,-42
postype = p1
facing = 1
bindtime = 1
removetime = -2
sprpriority = 4
shadow = 0,0,0
ownpal = 1
persistent = 0

[State 1000, Sound]
type = PlaySnd
trigger1 = movehit && numtarget
value = 4,1
persistent = 0

[State 1411, VarSet]
type = ParentVarSet
trigger1 = movehit && p2statetype = A
var(55) = 1000
ignorehitpause=1
[State 1411, VarSet]
type = ParentVarSet
trigger1 = numtarget(1000) && movehit
var(16) = 12
persistent = 0
ignorehitpause=1
[State 1050, VarSet]
type = VarSet
trigger1 = !time
var(0) = 2
ignorehitpause = 1
[State 1050, VarSet]
type = VarSet
trigger1 = 1
var(1) = movehit
ignorehitpause = 1
[State 1005, TargetDrop]
type = TargetDrop
trigger1 = root,numtarget 
[State 1005, End]
type=changestate
trigger1= movecontact
value=stateno+1
ignorehitpause=0
[State 1005, End]
type=destroyself
trigger1= pos x!=[-200,200]
[Statedef 7001]
type=S
physics=N
movetype=I
ctrl=0
anim=1
sprpriority=4
velset =0,0

[State -2, Helper]
type = Helper
trigger1 = !numhelper(50000) && !numhelper(50001)
trigger1 = WinKO && root,var(24)
helpertype = normal
name = "K.O."
ID = 50001
stateno = 50000
pos = 160,120
postype = left    ;p2,front,back,left,right
facing = 1
keyctrl = 0
ownpal = 0
supermovetime = 999999999999
pausemovetime = 999999999999
ignorehitpause = 1

[State 10063, AfterImage]
type = AfterImage
trigger1 = !time
time = 1
[State 1005, End]
type=destroyself
trigger1= !numtarget

;----------------------------------------------------------------------------------------------
; Scramble mode states
;----------------------------------------------------------------------------------------------
;Init. Tag out
[Statedef 8000];Ok!
type    = A
movetype= I
physics = N
velset = 0,0

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

[State 1000, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = 51

[State 181, ScreenBound]
type = ScreenBound
trigger1 = 1 
value = 0
movecamera = 0,0

[State 8000, PlaySnd]
type = PlaySnd
trigger1 = !time
value = 2+(var(32)*10),12

[State 310, PosAdd]
type = VelSet
trigger1 = animelem = 1
x = -13
y = -11.375
[State 8102, VelAdd]
type = VelAdd
trigger1 = animelemtime(1) > 0
y = 0.625

[State 1000, 6]
type = ChangeState
trigger1 = BackEdgeDist <= -48 
value = stateno+1
ctrl = 0

;================================================================================
;Get hit
;================================================================================
[StateDef 8050]
Type = A
MoveType =  H
VelSet = 0, -7
sprpriority = -1 
Ctrl = 0

[State 903, VelSet]
type = VelSet
trigger1 = time < 6
x = (-11.375*exp((-0.20763936477824450161544104426739)*(time-1)));

[State 245]
type = Nothitby
trigger1 = 1
value = SCA

[State 1040, go]
type = PosAdd
Trigger1 = !time
y = -1

[State 1040, go]
type = VelAdd
trigger1 = time > 0
y = 0.5

[State 811, Anim]
Type = ChangeAnim
Trigger1 = time < 9
Value = 5030

[State 811, Anim]
Type = ChangeAnim
Trigger1 = time = 9
Value = 5050

[State 811, 2]
type = SelfState
Trigger1 = vel y > 0 && pos y >= 0
value = 8051

;================================================================================
; Downed get-hit (hit ground from fall)
[Statedef 8051]
type    = L
movetype= H
physics = N

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

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

[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 ;Downed get-hit (lying down)

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = 2+(root,var(32)*10),5
channel = 1
volume = 200

[State 5100, Explod]
type = Explod
trigger1 = !time
anim = 12000
pos = 0,0
postype = p1  ;p2,front,back,left,right
sprpriority = -4
ownpal = 1

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

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

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

[State 5100, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20
;================================================================================
; HIT_BOUNCE (bounce into air)
[Statedef 8052]
type    = L
movetype= H
physics = N

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

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

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

[State 5101, 4]
type = VelSet
trigger1 = Time = 0
y = -3

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = time > 0
y = gethitvar(yaccel)

[State 5101, 6] ;Hit ground
trigger1 = Pos Y + Vel Y >= 0
type = ChangeState
value = 8053
;================================================================================
; HIT_LIEDOWN
[Statedef 8053]
type    = L
movetype= H
physics = N
velset = 0,0

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

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

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
trigger1 = time = 0
value = 5170

[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 5100, 10]
type = PlaySnd
trigger1 = Time = 1
value = 2+(root,var(32)*10),5
channel = 1
volume = 200

[State 5100, Explod]
type = Explod
trigger1 = !time
anim = 12004
pos = 36-((anim!=5170)*72),-2
postype = p1  ;p2,front,back,left,right
sprpriority = 3
ownpal = 1
facing = 1
persistent = 0

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

[State 5110, 11] ;If just died
type = ChangeState
trigger1 = time = 10 
value = 8054

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

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

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

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine
;================================================================================
; HIT_GETUP
[Statedef 8054]
type    = L
movetype= I
physics = N

[State 5120, 1] ;Get up anim (normal)
type = ChangeAnim
trigger1 = time = 0
value = 5120

[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, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 8055

;Jump Away
[Statedef 8055]
type = S
movetype = I
physics = N
poweradd= 0
ctrl = 0
velset = 0,0
sprpriority = 2

[State 8055, 1] ;G
type = ChangeAnim
trigger1 = time = 0
value = 8201

;
[State 8100, 1]
type = StateTypeSet
trigger1 = animelem = 3
statetype = A

[State 8100, go]
type = VelSet
trigger1 = animelem = 3
x = 16
y = -16 

[State 8000, PlaySnd]
type = PlaySnd
trigger1 = animelem = 3
value = 2+(root,var(32)*10),12

[State 1000, 6]
type = Destroyself
triggerall = animelemtime(3) > 0 
trigger1 = BackEdgeDist <= -48 
trigger2 = FrontEdgeDist <= -48 
;================================================================================

;Striker Call
[Statedef 8100]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 8100

[State -2, VarSet]
type = VarAdd
triggerall = var(42)
triggerall = teammode = simul
triggerall = partner, selfanimexist(90702)
trigger1 = var(42) = 1 ;Is Active
var(30) = -1
persistent = 0

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

[State 200, Punch Attempt Sound]
type = Playsnd
trigger1 = animelem = 2
value = 195,0
channel = 0

;Partner switch
[Statedef 8101]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 8100

[State 200, Punch Attempt Sound]
type = Playsnd
trigger1 = animelem = 2
value = 195,0
channel = 0

[State 195, 2]
type = Changestate
trigger1 = AnimTime = 0
value = 8102

;Jump out
[Statedef 8102]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = N
sprpriority = 2

[State 8102, VarSet]
type = VarSet
trigger1 = !time
var(42) = 2
persistent = 0

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 40
[State 191, 1]
type = ChangeAnim
trigger1 = anim = 40
trigger1 = !animtime
value = 51

[State -3, hop]
type = PlaySnd
trigger1 = anim = 51
value = 12,4
persistent = 0

[State 8100, go]
type = VelSet
trigger1 = anim = 51
trigger1 = animelem = 1
x = -13
y = -11.375
[State 8102, VelAdd]
type = VelAdd
trigger1 = anim = 51
trigger1 = animelemtime(1) > 0
y = 0.625

[State 181, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0
movecamera = 0,0

[State 1000, 6]
type = ChangeState
triggerall = anim = 51
trigger1 = BackEdgeDist <= -48 
trigger2 = FrontEdgeDist <= -48 
value = 8001
ctrl = 0

;Jump In
[Statedef 8103]
type = A
ctrl = 0
velset = 0,0
movetype = I
physics = N
sprpriority = 2

[State 8103, Turn]
type = Turn
trigger1 = !time
trigger1 = facing != partner,facing

[State 8102, VarSet]
type = VarSet
trigger1 = !time
var(42) = 1
persistent = 0

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 51

[State 8100, PosSet]
type = PosSet
trigger1 = animelem = 1
x = ifelse(partner,facing=-1,partner, pos x+394,partner, pos x-394)
y = 0

[State 8100, go]
type = VelSet
trigger1 = animelem = 1
x = 16
y = -12
[State 8100, add]
type = VelAdd
trigger1 = animelemtime(1) > 0 ;&& animelemtime(3) < 0
Y = 0.96435546875

[State 181, ScreenBound]
type = ScreenBound
trigger1 = ScreenPos X != (GameWidth/4,3*GameWidth/4)
value = 0
movecamera = 0,0
[State 181, ScreenBound]
type = ScreenBound
trigger1 = ScreenPos X = (GameWidth/4,3*GameWidth/4)
value = 1
movecamera = 1,0

[State 195, 2]
type = ChangeState
trigger1 = Vel Y + Pos Y >= 0
value = 52
ctrl = 0

;QuickShift
[Statedef 8104]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = S
sprpriority = 2

[State 8102, VarSet]
type = VarSet
trigger1 = 1
var(42) = 2
persistent = 0

[State 191, 1]
type = ChangeAnim
trigger1 = 1
value = 1
persistent = 0
ignorehitpause = 1

[State 1000: Helper]
type = Helper
trigger1 = numhelper(8106) = 0
name = "Jump Out"
id = 8106
pos = 0, 0 ;50
postype = p1
facing = 1
stateno = 8106
keyctrl = 0
ownpal = 1
supermovetime = 0
pausemovetime = 0
persistent = 0
ignorehitpause = 1

[State 195, 2]
type = Changestate
trigger1 = time = 2
value = 8001
persistent = 1
ignorehitpause = 1

;Quick Shift Jump In
[Statedef 8105]
type = A
ctrl = 0
velset = 0,0
movetype = I
physics = N
sprpriority = 2

[State 8103, Turn]
type = Turn
trigger1 = !time
trigger1 = facing != partner,facing

[State 8102, VarSet]
type = VarSet
trigger1 = !time
var(42) = 1
persistent = 0

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 51

[State 8100, PosSet]
type = PosSet
triggerall = numenemy
trigger1 = animelem = 1
x = ifelse(partner,facing=-1,enemynear, pos x+394,enemynear, pos x-394)
;x = ifelse(partner,facing=-1,partner, pos x+352,partner, pos x-352)
y = 0

[State 8100, go]
type = VelSet
trigger1 = animelem = 1
x = 16
y = -12
[State 8100, add]
type = VelAdd
trigger1 = animelemtime(1) > 0 ;&& animelemtime(3) < 0
Y = 0.96435546875

[State 181, ScreenBound]
type = ScreenBound
trigger1 = ScreenPos X != (GameWidth/4,3*GameWidth/4)
value = 0
movecamera = 0,0
[State 181, ScreenBound]
type = ScreenBound
trigger1 = ScreenPos X = (GameWidth/4,3*GameWidth/4)
value = 1
movecamera = 1,0

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

[State 195, 2]
type = ChangeState
trigger1 = Vel Y + Pos Y >= 0
value = 52
ctrl = 0

;Quick Shift Jump out
[Statedef 8106]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = N
sprpriority = 2

[State 191, 1]
type = ChangeAnim
trigger1 = !time
value = 40
[State 191, 1]
type = ChangeAnim
trigger1 = anim = 40
trigger1 = !animtime
value = 51

[State -2, PalFX]
type = PalFX
trigger1 = time < 12
time = 1
add = 0,0,252
sinadd = 0,0,0
mul = 0,0,256
invertall = 0
color = 256
ignorehitpause = 1
persistent = 2

[State -3, hop]
type = PlaySnd
trigger1 = anim = 51
value = 12,4
persistent = 0

[State 8100, go]
type = VelSet
trigger1 = anim = 51
trigger1 = animelem = 1
x = -13
y = -11.375
[State 8102, VelAdd]
type = VelAdd
trigger1 = anim = 51
trigger1 = animelemtime(1) > 0
y = 0.625

[State 181, ScreenBound]
type = ScreenBound
trigger1 = anim = 51
value = 0
movecamera = 0,0

[State 1000, 6]
type = DestroySelf
triggerall = anim = 51
triggerall = root,stateno != 8104
trigger1 = BackEdgeDist <= -48 
trigger2 = FrontEdgeDist <= -48 
;================================================================================
