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

;mina
[State 0, 1]
type = ChangeAnim
trigger1 = numhelper(4666)=1
trigger1 = Anim != 6200 && anim !=6205 && anim != 5
trigger2 = anim = 6205 && animtime = 0
value = 6200

;critical
[State 0, b]
type = ChangeAnim
triggerall = life <= 250
triggerall = numhelper(4666)=0
trigger1 = Anim != 2 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 2

;normal
[State 0, 1]
type = ChangeAnim
triggerall = life > 250
trigger1 = Anim != 0 && Anim != 5 && anim!= 6200 && anim != 6205
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
trigger3 = anim = 6200 && numhelper(4666)=0
value = 0

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = numhelper(4666)=1
trigger1 = anim = 5
value = 6205

[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

;helper morph - AL AZAR
[State 0, Helper]
type = Helper
trigger1 = anim = 0 && numhelper(4666)=0 && random <5
name = "morph"
ID = 4666
stateno = 4666
postype = p1
pos = 0,0
bindtime = -1

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

[State 440, 2]
type = PlaySnd
trigger1 = anim = 2 && animelem = 3
value = 5, 6
freqmul = 0.9+(random/3333.3)
channel = 0

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

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = ifelse(numhelper(4666)=0,10,6210)

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

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

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

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
trigger2 = anim = 6215 && animtime = 0
value = ifelse(numhelper(4666)=0,11,6211)

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && numhelper(4666)=1
value = 6215

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

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

[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = !time
value = ifelse(numhelper(4666)=0,12,6212)

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

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

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

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

;turn
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = numhelper(4666)=1
trigger1 = anim = 5
value = 6205

;ad male
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
triggerall = numhelper(4666)=0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

;ad female
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
triggerall = numhelper(4666)=1
trigger1 = Anim != 6220 && Anim != 6205
trigger2 = Anim = 6205 && AnimTime = 0
value = 6220

;at male
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
triggerall = numhelper(4666)=0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21

;at female
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
triggerall = numhelper(4666)=1
trigger1 = Anim != 6221 && Anim != 6205
trigger2 = Anim = 6205 && AnimTime = 0
value = 6221

[State -3, Landing Sound]
type = PlaySnd
trigger1 = animelem = 3
value = 40, 0
freqmul = 0.9+(random/3333.3)
volume = -100

;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = ifelse(numhelper(4666)=0,40,6240)
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(var(15)=1,2.4,ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x))))
y = ifelse(var(15)=0,const(velocity.jump.y),-13)

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

[State 0, afterimage]
type = AfterImage
trigger1 = var(15)= 1 && AnimTime = 0
time = 30
FrameGap = 1
length = 4
PalContrast = 200,0,0
PalBright = 100,-80,-180
TimeGap = 2
PalColor = 0
Trans = add
persistent = 0
paladd = 50,0,0

[State 0, Explod]
type = Explod
trigger1 = AnimTime = 0
anim = f 63
pos = 0,10
facing = ifelse(random<500,1,-1)
scale = 0.3,0.3
sprpriority = 3
ownpal = 1

[State 0, Explod]
type = Explod
trigger1 = AnimTime = 0
anim = f 64
scale = 0.5,0.5
pos = 0,10
facing = ifelse(random<500,1,-1)
sprpriority = 0
ownpal = 1

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

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

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

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

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0 && numhelper(4666)=1
value = ifelse((vel x)=0, 6241, ifelse((vel x)>0, 6242, 6243))

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

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 0
anim = ifelse(numhelper(4666)=0,47,6247)

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

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

[State 0, ChangeState]
type = ChangeState
trigger1 = numhelper(4666)=1
value = 101
ctrl = 0

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

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

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

[State 100, 4]
type = ChangeState
trigger1= var(24)=0 && command != "holdfwd"
trigger2= var(24)!=0 && p2bodydist x<60
trigger3= var(24)>=2 && enemynear, name = "ananzi" && enemynear, numhelper(1100)=1
trigger4 = var(24)>=2 && enemynear, name = "ananzi" && enemynear, stateno = 3100
value = 0

[State -3, Landing Sound]
type = PlaySnd
trigger1 = animelem = 3
value = 40, 0
freqmul = 0.8+(random/3333.3)
volume = -50

;---------------------------------------------------------------------------
; RUN_FWD FEMALE
[Statedef 101]
type    = A
physics = A
ctrl = 0
anim = 6241
sprpriority = 1

[State 440, 2]
type = PlaySnd
trigger1 = !time && random < 500
value = 5,15+(random<500)
freqmul = 0.9+(random/3333.3)
channel = 0

[State 200, 1]
type = PlaySnd
trigger1 = Time = 1
value = 0, 3
freqmul = 0.9+(random/3333.3)

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

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

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

;---------------------------------------------------------------------------
; RUN_BACK
[Statedef 105]
type    = A
physics = A
ctrl = 0
anim = ifelse(numhelper(4666)=0,105,6241)
sprpriority = 1

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

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

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

;--------------------------------------------
;muerto
[Statedef 5150, 0]
type = S
ctrl = 0
velset = 0,0
movetype = I
physics = S
sprpriority = 0

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

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = !time
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
value = 5111

[State 610, 2]
type = changeanim
triggerall= Anim != 91231 ;fatal peketo
triggerall= Anim != 91240 ;fatal animus
triggerall= Anim != 6304 ;fatal animus, peketo DF
triggerall= Anim != 5111 ;up type
trigger1 = !time
value = 5150

[State 0, ChangeAnim2]
type = ChangeAnim2
trigger1 = anim = 91240
value = 91241

;es peketo DF
[State 0, ChangeAnim2]
type = ChangeAnim
trigger1 = anim = 6304
value = 6305

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

;-----------------
;fatal move Peketo
;-----------------
;decapitado - cabeza (helper)
[Statedef 912320]
type    = A
movetype= I
physics = N
poweradd= 0
ctrl = 0
velset = ifelse((root,stateno=91230),-1.3,-1),ifelse(root,stateno=3011,-10,-5)
sprpriority = 7
anim = 912320

[State 210, Width]
type = veladd
trigger1 = 1
y = .3

[State 191, Snd 2]
type = PlaySnd
trigger1 = pos Y >= -3 && vel y > 0
value = F7,0
freqmul = 1.3
volume = 100
persistent = 0

[State 220, 3]
type = velset
trigger1 = pos Y >= -3 && vel y > 0
y = -4.8
persistent = 0

[State 220, 3]
type = changeanim
trigger1 = pos Y >= 0 && vel y > 0 && anim != 912321
value = 912321

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

[State 0, VelSet]
type = posSet
trigger1 = anim = 912321
y = 4

[State 191, Snd 2]
type = PlaySnd
trigger1 = anim = 912321 && animelem = 1
value = F7,0
freqmul = 1.3
volume = 100

[State 191, Snd 2]
type = PlaySnd
trigger1 = anim = 912321 && animelem = 2
value = 11,1

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