modifier_ability_power_reimu = class({})

local public = modifier_ability_power_reimu

local m_modifier_funcs=
{
	MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL,
	MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL_VALUE,	
}

local power_bonus = {
	["thtd_reimu_03"] = {  
		[1] = {
			["power_damage"] = 5,
		},
		[2] = {
			["power_damage"] = 10,
		},
		[3] = {
			["power_damage"] = 15,
		},			
	},
	["thtd_reimu_04"] = {  
		[1] = {
			["power_damage"] = 5,
		},
		[2] = {
			["power_damage"] = 10,
		},
		[3] = {
			["power_damage"] = 15,
		},	
		[4] = {
			["power_damage"] = 15,
		},	
		[5] = {
			["power_damage"] = 15,
			["power_up"] = 7,
		},		
	},	
}

function public:IsHidden()
	return true
end

function public:IsPermanent()
	return true
end

function public:RemoveOnDeath()
	return false
end

function public:IsDebuff()
	return false
end

function public:IsPurgable()
	return false
end

function public:DeclareFunctions()
	return m_modifier_funcs
end

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

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

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

function public:GetModifierOverrideAbilitySpecial( params )
	if self:GetParent() == nil or params.ability == nil then
		return 0
	end
		
	local abilityName = params.ability:GetAbilityName() 
	local level = self:GetStackCount()
	local valueName = params.ability_special_value
	
	if power_bonus[abilityName] == nil then
		return 0
	end

	if power_bonus[abilityName][level] == nil then
		level = 3
	end
	if power_bonus[abilityName][level] == nil then
		return 0
	end

	if power_bonus[abilityName][level][valueName] == nil then
		return 0
	end

	return 1
end

function public:GetModifierOverrideAbilitySpecialValue( params )
	local abilityName = params.ability:GetAbilityName() 
	local level = self:GetStackCount()
	local valueName = params.ability_special_value
	local specialLevel = params.ability_special_level

	if power_bonus[abilityName][level] == nil then
		level = 3
	end

	if abilityName == "thtd_reimu_03" then 
		return params.ability:GetLevelSpecialValueNoOverride(valueName, specialLevel) * power_bonus[abilityName][level][valueName]
	else
		if valueName == "power_damage" then
			return params.ability:GetLevelSpecialValueNoOverride(valueName, specialLevel) + power_bonus[abilityName][level][valueName]
		else
			return params.ability:GetLevelSpecialValueNoOverride(valueName, specialLevel) * power_bonus[abilityName][level][valueName]
		end
	end
end