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

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

;--------------------
; Remove Dust Explod
[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType != A
id = 900

[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = MoveType != A
id = 905
;--------------------

;--------------------
; Guard Shield
[State -2, Shield]
type = null ;Helper
triggerall = NumHelper(950) <= 0
trigger1 = StateNo = 120
trigger1 = AnimTime = 0
trigger2 = StateNo >= 130
trigger2 = StateNo < 140
trigger3 = StateNo >= 150
trigger3 = StateNo < 160
helpertype = normal
ignorehitpause = 1
name = "Shield"
size.ground.back = 10
size.ground.front = 10
size.air.back = 10
size.air.front = 10
id = 950
pos = 0, -35
postype = p1
stateno = 950
keyctrl = 0
ownpal = 1

[State -2, Shield]
type = Helper
triggerall = NumHelper(955) <= 0
trigger1 = StateNo = 120
trigger1 = AnimTime = 0
trigger2 = StateNo >= 130
trigger2 = StateNo < 140
trigger3 = StateNo >= 150
trigger3 = StateNo < 160
helpertype = normal
ignorehitpause = 1
name = "Shield"
size.ground.back = 10
size.ground.front = 10
size.air.back = 10
size.air.front = 10
id = 955
pos = 0, -35
postype = p1
stateno = 955
keyctrl = 0
ownpal = 1

[State -2, Variables]
type = DisplayToClipboard
trigger1 = 1
text = "Guard Shield: %f"
params = FVar(10)

[State -2, VarSet]
type = VarSet
trigger1 = RoundState <= 0
trigger2 = FVar(10) >= 1.1
fv = 10
value = 1.1

[State -2, VarSet]
type = VarSet
trigger1 = StateNo = 5310
fv = 10
value = 0.75

[State -2, VarSet]
type = VarSet
trigger1 = FVar(10) <= 0
fv = 10
value = 0

[State -2, VarAdd]
type = VarAdd
triggerall = FVar(10) < 1.1
triggerall = RoundState >= 2
triggerall = MoveType != H
trigger1 = StateNo < 120
trigger2 = StateNo >= 140
trigger2 = StateNo < 150
trigger3 = StateNo >= 160
fv = 10
value = 0.0005

[State -2, VarAdd]
type = VarAdd
triggerall = FVar(10) > 0.5
triggerall = RoundState >= 2
trigger1 = StateNo >= 120 && StateNo < 140
fv = 10
value = -0.001

[State -2, VarAdd]
type = VarAdd
triggerall = FVar(10) > 0.5
triggerall = RoundState >= 2
triggerall = MoveType = H
trigger1 = StateNo >= 150 && StateNo < 160
fv = 10
value = -0.002

[State -2, State]
type = ChangeState
triggerall = Life > 0 
triggerall = RoundState >= 2
trigger1 = FVar(10) <= 0.5
value = 5310
;--------------------

;--------------------
; Artificial AI 
[State -2, AI]
type = Helper
triggerall = Alive
triggerall = !Lose
triggerall = NumHelper(6666) = 0
trigger1 = Time <= 0
helpertype = normal
name = "AI Trigger"
id = 6666
pos = 1000, 1000
stateno = 6666
keyctrl = 1
ownpal = 1
;--------------------

;--------------------
; No Standard Guarding
[State -2, Special]
type = AssertSpecial
trigger1 = 1 
flag  = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoAirGuard
;--------------------

;--------------------
; KO Scream
[State -2, VarSet]
type = VarSet
trigger1 = Alive
trigger1 = Life > 0
ignorehitpause = 1
v = 55
value = -1

[State -2, VarAdd]
type = VarAdd
trigger1 = Alive = 0
trigger1 = Life <= 0
trigger1 = Var(55) <= 0
ignorehitpause = 1
v = 55
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = Var(55) > 0
ignorehitpause = 1
v = 55
value = 1

[State -2, PlaySnd]
Type = PlaySnd
triggerall = Var(5) = 0
triggerall = Alive = 0
triggerall = Life = 0
trigger1 = Var(55) = 0
value = 11, 2
;channel = 0
;--------------------

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

;--------------------
; Air Stand Bug Fix 
[State -3, State]
type = ChangeState
trigger1 = StateNo = 0
trigger1 = Pos Y != 0
value = 50
;--------------------

;--------------------
; Single Jump
[State -2, VarSet]
type = VarSet
trigger1 = StateNo != 40
trigger1 = Command = "holdup"
v = 40
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = StateNo != 40
trigger1 = Command != "holdup"
v = 40
value = 0
;--------------------

;--------------------
; AirJump Move
[State -3, VelAdd]
type = VelAdd
triggerall = Vel X < 2
triggerall = StateType = A
triggerall = Command = "holdfwd"
trigger1 = MoveType = A
trigger2 = Ctrl
x = .25

[State -3, VelAdd]
type = VelAdd
triggerall = Vel X > -2
triggerall = StateType = A
triggerall = Command = "holdback"
trigger1 = MoveType = A
trigger2 = Ctrl
x = -.25

[State -3, VelSet]
type = VelSet
triggerall = StateType = A
triggerall = MoveType != H
trigger1 = Vel Y >= 5
trigger1 = Vel Y < 8
y = 5

[State -3, VelSet]
type = VelSet
triggerall = StateType = A
triggerall = MoveType != H
trigger1 = Vel Y >= 10
y = 10

[State -3, PalFX]
type = PalFX
triggerall = Command = "down" && Command != "reldown"
triggerall = StateType = A
triggerall = MoveType != A
trigger1 = StateNo > 40
trigger1 = StateNo < 52
trigger1 = Vel Y > 0
trigger1 = Vel Y < 8
trigger1 = Ctrl
time = 1
add = 150,150,150

[State -3, VelSet]
type = VelSet
triggerall = Command = "down" && Command != "reldown"
triggerall = StateType = A
triggerall = MoveType != A
trigger1 = StateNo > 40
trigger1 = StateNo < 52
trigger1 = Vel Y > 0
trigger1 = Vel Y < 8
trigger1 = Ctrl
y = 8
;--------------------

;--------------------
; Air Jump Recovery
[State -3, State]
type = ChangeState
triggerall = Alive
triggerall = Life > 0
triggerall = CanRecover
triggerall = Command = "up"
trigger1 = MoveType = H
trigger1 = StateNo < 5070
trigger1 = Vel Y > 0
value = 45
;--------------------

;--------------------
; Jump Recovery Sounds
[State -3 Sound]
type = PlaySnd
trigger1 = Anim = 5200
trigger1 = AnimElem = 1, 1
value = 10,25
channel = 0

[State -3, Sound]
type = PlaySnd
trigger1 = Anim = 5210
trigger1 = AnimElem = 1, 1
value = 10,25
channel = 0
;--------------------

;--------------------
;Hit Sounds
[State -3, PlaySnd]
type = PlaySnd
triggerall = Alive
triggerall = Life > 0
triggerall = Time = 1
triggerall = Random <= 500
triggerall = StateNo = 5000 || StateNo = 5010
trigger1 = Anim = 5000 || Anim = 5010 || Anim = 5020
trigger2 = Anim = 5001 || Anim = 5011 || Anim = 5021
value = 10, 31

;[State -3, PlaySnd]
;type = PlaySnd
;triggerall = Alive
;triggerall = Life > 0
;triggerall = Time = 1
;triggerall = Random <= 500
;triggerall = StateNo = 5000 || StateNo = 5010
;trigger1 = Anim = 5002 || Anim = 5012 || Anim = 5022 || Anim = 5030
;value = 10, 25
;freqmul = 1.1

;[State -3, PlaySnd]
;type = PlaySnd
;triggerall = Alive
;triggerall = Life > 0
;triggerall = Time = 1
;triggerall = Random <= 500
;trigger1 = StateNo = 5070
;trigger2 = StateNo = 5080
;value = 10, 29
;channel = 0

;[State -3, PlaySnd]
;type = PlaySnd
;triggerall = Alive
;triggerall = Life > 0
;triggerall = Time = 1
;triggerall = Random <= 500
;trigger1 = StateNo = 5000 || StateNo = 5010
;trigger1 = Anim = 5050 || Anim = 5051 || Anim = 5052
;trigger2 = StateNo = 5020
;value = 10, 25
;--------------------

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