167 lines
5.3 KiB
Lua
167 lines
5.3 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 BaseItem = ____dota_ts_adapter.BaseItem
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
____exports.item_storm = __TS__Class()
|
|
local item_storm = ____exports.item_storm
|
|
item_storm.name = "item_storm"
|
|
item_storm.____file_path = "scripts/vscripts/items/default_items/item_storm.lua"
|
|
__TS__ClassExtends(item_storm, BaseItem)
|
|
function item_storm.prototype.GetIntrinsicModifierName(self)
|
|
return "modifier_storm"
|
|
end
|
|
item_storm = __TS__Decorate(
|
|
item_storm,
|
|
item_storm,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "item_storm"}
|
|
)
|
|
____exports.item_storm = item_storm
|
|
____exports.modifier_storm = __TS__Class()
|
|
local modifier_storm = ____exports.modifier_storm
|
|
modifier_storm.name = "modifier_storm"
|
|
modifier_storm.____file_path = "scripts/vscripts/items/default_items/item_storm.lua"
|
|
__TS__ClassExtends(modifier_storm, BaseModifier)
|
|
function modifier_storm.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_storm.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_storm.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_storm.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_EVENT_ON_ATTACK_LANDED}
|
|
end
|
|
function modifier_storm.prototype.GetModifierPreAttack_BonusDamage(self)
|
|
return self:GetAbility():GetSpecialValueFor("bonus_damage")
|
|
end
|
|
function modifier_storm.prototype.OnAttackLanded(self, event)
|
|
if event.attacker ~= self:GetParent() then
|
|
return
|
|
end
|
|
if RandomInt(1, 100) > self:GetAbility():GetSpecialValueFor("chance") then
|
|
return
|
|
end
|
|
local ____opt_0 = self:GetAbility()
|
|
if (____opt_0 and ____opt_0:IsCooldownReady()) == false then
|
|
return
|
|
end
|
|
self:GetAbility():GetSpecialValueFor("bolt_damage")
|
|
event.target:AddNewModifier(
|
|
self:GetParent(),
|
|
self:GetAbility(),
|
|
"modifier_storm_dps",
|
|
{
|
|
duration = 0.26,
|
|
attacker_entindex = self:GetCaster():entindex()
|
|
}
|
|
)
|
|
self:GetAbility():StartCooldown(self:GetAbility():GetSpecialValueFor("ability_cooldown"))
|
|
end
|
|
modifier_storm = __TS__Decorate(
|
|
modifier_storm,
|
|
modifier_storm,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_storm"}
|
|
)
|
|
____exports.modifier_storm = modifier_storm
|
|
____exports.modifier_storm_dps = __TS__Class()
|
|
local modifier_storm_dps = ____exports.modifier_storm_dps
|
|
modifier_storm_dps.name = "modifier_storm_dps"
|
|
modifier_storm_dps.____file_path = "scripts/vscripts/items/default_items/item_storm.lua"
|
|
__TS__ClassExtends(modifier_storm_dps, BaseModifier)
|
|
function modifier_storm_dps.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_storm_dps.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_storm_dps.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_storm_dps.prototype.OnCreated(self, params)
|
|
self:SetStackCount(3)
|
|
self:StartIntervalThink(0.25)
|
|
end
|
|
function modifier_storm_dps.prototype.OnIntervalThink(self)
|
|
if self:GetStackCount() == 0 then
|
|
return
|
|
end
|
|
self:SetDuration(0.26, true)
|
|
self:SetStackCount(self:GetStackCount() - 1)
|
|
local victim = self:GetParent()
|
|
local attacker = self:GetCaster()
|
|
local particle = ParticleManager:CreateParticle("particles/items_fx/chain_lightning.vpcf", PATTACH_ABSORIGIN_FOLLOW, victim)
|
|
if attacker then
|
|
ParticleManager:SetParticleControlEnt(
|
|
particle,
|
|
0,
|
|
attacker,
|
|
PATTACH_POINT_FOLLOW,
|
|
"attach_hitloc",
|
|
attacker:GetAbsOrigin(),
|
|
true
|
|
)
|
|
else
|
|
ParticleManager:SetParticleControl(
|
|
particle,
|
|
0,
|
|
victim:GetAbsOrigin()
|
|
)
|
|
end
|
|
ParticleManager:SetParticleControlEnt(
|
|
particle,
|
|
1,
|
|
victim,
|
|
PATTACH_POINT_FOLLOW,
|
|
"attach_hitloc",
|
|
victim:GetAbsOrigin(),
|
|
true
|
|
)
|
|
ParticleManager:SetParticleControl(
|
|
particle,
|
|
2,
|
|
Vector(1, 1, 1)
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(particle)
|
|
local ability = self:GetAbility()
|
|
if IsClient() then
|
|
return
|
|
end
|
|
if ability ~= nil and victim ~= nil and attacker ~= nil then
|
|
ApplyDamage({
|
|
victim = victim,
|
|
attacker = attacker,
|
|
damage = ability:GetSpecialValueFor("bolt_damage"),
|
|
damage_type = DAMAGE_TYPE_MAGICAL,
|
|
damage_flags = DOTA_DAMAGE_FLAG_NONE,
|
|
ability = ability
|
|
})
|
|
end
|
|
self:GetParent():AddNewModifier(
|
|
self:GetParent(),
|
|
self:GetAbility(),
|
|
"modifier_stunned",
|
|
{duration = self:GetAbility():GetSpecialValueFor("stun")}
|
|
)
|
|
end
|
|
function modifier_storm_dps.prototype.GetTexture(self)
|
|
return "default_items/storm"
|
|
end
|
|
modifier_storm_dps = __TS__Decorate(
|
|
modifier_storm_dps,
|
|
modifier_storm_dps,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_storm_dps"}
|
|
)
|
|
____exports.modifier_storm_dps = modifier_storm_dps
|
|
return ____exports
|