local easing = require("easing")
local XxxMagic = Class(function(self, inst)
    self.inst = inst
	self.max = 100 
    self.current = 0 
	self.inst:DoPeriodicTask(10, function() self:DoDelta(-17) end) 
	self.armor = 0
end)

function XxxMagic:DoDelta(val)
    local oldpercent = self.current/self.max
	if self.current<self.max and not val then
		self.current = self.current + 1
	elseif val then
		self.current = self.current + val
		if self.current<0 then
			self.current=0
		elseif self.current>self.max then
			self.current=self.max
		end
	end
	self.inst:PushEvent("xxxmagic_rivendelta", {oldpercent = oldpercent, newpercent = self.current/self.max})
end

function XxxMagic:GetPercent()
    return self.current / self.max
end

return XxxMagic