197 lines
7.6 KiB
Lua
197 lines
7.6 KiB
Lua
local ____lualib = require("lualib_bundle")
|
|
local __TS__Class = ____lualib.__TS__Class
|
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
local ____exports = {}
|
|
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local BaseItem = ____dota_ts_adapter.BaseItem
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
____exports.item_soul_devourer_staff = __TS__Class()
|
|
local item_soul_devourer_staff = ____exports.item_soul_devourer_staff
|
|
item_soul_devourer_staff.name = "item_soul_devourer_staff"
|
|
item_soul_devourer_staff.____file_path = "scripts/vscripts/items/default_items/item_soul_devourer_staff.lua"
|
|
__TS__ClassExtends(item_soul_devourer_staff, BaseItem)
|
|
function item_soul_devourer_staff.prototype.GetIntrinsicModifierName(self)
|
|
return "modifier_soul_devourer_staff"
|
|
end
|
|
item_soul_devourer_staff = __TS__Decorate(
|
|
item_soul_devourer_staff,
|
|
item_soul_devourer_staff,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "item_soul_devourer_staff"}
|
|
)
|
|
____exports.item_soul_devourer_staff = item_soul_devourer_staff
|
|
____exports.modifier_soul_devourer_staff = __TS__Class()
|
|
local modifier_soul_devourer_staff = ____exports.modifier_soul_devourer_staff
|
|
modifier_soul_devourer_staff.name = "modifier_soul_devourer_staff"
|
|
modifier_soul_devourer_staff.____file_path = "scripts/vscripts/items/default_items/item_soul_devourer_staff.lua"
|
|
__TS__ClassExtends(modifier_soul_devourer_staff, BaseModifier)
|
|
function modifier_soul_devourer_staff.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.DeclareFunctions(self)
|
|
return {
|
|
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS,
|
|
MODIFIER_PROPERTY_CAST_RANGE_BONUS,
|
|
MODIFIER_PROPERTY_MANA_REGEN_CONSTANT,
|
|
MODIFIER_PROPERTY_MANACOST_PERCENTAGE_STACKING,
|
|
MODIFIER_EVENT_ON_DEATH,
|
|
MODIFIER_PROPERTY_MANA_BONUS
|
|
}
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.OnDeath(self, event)
|
|
if event.attacker ~= self:GetCaster() then
|
|
return
|
|
end
|
|
local mana = self:GetCaster():GetMaxMana() * self:GetAbility():GetSpecialValueFor("kill_mana")
|
|
self:GetCaster():GiveMana(mana)
|
|
SendOverheadEventMessage(
|
|
nil,
|
|
OVERHEAD_ALERT_MANA_ADD,
|
|
self:GetCaster(),
|
|
mana,
|
|
self:GetCaster():GetPlayerOwner()
|
|
)
|
|
local caster = self:GetCaster()
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local blessing = caster:FindModifierByName("modifier_soul_devourer_staff_buff")
|
|
if not blessing then
|
|
blessing = caster:AddNewModifier(
|
|
self:GetParent(),
|
|
ability,
|
|
"modifier_soul_devourer_staff_buff",
|
|
{}
|
|
)
|
|
end
|
|
if blessing ~= nil then
|
|
blessing:IncrementStackCount()
|
|
end
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.GetModifierPercentageManacostStacking(self)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_manacost_reduction")
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.GetModifierBonusStats_Intellect(self)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_intellect")
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.GetModifierCastRangeBonus(self, event)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_cast_range")
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.GetModifierConstantManaRegen(self)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_mana_regen")
|
|
end
|
|
function modifier_soul_devourer_staff.prototype.GetModifierManaBonus(self)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_mana_special")
|
|
end
|
|
modifier_soul_devourer_staff = __TS__Decorate(
|
|
modifier_soul_devourer_staff,
|
|
modifier_soul_devourer_staff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_soul_devourer_staff"}
|
|
)
|
|
____exports.modifier_soul_devourer_staff = modifier_soul_devourer_staff
|
|
____exports.modifier_soul_devourer_staff_buff = __TS__Class()
|
|
local modifier_soul_devourer_staff_buff = ____exports.modifier_soul_devourer_staff_buff
|
|
modifier_soul_devourer_staff_buff.name = "modifier_soul_devourer_staff_buff"
|
|
modifier_soul_devourer_staff_buff.____file_path = "scripts/vscripts/items/default_items/item_soul_devourer_staff.lua"
|
|
__TS__ClassExtends(modifier_soul_devourer_staff_buff, BaseModifier)
|
|
function modifier_soul_devourer_staff_buff.prototype.IsHidden(self)
|
|
if self:GetCaster():HasModifier("modifier_soul_devourer_staff") then
|
|
return false
|
|
end
|
|
return true
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.GetTexture(self)
|
|
return "default_items/soul_devourer_staff"
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.refreshStackGrowthHudDuration(self, ability)
|
|
local interval = ability:GetSpecialValueFor("stack_growth_interval") > 0 and ability:GetSpecialValueFor("stack_growth_interval") or 60
|
|
local baseDur = ability:GetSpecialValueFor("stack_growth_duration")
|
|
if baseDur <= 0 then
|
|
baseDur = interval + 0.5
|
|
elseif baseDur <= interval then
|
|
baseDur = interval + 0.5
|
|
end
|
|
self:SetDuration(baseDur + 0.2, true)
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local interval = ability:GetSpecialValueFor("stack_growth_interval") > 0 and ability:GetSpecialValueFor("stack_growth_interval") or 60
|
|
self:StartIntervalThink(interval)
|
|
self:refreshStackGrowthHudDuration(ability)
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
if not parent or not parent:IsAlive() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local ability = self:GetAbility()
|
|
if not caster or not ability then
|
|
return
|
|
end
|
|
if not caster:HasModifier("modifier_soul_devourer_staff") then
|
|
return
|
|
end
|
|
local stacks = self:GetStackCount()
|
|
if stacks <= 0 then
|
|
return
|
|
end
|
|
local pct = ability:GetSpecialValueFor("stack_growth_percent")
|
|
local growthPct = pct > 0 and pct or 20
|
|
local mult = 1 + growthPct / 100
|
|
local newStacks = math.ceil(stacks * mult)
|
|
if newStacks > stacks then
|
|
self:SetStackCount(newStacks)
|
|
end
|
|
self:refreshStackGrowthHudDuration(ability)
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_MANA_BONUS}
|
|
end
|
|
function modifier_soul_devourer_staff_buff.prototype.GetModifierManaBonus(self)
|
|
if self:GetCaster():HasModifier("modifier_soul_devourer_staff") then
|
|
return self:GetAbility():GetSpecialValueFor("bonus_mana") * self:GetStackCount()
|
|
end
|
|
return 0
|
|
end
|
|
modifier_soul_devourer_staff_buff = __TS__Decorate(
|
|
modifier_soul_devourer_staff_buff,
|
|
modifier_soul_devourer_staff_buff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_soul_devourer_staff_buff"}
|
|
)
|
|
____exports.modifier_soul_devourer_staff_buff = modifier_soul_devourer_staff_buff
|
|
return ____exports
|