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


[Statedef -3]



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


;[State 33120, efeito spider sense]
;type  = Explod
;trigger1 = var(22) = 1 && var(24) = 0 && p2stateno = [200,4999]
;anim = 3110
;postype = left
;ID = 3110
;sprpriority = -7
;removetime = 3
;pos = 0,0
;scale = 1,1
;bindtime = -1
;;facing=1
;ignorehitpause=1

[State 4001, bgpalfx]
type = bgpalfx
trigger1 = var(22) = 1 && var(24) = 0 && p2stateno = [200,4999]
invertall = 1
add = 150,110,10
sinadd = -50,-50,-50,80
color = 0
time = 40


[State 0, VarSet]
type = VarSet
trigger1 = var(22) = 1 && var(24) = 0 && p2stateno = [200,4999]
v = 24
value = 1



[State 0, VarSet]
type = VarSet
trigger1 = var(22) = 1 && var(24) = 1 && p2stateno != [200,4999]
v = 24
value = 0



;[State 33120]
;type  = Explod
;triggerall = var(22) = 1
;triggerall = p2stateno = [200,4999] ;&& (stateno = [0,999] || stateno = [5000,6000])
;trigger1 = numexplod = 0
;anim = 3101
;postype = left
;ID = 3101
;sprpriority = -4
;removetime = 3
;pos = 0,0
;scale = 1,1
;bindtime = -1
;;facing=1
;ignorehitpause=1


[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) > 1350  && var(23) < 1500
anim = 3101
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 1350 && var(23) > 1200
anim = 3102
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 1200 && var(23) > 1050
anim = 3103
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 1050 && var(23) > 900
anim = 3104
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 900 && var(23) > 750
anim = 3105
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 750 && var(23) > 600
anim = 3106
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 600 && var(23) > 450
anim = 3107
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 450 && var(23) > 300
anim = 3108
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, sense bar]
type = Explod
triggerall = var(22) = 1
trigger1 = RoundState = 2 && var(23) <= 300 && var(23) > 150
anim = 3109
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1



[State -3, web bar capsule]
type = Explod
triggerall = var(22) != 1
triggerall = var(42) = 0 && stateno != 3510
trigger1 = RoundState = 2
anim = 1063
pos = ifelse(TeamSide = 1, 21, 299), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1


[State -3, web bar]
type = Explod
triggerall = var(22) != 1  && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 98
anim = 1050
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 90 && var(40) < 99
anim = 1051
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1


[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 80 && var(40) < 91
anim = 1052
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 70 && var(40) < 81
anim = 1053
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 60 && var(40) < 71
anim = 1054
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 50 && var(40) < 61
anim = 1055
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 40 && var(40) < 51
anim = 1056
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 30 && var(40) < 41
anim = 1057
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 20 && var(40) < 31
anim = 1058
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 10 && var(40) < 21
anim = 1059
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 5 && var(40) < 11
anim = 1060
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) > 0 && var(40) < 6
anim = 1061
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar]
type = Explod
triggerall = var(22) != 1 && stateno != 3510
trigger1 = RoundState = 2 && var(40) <= 0
anim = 1062
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1

[State -3, web bar vazia]
type = Explod
triggerall = var(22) != 1 && (stateno = 178 || stateno = 179)
trigger1 = RoundState = 2 && var(40) <= 0
trigger1 = timemod = 4,2
anim = 1064
pos = ifelse(TeamSide = 1, 1, 319), 240
postype = left
facing = ifelse(TeamSide = 1, 1, -1)
bindtime = -1
removetime = 1
sprpriority = 5
ignorehitpause = 1


[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, hurt Sound 2]
type = PlaySnd
triggerall = Time = 1
triggerall = random < 200
trigger1 = Stateno = 5070 || stateno = 5080
trigger1 = movetype = H
value = 5000,random%3



[State -3, Get Up]
type = null;PlaySnd
triggerall = Time = 1
trigger1 = Stateno = 5120
value = 5120,0




[State -3, Super Jump]
type = null;PlaySnd
triggerall = Time = 1
trigger1 = Stateno = 7710 || stateno = 7720
value = 100,0

; Guard Shield
;[State -3]
;type = Helper
;trigger1 = Stateno = 120 && Time = 0
;trigger2 = (stateno = [130,132]) || (stateno = [150,152]) && NumHelper(6120) = 0
;stateno = 6120
;id = 6120
;ownpal = 1


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


[State -3]
type = AfterImage
trigger1 = time = 0  && !var(57)
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

;-----------------------------------------
;Wall Hit

[State -3]
type = Helper
triggerall = stateno != 7740
triggerall = NumEnemy = [1,2]
triggerall = NumHelper(7750) = 0
triggerall = enemy(0),stateno != [120,159]
trigger1 = enemy(0),movetype = h
trigger1 = enemy(0),backedgedist <= 15
trigger1 = enemy(0),statetype = a
trigger1 = enemy(0),vel x < 0
stateno = 7750
id = 7750
postype = p2

[State -3]
type = Helper
triggerall = stateno != 7740
triggerall = NumEnemy = 2
triggerall = NumHelper(7751) = 0
triggerall = enemy(1),stateno != [120,159]
trigger1 = enemy(1),movetype = h
trigger1 = enemy(1),backedgedist <= 15
trigger1 = enemy(1),statetype = a
trigger1 = enemy(1),vel x < 0
stateno = 7750
id = 7751
postype = p2


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

[State -3]
type = Helper
triggerall = NumEnemy = [1,2]
triggerall = NumHelper(7755) = 0
triggerall = enemy(0),stateno != [120,159]
trigger1 = enemy(0),movetype = h
trigger1 = enemy(0),pos y >= 0
trigger1 = enemy(0),vel y > 5
stateno = 7755
id = 7755
postype = p2

[State -3]
type = Helper
triggerall = NumEnemy = 2
triggerall = NumHelper(7756) = 0
triggerall = enemy(1),stateno != [120,159]
trigger1 = enemy(1),movetype = h
trigger1 = enemy(1),pos y >= 0
trigger1 = enemy(1),vel y > 5
stateno = 7755
id = 7756
postype = p2

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

;----------------------------------------------
;KO Sound
[State -3]
type = Helper
triggerall = !alive
trigger1 = NumHelper(7760) = 0
stateno = 7760
id = 7760

;----------------------------------------------
;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

------------------------

[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,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




