222 lines
8.1 KiB
Lua
222 lines
8.1 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 BaseAbility = ____dota_ts_adapter.BaseAbility
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
local ____vampirism = require("utils.vampirism")
|
|
local addPhysicalVampirism = ____vampirism.addPhysicalVampirism
|
|
local reducePhysicalVampirism = ____vampirism.reducePhysicalVampirism
|
|
____exports.ability_bloodrage = __TS__Class()
|
|
local ability_bloodrage = ____exports.ability_bloodrage
|
|
ability_bloodrage.name = "ability_bloodrage"
|
|
ability_bloodrage.____file_path = "scripts/vscripts/abilities/heroes/bloodhunter/ability_bloodrage.lua"
|
|
__TS__ClassExtends(ability_bloodrage, BaseAbility)
|
|
function ability_bloodrage.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
caster:AddNewModifier(
|
|
caster,
|
|
self,
|
|
____exports.modifier_bloodrage_buff.name,
|
|
{duration = self:GetSpecialValueFor("duration")}
|
|
)
|
|
EmitSoundOn("hero_bloodseeker.bloodRage", caster)
|
|
end
|
|
ability_bloodrage = __TS__Decorate(
|
|
ability_bloodrage,
|
|
ability_bloodrage,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_bloodrage"}
|
|
)
|
|
____exports.ability_bloodrage = ability_bloodrage
|
|
____exports.modifier_bloodrage_buff = __TS__Class()
|
|
local modifier_bloodrage_buff = ____exports.modifier_bloodrage_buff
|
|
modifier_bloodrage_buff.name = "modifier_bloodrage_buff"
|
|
modifier_bloodrage_buff.____file_path = "scripts/vscripts/abilities/heroes/bloodhunter/ability_bloodrage.lua"
|
|
__TS__ClassExtends(modifier_bloodrage_buff, BaseModifier)
|
|
function modifier_bloodrage_buff.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.bonusDamage = 0
|
|
self.bonusAttackSpeed = 0
|
|
self.stackDamage = 0
|
|
self.stackAttackspeed = 0
|
|
self.physicalVampirism = 0
|
|
self.stackPhysicalVampirism = 0
|
|
end
|
|
function modifier_bloodrage_buff.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_buff.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_buff.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_buff.prototype.IsBuff(self)
|
|
return true
|
|
end
|
|
function modifier_bloodrage_buff.prototype.RemoveOnDeath(self)
|
|
return true
|
|
end
|
|
function modifier_bloodrage_buff.prototype.GetEffectName(self)
|
|
return "particles/econ/items/bloodseeker/bloodseeker_eztzhok_weapon/bloodseeker_bloodrage_eztzhok.vpcf"
|
|
end
|
|
function modifier_bloodrage_buff.prototype.GetEffectAttachType(self)
|
|
return PATTACH_ABSORIGIN_FOLLOW
|
|
end
|
|
function modifier_bloodrage_buff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_PROCATTACK_FEEDBACK}
|
|
end
|
|
function modifier_bloodrage_buff.prototype.OnCreated(self)
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
self.bonusDamage = ability:GetSpecialValueFor("bonus_damage")
|
|
self.bonusAttackSpeed = ability:GetSpecialValueFor("bonus_attack_speed")
|
|
self.stackDamage = ability:GetSpecialValueFor("stack_damage")
|
|
self.stackAttackspeed = ability:GetSpecialValueFor("stack_attackspeed")
|
|
self.physicalVampirism = ability:GetSpecialValueFor("physical_vampirism")
|
|
self.stackPhysicalVampirism = 0
|
|
local parent = self:GetParent()
|
|
if parent:IsRealHero() then
|
|
addPhysicalVampirism(nil, parent, self.physicalVampirism)
|
|
end
|
|
self:StartIntervalThink(0.25)
|
|
self:OnIntervalThink()
|
|
end
|
|
function modifier_bloodrage_buff.prototype.OnRefresh(self)
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
self.bonusDamage = ability:GetSpecialValueFor("bonus_damage")
|
|
self.bonusAttackSpeed = ability:GetSpecialValueFor("bonus_attack_speed")
|
|
self.stackDamage = ability:GetSpecialValueFor("stack_damage")
|
|
self.stackAttackspeed = ability:GetSpecialValueFor("stack_attackspeed")
|
|
self.physicalVampirism = ability:GetSpecialValueFor("physical_vampirism")
|
|
self.stackPhysicalVampirism = 0
|
|
self:StartIntervalThink(0.25)
|
|
self:OnIntervalThink()
|
|
end
|
|
function modifier_bloodrage_buff.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local currentHealth = parent:GetHealth()
|
|
local damage = 100 * 0.1
|
|
parent:SetHealth(math.max(currentHealth - damage, 1))
|
|
end
|
|
function modifier_bloodrage_buff.prototype.GetModifierProcAttack_Feedback(self, event)
|
|
if not IsServer() then
|
|
return 0
|
|
end
|
|
local parent = self:GetParent()
|
|
if parent:HasScepter() then
|
|
self:AddStack(40, 5)
|
|
else
|
|
self:AddStack(20, 2)
|
|
end
|
|
parent:CalculateStatBonus(true)
|
|
return 0
|
|
end
|
|
function modifier_bloodrage_buff.prototype.GetModifierPreAttack_BonusDamage(self)
|
|
return self.bonusDamage + self:GetStackCount() * self.stackDamage
|
|
end
|
|
function modifier_bloodrage_buff.prototype.GetModifierAttackSpeedBonus_Constant(self)
|
|
return self.bonusAttackSpeed + self:GetStackCount() * self.stackAttackspeed
|
|
end
|
|
function modifier_bloodrage_buff.prototype.AddStack(self, duration, count)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local mod = parent:AddNewModifier(parent, ability, ____exports.modifier_bloodrage_count.name, {duration = duration})
|
|
if mod then
|
|
mod.modifier = self
|
|
mod.bonus = count
|
|
end
|
|
self:SetStackCount(self:GetStackCount() + count)
|
|
if parent:IsRealHero() then
|
|
addPhysicalVampirism(nil, parent, self.stackPhysicalVampirism)
|
|
end
|
|
end
|
|
function modifier_bloodrage_buff.prototype.RemoveStack(self, value)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:SetStackCount(self:GetStackCount() - value)
|
|
local parent = self:GetParent()
|
|
if parent:IsRealHero() then
|
|
reducePhysicalVampirism(nil, parent, self.stackPhysicalVampirism)
|
|
end
|
|
end
|
|
function modifier_bloodrage_buff.prototype.OnDestroy(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
if parent:IsRealHero() then
|
|
local totalPhysical = self.physicalVampirism + self:GetStackCount() * self.stackPhysicalVampirism
|
|
reducePhysicalVampirism(nil, parent, totalPhysical)
|
|
end
|
|
end
|
|
modifier_bloodrage_buff = __TS__Decorate(
|
|
modifier_bloodrage_buff,
|
|
modifier_bloodrage_buff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_bloodrage_buff"}
|
|
)
|
|
____exports.modifier_bloodrage_buff = modifier_bloodrage_buff
|
|
____exports.modifier_bloodrage_count = __TS__Class()
|
|
local modifier_bloodrage_count = ____exports.modifier_bloodrage_count
|
|
modifier_bloodrage_count.name = "modifier_bloodrage_count"
|
|
modifier_bloodrage_count.____file_path = "scripts/vscripts/abilities/heroes/bloodhunter/ability_bloodrage.lua"
|
|
__TS__ClassExtends(modifier_bloodrage_count, BaseModifier)
|
|
function modifier_bloodrage_count.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_bloodrage_count.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_count.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_count.prototype.IsBuff(self)
|
|
return true
|
|
end
|
|
function modifier_bloodrage_count.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_bloodrage_count.prototype.GetAttributes(self)
|
|
return MODIFIER_ATTRIBUTE_MULTIPLE
|
|
end
|
|
function modifier_bloodrage_count.prototype.OnRemoved(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if self.modifier and self.bonus ~= nil then
|
|
self.modifier:RemoveStack(self.bonus)
|
|
end
|
|
end
|
|
modifier_bloodrage_count = __TS__Decorate(
|
|
modifier_bloodrage_count,
|
|
modifier_bloodrage_count,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_bloodrage_count"}
|
|
)
|
|
____exports.modifier_bloodrage_count = modifier_bloodrage_count
|
|
return ____exports
|