162 lines
5.5 KiB
Lua
162 lines
5.5 KiB
Lua
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
||
local ____exports = {}
|
||
function ____exports.getLunaMoonGlaiveAbility(self, caster)
|
||
return caster:FindAbilityByName(____exports.LUNA_MOON_GLAIVE_ABILITY) or nil
|
||
end
|
||
--- Фасет «лунное благословение» на пассиве Moon Glaives: 2× PerformAttack по цели удара Q/ульты.
|
||
function ____exports.tryLunarBlessingFacetPerformAttack(self, caster, victim)
|
||
if not IsServer() then
|
||
return
|
||
end
|
||
if not victim or victim:IsNull() or not victim:IsAlive() then
|
||
return
|
||
end
|
||
local moon = ____exports.getLunaMoonGlaiveAbility(nil, caster)
|
||
if not moon then
|
||
return
|
||
end
|
||
if moon:GetSpecialValueFor("moon_facet_perform_attack") <= 0 then
|
||
return
|
||
end
|
||
caster:PerformAttack(
|
||
victim,
|
||
true,
|
||
true,
|
||
true,
|
||
false,
|
||
false,
|
||
false,
|
||
true
|
||
)
|
||
caster:PerformAttack(
|
||
victim,
|
||
true,
|
||
true,
|
||
true,
|
||
false,
|
||
false,
|
||
false,
|
||
true
|
||
)
|
||
end
|
||
--- Имя Q — параметры AoE фасета читаются только отсюда.
|
||
____exports.LUNA_LUCENT_BEAM_ABILITY = "ability_luna_lucent_beam_custom"
|
||
____exports.LUNA_MOON_GLAIVE_ABILITY = "ability_luna_moon_glaive_custom"
|
||
function ____exports.getLunaLucentBeamAbility(self, caster)
|
||
return caster:FindAbilityByName(____exports.LUNA_LUCENT_BEAM_ABILITY) or nil
|
||
end
|
||
--- Фасет Lucent Beam: AoE вокруг точки удара.
|
||
function ____exports.isLucentBeamFacetAoeActive(self, caster)
|
||
local q = ____exports.getLunaLucentBeamAbility(nil, caster)
|
||
if not q then
|
||
return false
|
||
end
|
||
return q:GetSpecialValueFor("lucent_beam_aoe_radius") > 0
|
||
end
|
||
--- Луч Lucent на врага — CP на attach_hitloc.
|
||
function ____exports.playLucentBeamVfxOnTarget(self, target)
|
||
local pos = target:GetAbsOrigin()
|
||
local pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_luna/luna_lucent_beam.vpcf", PATTACH_ABSORIGIN, target)
|
||
ParticleManager:SetParticleControl(pfx, 1, pos)
|
||
ParticleManager:SetParticleControlEnt(
|
||
pfx,
|
||
2,
|
||
target,
|
||
PATTACH_POINT_FOLLOW,
|
||
"attach_hitloc",
|
||
target:GetAbsOrigin(),
|
||
true
|
||
)
|
||
ParticleManager:SetParticleControlEnt(
|
||
pfx,
|
||
5,
|
||
target,
|
||
PATTACH_POINT_FOLLOW,
|
||
"attach_hitloc",
|
||
target:GetAbsOrigin(),
|
||
true
|
||
)
|
||
ParticleManager:SetParticleControlEnt(
|
||
pfx,
|
||
6,
|
||
target,
|
||
PATTACH_POINT_FOLLOW,
|
||
"attach_hitloc",
|
||
target:GetAbsOrigin(),
|
||
true
|
||
)
|
||
ParticleManager:ReleaseParticleIndex(pfx)
|
||
end
|
||
--- Урон + мини-стан Lucent по главной цели; при фасете Q — AoE вокруг неё.
|
||
-- После удара — фасет Lunar Blessing: 2× PerformAttack по цели (через Moon Glaives KV).
|
||
function ____exports.applyLucentBeamHit(self, caster, damageAbility, primary, damage, stunDuration)
|
||
if not IsServer() then
|
||
return
|
||
end
|
||
if not primary or primary:IsNull() or not primary:IsAlive() then
|
||
return
|
||
end
|
||
local lunaQ = ____exports.getLunaLucentBeamAbility(nil, caster)
|
||
____exports.playLucentBeamVfxOnTarget(nil, primary)
|
||
EmitSoundOnLocationWithCaster(
|
||
primary:GetAbsOrigin(),
|
||
"Hero_Luna.LucentBeam.Target",
|
||
caster
|
||
)
|
||
ApplyDamage({
|
||
victim = primary,
|
||
attacker = caster,
|
||
damage = damage,
|
||
damage_type = DAMAGE_TYPE_MAGICAL,
|
||
ability = damageAbility
|
||
})
|
||
primary:AddNewModifier(caster, damageAbility, "modifier_stunned", {duration = stunDuration})
|
||
if lunaQ and ____exports.isLucentBeamFacetAoeActive(nil, caster) then
|
||
local radius = lunaQ:GetSpecialValueFor("lucent_beam_aoe_radius")
|
||
local pct = lunaQ:GetSpecialValueFor("lucent_beam_aoe_damage_pct") / 100
|
||
local secondaryDmg = damage * pct
|
||
local secondaryStun = stunDuration * pct
|
||
local others = FindUnitsInRadius(
|
||
caster:GetTeamNumber(),
|
||
primary: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
|
||
)
|
||
local primaryIdx = primary:entindex()
|
||
for ____, u in ipairs(others) do
|
||
do
|
||
if not u or u:IsNull() or not u:IsAlive() then
|
||
goto __continue11
|
||
end
|
||
if u:entindex() == primaryIdx then
|
||
goto __continue11
|
||
end
|
||
____exports.playLucentBeamVfxOnTarget(nil, u)
|
||
EmitSoundOnLocationWithCaster(
|
||
u:GetAbsOrigin(),
|
||
"Hero_Luna.LucentBeam.Target",
|
||
caster
|
||
)
|
||
ApplyDamage({
|
||
victim = u,
|
||
attacker = caster,
|
||
damage = secondaryDmg,
|
||
damage_type = DAMAGE_TYPE_MAGICAL,
|
||
ability = damageAbility
|
||
})
|
||
if secondaryStun > 0 then
|
||
u:AddNewModifier(caster, damageAbility, "modifier_stunned", {duration = secondaryStun})
|
||
end
|
||
end
|
||
::__continue11::
|
||
end
|
||
end
|
||
____exports.tryLunarBlessingFacetPerformAttack(nil, caster, primary)
|
||
end
|
||
return ____exports
|