;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

;------------------ DESHACER y hacer EFECTOS, blablalbla
[State 0, noboardenfatals]
type = AssertSpecial
triggerall = numpartner = 0 ; no en simul
trigger1 = prevstateno = 6056
trigger2 = prevstateno = 6059
trigger3 = prevstateno = 6063
trigger4 = prevstateno = 6066
trigger5 = prevstateno = 6068
trigger6 = prevstateno = 6070
trigger7 = prevstateno = 6073
trigger8 = prevstateno = 6075
trigger9 = prevstateno = 6077 && var(22) != 5008
trigger10 = prevstateno = 6078
trigger11 = prevstateno = [6050,6080]
trigger12 = prevstateno = 6051
trigger13 = prevstateno = 6052
trigger14 = prevstateno = 6054
trigger15 = prevstateno = 6079
trigger16 = prevstateno = 60806 || stateno = [60877,60887]
trigger17 = prevstateno = 6082
flag = nobardisplay
ignorehitpause = 1
flag2 = noautoturn

[State 0, deshaceefecto]
type = BGPalFX
trigger1 = prevstateno = 192
time = 1
add = 0,0,0

[State 0, deshaceefecto]
type = PalFX
trigger1 = prevstateno = 195 || prevstateno = 196
trigger1 = palno != 4
time = 1
add = 0,0,0

[State 0, notiemblaluegodeintro]
type = EnvShake
trigger1 = prevstateno = 192
time = 1
ampl = 0

[State 0, stopchannel0]
type = StopSnd
trigger1 = prevstateno = 100
channel = 0

[State 0, VarSet]
type = VarSet
trigger1 = !time
var(18) = 0

[State 0, noboard]
type = AssertSpecial
trigger1 = var(16) != 0
flag = nobardisplay
;-------------------- Stand pose
[State 0, stand]
type = ChangeAnim
triggerall = var(21) != 1
triggerall = var(16) = 0
triggerall = prevstateno != 6056
triggerall = var(16) = 0
triggerall = anim != 6014
trigger1 = Anim != 0 && Anim != 1 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = ifelse(var(20) = 1,0,1)

[State 0, randomCha]
type = VarRandom
triggerall = var(21) = 1
trigger1 = time = 0
v = 15
range = 0,1

[State 0, Stacha]
type = ChangeAnim
triggerall = var(16) = 0
triggerall = prevstateno != 6056
triggerall = var(16) = 0
triggerall = var(21) = 1
triggerall = anim != 6014
trigger1 = Anim != 0 && Anim != 5 && Anim != 1 && Anim != 2
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = var(15)
;--------------------------------------
[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

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

;---------------------------------------
; turn
[Statedef 5]
type = U
physics = S
sprpriority = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = ifelse(statetype = S,5,6)

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

[State 0, ChangeState]
type = ChangeState
trigger1 = !animtime
value = ifelse(statetype = S,0,11)
ctrl = 1

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

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

[State 10, 2]
type = ChangeState
trigger1 = !AnimTime
ctrl = ifelse(prevstateno = 6009,0,1)
value = 11
;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
sprpriority = 0
anim = 11

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

[State 10, 2]
type = ChangeState
trigger1 = command != "holddown"
value = 0
ctrl = 1
;---------------------------------------------------------------
[Statedef 6099]
type    = S
movetype= H
physics = S
velset = 0,0

[State end]
type = changeState
trigger1 = 1
value = 6099
;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
ctrl = 1;0
anim = 12

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

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

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

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

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

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

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

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

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = ifelse(anim != 41,42,47)

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

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

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

[State 52, 3]
type = null;changeanim
trigger1 = Time = 2
value = 47

[State turn]
type = turn
triggerall = p2bodydist x <= -15 && (enemynear,backedgedist != 0)
trigger1 = !time

[State 52, 4]
type = ChangeState
trigger1 = time = 4
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; DASH_FWD
[Statedef 100]
type    = S
physics = N
anim = 100
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = time = 3
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 cual]
type = VarRandom
trigger1 = !time
v = 15
range = 0,2

[State voz]
type = PlaySnd
trigger1 = !time
value = ifelse(!var(15),1,ifelse(var(15) = 1,2,ifelse(var(15) = 2,14,0))),ifelse(!var(15),14,ifelse(var(15) = 1,11,ifelse(var(15) = 2,3,0)))
channel = 0

[State ]
type = PlaySnd
trigger1 = animelem = 4
trigger2 = animelem = 10
value = 3,0

[State giraconBonus]
type = Turn
trigger1 = fvar(4) && command = "holdback" && command != "holdfwd"

[State gira]
type = VelMul
trigger1 = fvar(4) && command = "holdback" && command != "holdfwd"
x = -1

[State ]
type = velset
trigger1 = !var(55)
trigger1 = (command != "holdfwd" && !fvar(4)) || (command != "holdfwd" && command != "holdback" && fvar(4))
trigger2 = var(55) = 1 && p2bodydist X <= 10
x = 0

[State 100, 4]
type = ChangeState
trigger1 = !vel X && time > 3
value = ifelse(!var(55),0,ifelse(p2bodydist x <= 10,ifelse(random < 80,208,209),0))
ctrl = 1

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

[State gira]
type = Turn
trigger1 = !time

[State corre]
type = ChangeState
trigger1 = time = 1
value = 100
ctrl = 1
;------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
;---------------------------------------------- AI
trigger3 = vel X != const(velocity.walk.back.x)
trigger2 = var(55) = 1 && random <= 500
trigger3 = var(55) = 1 && p2stateno = 7022 && numhelper(7021) && random <= 500
;----------------------------------------------Fin AI
trigger1 = var(55) = 0
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)+ifelse(!var(21),0,1)

[State 20, 2]
type = VelSet
;---------------------------------------------- AI
trigger3 = vel X != const(velocity.walk.fwd.x)
trigger2 = var(55) = 1 && random <= 500
trigger3 = var(55) = 1 && p2stateno = 7022 && numhelper(7021) && random <= 500
;----------------------------------------------Fin AI
trigger1 = var(55) = 0
triggerall = command = "holdback"
x = const(velocity.walk.back.x)-ifelse(!var(21),0,1)

[State 0, VarRandom]
type = VarRandom
triggerall = var(21) = 1
trigger1 = !time
v = 15
range = 1,3

[State 20, delante]
type = ChangeAnim
trigger1 = vel x > 0
trigger1 = Anim != 20 || (Anim = 5 && !AnimTime)
value = 20

[State 20, atras]
type = ChangeAnim
trigger1 = vel x < 0
trigger1 = Anim != 21 || (Anim = 5 && !AnimTime)
value = 21


;---------------------------------------------------------------------------
;---------------------------------------------------------------------------
;variables
;var(0) = jabsound                                                 fvar(0) = damage scaling
;var(1) = shao                                                     fvar(1) = juggle
;var(2) = freezelimit                                              fvar(2) =
;var(3) = ow
;var(4) = fatal bitch


;var(41) = wincount
;var(58) = max wins
;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State mode]
type = VarRandom
trigger1 = !time && var(20) = 3 
v = 15
range = 0,1

[State normal] 
type = ChangeState
trigger1 = time = 1 && !var(15)
value = 191

[State smoke] 
type = ChangeState
trigger1 = time = 1 && var(15) = 1 && var(20) = 3
value = 192

;---------------------------------------------------------------------------
; Introduction
[Statedef 191]
type = S
ctrl = 0
velset = 0,0

[State ]
type = ChangeAnim
trigger1 = time = 1 && !RoundState
value = ifelse(var(20) = 1,190,191)

[State ]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State ]
type = ChangeState
trigger1 = !AnimTime && !numhelper(7019)
value = 0


;-----------------------------------------------------
;SMOKE - special intro
[Statedef 192]
type = S
ctrl = 0
anim = 9999

[State ]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State mode]
type = VarRandom
trigger1 = !time
v = 15
range = 0,1

[State explosion]
type = explod
trigger1 = time = 150 && !var(15)
trigger2 = time = 85 && var(15) = 1
anim = 7038
postype = p1
sprpriority = 9
ownpal = 1
pos = ceil(-10*const(size.xscale)*(1+fvar(2))),ceil(10*const(size.yscale)*(1+fvar(2)))
scale = const(size.xscale)*(1+fvar(2)),const(size.yscale)*(1+fvar(2))

[State explosion]
type = PlaySnd
trigger1 = time = 150 && !var(15)
trigger2 = time = 85 && var(15) = 1
value = 1,22
volume = 200
channel = 2

[State tiembla]
type = EnvShake
trigger1 = time = 150 && !var(15)
trigger2 = time = 85 && var(15) = 1
time = 15
ampl = -3

[State 191, 3]
type = ChangeState
triggerall = !numhelper(7019)
trigger1 = !animtime && anim = 1911 && !var(15)
trigger2 = time >= 100 && var(15) = 1
value = 0

;---------------------------- MODE 1
[State ]
type = AssertSpecial
triggerall = !var(15)
trigger1 = time < 150
flag = invisible

[State ]
type = BGPalfx
triggerall = !var(15)
trigger1 = !time
time = 170
add = -250,-250,-250
sinadd = 180,100,100,50

[State ]
type = BGPalfx
triggerall = !var(15)
trigger1 = time = 100
time = 70
add = -250,-250,-250
sinadd = 180,100,100,25

[State ]
type = Explod
triggerall = !var(15)
trigger1 = time = [30,150]
anim = 7040
ID = 7040
name = "Humo"
pos = 0, ceil(-70*const(size.yscale)*(1+fvar(2)))
postype = p1
bindtime = -1
vel = 0, -2
scale = const(size.xscale)*(1+fvar(2)),const(size.yscale)*(1+fvar(2))
random = ceil(40*const(size.xscale)*(1+fvar(2))),ceil(100*const(size.yscale)*(1+fvar(2)))
sprpriority = 9
ownpal = 1
shadow = 0

[State humo]
type = PlaySnd
triggerall = !var(15)
trigger1 = time = 30
trigger2 = time = 40
trigger3 = time = 50
trigger4 = time = 60
trigger5 = time = 70
trigger6 = time = 80
trigger7 = time = 90
trigger8 = time = 100
trigger9 = time = 110
trigger10 = time = 120
trigger11 = time = 130
trigger12 = time = 140
trigger13 = time = 150
value = 6,1
volume = 200

[State tiembla]
type = EnvShake
triggerall = !var(15)
trigger1 = time = 30
time = 120
freq = 60
ampl = -4

[State estoy aqui]
type = ChangeAnim
triggerall = !var(15)
trigger1 = time = 150
value = 1911

;-------------------------- MODE 2
[State cyborg]
type = ChangeAnim
triggerall = var(15) = 1
trigger1 = !time
value = 1910

;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State endWins]
type = varset
trigger1 = !time
triggerall = name = "juano`s cyborg guy"
var(57) = 0
ignorehitpause = 1

[State findeflawles]
type = varset
trigger1 = !time
triggerall = name = "juano`s cyborg guy"
var(42) = 0
ignorehitpause = 1

;---------------------------------------------------------------------------
; Win pose - FUCK YOU!
[Statedef 180]
type = S
ctrl = 0

[State 0, VelSet]
type = VelSet
trigger1 = anim != 7102
x = 0
y = 0

[State 0, VardefatalesA0]
type = VarSet
trigger1 = time = 5
v = 16
value = 0

[State ]
type = changeanim
trigger1 = !time && !var(21) && anim != 7080 && anim != 7090 && anim != 180 && anim != 181
trigger1 = anim != 7100 && anim != 7101 
value = ifelse(var(20) = 1,180,181)

[State ]
type = changeanim
trigger1 = !time && var(21) = 1 && anim != 7080 && anim != 7090 && anim != 180 && anim != 181 && anim != 7101 && anim != 7102 && anim != 6051
trigger1 = anim != 7100 
value = 182

[State ]
type = varadd
trigger1 =  !time
ignorehitpause = 1
var(41) = 1

;================ CHAR WINS ==============
[State 180 , cyrax wins]
type = PlaySnd
triggerall = var(20) = 1 && !var(21)
trigger1 = !time && !numpartner
trigger2 = !time && numpartner = 1
trigger2 = !partner,alive ;|| partner,authorname != "juano16"
trigger3 = numpartner = 1
trigger3 = time = ifelse(id = 56,0,120) && teamside = 1 && partner,authorname = "juano16"
trigger4 = numpartner = 1
trigger4 = time = ifelse(id = 58,0,120) && teamside = 2 && partner,authorname = "juano16"
trigger5 = numpartner = 1
trigger5 = time = 120 && numpartner = 1 && partner,name = "reptile by binho"
abspan = 1
value = 4, ifelse(!var(27),8,18)
persistent = 0

[State 180 , sektor wins]
type = PlaySnd
triggerall = var(20) = 2 && !var(21)
trigger1 = !time && !numpartner
trigger2 = !time && numpartner = 1
trigger2 = !partner,alive ;|| partner,authorname != "juano16"
trigger3 = numpartner = 1
trigger3 = time = ifelse(id = 56,0,120) && teamside = 1 && partner,authorname = "juano16"
trigger4 = numpartner = 1
trigger4 = time = ifelse(id = 58,0,120) && teamside = 2 && partner,authorname = "juano16"
trigger5 = numpartner = 1
trigger5 = time = 120 && numpartner = 1 && partner,name = "reptile by binho"
abspan = 1
value = 16,ifelse(!var(27),1,11)
persistent = 0

[State 180 , smoke wins]
type = PlaySnd
triggerall = var(20) = 3 && !var(21)
trigger1 = !time && !numpartner
trigger2 = !time && numpartner = 1
trigger2 = !partner,alive ;|| partner,authorname != "juano16"
trigger3 = numpartner = 1
trigger3 = time = ifelse(id = 56,0,120) && teamside = 1 && partner,authorname = "juano16"
trigger4 = numpartner = 1
trigger4 = time = ifelse(id = 58,0,120) && teamside = 2 && partner,authorname = "juano16"
trigger5 = numpartner = 1
trigger5 = time = 120 && numpartner = 1 && partner,name = "reptile by binho"
abspan = 1
value = 16,ifelse(!var(27),0,10)
persistent = 0

[State 180 , chameleon wins]
type = PlaySnd
triggerall = var(21)
trigger1 = !time && !numpartner
trigger2 = !time && numpartner = 1
trigger2 = !partner,alive ;|| partner,authorname != "juano16"
trigger3 = numpartner = 1
trigger3 = time = ifelse(id = 56,0,120) && teamside = 1 && partner,authorname = "juano16"
trigger4 = numpartner = 1
trigger4 = time = ifelse(id = 58,0,120) && teamside = 2 && partner,authorname = "juano16"
trigger5 = numpartner = 1
trigger5 = time = 120 && numpartner = 1 && partner,name = "reptile by binho"
abspan = 1
value = 16,ifelse(!var(27),2,12)
persistent = 0
;----------------------- MARCADOR DE VICTORIAS
[State ]
type = varadd
trigger1 =  !time
ignorehitpause = 1
var(57) = 1

[State Marcador]
type = Helper
triggerall = stateno = 180
trigger1 = !time
helpertype = Normal
name = "Num wins"
postype = left
pos = 160
stateno = 704515
ownpal = 1

[State -1,ospc]
type = playsnd
Triggerall = var(57) >= 20 && var(21) = 0
trigger1 = time = 450 && winperfect
trigger2 = time = 350 && !winperfect
channel = -1
value = 5,1
volume = -255

;==========================================
;------------- FLAWLESS VICTORY -----------
[State BGsnd]
type = PlaySnd
trigger1 = numexplod(6995)
value = 1,51
persistent = 0

[State snd]
type = PlaySnd
trigger1 = numexplod(6995)
abspan = 1
value = 4, ifelse(!var(27),9,24)
persistent = 0

[State 0, mensajeFlawwles]
type = Explod
triggerall = winperfect
trigger1 = !numpartner
trigger1 = time = 110
trigger2 = numpartner = 1
trigger2 = time = ifelse(numpartner = 1 && partner,alive && (partner,name = "Juano`s Sub guy" || partner,name ="Juano`s Kit girl" || partner,name ="juano`s cyborg guy"),250,110)
trigger2 = (id = 56 && teamside = 1) || (id = 58 && teamside = 2)
anim = ifelse(var(42) < 2,6995,6994)
pos = 160,100
id = 6995
postype = left
removetime = 9999
ontop = 1
ownpal = 1
persistent = 0

[State desaparece msg]
type = ModifyExplod
triggerall = time = 110
trigger1 = numhelper(7021)
trigger1 = helper(7021),var(0) = 1
trigger2 = numhelper(7043)
id = 6995
removetime = ifelse(winperfect,140,40)

[State 0, increiblewinning]
type = explod
triggerall = var(42) > 2
trigger1 = time = 20 && winperfect
ignorehitpause = 1
anim = 6992
pos = 160,220
facing = 1
postype = left
bindtime = -1
ownpal = 1
ontop = 1
persistent = 0
removetime = 120

[State cantidaddeflawles]
type = varadd
trigger1 = !time && winperfect
ignorehitpause = 1
var(42) = 1

[State findeflawles]
type = varset
trigger1 = !time && !winperfect
ignorehitpause = 1
var(42) = 0

;---------------------------------------
[State fin normal]
type = assertspecial
triggerall = winperfect
trigger1 = !numpartner
trigger1 = time < 450
trigger2 = numpartner = 1
trigger2 = time < ifelse(numpartner = 1 && partner,alive && (partner,authorname = "juano16"),420,300)
flag = roundnotover

[State fin fatality]
type = assertspecial
trigger1 = numhelper(7021)
trigger1 = helper(7021),var(0) && (time <= 550 && winperfect || time <= 450 && !winperfect)
trigger2 = time < 400
trigger2 = !numpartner
trigger3 = time < 300
trigger3 = numpartner = 1
trigger3 = partner,authorname = "juano16"
flag = roundnotover
;----------------------------------------------------------------
;---------------------------------------------------------------------------
; GUARD (start)
[Statedef 120]
type = U    ;Leave state type unchanged
physics = U ;Leave physics unchanged

[State 120, 1]
type = ChangeAnim
trigger1 = Time = 0 && prevstateno != 20 && prevstateno != 40
value = 120 + (statetype = C) + (statetype = A)*2

[State 120, 1]
type = ChangeAnim
triggerall = !Time && anim != 1302
trigger1 = prevstateno = 20
trigger2 = prevstateno = 40
value = 130

[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 = statetype = S && command = "holddown"
statetype = C
physics = C

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

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

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

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

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

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

[State 130, Stop Guarding]
type = ChangeState
triggerall = command != "hold_z" && time >= 8
trigger1 = command != "holdback"
trigger2 = !inguarddist
value = 140

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

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

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

[State 131, Stop Guarding]
type = ChangeState
triggerall = (command != "hold_z" && command != "holddown") || command != "hold_z"
triggerall = time >= 8
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 151, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

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

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

[State 151, Hi to Lo]
type = StateTypeSet
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 153, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

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

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

[State 153, Hi to Lo]
type = StateTypeSet
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
;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State stand]
type = ChangeAnim
triggerall = time >= 1
trigger1 = anim != 1
trigger1 = var(20) != 1
value = 1

[State -3, Helper]
type = null;Helper
triggerall = random < 75 && !time && !var(21)
trigger1 = !numpartner && p2name != "Juano`s Sub guy"  && p4name != "Juano`s Sub guy" && p2name != "Juano`s Kit girl"  && p4name != "Juano`s Kit girl"
trigger2 = !numpartner && teamside = 1 && (p2name = "Juano`s Sub guy"  || p4name = "Juano`s Sub guy" || p2name = "Juano`s Kit girl" || p4name = "Juano`s Kit girl")
trigger3 = numpartner = 1
trigger3 = (id = 56 && teamside = 1) || (id = 58 && teamside = 2)
helpertype = normal
name = "El chapulin colorado"
ID = 70420
stateno = 70420
pos = 170,-400
postype = left
facing = 1
ownpal = 1
scale = const(size.xscale),const(size.yscale)

[State 0, VarSet]
type = VarSet
triggerall = var(57) < 20
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
v = 59
value = 0

[State -2, sifatalanobonus]
type = varset
triggerall = var(58) = -2
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
var(58) = 0

[State 5900, 1] ;Clear all int variables part 1
type = VarRangeSet
triggerall = !time 
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
value = 0
first = 0
last = 19

[State 5900, 2] ;Clear all int variables part 2
type = VarRangeSet
triggerall = !time 
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
value = 0
first = 21
last = 57

[State 5900, 2] ;Clear all float variables
type = varRangeSet
triggerall = !time 
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
fvalue = 0

[State FATALITY]
type = varadd
triggerall = !var(41)
Trigger1 = TeamMode = turns
Trigger2 = enemynear,TeamMode = turns
trigger3 = RoundsExisted = 0 && RoundNo > 1
var(41) = 1

[State 5900, 3] ;Intro
type = ChangeState
triggerall = time >= 1
trigger1 = roundno = 1
trigger2 = RoundsExisted = 0 && TeamMode = Turns && RoundNo > 0
value = 190

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

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

[State sile mk]
type = ChangeAnim
trigger1 = !time && vel x <= -8
value = 6058

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0 && vel x > -8
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver && anim != 6058
trigger2 = HitOver && !animtime && anim = 6058
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver && anim != 6058
trigger2 = HitOver && !animtime && anim = 6058
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver && anim != 6058
trigger2 = HitOver && !animtime && anim = 6058
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

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

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

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

[State 5050, 5]; Recover in mid air
type = ChangeState
triggerall = Vel Y > -1 && alive && CanRecover
trigger1 = time >= 8
value = 5040

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]), 0, 25)
value = 5100 ;HIT_BOUNCE
;---------------------------------------------------------------------------
; HIT_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
;trigger1 = GetHitVar(fall.yvel) = 0
sysvar(1) = floor(vel y)

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

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

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

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

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

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

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
;value = 61
;pos = 0, 0
;under = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 10

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

[State 5100, 10]
type = PlaySnd
trigger1 = !Time
value = 2, 1

[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_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N

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

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = anim = 5070
value = 5071

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

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = !time && (anim != [5070,5071])
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 && (anim != [5070,5071])
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 6]
type = PlaySnd
trigger1 = !Time
value = 2, 2-alive

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

[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]) || anim = 5071
value = 5150

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

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

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

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

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

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

[State 0, comolevantarse]
type = VarRandom
trigger1 = !time
v = 15
range = 0,3

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = anim != 5120
trigger1 = anim = 5071
value = 5120
;------------------------------
[State 5120, 1a] ;Get up anim (luego de legrab)
type = ChangeAnim
triggerall = time = 1
trigger1 = anim != 5120
value = 7072

[State 0, PosAdd]
type = PosAdd
triggerall = anim = 7072
trigger1 = !animelemtime(6)
x = const(size.xscale)*30
;---------------------------------

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = null;ChangeAnim
triggerall = !time
trigger1 = anim = 5071
triggerall = prevstateno != 6037
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, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

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

[State 5120, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
;sprpriority = -3

[State endWins]
type = varset
trigger1 = !time
triggerall = name = "Juano`s Sub guy"
ignorehitpause = 1
var(57) = 0

[State findeflawles]
type = varset
trigger1 = !time
triggerall = name = "Juano`s Sub guy"
ignorehitpause = 1
var(42) = 0

[State caesinbrazos]
type = PlaySnd
trigger1 = anim = 70781 && animelem = 11
value = 2, 2

[State 0, caesinbrazos]
type = EnvShake
trigger1 = anim = 70781 && animelem = 11
time = 8
ampl = -4
;------------------------------ BAJA EN KOMBATTOMB Y BELLTOWER
[State 0, altosibelltower]
type = VelSet
trigger1 = prevstateno = 607721
trigger2 = prevstateno = 607714 ;kombat tomb
trigger2 = pos Y < -260 || pos Y > -20
y = 0
[State 0, bajaBelltower]
type = PosAdd
triggerall = !(time%2)
trigger1 = random < 100 && prevstateno = 607721 ;BELLTOWER
trigger2 = prevstateno = 607714 && pos Y < -260 ;kombat tomb
trigger2 = enemynear,command = "holddown" && random < 200
y = 1
[State 0, CaeTomb]
type = gravity
triggerall = prevstateno = 607714
trigger1 = pos Y >= -260 && pos Y < -20
[State 0, tiemblaalCAER]
type = EnvShake
triggerall = prevstateno = 607714
trigger1 = pos Y = [-20,1]
time = 10
ampl = -4
persistent = 0
;--------------------------------------
[State 0, SprPriority]
type = SprPriority
trigger1 = name = "Peter Griffin2"
value = 5

[State 0, AssertSpecial]
type = AssertSpecial
trigger3 = name = "Leela"
trigger2 = name = "Homero J Simpson"
trigger1 = name = "Peter Griffin"
flag = noautoturn

[State 5150, decapitado] ;peter decapitado
type = ChangeAnim
trigger1 = PrevStateNo != 60532
trigger1 = prevstateno = 60722
;trigger3 = name = "Leela"
;trigger2 = name = "Homero J Simpson"
;trigger1 = name = "Peter Griffin"
value = 91232
elem = 2

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = anim != 9108108 && prevstateno != 91230 && anim != 912320 && prevstateno != 60501
triggerall = prevstateno != 607723 && anim != 9108111 && anim != 9108107 && prevstateno != 607713
triggerall = prevstateno != 607721 && anim != 9108112
triggerall = prevstateno != 607719 && anim != 9108091
triggerall = prevstateno != 607211
triggerall = prevstateno != 607714; kombat tomb
triggerall = anim != 9108104+ifelse(name = "juano`s morph guy",var(20)*1000,0) && anim != 9108105+ifelse(name = "juano`s morph guy",var(20)*1000,0);babality
triggerall = anim != 607713 && anim != 607715; por si cayo del pit 2
triggerall = anim != 912332 && anim != 91231 ;no si esta decapitado peketo
triggerall = PrevStateNo != 60532 && PrevStateNo != 607211 && PrevStateNo != 607212
;triggerall = name != "Leela"
;triggerall = name != "Homero J Simpson"
;triggerall = name != "Peter Griffin"
triggerall = prevstateno != 6076 && prevstateno != 60770 && prevstateno != 60780
triggerall = prevstateno != 6053 && prevstateno != 60723
triggerall = prevstateno != [6061,6062]
triggerall = !Time && anim != 5071 && prevstateno != 60726
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
triggerall = anim != 9108108 && prevstateno != 91230 && anim != 912320 && prevstateno != 60501
triggerall = prevstateno != 607723 && anim != 9108111 && anim != 9108107 && prevstateno != 607713
triggerall = prevstateno != 607721 && anim != 9108112
triggerall = prevstateno != 607719 && anim != 9108091
triggerall = prevstateno != 607211
triggerall = prevstateno != 607714; kombat tomb
triggerall = anim != 9108104+ifelse(name = "juano`s morph guy",var(20)*1000,0) && anim != 9108105+ifelse(name = "juano`s morph guy",var(20)*1000,0);babality
triggerall = anim != 607713 && anim != 607715; por si cayo del pit 2
triggerall = anim != 912332 && anim != 91231 ;no si esta decapitado peketo
triggerall = PrevStateNo != 60532 && PrevStateNo != 607211 && PrevStateNo != 607212
;triggerall = name != "Leela"
;triggerall = name != "Homero J Simpson"
;triggerall = name != "Peter Griffin"
triggerall = prevstateno != 6076 && prevstateno != 60770 && prevstateno != 60780
triggerall = prevstateno != 6053 && prevstateno != 60723 && prevstateno != 60726
triggerall = prevstateno != [6061,6062]
trigger1 = !Time && anim != 5071
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
triggerall = anim != 9108108 && prevstateno != 91230 && anim != 912320 && prevstateno != 60501
triggerall = prevstateno != 607723 && anim != 9108111 && anim != 9108107 && prevstateno != 607713
triggerall = prevstateno != 607721 && anim != 9108112
triggerall = prevstateno != 607719 && anim != 9108091
triggerall = prevstateno != 607211
triggerall = prevstateno != 607714; kombat tomb
triggerall = anim != 9108104+ifelse(name = "juano`s morph guy",var(20)*1000,0) && anim != 9108105+ifelse(name = "juano`s morph guy",var(20)*1000,0);babality
triggerall = anim != 607713 && anim != 607715; por si cayo del pit 2
triggerall = anim != 912332 && anim != 91231 ;no si esta decapitado peketo
triggerall = PrevStateNo != 60532 && PrevStateNo != 607211 && PrevStateNo != 607212
;triggerall = name != "Homero J Simpson"
;triggerall = name != "Peter Griffin"
;triggerall = name != "Leela"
persistent = 0
triggerall = prevstateno != 6076 && prevstateno != 60770 && prevstateno != 60780
triggerall = prevstateno != 6053 && prevstateno != 60723
triggerall = prevstateno != [6061,6062]
trigger1 = MatchOver = 1 && anim != 5071 && prevstateno != 60726
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
triggerall = anim != 9108108 && prevstateno != 91230 && anim != 912320 && prevstateno != 60501
triggerall = prevstateno != 607723 && anim != 9108111 && anim != 9108107 && prevstateno != 607713
triggerall = prevstateno != 607721 && anim != 9108112
triggerall = prevstateno != 607719 && anim != 9108091
triggerall = prevstateno != 607211
triggerall = prevstateno != 607714; kombat tomb
triggerall = anim != 9108104+ifelse(name = "juano`s morph guy",var(20)*1000,0) && anim != 9108105+ifelse(name = "juano`s morph guy",var(20)*1000,0);babality
triggerall = anim != 607713 && anim != 607715; por si cayo del pit 2
triggerall = anim != 912332 && anim != 91231 ;no si esta decapitado peketo
triggerall = PrevStateNo != 60532 && PrevStateNo != 607211 && PrevStateNo != 607212
;triggerall = name != "Homero J Simpson"
;triggerall = name != "Peter Griffin"
;triggerall = name != "Leela"
triggerall = prevstateno != 6076 && prevstateno != 60770 && prevstateno != 60780
trigger1 = !Time && anim != 5071
triggerall = prevstateno != 6053 && prevstateno != 60723 && prevstateno != 60726
triggerall = prevstateno != [6061,6062]
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 0, noesta]
type = ChangeAnim2
triggerall = anim != 9108104 && anim != 9108105;babality
triggerall = PrevStateNo != 60532 && PrevStateNo != 607211 && PrevStateNo != 607212
;triggerall = name != "Homero J Simpson"
;triggerall = name != "Peter Griffin"
;triggerall = name != "Leela"
triggerall = prevstateno != 6076 && prevstateno != 60770 && prevstateno != 60726
trigger1 = name = "Juano`s Sub guy"
trigger1 = palno = 7
trigger1 = prevstateno = 6062 || prevstateno = 6058 || prevstateno = 6064
value = 7049

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

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

[State -2]
type = assertspecial
trigger23 = prevstateno = 60552
trigger22 = prevstateno = 90063 ; team fatality 3
trigger21 = prevstateno = 60531
trigger20 = prevstateno = 60501 && !selfanimexist(9108120) ;quemado
trigger19 = prevstateno = 91230 && (anim = 912320 || anim = 5300) ; chop and eat peketo
trigger18 = prevstateno = 60561 ;comido mileena
trigger17 = prevstateno = 60551
trigger16 = prevstateno = 60521 ;kiss of death
trigger15 = prevstateno = 60500 ;por si kitana decapitacion
trigger14 = prevstateno = 60860 ;pos Si hell hand
trigger13 = prevstateno = 607723 ; subway MKA
trigger12 = prevstateno = 607719 ; subway
trigger11 = prevstateno = 607717 ;scorpion liar
trigger10 = prevstateno = 607716 ; the pit 3
trigger9 = prevstateno = 60840 && anim != 9108104+ifelse(name = "juano`s morph guy",var(20)*1000,0) && anim != 9108105+ifelse(name = "juano`s morph guy",var(20)*1000,0);babality
trigger8 = prevstateno = [607213,607214];fatality compatibles
trigger7 = prevstateno = 91231 && name = "Juano`s Kit girl" ;por si peketo
trigger6 = prevstateno = 607212 || prevstateno = 607210 ;por si peketo 2
trigger5 = (prevstateno = [6050,6080]) ;|| (prevstateno = [60722,60729])
trigger4 = prevstateno = 60779
trigger3 = prevstateno = 60727
trigger2 = prevstateno = 60726
trigger1 = prevstateno = 6053 || prevstateno = 6055  || prevstateno = 6058 || (prevstateno = [6061,6098]) || (prevstateno = 60811)
triggerall = prevstateno != 6076 && prevstateno != 60770
ignorehitpause = 1
flag = invisible

[State 0, camaranosemuevesisatagefatality]
type = ScreenBound
trigger1 = prevstateno = 60770
trigger2 = prevstateno = 607713
trigger3 = prevstateno = 607717
trigger4 = prevstateno = 60840
trigger5 = prevstateno = 607719
trigger6 = prevstateno = 50501
trigger7 = prevstateno = 60510
value = 0
movecamera = 0,0

[State 0, PIT2 noFGBG]
type = AssertSpecial
trigger1 = prevstateno = 607713
flag = noBG
flag2 = noFG

[State 0,porsistagefatalitypicos]
type = assertspecial
trigger1 = prevstateno = 60770
trigger2 = prevstateno = 607714
trigger3 = prevstateno = 607719
trigger4 = prevstateno = 607721
trigger5 = prevstateno = 60510
flag = noKOsnd
flag2 = noshadow

[State ]
type = PosSet
triggerall = prevstateno != 60770 && prevstateno != 607711 && prevstateno != 607713 && prevstateno != 607714 && prevstateno != 607716 && prevstateno != 607717 && prevstateno != 607719 && prevstateno != 607721 && prevstateno != 607211
triggerall = prevstateno != 60510 
trigger1 = p2name = "juano`s sub guy"
trigger2 = p2name = "juano`s kit girl" 
y = 0

[State 0, AfterImageTime]
type = AfterImageTime
trigger1 = alive = 0
time = 0
ignorehitpause = 1

[State 0, fisicaOFF]
type = StateTypeSet
trigger1 = prevstateno = 607711
trigger2 = prevstateno = 607713
trigger3 = prevstateno = 607714
trigger4 = prevstateno = 607715 || prevstateno = 607716
trigger5 = prevstateno = 607719
trigger6 = prevstateno = 607721
trigger7 = prevstateno = 60510
statetype = A
movetype = H
physics = N

;---------------------------------------------------------------------------
; se va para atras
[Statedef 50500]
type    = S
movetype= H
physics = N
anim = 804
velset = -4

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

[State ow]
type = Playsnd
trigger1 = !time
value = 2,var(3)
channel = 0

[State 0, ChangeState]
type = ChangeState
trigger1 = !animtime
value = ifelse(!alive,50501,0)
;---------------------------------------------------------------------------
; Cae como mk3
[Statedef 50501]
type    = L
movetype= H
physics = S
velset = 0,0
anim = 50500

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

[State 0, PlaySnd]
type = PlaySnd
trigger1 = animelem = 7
value = S2,2

[State 0, EnvShake]
type = EnvShake
trigger1 = animelem = 7
time = 10
ampl = -4

[State 0, PosAdd]
type = PosAdd
trigger1 = animelem = 7
x = -71*const(size.xscale)

[State 0, ChangeState]
type = ChangeState
trigger1 = !animtime
value = 5150

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

[State 5030, umk3]
type = ChangeState
triggerall = !alive && vel Y = 0
trigger1 = GetHitVar(groundtype) != 1
value = 50500

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

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

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

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

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