159 lines
6.0 KiB
Lua
159 lines
6.0 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.axe_counter_helix_custom = __TS__Class()
|
|
local axe_counter_helix_custom = ____exports.axe_counter_helix_custom
|
|
axe_counter_helix_custom.name = "axe_counter_helix_custom"
|
|
axe_counter_helix_custom.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_counter_helix_custom.lua"
|
|
__TS__ClassExtends(axe_counter_helix_custom, BaseAbility)
|
|
function axe_counter_helix_custom.prototype.Precache(self, context)
|
|
PrecacheResource("particle", "particles/units/heroes/hero_axe/axe_counterhelix.vpcf", context)
|
|
PrecacheResource("particle", "particles/econ/items/axe/axe_weapon_bloodchaser/axe_attack_blur_counterhelix_bloodchaser.vpcf", context)
|
|
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_axe.vsndevts", context)
|
|
end
|
|
function axe_counter_helix_custom.prototype.GetIntrinsicModifierName(self)
|
|
return ____exports.modifier_axe_counter_helix_passive.name
|
|
end
|
|
axe_counter_helix_custom = __TS__Decorate(
|
|
axe_counter_helix_custom,
|
|
axe_counter_helix_custom,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "axe_counter_helix_custom"}
|
|
)
|
|
____exports.axe_counter_helix_custom = axe_counter_helix_custom
|
|
____exports.modifier_axe_counter_helix_passive = __TS__Class()
|
|
local modifier_axe_counter_helix_passive = ____exports.modifier_axe_counter_helix_passive
|
|
modifier_axe_counter_helix_passive.name = "modifier_axe_counter_helix_passive"
|
|
modifier_axe_counter_helix_passive.____file_path = "scripts/vscripts/abilities/heroes/axe/axe_counter_helix_custom.lua"
|
|
__TS__ClassExtends(modifier_axe_counter_helix_passive, BaseModifier)
|
|
function modifier_axe_counter_helix_passive.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.lastHelixGameTime = 0
|
|
self.scepterLandCounter = 0
|
|
end
|
|
function modifier_axe_counter_helix_passive.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_axe_counter_helix_passive.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_axe_counter_helix_passive.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_TAKEDAMAGE}
|
|
end
|
|
function modifier_axe_counter_helix_passive.prototype.OnTakeDamage(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local ability = self:GetAbility()
|
|
if parent:PassivesDisabled() then
|
|
return
|
|
end
|
|
if not ability or event.unit ~= parent then
|
|
return
|
|
end
|
|
local attacker = event.attacker
|
|
if not attacker or attacker == parent or not attacker:IsAlive() then
|
|
return
|
|
end
|
|
if attacker:GetTeamNumber() == parent:GetTeamNumber() then
|
|
return
|
|
end
|
|
local cd = ability:GetSpecialValueFor("duration")
|
|
local now = GameRules:GetGameTime()
|
|
if now < self.lastHelixGameTime + cd then
|
|
return
|
|
end
|
|
local chance = ability:GetSpecialValueFor("trigger_chance")
|
|
local needScepter = parent:HasScepter()
|
|
local attacksForProc = needScepter and ability:GetSpecialValueFor("scepter_attacks") or 0
|
|
local helixed = false
|
|
if attacksForProc > 0 then
|
|
self.scepterLandCounter = self.scepterLandCounter + 1
|
|
if self.scepterLandCounter >= attacksForProc then
|
|
self.scepterLandCounter = 0
|
|
self:triggerHelix(ability)
|
|
helixed = true
|
|
end
|
|
end
|
|
if not helixed and RollPercentage(chance) then
|
|
self:triggerHelix(ability)
|
|
helixed = true
|
|
end
|
|
if helixed then
|
|
self.lastHelixGameTime = now
|
|
end
|
|
end
|
|
function modifier_axe_counter_helix_passive.prototype.triggerHelix(self, ability)
|
|
if self:GetParent():PassivesDisabled() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
local radius = ability:GetSpecialValueFor("radius")
|
|
local damage = ability:GetSpecialValueFor("damage")
|
|
parent:StartGestureWithPlaybackRate(ACT_DOTA_CAST_ABILITY_3, 1)
|
|
local helix_pfx = ParticleManager:CreateParticle("particles/econ/items/axe/axe_weapon_bloodchaser/axe_attack_blur_counterhelix_bloodchaser.vpcf", PATTACH_ABSORIGIN_FOLLOW, parent)
|
|
EmitSoundOn("Hero_Axe.CounterHelix", parent)
|
|
ParticleManager:SetParticleControl(
|
|
helix_pfx,
|
|
0,
|
|
parent:GetAbsOrigin()
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(helix_pfx)
|
|
local enemies = FindUnitsInRadius(
|
|
parent:GetTeamNumber(),
|
|
parent:GetAbsOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
for ____, enemy in ipairs(enemies) do
|
|
do
|
|
if not enemy or not enemy:IsAlive() then
|
|
goto __continue20
|
|
end
|
|
ApplyDamage({
|
|
victim = enemy,
|
|
attacker = parent,
|
|
damage = damage,
|
|
damage_type = ability:GetAbilityDamageType(),
|
|
ability = ability
|
|
})
|
|
parent:PerformAttack(
|
|
enemy,
|
|
false,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
false,
|
|
true
|
|
)
|
|
end
|
|
::__continue20::
|
|
end
|
|
local icd = ability:GetSpecialValueFor("duration")
|
|
if icd > 0 then
|
|
ability:StartCooldown(icd)
|
|
end
|
|
end
|
|
modifier_axe_counter_helix_passive = __TS__Decorate(
|
|
modifier_axe_counter_helix_passive,
|
|
modifier_axe_counter_helix_passive,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_axe_counter_helix_passive"}
|
|
)
|
|
____exports.modifier_axe_counter_helix_passive = modifier_axe_counter_helix_passive
|
|
return ____exports
|