restructure
This commit is contained in:
131
game/scripts/vscripts/modifiers/power/modifier_ability_power_daiyousei.lua
Executable file
131
game/scripts/vscripts/modifiers/power/modifier_ability_power_daiyousei.lua
Executable file
@@ -0,0 +1,131 @@
|
||||
modifier_ability_power_daiyousei = class({})
|
||||
|
||||
local public = modifier_ability_power_daiyousei
|
||||
|
||||
local m_modifier_funcs=
|
||||
{
|
||||
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL,
|
||||
MODIFIER_PROPERTY_OVERRIDE_ABILITY_SPECIAL_VALUE,
|
||||
}
|
||||
|
||||
local power_bonus = {
|
||||
["thtd_daiyousei_02"] = {
|
||||
[1] = {
|
||||
["mana_reg"] = 1,
|
||||
},
|
||||
[2] = {
|
||||
["mana_reg"] = 2,
|
||||
},
|
||||
[3] = {
|
||||
["mana_reg"] = 3,
|
||||
},
|
||||
},
|
||||
["thtd_daiyousei_03"] = {
|
||||
[1] = {
|
||||
["damage_up"] = 10,
|
||||
["crino_up"] = 10,
|
||||
},
|
||||
[2] = {
|
||||
["damage_up"] = 20,
|
||||
["crino_up"] = 20,
|
||||
},
|
||||
[3] = {
|
||||
["damage_up"] = 30,
|
||||
["crino_up"] = 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 )
|
||||
-- self:ForceRefresh()
|
||||
-- end
|
||||
|
||||
-- function public:OnRefresh( kv )
|
||||
-- if not IsServer() then return end
|
||||
-- end
|
||||
|
||||
function public:OnDestroy(kv)
|
||||
if not IsServer() then return end
|
||||
self:OnStackCountChanged(0)
|
||||
end
|
||||
|
||||
function public:OnStackCountChanged( iStackCount )
|
||||
-- 双端触发,iStackCount为改变前的层数
|
||||
if not IsServer() then return end
|
||||
|
||||
local caster = self:GetParent()
|
||||
if caster ~= nil and caster:IsNull() == false then
|
||||
if caster.ability_daiyousei_03_target1 ~= nil and caster.ability_daiyousei_03_target1:HasModifier("modifier_daiyousei_03") then
|
||||
caster.ability_daiyousei_03_target1:RemoveModifierByName("modifier_daiyousei_03")
|
||||
caster:FindAbilityByName("thtd_daiyousei_03"):ApplyDataDrivenModifier(caster, caster.ability_daiyousei_03_target1, "modifier_daiyousei_03", nil)
|
||||
end
|
||||
if caster.ability_daiyousei_03_target2 ~= nil and caster.ability_daiyousei_03_target2:HasModifier("modifier_daiyousei_03") then
|
||||
caster.ability_daiyousei_03_target2:RemoveModifierByName("modifier_daiyousei_03")
|
||||
caster:FindAbilityByName("thtd_daiyousei_03"):ApplyDataDrivenModifier(caster, caster.ability_daiyousei_03_target2, "modifier_daiyousei_03", nil)
|
||||
end
|
||||
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
|
||||
|
||||
return params.ability:GetLevelSpecialValueNoOverride(valueName, specialLevel) + power_bonus[abilityName][level][valueName]
|
||||
end
|
||||
Reference in New Issue
Block a user