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

;---------------------------------------------------------------------------
; States that are always executed (use statedef -2)
;---------------------------------------------------------------------------
[Statedef -2]
[State -2, Remove Sparks]
type = RemoveExplod
trigger1 = StateNo != 1110
id = 1115

[State -2, VarSet]
type = VarSet
trigger1 = StateNo = 0
trigger2 = StateNo = 140
trigger3 = StateNo = 5110
trigger4 = StateNo = 5300
trigger5 = StateNo = 5400
v = 35
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = StateNo = 120
trigger2 = StateNo >= 130
trigger2 = StateNo < 135
trigger3 = StateNo >= 150
trigger3 = StateNo <= 155
v = 35
value = 1

[State -2, VarSet]
type = VarSet
trigger1 = ctrl = 1
v = 0
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = ctrl = 1
v = 25
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = ctrl = 1
v = 26
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = ctrl = 1
v = 28
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = ctrl = 1
v = 29
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = MatchOver
v = 30
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = MatchOver
v = 31
value = 0

[State -2, RemoveExplod]
type = RemoveExplod
trigger1 = StateNo != 181
trigger1 = StateNo != 190
trigger1 = StateNo != 191
trigger1 = StateNo != 196
trigger2 = Var(2) > 0
trigger2 = StateNo = 190
trigger3 = Var(2) > 0
trigger3 = StateNo = 191
id = 10

[State -2, Invisible]
type = AssertSpecial
triggerall = NumHelper(3) > 0
triggerall = MoveType = H
trigger1 = Anim < 200
trigger2 = Anim >= 5000
trigger2 = Anim <= 5240
trigger3 = Anim >= 5300
trigger3 = Anim < 5400
trigger4 = Anim > 7600
trigger4 = Anim < 8500
trigger5 = Anim > 8500
trigger5 = Anim < 8510
trigger6 = Anim > 8510
trigger6 = Anim < 9000
trigger7 = Anim > 9010
trigger7 = Anim < 10000
flag = invisible

[State -2, Invisible]
type = AssertSpecial
triggerall = NumHelper(3) > 0
triggerall = MoveType != H
trigger1 = ctrl = 1
trigger2 = Anim < 260
trigger3 = Anim > 270
trigger3 = Anim < 280
trigger4 = Anim > 290
trigger4 = Anim <= 314
trigger5 = Anim >= 316
trigger5 = Anim <= 700
trigger6 = Anim > 710
trigger6 = Anim < 802
trigger7 = Anim > 804
trigger7 = Anim < 1060
trigger8 = Anim > 1065
trigger8 = Anim <= 3200
trigger9 = Anim >= 5000
flag = invisible

[State -2, Cage]
type = Helper
triggerall = Time > 0
triggerall = Facing = 1
triggerall = StateNo != 190
trigger1 = NumHelper(10) = 0
trigger1 = Var(30) > 0
helpertype = normal
name = "Cage"
id = 10
facing = 1
pos = 150,-500
postype = back
stateno = 30010
keyctrl = 0
ownpal = 1

[State -2, Cage]
type = Helper
triggerall = Time > 0
triggerall = Facing = -1
triggerall = StateNo != 190
trigger1 = NumHelper(10) = 0
trigger1 = Var(30) > 0
helpertype = normal
name = "Cage"
id = 10
facing = -1
pos = 150,-500
postype = back
stateno = 30010
keyctrl = 0
ownpal = 1

;-----Dizzy Counter-----
[State -2, Hits]
type = VarAdd
triggerall = UniqHitCount <= 1
triggerall = GetHitVar(hitcount) <= 2
triggerall = StateNo >= 5000
trigger1 = MoveType = H
trigger1 = !HitShakeOver
trigger1 = Time = 0
ignorhitpause = 1
v = 15
value = 1

[State -2, Hit Subtract]
type = VarAdd
triggerall = MoveType != H
triggerall = Var(15) > 0
trigger1 = Time > 0
trigger1 = TimeMod = 40,0
v = 15
value = -1

[State -2, Hit Max]
type = VarSet
trigger1 = Var(15) >= 10
v = 15
value = 10

[State -2, Dizzy Reset]
type = VarSet
trigger1 = MoveType = H
trigger1 = !Alive
trigger2 = MoveType != H
trigger2 = Var(15) >= 10
trigger3 = UniqHitCount > 2
trigger4 = GetHitVar(hitcount) > 2
ignorehitpause = 1
v = 15
value = 0

[State -2, VarSet]
type = VarSet
trigger1 = MoveType = H
trigger1 = !HitShakeOver
trigger1 = StateNo != 5400
trigger1 = StateNo != 5410
trigger2 = StateNo = 0
ignorehitpause = 1
v = 5
value = 0

[State -2, SelfState]
type = SelfState
triggerall = MoveType = H
triggerall = !HitShakeOver
trigger1 = StateNo != 5400
trigger1 = Var(15) >= 10
ignorehitpause = 1
value = 5400
ctrl = 0

[State -2, NotHitBy]
type = NotHitBy
trigger1 = MoveType = H
trigger1 = Var(5) > 0
value = SCA
time = 1
;-----------------------

;-----Super Explode Finish-----
[State -2, KOExplode]
type = Explod
triggerall = MoveHit
triggerall = WinKO = 1
triggerall = NumExplod(4400) = 0
trigger1 = HitDefAttr = SA, HA
pos = 0,0
postype = left
bindtime = -1
anim = 4400
id = 4400
sprpriority = -5
time = 50
ignorehitpause = 1
scale = .85, 1.10
ownpal = 1

[State -2, KOSound]
type = PlaySnd
triggerall = WinKO = 1
triggerall = NumExplod(4400) = 1
trigger1 = Var(20) = 0
value = 20,0
ignorehitpause = 1
channel = 1

[State -2, 1]
type = VarAdd
triggerall = WinKO = 1
triggerall = NumExplod(4400) = 1
trigger1 = TimeMod = 1,0
ignorehitpause = 1
v = 20
value = 10

[State -2, 2]
type = VarSet
triggerall = WinKO = 1
triggerall = NumExplod(4400) = 1
trigger1 = Var(20) >= 200
ignorehitpause = 1
v = 20
value = -1

[State -2,3]
type = Envcolor
triggerall = WinKO = 1
trigger1 = NumExplod(4400) = 1
value = var(20),var(20),var(20)
ignorehitpause = 1
under = 1

[State -2,4]
type = AssertSpecial
triggerall = WinKO = 1
trigger1 = NumExplod(4400) = 1
ignorehitpause = 1
flag = NoMusic
;-----------------------

[State -2,5]
type = SelfState
triggerall = Alive
triggerall = Var(35) > 0
trigger1 = Statetype != A
trigger1 = Movetype = H
trigger1 = GetHitVar(Damage) >= Life
value = 5240
persistent = 1
ignorehitpause = 1

;-----Hit Sounds-----
[State -2, VarRandom]
type = VarRandom
trigger1 = stateno = 5000
trigger2 = stateno = 5010
trigger3 = stateno = 5020
trigger4 = stateno = 5030
trigger5 = stateno = 5050
trigger6 = stateno = 5070
trigger7 = stateno = 5080
v = 0
range = 0,100

[State -2, Hit0]
type = PlaySnd
triggerall = Alive
triggerall = Time = 0
triggerall = Var(0) = [0,20]
trigger1 = Stateno = 5000
trigger2 = Stateno = 5010
value = 5000, 0

[State -2, Hit1]
type = PlaySnd
triggerall = Alive
triggerall = Time = 0
triggerall = Var(0) = [30,50]
trigger1 = Stateno = 5000
trigger2 = Stateno = 5010
value = 5000, 1

[State -2, Hit2]
type = PlaySnd
triggerall = Alive
triggerall = Time = 0
triggerall = Var(0) = [50,100]
trigger1 = stateno = 5020
trigger2 = stateno = 5030
trigger3 = stateno = 5050
trigger4 = stateno = 5070
trigger5 = stateno = 5080
value = 5000, 2
;-------------------

;This controller plays a sound everytime the player lands from a jump, or
;from a back-dash.
[State -2, Landing Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 52 ;Jump land
trigger2 = stateno = 71 ;Back Flip bounce
trigger3 = stateno = 80 ;Back Flip land
trigger4 = stateno = 106 ;Run-back land
trigger5 = stateno = 1001 ;Roll Bounce
value = 0, 0
