; States file for {character} -- Overrides and Common states
;
;---------------------------------------------------------------------------
; Vars:
;   0: for Super Jump (0=vertical, 1=forward, -1=backward)
;   2: keep track of power level (for levelup sounds)
;  10: flood mode
;  11: flood mode count
;  50: Desperation quote ("DANGER!" or whatever)
;  59: AI flag
; Helpers:
;   0: superjump opponent position indicator
; Explods:
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------

;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
movetype = I
physics = N
anim = 100
sprpriority = 1
velset = const(velocity.run.fwd.x), 0

[State 100, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = S8,0

[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
triggerall = !Var(59)
trigger1 = command != "holdfwd";Time = 135
value = 0
ctrl = 1

[State 100, 4]
type = ChangeState
triggerall = Var(59)
trigger1 = time > 15
value = 0
ctrl = 1


[Statedef 101]
type    = A
movetype = I
physics = N
anim = 100
sprpriority = 1
velset = const(velocity.run.fwd.x), 0

[State 100, PlaySnd]
type = PlaySnd
trigger1 = Time = 0
value = S8,0

[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 = Time >= 35
value = 948
ctrl = 1


;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]

[State 0, PowerSet]
type = PowerSet
triggerall = enemynear, name ="Trainingroom"
trigger1 = power != 3000
value = 3000

[State -2, debug]       ; (debug clipboard)
type = DisplayToClipboard
trigger1 = 1 ;Alive
text = "PalNo: %d - Pos Y: %f"
params = PalNo, Pos Y

[State -2, PosSet]
type = PosSet
trigger1 = Alive
z = 0.9

        ;hover
[State 0, VelAdd]
type = VelAdd
triggerall = statetype = A
triggerall = vel y > 2
triggerall = movetype != A
triggerall = movetype != H
triggerall = ctrl
trigger1= command = "holdup"
y = -0.5

[State -2, gethits]         ; custom gethit sounds
type = PlaySnd
triggerall = (stateno = [5000,5210]) && (Time = 0) && (!IsHelper)
trigger1 = anim = 5002  ; standing hard hit high
trigger2 = anim = 5012  ; stand hard hit low
trigger3 = anim = 5022  ; crouching hard hit
trigger4 = anim = 5030  ; air hit
trigger5 = anim = 5070  ; tripped
persistent = 0
value = 4,0




[state - 2, flood mode]
type = varset
triggerall = stateno = [3301,3399]
trigger1 = var(10) = 0
v = 10
value = 1

[state - 2, flood mode 0ff]
type = varset
trigger1 = stateno = 0  && var(10) = 1 ;numexplod(3310)=0
v = 10
value = 0

[State -2]
type = VarSet
triggerall = var(11) = 0 && var(10) = 0
trigger1 = 1
v = 11
value = 1000

[State -2, contador]
type = VarAdd
triggerall = var(11) != 0 && var(10) = 1
trigger1 = (GameTime % 1) = 0
v = 11
value = -1

[State -2]
type = VarSet
triggerall = var(11) = 0 && var(10) = 1
trigger1 = 1
v = 10
value = 0

[State 0, RemoveExplod]
type = RemoveExplod
triggerall = numexplod(3310)>0
trigger1 =  var(10) = 0
trigger2 = lose
id = 3310
;ignorehitpause =
;persistent =

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 =  numexplod(3101)>0 && stateno != 3100
id = 3101

[State -2]
type = VarSet
triggerall = lose && var(10) = 1
trigger1 = 1
v = 10
value = 0

;---------------------------------------------------------------------------
; States that are executed when in self's state file (use statedef -3)
;---------------------------------------------------------------------------
[Statedef -3]

;[State -3, SuperPause]
;type = SuperPause
;triggerall = var(10) = 1 ;&& var(45) !=0
;triggerall = enemynear, name != "Aquaman"
;triggerall = p2stateno = [0,110] ;&& (stateno = [0,999] || stateno = [5000,6000])
;trigger1 = timemod = 2,1 ;&& time < 10
;Time = 2
;pos = 9999,-9951
;movetime = 2
;darken = 0
;move = 2

[State -3, Landing Dust]
type = Explod
triggerall =  NumExplod(60) < 1
triggerall = Time = 3
trigger1 = StateNo = 52 ;Jump land
trigger2 = StateNo = 101 ;Run-fdw land
trigger3 = StateNo = 106 ;Run-back land
trigger4 = PrevStateNo = 52 && StateNo = 11 ;Jump land/crouch
persistent = 0
ID = 60
anim = 60
postype = p1
pos = 7, 3
velocity = 0, 0
accel = 0, 0
removetime = -2
sprpriority = -2
ownpal = 1

[State -3, Landing Sound]
type = PlaySnd
triggerall = Time = 1 && Var(20) != 2
trigger1 = StateNo = 52 ;Jump land
trigger2 = StateNo = 101 ;Run-fwd land
trigger3 = StateNo = 106 ;Run-back land
value = 8, 1


; desperation quote
[State -3, PlaySnd]
type = PlaySnd
trigger1 = (Life <= 150) && (var(50) = 0)
value = S11,1

[State -3, VarSet]
type = VarSet
trigger1 = Life <= 150
v = 50
value = 1





[State -3, Overide Hits]
type = HitOverRide
trigger1 = StateNo = 3301  ||  StateNo = 3320  ||   StateNo = 3330
trigger2 = StateNo = 3340  ||  StateNo = 3350  ||   StateNo = 3360
trigger3 = StateNo = 3370  ||  StateNo = 3380  ||   StateNo = 3210
;trigger4 = StateNo = 1012
time = 2
slot = 0
attr = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT;SCA, AA, AP, AT
stateno = 3210



[State -3, 2]
type = PlaySnd
triggerall = Time = 1
triggerall = Life
triggerall = random % 10 > 5
trigger1 = stateno = 5000 || stateno = 5020
trigger1 = anim != 5000 && anim != 5010
trigger2 = stateno = 5010
trigger2 = anim != 5020
value = 174,0
channel = 0
ignorehitpause = 1
volume = 255

[State -3, 2]
type = PlaySnd
triggerall = Time = 1
triggerall = Life
triggerall = random % 10 > 5
trigger1 = stateno = 5000 || stateno = 5020
trigger1 = anim != 5000 && anim != 5010
trigger2 = stateno = 5010
trigger2 = anim != 5020
value = 174,1
channel = 0
ignorehitpause = 1
volume = 255
