Files
Dota-Zombie-Invasion/scripts/vscripts/abilities/heroes/sven/ability_sven_warcry_custom.lua
T
2026-05-29 15:11:31 +07:00

230 lines
9.5 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
____exports.ability_sven_warcry_custom = __TS__Class()
local ability_sven_warcry_custom = ____exports.ability_sven_warcry_custom
ability_sven_warcry_custom.name = "ability_sven_warcry_custom"
ability_sven_warcry_custom.____file_path = "scripts/vscripts/abilities/heroes/sven/ability_sven_warcry_custom.lua"
__TS__ClassExtends(ability_sven_warcry_custom, BaseAbility)
function ability_sven_warcry_custom.prototype.GetIntrinsicModifierName(self)
return "modifier_sven_warcry_custom_passive"
end
function ability_sven_warcry_custom.prototype.GetHealthCost(self, level)
if self:GetSpecialValueFor("shield_pct") > 0 then
return self:GetCaster():GetHealth()
end
return 0
end
function ability_sven_warcry_custom.prototype.OnSpellStart(self)
if not IsServer() then
return
end
local caster = self:GetCaster()
if not caster then
return
end
local duration = self:GetSpecialValueFor("duration")
local radius = self:GetSpecialValueFor("radius")
local nearbyHeroes = FindUnitsInRadius(
caster:GetTeamNumber(),
caster:GetAbsOrigin(),
nil,
radius,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false
)
for ____, unit in ipairs(nearbyHeroes) do
if unit and IsValidEntity(unit) and unit:IsAlive() then
unit:Purge(
false,
true,
false,
true,
true
)
end
end
caster:AddNewModifier(caster, self, "modifier_sven_warcry_custom_active", {duration = duration})
if self:GetSpecialValueFor("shield_pct") > 0 then
local shieldAmount = self:GetCaster():GetMaxHealth() * (self:GetSpecialValueFor("shield_pct") / 100)
local casterModifier = caster:AddNewModifier(caster, self, "modifier_sven_warcry_custom_buff", {})
if casterModifier ~= nil then
casterModifier:SetStackCount(shieldAmount)
end
end
for ____, ally in ipairs(nearbyHeroes) do
if ally ~= caster then
ally:AddNewModifier(caster, self, "modifier_sven_warcry_custom_active", {duration = duration})
if self:GetSpecialValueFor("shield_pct") > 0 then
local shieldAmount = self:GetCaster():GetMaxHealth() * (self:GetSpecialValueFor("shield_pct") / 100)
local allyModifier = ally:AddNewModifier(caster, self, "modifier_sven_warcry_custom_buff", {})
if allyModifier ~= nil then
allyModifier:SetStackCount(shieldAmount)
end
end
end
end
EmitSoundOn("Hero_Sven.WarCry", caster)
local particleId = ParticleManager:CreateParticle("particles/units/heroes/hero_sven/sven_spell_warcry.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
ParticleManager:ReleaseParticleIndex(particleId)
end
ability_sven_warcry_custom = __TS__Decorate(
ability_sven_warcry_custom,
ability_sven_warcry_custom,
{registerAbility(nil)},
{kind = "class", name = "ability_sven_warcry_custom"}
)
____exports.ability_sven_warcry_custom = ability_sven_warcry_custom
____exports.modifier_sven_warcry_custom_passive = __TS__Class()
local modifier_sven_warcry_custom_passive = ____exports.modifier_sven_warcry_custom_passive
modifier_sven_warcry_custom_passive.name = "modifier_sven_warcry_custom_passive"
modifier_sven_warcry_custom_passive.____file_path = "scripts/vscripts/abilities/heroes/sven/ability_sven_warcry_custom.lua"
__TS__ClassExtends(modifier_sven_warcry_custom_passive, BaseModifier)
function modifier_sven_warcry_custom_passive.prototype.IsHidden(self)
return true
end
function modifier_sven_warcry_custom_passive.prototype.IsDebuff(self)
return false
end
function modifier_sven_warcry_custom_passive.prototype.IsPurgable(self)
return false
end
function modifier_sven_warcry_custom_passive.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE}
end
function modifier_sven_warcry_custom_passive.prototype.GetModifierPreAttack_BonusDamage(self)
if self:GetParent():PassivesDisabled() then
return 0
end
local ability = self:GetAbility()
if not ability then
return 0
end
return ability:GetSpecialValueFor("damage_bonus_per_armor") * self:GetParent():GetPhysicalArmorValue(false)
end
modifier_sven_warcry_custom_passive = __TS__Decorate(
modifier_sven_warcry_custom_passive,
modifier_sven_warcry_custom_passive,
{registerModifier(nil)},
{kind = "class", name = "modifier_sven_warcry_custom_passive"}
)
____exports.modifier_sven_warcry_custom_passive = modifier_sven_warcry_custom_passive
____exports.modifier_sven_warcry_custom_active = __TS__Class()
local modifier_sven_warcry_custom_active = ____exports.modifier_sven_warcry_custom_active
modifier_sven_warcry_custom_active.name = "modifier_sven_warcry_custom_active"
modifier_sven_warcry_custom_active.____file_path = "scripts/vscripts/abilities/heroes/sven/ability_sven_warcry_custom.lua"
__TS__ClassExtends(modifier_sven_warcry_custom_active, BaseModifier)
function modifier_sven_warcry_custom_active.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.armor_bonus = 0
self.move_speed_bonus = 0
self.attack_speed_bonus = 0
end
function modifier_sven_warcry_custom_active.prototype.IsHidden(self)
return false
end
function modifier_sven_warcry_custom_active.prototype.IsDebuff(self)
return false
end
function modifier_sven_warcry_custom_active.prototype.IsPurgable(self)
return true
end
function modifier_sven_warcry_custom_active.prototype.OnCreated(self)
local ability = self:GetAbility()
if not ability then
return
end
self.armor_bonus = ability:GetSpecialValueFor("armor_bonus")
self.move_speed_bonus = ability:GetSpecialValueFor("movespeed_bonus")
self.attack_speed_bonus = ability:GetSpecialValueFor("attackspeed_bonus")
end
function modifier_sven_warcry_custom_active.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_ATTACKSPEED_PERCENTAGE}
end
function modifier_sven_warcry_custom_active.prototype.GetModifierAttackSpeedPercentage(self)
return self.attack_speed_bonus
end
function modifier_sven_warcry_custom_active.prototype.GetModifierPhysicalArmorBonus(self)
return self.armor_bonus
end
function modifier_sven_warcry_custom_active.prototype.GetModifierMoveSpeedBonus_Percentage(self)
return self.move_speed_bonus
end
function modifier_sven_warcry_custom_active.prototype.GetEffectName(self)
return "particles/units/heroes/hero_sven/sven_warcry_buff.vpcf"
end
function modifier_sven_warcry_custom_active.prototype.GetEffectAttachType(self)
return PATTACH_ABSORIGIN_FOLLOW
end
modifier_sven_warcry_custom_active = __TS__Decorate(
modifier_sven_warcry_custom_active,
modifier_sven_warcry_custom_active,
{registerModifier(nil)},
{kind = "class", name = "modifier_sven_warcry_custom_active"}
)
____exports.modifier_sven_warcry_custom_active = modifier_sven_warcry_custom_active
____exports.modifier_sven_warcry_custom_buff = __TS__Class()
local modifier_sven_warcry_custom_buff = ____exports.modifier_sven_warcry_custom_buff
modifier_sven_warcry_custom_buff.name = "modifier_sven_warcry_custom_buff"
modifier_sven_warcry_custom_buff.____file_path = "scripts/vscripts/abilities/heroes/sven/ability_sven_warcry_custom.lua"
__TS__ClassExtends(modifier_sven_warcry_custom_buff, BaseModifier)
function modifier_sven_warcry_custom_buff.prototype.IsHidden(self)
return false
end
function modifier_sven_warcry_custom_buff.prototype.IsPurgable(self)
return false
end
function modifier_sven_warcry_custom_buff.prototype.GetEffectName(self)
return "particles/units/heroes/hero_medusa/medusa_mana_shield_buff.vpcf"
end
function modifier_sven_warcry_custom_buff.prototype.GetEffectAttachType(self)
return PATTACH_ABSORIGIN_FOLLOW
end
function modifier_sven_warcry_custom_buff.prototype.OnCreated(self)
if not IsServer() then
return
end
end
function modifier_sven_warcry_custom_buff.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_INCOMING_DAMAGE_CONSTANT}
end
function modifier_sven_warcry_custom_buff.prototype.GetModifierIncomingDamageConstant(self, event)
if IsClient() then
return self:GetStackCount()
end
if not IsServer() then
return 0
end
if event.inflictor and event.inflictor == self:GetAbility() then
return 0
end
if self:GetStackCount() > event.damage then
self:SetStackCount(self:GetStackCount() - event.damage)
local damage = event.damage
return -damage
else
local damage = self:GetStackCount()
self:SetStackCount(0)
self:Destroy()
return -damage
end
end
modifier_sven_warcry_custom_buff = __TS__Decorate(
modifier_sven_warcry_custom_buff,
modifier_sven_warcry_custom_buff,
{registerModifier(nil)},
{kind = "class", name = "modifier_sven_warcry_custom_buff"}
)
____exports.modifier_sven_warcry_custom_buff = modifier_sven_warcry_custom_buff
return ____exports