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


[Statedef -3]




[State -3, hurt Sound 1]
type = PlaySnd
triggerall = Time = 1
triggerall = random < 200
trigger1 = Stateno = 5000 || stateno = 5010 || Stateno = 5020
trigger1 = movetype = H
trigger1 = GetHitVar(animtype) <= 2
value = 5000,GetHitVar(animtype)



[State -3]
type = null;PalFx
trigger1 = Time = 0
trigger1 = MoveType != H
time = 0
add = 0,0,0


[State -3]
type = AfterImage
trigger1 = time = 0
time = 0
length = 7
palbright = 30,30,130
palpostbright = 0,0,50
palcontrast =120,120,220
paladd = 0,0,0
palmul = 1,1,1
palcolor = 0
timegap = 2
framegap = 3

[State -3]
type = null;AfterImage
trigger1 = time = 0
time = 0
length = 7
palbright = 0,0,0
palpostbright = 0,0,0
palcontrast =256,256,256
paladd = 0,0,0
palmul = 1,1,1
palcolor = 256
timegap = 2
framegap = 3


[State -2]
type = null;ScreenBound
trigger1 = 1
value = 0
movecamera = 0,0

;---------------------------------------------
;Ground Hit

[State -3]
type = VarSet
trigger1 = p2stateno = 21263
trigger1 = !var(41)
var(41) = 1
persistent = 0


[State -3]
type = VarSet
trigger1 = p2stateno = 23079
trigger1 = !var(40)
var(40) = 1
persistent = 0

;-----------------------------------------
;Wall Hit
[State -3]
type = varset
triggerall = var(42)
triggerall = enemynear,stateno != [120,159]
trigger1 = enemynear,movetype = h
trigger1 = enemynear,backedgedist <= 15
trigger1 = enemynear,statetype = a
trigger1 = enemynear,vel x < 0
var(40) = 1

[State -3]
type = varset
triggerall = var(42)
triggerall = enemynear,stateno != [120,159]
trigger1 = enemynear,statetype = A
trigger1 = enemynear,movetype = h
trigger1 = enemynear,pos y >= 0
trigger1 = enemynear,vel y > 5
var(41) = 1

[state -3]
type = explod
trigger1 = var(40)
trigger1 = enemynear,backedgedist <= 15
anim = 7024
id = 7024
postype = p2
pos = 0, -60
postype = p2
bindtime = 1
facing = -1
removetime = -2
scale = 0.25, 0.25
sprpriority = 4
ownpal = 1
ignorehitpause = 1
persistent = 0

[state -3]
type = playsnd
trigger1 = var(40)
trigger1 = enemynear,backedgedist <= 15
persistent = 0
value = 825,0
channel = 1
volume = 255

;ground hit
[state -3]
type = null;explod
trigger1 = var(40)
anim = 7022
postype = p2
pos = 0, 0
postype = p2
bindtime = 1
facing = -1
removetime = -2
scale = 0.25, 0.25
sprpriority = 4
ownpal = 1
ignorehitpause = 1
persistent = 0

;ground hit
[state -3]
type = explod
trigger1 = var(41)
trigger1 = enemynear,pos y >= 0
anim = 7510
id = 7510
postype = p2
pos = 0, floor(enemynear,pos y - enemynear,vel y)
postype = p2
bindtime = 1
facing = -1
removetime = -2
scale = const(size.xscale),const(size.yscale)
sprpriority = -4
ownpal = 1
ignorehitpause = 1
persistent = 0

;ground hit
[state -3]
type = PlaySnd
trigger1 = var(41)
trigger1 = enemynear,pos y >= 0
value = 5100,4

[State -3, EnvShake]
type = EnvShake
trigger1 = var(41)
trigger1 = enemynear,pos y >= 0
time = 8
ampl = -8


[state -3]
type = varset
trigger1 = var(40) || var(41)
trigger2 = enemynear,movetype != h
var(42) = 0


[state -3]
type = varset
trigger1 = var(40)
trigger1 = NumExplod(7024)
trigger2 = roundstate = 3
var(40) = 0


[state -3]
type = varset
trigger1 = var(41)
trigger1 = NumExplod(7510)
trigger2 = roundstate = 3
var(41) = 0



[state -3]
type = varset
trigger1 = 1
v = 24
value = var(23)

[state -3]
type = varset
trigger1 = 1
v = 23
value = var(25)+hitcount

[state -3]
type = varset
trigger1 = enemynear,movetype != H
v = 25
value = 0


[state -3]
type = varset
trigger1 = var(23)> var(24)
v = 42
value = 1


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


;----------------------------------------------
;KO Delay
[State -3]
type = null;helper
trigger1 = roundstate = 2 && !numhelper(7600)
helpertype = Normal
id = 7600
pos = 0,0
postype = p1
name = "Ko Helper"
stateno = 7600
supermovetime = 9999999999
pausemovetime = 9999999999
scale = const(size.xscale),const(size.yscale)
------------------------

[State -3, hit ground Sound]
type = PlaySnd
triggerall = Time = 1
trigger1 = stateno = 5100
value = 5100,0


[State 130]
type = AssertSpecial
trigger1 = 1
trigger1 = Stateno = [120,155]
flag = NoWalk


[State -3]
type = null;AttackMulSet
trigger1 = var(56) = 4
trigger1 = roundstate = 2
value = ifelse( var(32) >= 1, var(32), 1)


[State -3]
type = null;DefenceMulSet
trigger1 = var(56) = 4
trigger1 = roundstate = 2
value = ifelse( var(32) >= 1, var(32), 1)

[State -3,r]
type = SelfState
triggerall = stateno != 7777
triggerall = var(56) = 4
trigger1 = gethitvar(damage) >= life
trigger2 = Life < 10
value = 7777




[State -3,ai]
type = varset
trigger1 = !var(58)
trigger1 = var(59)
var(58) = 1


