172 lines
6.2 KiB
Lua
172 lines
6.2 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_hell_summon = __TS__Class()
|
|
local ability_hell_summon = ____exports.ability_hell_summon
|
|
ability_hell_summon.name = "ability_hell_summon"
|
|
ability_hell_summon.____file_path = "scripts/vscripts/abilities/heroes/sargatanas/ability_hell_summon.lua"
|
|
__TS__ClassExtends(ability_hell_summon, BaseAbility)
|
|
function ability_hell_summon.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local point = caster:GetAbsOrigin()
|
|
local portal = CreateUnitByName(
|
|
"npc_portal",
|
|
point,
|
|
true,
|
|
nil,
|
|
nil,
|
|
DOTA_TEAM_GOODGUYS
|
|
)
|
|
if not portal then
|
|
return
|
|
end
|
|
local pointForUnit = portal:GetAbsOrigin()
|
|
local unitName = self:UnitnameHell()
|
|
local strDmg = caster:GetStrength() * self:GetSpecialValueFor("str_dmg")
|
|
local strHp = caster:GetStrength() * self:GetSpecialValueFor("str_hp")
|
|
portal:AddNewModifier(caster, self, ____exports.modifier_hell_summon_portal.name, {})
|
|
local units = FindUnitsInRadius(
|
|
DOTA_TEAM_GOODGUYS,
|
|
caster:GetAbsOrigin(),
|
|
nil,
|
|
-1,
|
|
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
|
|
DOTA_UNIT_TARGET_BASIC,
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
for ____, unit in ipairs(units) do
|
|
if unit:GetOwner() == caster then
|
|
unit:Destroy()
|
|
end
|
|
end
|
|
Timers:CreateTimer(
|
|
2,
|
|
function()
|
|
if not caster:IsAlive() then
|
|
return nil
|
|
end
|
|
if caster:HasModifier("modifier_star_devour_stack") then
|
|
local modif = caster:FindModifierByName("modifier_star_devour_stack")
|
|
if modif then
|
|
local stackCount = modif:GetStackCount()
|
|
do
|
|
local i = 0
|
|
while i < stackCount do
|
|
local unit = CreateUnitByName(
|
|
unitName,
|
|
pointForUnit,
|
|
true,
|
|
nil,
|
|
nil,
|
|
DOTA_TEAM_GOODGUYS
|
|
)
|
|
if unit ~= nil and unit ~= nil then
|
|
unit:SetOwner(caster)
|
|
unit:SetControllableByPlayer(
|
|
caster:GetPlayerID(),
|
|
true
|
|
)
|
|
FindClearSpaceForUnit(unit, pointForUnit, true)
|
|
unit:SetBaseMaxHealth(strHp)
|
|
unit:SetBaseDamageMin(strDmg)
|
|
unit:SetBaseDamageMax(strDmg)
|
|
end
|
|
i = i + 1
|
|
end
|
|
end
|
|
caster:RemoveModifierByName("modifier_star_devour_stack")
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
)
|
|
end
|
|
function ability_hell_summon.prototype.UnitnameHell(self)
|
|
local abilityLvl = self:GetLevel()
|
|
if abilityLvl == 1 then
|
|
return "npc_spirit_sargatanas_hell_summon"
|
|
elseif abilityLvl == 2 then
|
|
return "npc_golem_sargatanas_hell_summon"
|
|
elseif abilityLvl == 3 then
|
|
return "npc_scorpion_sargatanas_hell_summon"
|
|
elseif abilityLvl == 4 then
|
|
return "npc_dragon_sargatanas_hell_summon"
|
|
elseif abilityLvl == 5 then
|
|
return "npc_kaban_sargatanas_hell_summon"
|
|
end
|
|
return "npc_spirit_sargatanas_hell_summon"
|
|
end
|
|
ability_hell_summon = __TS__Decorate(
|
|
ability_hell_summon,
|
|
ability_hell_summon,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_hell_summon"}
|
|
)
|
|
____exports.ability_hell_summon = ability_hell_summon
|
|
____exports.modifier_hell_summon_portal = __TS__Class()
|
|
local modifier_hell_summon_portal = ____exports.modifier_hell_summon_portal
|
|
modifier_hell_summon_portal.name = "modifier_hell_summon_portal"
|
|
modifier_hell_summon_portal.____file_path = "scripts/vscripts/abilities/heroes/sargatanas/ability_hell_summon.lua"
|
|
__TS__ClassExtends(modifier_hell_summon_portal, BaseModifier)
|
|
function modifier_hell_summon_portal.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_hell_summon_portal.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_hell_summon_portal.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_hell_summon_portal.prototype.AllowIllusionDuplicate(self)
|
|
return true
|
|
end
|
|
function modifier_hell_summon_portal.prototype.GetAttributes(self)
|
|
return MODIFIER_ATTRIBUTE_IGNORE_INVULNERABLE
|
|
end
|
|
function modifier_hell_summon_portal.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local particleName2 = "particles/units/heroes/heroes_underlord/abbysal_underlord_portal_ambient.vpcf"
|
|
self.effectCast = ParticleManager:CreateParticle(
|
|
particleName2,
|
|
PATTACH_ABSORIGIN_FOLLOW,
|
|
self:GetParent()
|
|
)
|
|
self:StartIntervalThink(5)
|
|
end
|
|
function modifier_hell_summon_portal.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:GetParent():Destroy()
|
|
end
|
|
function modifier_hell_summon_portal.prototype.OnDestroy(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if self.effectCast ~= nil then
|
|
ParticleManager:DestroyParticle(self.effectCast, true)
|
|
end
|
|
end
|
|
modifier_hell_summon_portal = __TS__Decorate(
|
|
modifier_hell_summon_portal,
|
|
modifier_hell_summon_portal,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_hell_summon_portal"}
|
|
)
|
|
____exports.modifier_hell_summon_portal = modifier_hell_summon_portal
|
|
return ____exports
|