120 lines
4.5 KiB
Lua
120 lines
4.5 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 registerAbility = ____dota_ts_adapter.registerAbility
|
|
local ____modifier_overheating = require("abilities.heroes.sargatanas.modifier_overheating")
|
|
local modifier_overheating = ____modifier_overheating.modifier_overheating
|
|
local function DamageHell(self, unit)
|
|
if unit:HasModifier(modifier_overheating.name) then
|
|
local modif = unit:FindModifierByName(modifier_overheating.name)
|
|
if modif then
|
|
return modif:GetStackCount() / 100 + 1
|
|
end
|
|
end
|
|
return 1
|
|
end
|
|
____exports.ability_sunflame = __TS__Class()
|
|
local ability_sunflame = ____exports.ability_sunflame
|
|
ability_sunflame.name = "ability_sunflame"
|
|
ability_sunflame.____file_path = "scripts/vscripts/abilities/heroes/sargatanas/ability_sunflame.lua"
|
|
__TS__ClassExtends(ability_sunflame, BaseAbility)
|
|
function ability_sunflame.prototype.____constructor(self, ...)
|
|
BaseAbility.prototype.____constructor(self, ...)
|
|
self.projectiles = {}
|
|
end
|
|
function ability_sunflame.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local target = self:GetCursorTarget()
|
|
local point = self:GetCursorPosition()
|
|
if target then
|
|
point = target:GetAbsOrigin()
|
|
end
|
|
local damage
|
|
local unduced
|
|
local projectileName
|
|
if caster:HasModifier("modifier_ability_metamorphosis") then
|
|
projectileName = "particles/units/heroes/hero_dragon_knight/dragon_knight_breathe_fire.vpcf"
|
|
damage = self:GetSpecialValueFor("damage_meta")
|
|
unduced = self:GetSpecialValueFor("unduced_meta") / 100 + 1
|
|
else
|
|
projectileName = "particles/units/heroes/hero_dragon_knight/dragon_knight_breathe_fire.vpcf"
|
|
damage = self:GetSpecialValueFor("damage")
|
|
unduced = self:GetSpecialValueFor("unduced") / 100 + 1
|
|
end
|
|
local projectileDistance = self:GetSpecialValueFor("range")
|
|
local projectileStartRadius = self:GetSpecialValueFor("start_radius")
|
|
local projectileEndRadius = self:GetSpecialValueFor("end_radius")
|
|
local projectileSpeed = self:GetSpecialValueFor("speed")
|
|
local projectileDirection = point - caster:GetAbsOrigin()
|
|
projectileDirection.z = 0
|
|
projectileDirection = projectileDirection:Normalized()
|
|
local info = {
|
|
Source = caster,
|
|
Ability = self,
|
|
vSpawnOrigin = caster:GetAbsOrigin(),
|
|
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
iUnitTargetType = bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC),
|
|
EffectName = projectileName,
|
|
fDistance = projectileDistance,
|
|
fStartRadius = projectileStartRadius,
|
|
fEndRadius = projectileEndRadius,
|
|
vVelocity = projectileDirection * projectileSpeed
|
|
}
|
|
local projectile = ProjectileManager:CreateLinearProjectile(info)
|
|
self.projectiles[projectile] = {damage = damage, unduced = unduced}
|
|
EmitSoundOn("Hero_DragonKnight.BreathFire", caster)
|
|
end
|
|
function ability_sunflame.prototype.OnProjectileHitHandle(self, target, location, handle)
|
|
if not target then
|
|
return false
|
|
end
|
|
if not IsServer() then
|
|
return false
|
|
end
|
|
local stackOverhell = self:GetSpecialValueFor("stack_overhell")
|
|
local data = self.projectiles[handle]
|
|
if not data then
|
|
return false
|
|
end
|
|
local damage = data.damage
|
|
ApplyDamage({
|
|
victim = target,
|
|
attacker = self:GetCaster(),
|
|
damage = damage * DamageHell(nil, target),
|
|
damage_type = self:GetAbilityDamageType(),
|
|
ability = self
|
|
})
|
|
data.damage = damage * data.unduced
|
|
local modifier = target:FindModifierByName(modifier_overheating.name)
|
|
if modifier then
|
|
modifier:SetStackCount(modifier:GetStackCount() + stackOverhell)
|
|
modifier:SetDuration(8, true)
|
|
else
|
|
modifier = target:AddNewModifier(
|
|
self:GetCaster(),
|
|
self,
|
|
modifier_overheating.name,
|
|
{duration = 8}
|
|
)
|
|
if modifier then
|
|
modifier:SetStackCount(stackOverhell)
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
ability_sunflame = __TS__Decorate(
|
|
ability_sunflame,
|
|
ability_sunflame,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_sunflame"}
|
|
)
|
|
____exports.ability_sunflame = ability_sunflame
|
|
return ____exports
|