335 lines
13 KiB
Lua
335 lines
13 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
|
||
--- Навсегда броня: стаки × armor_per_creep_kill (крип +0.1, герой — через armor_per_stack).
|
||
local function axeCullingAddPermanentArmor(self, caster, ability, flatArmor)
|
||
if flatArmor <= 0 then
|
||
return
|
||
end
|
||
local step = ability:GetSpecialValueFor("armor_per_creep_kill")
|
||
if step <= 0 then
|
||
return
|
||
end
|
||
local addStacks = math.floor(flatArmor / step + 0.5)
|
||
if addStacks < 1 then
|
||
addStacks = 1
|
||
end
|
||
local m = caster:FindModifierByName(____exports.modifier_axe_culling_blade_armor_stack.name)
|
||
if not m then
|
||
m = caster:AddNewModifier(caster, ability, ____exports.modifier_axe_culling_blade_armor_stack.name, {})
|
||
end
|
||
if m ~= nil then
|
||
m:SetStackCount(m:GetStackCount() + addStacks)
|
||
end
|
||
end
|
||
local function axeReduceAllAbilityCooldowns(self, caster, seconds)
|
||
if seconds <= 0 then
|
||
return
|
||
end
|
||
do
|
||
local i = 0
|
||
while i < 24 do
|
||
do
|
||
local ab = caster:GetAbilityByIndex(i)
|
||
if not ab or ab:IsNull() then
|
||
goto __continue10
|
||
end
|
||
local remaining = ab:GetCooldownTimeRemaining()
|
||
if remaining <= 0 then
|
||
goto __continue10
|
||
end
|
||
ab:EndCooldown()
|
||
local next = math.max(0, remaining - seconds)
|
||
if next > 0 then
|
||
ab:StartCooldown(next)
|
||
end
|
||
end
|
||
::__continue10::
|
||
i = i + 1
|
||
end
|
||
end
|
||
end
|
||
____exports.axe_culling_blade_custom = __TS__Class()
|
||
local axe_culling_blade_custom = ____exports.axe_culling_blade_custom
|
||
axe_culling_blade_custom.name = "axe_culling_blade_custom"
|
||
axe_culling_blade_custom.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_culling_blade_custom.lua"
|
||
__TS__ClassExtends(axe_culling_blade_custom, BaseAbility)
|
||
function axe_culling_blade_custom.prototype.GetIntrinsicModifierName(self)
|
||
return ____exports.modifier_axe_culling_blade_shard_cdr.name
|
||
end
|
||
function axe_culling_blade_custom.prototype.Precache(self, context)
|
||
PrecacheResource("particle", "particles/units/heroes/hero_axe/axe_culling_blade.vpcf", context)
|
||
PrecacheResource("particle", "particles/econ/items/axe/ti9_jungle_axe/ti9_jungle_axe_culling_blade_sprint_fire.vpcf", context)
|
||
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_axe.vsndevts", context)
|
||
end
|
||
function axe_culling_blade_custom.prototype.GetCastRange(self, location, target)
|
||
return self:GetSpecialValueFor("AbilityCastRange")
|
||
end
|
||
function axe_culling_blade_custom.prototype.GetAOERadius(self)
|
||
return self:GetSpecialValueFor("cull_radius")
|
||
end
|
||
function axe_culling_blade_custom.prototype.OnSpellStart(self)
|
||
if not IsServer() then
|
||
return
|
||
end
|
||
local caster = self:GetCaster()
|
||
local point = self:GetCursorPosition()
|
||
local cullRadius = self:GetSpecialValueFor("cull_radius")
|
||
local buffRadius = self:GetSpecialValueFor("speed_aoe")
|
||
local creepArmor = self:GetSpecialValueFor("armor_per_creep_kill")
|
||
local heroArmor = self:GetSpecialValueFor("armor_per_stack")
|
||
EmitSoundOn("Hero_Axe.Culling_Blade", caster)
|
||
local enemies = FindUnitsInRadius(
|
||
caster:GetTeamNumber(),
|
||
point,
|
||
nil,
|
||
cullRadius,
|
||
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
||
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
|
||
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES,
|
||
FIND_ANY_ORDER,
|
||
false
|
||
)
|
||
local anyExecuted = false
|
||
for ____, target in ipairs(enemies) do
|
||
do
|
||
if not target or not target:IsAlive() or target:IsInvulnerable() then
|
||
goto __continue20
|
||
end
|
||
self:playCullingBladeParticle(caster, target)
|
||
EmitSoundOn("Hero_Axe.Culling_Blade", target)
|
||
local wasHero = target:IsHero()
|
||
local bonusAttackDamage = caster:GetAverageTrueAttackDamage(target)
|
||
ApplyDamage({
|
||
victim = target,
|
||
attacker = caster,
|
||
damage = bonusAttackDamage,
|
||
damage_type = self:GetAbilityDamageType(),
|
||
ability = self
|
||
})
|
||
if target:IsAlive() then
|
||
caster:PerformAttack(
|
||
target,
|
||
false,
|
||
true,
|
||
true,
|
||
true,
|
||
false,
|
||
false,
|
||
true
|
||
)
|
||
end
|
||
if not target:IsAlive() then
|
||
anyExecuted = true
|
||
EmitSoundOn("Hero_Axe.Culling_Blade_Success", target)
|
||
if not wasHero and creepArmor > 0 then
|
||
axeCullingAddPermanentArmor(nil, caster, self, creepArmor)
|
||
elseif wasHero and heroArmor > 0 then
|
||
axeCullingAddPermanentArmor(nil, caster, self, heroArmor)
|
||
end
|
||
end
|
||
end
|
||
::__continue20::
|
||
end
|
||
if anyExecuted then
|
||
local durBase = self:GetSpecialValueFor("speed_duration")
|
||
local dur = caster:HasScepter() and self:GetSpecialValueFor("scepter_speed_duration") or durBase
|
||
local tm = caster:GetTeamNumber()
|
||
local unitList = FindUnitsInRadius(
|
||
tm,
|
||
caster:GetAbsOrigin(),
|
||
nil,
|
||
buffRadius,
|
||
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
|
||
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
|
||
DOTA_UNIT_TARGET_FLAG_NONE,
|
||
FIND_ANY_ORDER,
|
||
false
|
||
)
|
||
for ____, unit in ipairs(unitList) do
|
||
do
|
||
if not unit or not unit:IsAlive() then
|
||
goto __continue28
|
||
end
|
||
unit:AddNewModifier(caster, self, ____exports.modifier_axe_culling_blade_movespeed.name, {duration = dur})
|
||
end
|
||
::__continue28::
|
||
end
|
||
end
|
||
end
|
||
function axe_culling_blade_custom.prototype.playCullingBladeParticle(self, caster, target)
|
||
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_axe/axe_culling_blade.vpcf", PATTACH_ABSORIGIN_FOLLOW, target)
|
||
ParticleManager:SetParticleControl(
|
||
particle,
|
||
0,
|
||
caster:GetAbsOrigin()
|
||
)
|
||
ParticleManager:SetParticleControl(
|
||
particle,
|
||
1,
|
||
target:GetAbsOrigin()
|
||
)
|
||
ParticleManager:SetParticleControlEnt(
|
||
particle,
|
||
2,
|
||
target,
|
||
PATTACH_ABSORIGIN_FOLLOW,
|
||
"attach_hitloc",
|
||
target:GetAbsOrigin(),
|
||
true
|
||
)
|
||
ParticleManager:ReleaseParticleIndex(particle)
|
||
end
|
||
axe_culling_blade_custom = __TS__Decorate(
|
||
axe_culling_blade_custom,
|
||
axe_culling_blade_custom,
|
||
{registerAbility(nil)},
|
||
{kind = "class", name = "axe_culling_blade_custom"}
|
||
)
|
||
____exports.axe_culling_blade_custom = axe_culling_blade_custom
|
||
____exports.modifier_axe_culling_blade_shard_cdr = __TS__Class()
|
||
local modifier_axe_culling_blade_shard_cdr = ____exports.modifier_axe_culling_blade_shard_cdr
|
||
modifier_axe_culling_blade_shard_cdr.name = "modifier_axe_culling_blade_shard_cdr"
|
||
modifier_axe_culling_blade_shard_cdr.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_culling_blade_custom.lua"
|
||
__TS__ClassExtends(modifier_axe_culling_blade_shard_cdr, BaseModifier)
|
||
function modifier_axe_culling_blade_shard_cdr.prototype.IsHidden(self)
|
||
return true
|
||
end
|
||
function modifier_axe_culling_blade_shard_cdr.prototype.IsPurgable(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_shard_cdr.prototype.RemoveOnDeath(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_shard_cdr.prototype.OnCreated(self)
|
||
if not IsServer() then
|
||
return
|
||
end
|
||
local parent = self:GetParent()
|
||
self.killListener = ListenToGameEvent(
|
||
"entity_killed",
|
||
function(event)
|
||
local attacker = EntIndexToHScript(event.entindex_attacker)
|
||
local killed = EntIndexToHScript(event.entindex_killed)
|
||
local ____temp_0
|
||
if event.entindex_inflictor ~= nil and event.entindex_inflictor ~= 0 then
|
||
____temp_0 = EntIndexToHScript(event.entindex_inflictor)
|
||
else
|
||
____temp_0 = nil
|
||
end
|
||
local inflictor = ____temp_0
|
||
if not attacker or not killed then
|
||
return
|
||
end
|
||
if attacker ~= parent then
|
||
return
|
||
end
|
||
if inflictor and not inflictor:IsNull() then
|
||
return
|
||
end
|
||
if not parent:IsRealHero() or parent:IsIllusion() then
|
||
return
|
||
end
|
||
if parent:PassivesDisabled() then
|
||
return
|
||
end
|
||
if not parent:HasScepter() then
|
||
return
|
||
end
|
||
if not killed:IsCreep() then
|
||
return
|
||
end
|
||
axeReduceAllAbilityCooldowns(nil, parent, 1)
|
||
end,
|
||
nil
|
||
)
|
||
end
|
||
function modifier_axe_culling_blade_shard_cdr.prototype.OnDestroy(self)
|
||
if self.killListener ~= nil then
|
||
StopListeningToGameEvent(self.killListener)
|
||
self.killListener = nil
|
||
end
|
||
end
|
||
modifier_axe_culling_blade_shard_cdr = __TS__Decorate(
|
||
modifier_axe_culling_blade_shard_cdr,
|
||
modifier_axe_culling_blade_shard_cdr,
|
||
{registerModifier(nil)},
|
||
{kind = "class", name = "modifier_axe_culling_blade_shard_cdr"}
|
||
)
|
||
____exports.modifier_axe_culling_blade_shard_cdr = modifier_axe_culling_blade_shard_cdr
|
||
____exports.modifier_axe_culling_blade_armor_stack = __TS__Class()
|
||
local modifier_axe_culling_blade_armor_stack = ____exports.modifier_axe_culling_blade_armor_stack
|
||
modifier_axe_culling_blade_armor_stack.name = "modifier_axe_culling_blade_armor_stack"
|
||
modifier_axe_culling_blade_armor_stack.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_culling_blade_custom.lua"
|
||
__TS__ClassExtends(modifier_axe_culling_blade_armor_stack, BaseModifier)
|
||
function modifier_axe_culling_blade_armor_stack.prototype.IsHidden(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_armor_stack.prototype.IsPurgable(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_armor_stack.prototype.IsDebuff(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_armor_stack.prototype.DeclareFunctions(self)
|
||
return {MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS}
|
||
end
|
||
function modifier_axe_culling_blade_armor_stack.prototype.GetModifierPhysicalArmorBonus(self)
|
||
local ab = self:GetAbility()
|
||
if not ab then
|
||
return 0
|
||
end
|
||
return self:GetStackCount() * ab:GetSpecialValueFor("armor_per_creep_kill")
|
||
end
|
||
modifier_axe_culling_blade_armor_stack = __TS__Decorate(
|
||
modifier_axe_culling_blade_armor_stack,
|
||
modifier_axe_culling_blade_armor_stack,
|
||
{registerModifier(nil)},
|
||
{kind = "class", name = "modifier_axe_culling_blade_armor_stack"}
|
||
)
|
||
____exports.modifier_axe_culling_blade_armor_stack = modifier_axe_culling_blade_armor_stack
|
||
____exports.modifier_axe_culling_blade_movespeed = __TS__Class()
|
||
local modifier_axe_culling_blade_movespeed = ____exports.modifier_axe_culling_blade_movespeed
|
||
modifier_axe_culling_blade_movespeed.name = "modifier_axe_culling_blade_movespeed"
|
||
modifier_axe_culling_blade_movespeed.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_culling_blade_custom.lua"
|
||
__TS__ClassExtends(modifier_axe_culling_blade_movespeed, BaseModifier)
|
||
function modifier_axe_culling_blade_movespeed.prototype.IsHidden(self)
|
||
return false
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.IsPurgable(self)
|
||
return true
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.DeclareFunctions(self)
|
||
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT}
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.GetModifierMoveSpeedBonus_Percentage(self)
|
||
return self:GetAbility():GetSpecialValueFor("speed_bonus")
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.CheckState(self)
|
||
return {[MODIFIER_STATE_DEBUFF_IMMUNE] = true}
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.GetModifierAttackSpeedBonus_Constant(self)
|
||
return self:GetAbility():GetSpecialValueFor("attack_speed_bonus")
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.GetEffectName(self)
|
||
return "particles/econ/items/axe/ti9_jungle_axe/ti9_jungle_axe_culling_blade_sprint_fire.vpcf"
|
||
end
|
||
function modifier_axe_culling_blade_movespeed.prototype.GetEffectAttachType(self)
|
||
return PATTACH_ABSORIGIN_FOLLOW
|
||
end
|
||
modifier_axe_culling_blade_movespeed = __TS__Decorate(
|
||
modifier_axe_culling_blade_movespeed,
|
||
modifier_axe_culling_blade_movespeed,
|
||
{registerModifier(nil)},
|
||
{kind = "class", name = "modifier_axe_culling_blade_movespeed"}
|
||
)
|
||
____exports.modifier_axe_culling_blade_movespeed = modifier_axe_culling_blade_movespeed
|
||
return ____exports
|