local _ClawGivePowerup = ffi.cast("int (*)(int, int)", 0x00420EE0)

function main(self)
    if self.State == 0 then
        self.State = 1
		self.AttackRect = {-18,-18,18,18}
		self.AttackFlags.Player = true
		self.Glitter = CreateObject { x=self.X, y=self.Y, z=self.Z+1, logic="PowerupGlitter"}
	end
	if self.State == 1 then self.State = 2 end
	if self.State == 2 then self.State = 1 end
end

function attack(self)
	local catnip = Powerup.Catnip
	if _CurrentPowerup[0] ~= catnip then
		_ClawGivePowerup(catnip, self.Smarts)
		PlaySound("GAME_CATNMAG")
	elseif _CurrentPowerup[0] == catnip and _PowerupTime[0] < self.Smarts - 300 then
		local addTime = self.Smarts - _PowerupTime[0]
		_ClawGivePowerup(9916, addTime)
	end
end
