Files
Dota-Zombie-Invasion/scripts/vscripts/items/default_items/item_ethereal_blade_custom.lua
T
2026-05-29 15:11:31 +07:00

325 lines
14 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 __TS__ArrayPush = ____lualib.__TS__ArrayPush
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
local ETHEREAL_BLADE_PARTICLE = "particles/items_fx/ethereal_blade.vpcf"
local ETHEREAL_STATUS_PARTICLE = "particles/status_fx/status_effect_ghost.vpcf"
____exports.item_ethereal_blade_custom = __TS__Class()
local item_ethereal_blade_custom = ____exports.item_ethereal_blade_custom
item_ethereal_blade_custom.name = "item_ethereal_blade_custom"
item_ethereal_blade_custom.____file_path = "scripts/vscripts/items/default_items/item_ethereal_blade_custom.lua"
__TS__ClassExtends(item_ethereal_blade_custom, BaseItem)
function item_ethereal_blade_custom.prototype.Precache(self, context)
PrecacheResource("particle", ETHEREAL_BLADE_PARTICLE, context)
PrecacheResource("particle", ETHEREAL_STATUS_PARTICLE, context)
PrecacheResource("soundfile", "soundevents/game_sounds_items.vsndevts", context)
end
function item_ethereal_blade_custom.prototype.GetIntrinsicModifierName(self)
return ____exports.modifier_item_ethereal_blade_custom.name
end
function item_ethereal_blade_custom.prototype.GetAOERadius(self)
return self:GetSpecialValueFor("splash_radius")
end
function item_ethereal_blade_custom.prototype.GetCastRange(self)
local range = self:GetSpecialValueFor("abilitycastrange")
if IsServer() then
return range
end
local ____opt_0 = self:GetCaster()
local bonus = ____opt_0 and ____opt_0:GetCastRangeBonus() or 0
return range - bonus
end
function item_ethereal_blade_custom.prototype.OnSpellStart(self)
if not IsServer() then
return
end
local caster = self:GetCaster()
local target = self:GetCursorTarget()
if not target then
return
end
local splashRadius = self:GetSpecialValueFor("splash_radius")
local projectileSpeed = self:GetSpecialValueFor("projectile_speed")
local sourceLoc = caster:GetAbsOrigin()
caster:EmitSound("DOTA_Item.EtherealBlade.Activate")
local isAlly = target:GetTeamNumber() == caster:GetTeamNumber()
local units = {}
if isAlly then
units = {target}
else
units = FindUnitsInRadius(
caster:GetTeamNumber(),
target:GetAbsOrigin(),
nil,
splashRadius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false
)
if #units == 0 then
units = {target}
end
end
for ____, enemy in ipairs(units) do
ProjectileManager:CreateTrackingProjectile({
Target = enemy,
Source = caster,
Ability = self,
EffectName = ETHEREAL_BLADE_PARTICLE,
iMoveSpeed = projectileSpeed,
vSourceLoc = sourceLoc,
bDodgeable = true,
bProvidesVision = false
})
end
end
function item_ethereal_blade_custom.prototype.OnProjectileHit(self, target)
if not IsServer() or not target then
return
end
local caster = self:GetCaster()
if target:IsMagicImmune() then
return
end
if target:TriggerSpellAbsorb(self) then
return
end
target:EmitSound("DOTA_Item.EtherealBlade.Target")
local durationEnemy = self:GetSpecialValueFor("duration")
local durationAlly = self:GetSpecialValueFor("duration_ally")
local isAlly = target:GetTeamNumber() == caster:GetTeamNumber()
if isAlly then
target:AddNewModifier(caster, self, ____exports.modifier_item_ethereal_blade_custom_ethereal.name, {duration = durationAlly, is_ally = 1})
target:AddNewModifier(caster, self, ____exports.modifier_item_ethereal_blade_custom_ally_haste.name, {duration = durationAlly})
return
end
local resistDuration = durationEnemy * (1 - target:GetStatusResistance())
target:AddNewModifier(caster, self, ____exports.modifier_item_ethereal_blade_custom_ethereal.name, {duration = resistDuration, is_ally = 0})
local hero = caster
local statMult = self:GetSpecialValueFor("blast_stat_multiplier")
local baseDamage = self:GetSpecialValueFor("blast_damage_base")
local damage = (hero:IsHero() and hero:GetPrimaryStatValue() or 0) * statMult + baseDamage
ApplyDamage({
victim = target,
attacker = caster,
damage = damage,
damage_type = DAMAGE_TYPE_MAGICAL,
ability = self
})
end
item_ethereal_blade_custom = __TS__Decorate(
item_ethereal_blade_custom,
item_ethereal_blade_custom,
{registerAbility(nil)},
{kind = "class", name = "item_ethereal_blade_custom"}
)
____exports.item_ethereal_blade_custom = item_ethereal_blade_custom
____exports.modifier_item_ethereal_blade_custom = __TS__Class()
local modifier_item_ethereal_blade_custom = ____exports.modifier_item_ethereal_blade_custom
modifier_item_ethereal_blade_custom.name = "modifier_item_ethereal_blade_custom"
modifier_item_ethereal_blade_custom.____file_path = "scripts/vscripts/items/default_items/item_ethereal_blade_custom.lua"
__TS__ClassExtends(modifier_item_ethereal_blade_custom, BaseModifier)
function modifier_item_ethereal_blade_custom.prototype.IsHidden(self)
return true
end
function modifier_item_ethereal_blade_custom.prototype.IsPurgable(self)
return false
end
function modifier_item_ethereal_blade_custom.prototype.RemoveOnDeath(self)
return false
end
function modifier_item_ethereal_blade_custom.prototype.GetAttributes(self)
return MODIFIER_ATTRIBUTE_MULTIPLE
end
function modifier_item_ethereal_blade_custom.prototype.DeclareFunctions(self)
return {
MODIFIER_PROPERTY_STATS_STRENGTH_BONUS,
MODIFIER_PROPERTY_STATS_AGILITY_BONUS,
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS,
MODIFIER_PROPERTY_STATUS_RESISTANCE_STACKING,
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT,
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
MODIFIER_PROPERTY_HP_REGEN_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_MP_REGEN_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_MAGICAL
}
end
function modifier_item_ethereal_blade_custom.prototype.getValue(self, name)
local ____opt_2 = self:GetAbility()
return ____opt_2 and ____opt_2:GetSpecialValueFor(name) or 0
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierBonusStats_Strength(self)
return self:getValue("bonus_strength")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierBonusStats_Agility(self)
return self:getValue("bonus_agility")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierBonusStats_Intellect(self)
return self:getValue("bonus_intellect")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierStatusResistanceStacking(self)
return self:getValue("status_resistance")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierAttackSpeedBonus_Constant(self)
return self:getValue("bonus_attack_speed")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierMoveSpeedBonus_Percentage(self)
return self:getValue("movement_speed_percent_bonus")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierHPRegenAmplify_Percentage(self)
return self:getValue("hp_regen_amp")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierMPRegenAmplify_Percentage(self)
return self:getValue("mana_regen_multiplier")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierSpellAmplify_Percentage(self)
return self:getValue("spell_amp")
end
function modifier_item_ethereal_blade_custom.prototype.GetModifierProcAttack_BonusDamage_Magical(self)
return self:getValue("magic_damage_attack")
end
modifier_item_ethereal_blade_custom = __TS__Decorate(
modifier_item_ethereal_blade_custom,
modifier_item_ethereal_blade_custom,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_ethereal_blade_custom"}
)
____exports.modifier_item_ethereal_blade_custom = modifier_item_ethereal_blade_custom
____exports.modifier_item_ethereal_blade_custom_ethereal = __TS__Class()
local modifier_item_ethereal_blade_custom_ethereal = ____exports.modifier_item_ethereal_blade_custom_ethereal
modifier_item_ethereal_blade_custom_ethereal.name = "modifier_item_ethereal_blade_custom_ethereal"
modifier_item_ethereal_blade_custom_ethereal.____file_path = "scripts/vscripts/items/default_items/item_ethereal_blade_custom.lua"
__TS__ClassExtends(modifier_item_ethereal_blade_custom_ethereal, BaseModifier)
function modifier_item_ethereal_blade_custom_ethereal.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.blastMovementSlow = 0
self.etherealDamageBonus = 0
self.turnRateReduction = 0
self.isAlly = false
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.IsHidden(self)
return false
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.IsDebuff(self)
return not self.isAlly
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.IsPurgable(self)
return true
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetStatusEffectName(self)
return ETHEREAL_STATUS_PARTICLE
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.StatusEffectPriority(self)
return MODIFIER_PRIORITY_NORMAL
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.OnCreated(self, params)
local ability = self:GetAbility()
if not ability then
self:Destroy()
return
end
self.isAlly = (params.is_ally or 0) == 1
self.blastMovementSlow = ability:GetSpecialValueFor("blast_movement_slow")
self.etherealDamageBonus = ability:GetSpecialValueFor("ethereal_damage_bonus")
self.turnRateReduction = ability:GetSpecialValueFor("turn_rate_reduction")
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.CheckState(self)
return {[MODIFIER_STATE_ATTACK_IMMUNE] = true, [MODIFIER_STATE_DISARMED] = true}
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.DeclareFunctions(self)
local funcs = {MODIFIER_PROPERTY_MAGICAL_RESISTANCE_DECREPIFY_UNIQUE, MODIFIER_PROPERTY_ABSOLUTE_NO_DAMAGE_PHYSICAL}
if self.isAlly then
funcs[#funcs + 1] = MODIFIER_PROPERTY_IGNORE_CAST_ANGLE
else
__TS__ArrayPush(funcs, MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_TURN_RATE_PERCENTAGE)
end
return funcs
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetModifierMoveSpeedBonus_Percentage(self)
if self.isAlly then
return 0
end
return self.blastMovementSlow
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetModifierMagicalResistanceDecrepifyUnique(self)
return self.etherealDamageBonus
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetAbsoluteNoDamagePhysical(self)
return 1
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetModifierTurnRate_Percentage(self)
return self.turnRateReduction
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetModifierIgnoreCastAngle(self)
return self.isAlly and 1 or 0
end
function modifier_item_ethereal_blade_custom_ethereal.prototype.GetTexture(self)
return "item_ethereal_blade"
end
modifier_item_ethereal_blade_custom_ethereal = __TS__Decorate(
modifier_item_ethereal_blade_custom_ethereal,
modifier_item_ethereal_blade_custom_ethereal,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_ethereal_blade_custom_ethereal"}
)
____exports.modifier_item_ethereal_blade_custom_ethereal = modifier_item_ethereal_blade_custom_ethereal
--- Ускорение при касте по союзнику (движение и атака).
____exports.modifier_item_ethereal_blade_custom_ally_haste = __TS__Class()
local modifier_item_ethereal_blade_custom_ally_haste = ____exports.modifier_item_ethereal_blade_custom_ally_haste
modifier_item_ethereal_blade_custom_ally_haste.name = "modifier_item_ethereal_blade_custom_ally_haste"
modifier_item_ethereal_blade_custom_ally_haste.____file_path = "scripts/vscripts/items/default_items/item_ethereal_blade_custom.lua"
__TS__ClassExtends(modifier_item_ethereal_blade_custom_ally_haste, BaseModifier)
function modifier_item_ethereal_blade_custom_ally_haste.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.bonusMoveSpeedPct = 0
self.bonusAttackSpeedPct = 0
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.IsHidden(self)
return false
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.IsDebuff(self)
return false
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.IsPurgable(self)
return true
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.OnCreated(self)
local ability = self:GetAbility()
if not ability then
self:Destroy()
return
end
self.bonusMoveSpeedPct = ability:GetSpecialValueFor("ally_bonus_movespeed")
self.bonusAttackSpeedPct = ability:GetSpecialValueFor("ally_bonus_attack_speed")
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_ATTACKSPEED_PERCENTAGE}
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.GetModifierMoveSpeedBonus_Percentage(self)
return self.bonusMoveSpeedPct
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.GetModifierAttackSpeedPercentage(self)
return self.bonusAttackSpeedPct
end
function modifier_item_ethereal_blade_custom_ally_haste.prototype.GetTexture(self)
return "item_ethereal_blade"
end
modifier_item_ethereal_blade_custom_ally_haste = __TS__Decorate(
modifier_item_ethereal_blade_custom_ally_haste,
modifier_item_ethereal_blade_custom_ally_haste,
{registerModifier(nil)},
{kind = "class", name = "modifier_item_ethereal_blade_custom_ally_haste"}
)
____exports.modifier_item_ethereal_blade_custom_ally_haste = modifier_item_ethereal_blade_custom_ally_haste
return ____exports