modifier_touhoutd_luck = class({})

local public = modifier_touhoutd_luck

function public:IsHidden()
	return false
end

function public:IsDebuff()
	return false
end

function public:IsPurgable()
	return false
end

function public:GetTexture()
	return "luck"
end

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

function public:OnCreated( kv )
	if not IsServer() then
		return
	end

	local target = self:GetParent()
	target:SetModelScale(target:GetModelScale() * 1.25)	

	local bonus = GameRules.GameData.luck_crit
	self:SetStackCount(bonus)
	target:THTD_AddCritDamage(bonus, "thtd_luck_day_bonus")	
	target:THTD_AddCritChance(math.floor(bonus/10), "thtd_luck_day_bonus")
end

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

function public:OnDestroy()
	if not IsServer() then
		return
	end

	local target = self:GetParent()
	
	target:SetModelScale(target:GetModelScale() / 1.25)
	target:THTD_AddCritDamage("thtd_luck_day_bonus")
	target:THTD_AddCritChance("thtd_luck_day_bonus")
end