restructure
This commit is contained in:
122
game/scripts/vscripts/modifiers/power/modifier_ability_power_lily.lua
Executable file
122
game/scripts/vscripts/modifiers/power/modifier_ability_power_lily.lua
Executable file
@@ -0,0 +1,122 @@
|
||||
modifier_ability_power_lily = class({})
|
||||
|
||||
local public = modifier_ability_power_lily
|
||||
|
||||
local m_modifier_funcs=
|
||||
{
|
||||
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL,
|
||||
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL_VALUE,
|
||||
}
|
||||
|
||||
local power_bonus = {
|
||||
["thtd_lily_02"] = {
|
||||
[1] = {
|
||||
["radius"] = 150,
|
||||
},
|
||||
[2] = {
|
||||
["radius"] = 300,
|
||||
},
|
||||
[3] = {
|
||||
["radius"] = 450,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local thtd_lily_01_mana_cost = {
|
||||
[1] = 10,
|
||||
[2] = 20,
|
||||
[3] = 30,
|
||||
}
|
||||
|
||||
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 )
|
||||
-- -- 设置层数仅本地会触发,无层数设置为1层时不触发
|
||||
-- -- 使用 modifier:ForceRefresh() 会双端触发
|
||||
-- if not IsServer() then return end
|
||||
-- end
|
||||
|
||||
function public:OnStackCountChanged( iStackCount )
|
||||
-- 双端触发,iStackCount为改变前的层数
|
||||
if not IsServer() then return end
|
||||
|
||||
local level = math.max(1, math.min(3, self:GetStackCount()))
|
||||
local caster = self:GetParent()
|
||||
caster:AddManaCostReducePercent(thtd_lily_01_mana_cost[level], "thtd_lily_01_power_level_buff")
|
||||
caster.lily_max_mana = 100 - caster:GetManaCostReducePercent()
|
||||
end
|
||||
|
||||
function public:OnDestroy(kv)
|
||||
if not IsServer() then return end
|
||||
|
||||
local caster = self:GetParent()
|
||||
caster:AddManaCostReducePercent("thtd_lily_01_power_level_buff")
|
||||
caster.lily_max_mana = 100 - caster:GetManaCostReducePercent()
|
||||
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
|
||||
|
||||
return params.ability:GetLevelSpecialValueNoOverride(valueName, specialLevel) + power_bonus[abilityName][level][valueName]
|
||||
end
|
||||
Reference in New Issue
Block a user