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

;Dizzy State
[Statedef 5293]
type    = A
movetype= H
physics = N
anim = 7000
ctrl = 0

;Dizzy Birds
;Var(22) for dizzy bird explod
[State 5293, Varset]
Type = Varset
trigger1 = HitShakeover
var(22) = 0

[State 5293, Dizzy]
type = Explod
trigger1 = Hitshakeover
Anim = 7017 + var(22)
pos = 10, -95
postype = p1
sprpriority = 2
scale = .9,.9
ownpal = 1
bindtime = -1
removeongethit = 1
ID = 7017
removetime = -1

;Var(23) for dizzy bird chirp
[State 5293, 1]
type = Varset
trigger1 = time = 1
var(23) = 0

[State 5293, Dizzy birds chirp]
type = Playsnd
trigger1 = !Time
trigger2 = var(23) = 1
value = s12, 0
channel = 4

[State 5293, Can't be hit] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = Anim = 7000
value = , NT,ST,HT
time = 12

[State 5293, Can't be thrown] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = Anim = 7000
value2 = SCA
time = 12

[State 5293, Changestate]
type= Changestate
trigger1 = time = 0
value= 5294

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

[Statedef 5294]
type    = A
movetype= H
physics = N
anim = 7001

[State 5294, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12, 0
channel = 4

[State 5294, Can't be hit] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = Anim = 7001
value = , NT,ST,HT
time = 12

[State 5294, Can't be thrown] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = Anim = 7001
value2 = SCA
time = 12

[State 5294, ChangeAnim]
type = ChangeAnim
trigger1 = !HitShakeOver
value = 7001

[State 5294, ChangeState]
type = ChangeState
trigger1 = !Alive
value = 5000

[State 5294, HitVelSet]
type = HitVelSet
trigger1 = !Alive
trigger1 = HitShakeOver
x = -2
y = -2

[State 5294, VelSet]
type = VelSet
trigger1 = Alive
trigger1 = HitShakeOver
x = -4
y = -4

[State 5294, ChangeState]
type = ChangeState
triggerall = Alive
trigger1 = HitShakeOver
value = 5295
ctrl = 0

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

[Statedef 5295]
type    = A
movetype= H
physics = N
anim = 5050

[State 5295, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,0
channel = 4

[State 5295, Can't be hit] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = Anim = 5050
value = , NT,ST,HT
time = 12

[State 5295, Can't be thrown] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = Anim = 5050
value2 = SCA
time = 12


[State 5295, DizzySet]
type = VarSet
trigger1 = 1
v = 25
value = 1

[State 5295, HitSet]
type = VarSet
trigger1 = Time > 0
trigger1 = Vel Y > 0
trigger1 = Pos Y > 0
v = 24
value = 0

[State 5295, VelAdd]
type = VelAdd
trigger1 = 1
y = .4

[State 5295, Changestate]
type = Changestate
trigger1 = Time > 10
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 20
value = 5296

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

;Hit ground
[Statedef 5296]
type    = L
movetype= H
physics = N
anim = 5100
ctrl = 0

[State 5296, Dizzy bird chirps]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,0
channel = 4

[State 5296, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5296, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5296, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5296, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5296, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5296, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5296, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5296, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5296, 10]
type = PlaySnd
trigger1 = Time = 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5296, 11]
type = PosFreeze
trigger1 = 1

[State 5296, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5296, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

[State 5296, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5297

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

;Bounce off
[Statedef 5297]
type    = L
movetype= H
physics = N
anim = 5160
ctrl = 0

[State 5297, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,0
channel = 4

[State 5297, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5297, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 5297, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5297, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5297, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

[State 5297, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 5298

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

;Downed
HIT_LIEDOWN
[Statedef 5298]
type    = L
movetype= H
physics = N
anim = 5110
ctrl = 0

[State 5298, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,0
channel = 4

[State 5298, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5298, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5298, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5298, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5298, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5298, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5298, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5298, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5298, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85


[State 5298, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12


[State 5298, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3


[State 5298, 12]
type = ChangeState
triggerall = alive
trigger1 = Time = 30
value = 5299


[State 5298, 13] ;If KO'ed.
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

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

[Statedef 5299]
type    = L
movetype= I
physics = N
anim = 5120
ctrl = 0

[State 5299, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,0
channel = 4

[State 5299, 2]
type = VelSet
trigger1 = Time = 0
x = 0

[State 5299, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 12

[State 5299, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 3

[State 5299, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 5300
ctrl = 0

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

;Dizzy State
[Statedef 5300]
type    = S
physics = S
anim = 5300
ctrl = 0

;Var(31) for dizzy moan snd
[State 5300, 1]
type = Varset
trigger1 = time = 0
var(28) = 0

[State 5300, Playsnd]
type = Playsnd
triggerall = Var(28) <= 0
trigger1 = time = 0
value = s5001, 1
volume = 255
channel = 0

[State 5300, Dizzy birds chirp]
type = Playsnd
trigger1 = (GameTime%41) = 0
trigger2 = var(23) = 1
value = s12,1
channel = 5

;Button Mash escape
[State 5300, 1]
type = Changeanim
triggerall = Time > 0
trigger1 = Command = "a" || Command = "b" || Command = "c" || Command = "x" || Command = "y" || Command = "z"
value = 5500

[State 5300, ChangeAnim]
type = ChangeAnim
trigger1 = Anim = 5500
trigger1 = AnimTime = 0
trigger2 = Time = 55
value = 5300

[State 5300, VarSet]
type = VarSet
trigger1 = (!Time)
var(26) = 11

[State 5300, VarAdd]
type = VarAdd
trigger1 = Command = "a" || Command = "b" || Command = "c" || Command = "x" || Command = "y" || Command = "z"
var(26) = -1

[State 5300, Changestate 1]
type = Changestate
trigger1 = Var(26) = 0
value = 0
ctrl = 1

[State 5300, Changestate 2]
type = Changestate
trigger1 = Time = 350
value = 0
ctrl = 1

