155 lines
6.0 KiB
Lua
155 lines
6.0 KiB
Lua
local ____lualib = require("lualib_bundle")
|
|
local __TS__Class = ____lualib.__TS__Class
|
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
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 ____world_destroyer = require("abilities.heroes.nagash.world_destroyer")
|
|
local applyNagashSecondSkillShardInvulnerable = ____world_destroyer.applyNagashSecondSkillShardInvulnerable
|
|
____exports.leader_call = __TS__Class()
|
|
local leader_call = ____exports.leader_call
|
|
leader_call.name = "leader_call"
|
|
leader_call.____file_path = "scripts/vscripts/abilities/heroes/nagash/leader_call.lua"
|
|
__TS__ClassExtends(leader_call, BaseAbility)
|
|
function leader_call.prototype.getWorldDestroyerUnits(self, caster)
|
|
return __TS__ArrayFilter(
|
|
FindUnitsInRadius(
|
|
caster:GetTeamNumber(),
|
|
caster:GetAbsOrigin(),
|
|
nil,
|
|
2500,
|
|
1,
|
|
bit.bor(18, 1),
|
|
0,
|
|
0,
|
|
false
|
|
),
|
|
function(____, u) return IsValidEntity(u) and u:GetOwner() == caster and u:HasModifier("modifier_dominated_bonus") end
|
|
)
|
|
end
|
|
function leader_call.prototype.CastFilterResult(self)
|
|
if not IsServer() then
|
|
return UF_SUCCESS
|
|
end
|
|
local caster = self:GetCaster()
|
|
local units = self:getWorldDestroyerUnits(caster)
|
|
if #units < 1 then
|
|
return UF_FAIL_CUSTOM
|
|
end
|
|
return UF_SUCCESS
|
|
end
|
|
function leader_call.prototype.GetCustomCastError(self)
|
|
if not IsServer() then
|
|
return ""
|
|
end
|
|
local caster = self:GetCaster()
|
|
local units = self:getWorldDestroyerUnits(caster)
|
|
if #units < 1 then
|
|
return "#dota_hud_error_havent_entities"
|
|
end
|
|
return ""
|
|
end
|
|
function leader_call.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local team = caster:GetTeamNumber()
|
|
applyNagashSecondSkillShardInvulnerable(
|
|
nil,
|
|
caster,
|
|
self,
|
|
self:GetCastPoint() + 0.3
|
|
)
|
|
local explosionRadius = self:GetSpecialValueFor("explosion_radius")
|
|
local explosionDamage = self:GetSpecialValueFor("explosion_damage")
|
|
local units = self:getWorldDestroyerUnits(caster)
|
|
local sacrificedCount = 0
|
|
for ____, unit in ipairs(units) do
|
|
local origin = unit:GetAbsOrigin()
|
|
local p = ParticleManager:CreateParticle("particles/econ/items/zeus/arcana_chariot/zeus_arcana_kill_explosion.vpcf", PATTACH_WORLDORIGIN, nil)
|
|
ParticleManager:SetParticleControl(p, 1, origin)
|
|
ParticleManager:SetParticleControl(p, 2, origin)
|
|
ParticleManager:ReleaseParticleIndex(p)
|
|
EmitSoundOn("Hero_AbyssalUnderlord.PitOfMalice", unit)
|
|
local enemies = FindUnitsInRadius(
|
|
team,
|
|
origin,
|
|
nil,
|
|
explosionRadius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
bit.bor(DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_HERO),
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
for ____, enemy in ipairs(enemies) do
|
|
ApplyDamage({
|
|
victim = enemy,
|
|
attacker = caster,
|
|
damage = self:GetSpecialValueFor("unit_health_for_damage") > 0 and explosionDamage + unit:GetMaxHealth() * (self:GetSpecialValueFor("unit_health_for_damage") * 0.01) or explosionDamage,
|
|
damage_type = DAMAGE_TYPE_PURE,
|
|
ability = self
|
|
})
|
|
end
|
|
if unit:IsAlive() then
|
|
unit:Kill(self, unit)
|
|
sacrificedCount = sacrificedCount + 1
|
|
end
|
|
end
|
|
if sacrificedCount > 0 then
|
|
local tokenModifier = caster:AddNewModifier(caster, self, "modifier_leader_token", {})
|
|
if tokenModifier ~= nil then
|
|
tokenModifier:SetStackCount(tokenModifier:GetStackCount() + sacrificedCount)
|
|
end
|
|
end
|
|
end
|
|
leader_call = __TS__Decorate(
|
|
leader_call,
|
|
leader_call,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "leader_call"}
|
|
)
|
|
____exports.leader_call = leader_call
|
|
____exports.modifier_leader_token = __TS__Class()
|
|
local modifier_leader_token = ____exports.modifier_leader_token
|
|
modifier_leader_token.name = "modifier_leader_token"
|
|
modifier_leader_token.____file_path = "scripts/vscripts/abilities/heroes/nagash/leader_call.lua"
|
|
__TS__ClassExtends(modifier_leader_token, BaseModifier)
|
|
function modifier_leader_token.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_leader_token.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_leader_token.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_EVENT_ON_DEATH}
|
|
end
|
|
function modifier_leader_token.prototype.OnDeath(self, event)
|
|
if event.unit == self:GetParent() then
|
|
self:SetStackCount(self:GetStackCount() * (self:GetAbility():GetSpecialValueFor("lost_souls_pct") * 0.01))
|
|
end
|
|
end
|
|
function modifier_leader_token.prototype.GetModifierBonusStats_Agility(self)
|
|
return self:GetStackCount() * self:GetAbility():GetSpecialValueFor("bonus_stats_per_soul")
|
|
end
|
|
function modifier_leader_token.prototype.GetModifierBonusStats_Intellect(self)
|
|
return self:GetStackCount() * self:GetAbility():GetSpecialValueFor("bonus_stats_per_soul")
|
|
end
|
|
function modifier_leader_token.prototype.GetModifierBonusStats_Strength(self)
|
|
return self:GetStackCount() * self:GetAbility():GetSpecialValueFor("bonus_stats_per_soul")
|
|
end
|
|
modifier_leader_token = __TS__Decorate(
|
|
modifier_leader_token,
|
|
modifier_leader_token,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_leader_token"}
|
|
)
|
|
____exports.modifier_leader_token = modifier_leader_token
|
|
return ____exports
|