Files
2HUCardTDGame/scripts/vscripts/modifiers/power/modifier_ability_power_yukari.lua
2021-10-24 15:36:18 -04:00

157 lines
3.1 KiB
Lua
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
modifier_ability_power_yukari = class({})
local public = modifier_ability_power_yukari
local m_modifier_funcs=
{
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL,
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL_VALUE,
}
local power_bonus = {
["thtd_yukari_01"] = {
[1] = {
["duration_time"] = 1,
},
[2] = {
["duration_time"] = 1,
},
[3] = {
["duration_time"] = 1,
},
[4] = {
["duration_time"] = 2,
},
[5] = {
["duration_time"] = 2,
},
},
["thtd_yukari_03"] = {
[1] = {
["power_damage"] = 5,
},
[2] = {
["power_damage"] = 10,
},
[3] = {
["power_damage"] = 15,
},
},
["thtd_yukari_04"] = {
[1] = {
["power_damage"] = 10,
["max_count"] = 1,
},
[2] = {
["power_damage"] = 20,
["max_count"] = 1,
},
[3] = {
["power_damage"] = 30,
["max_count"] = 1,
},
[4] = {
["power_damage"] = 30,
["max_count"] = 2,
},
[5] = {
["power_damage"] = 30,
["max_count"] = 2,
},
},
}
local power999_bonus = 400
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
local caster = self:GetParent()
caster:THTD_AddPowerPercentage("thtd_yukari_power_999")
end
function public:OnStackCountChanged( iStackCount )
-- 双端触发iStackCount为改变前的层数
if not IsServer() then return end
local caster = self:GetParent()
if self:GetStackCount() == 5 then
caster:THTD_AddPowerPercentage(power999_bonus, "thtd_yukari_power_999")
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 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