Files
Dota-Zombie-Invasion/scripts/vscripts/abilities/heroes/smaug/ability_dragon_reward.lua
T
2026-05-29 15:11:31 +07:00

141 lines
5.1 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.ability_dragon_reward = __TS__Class()
local ability_dragon_reward = ____exports.ability_dragon_reward
ability_dragon_reward.name = "ability_dragon_reward"
ability_dragon_reward.____file_path = "scripts/vscripts/abilities/heroes/smaug/ability_dragon_reward.lua"
__TS__ClassExtends(ability_dragon_reward, BaseAbility)
function ability_dragon_reward.prototype.GetIntrinsicModifierName(self)
return ____exports.modifier_dragon_reward.name
end
ability_dragon_reward = __TS__Decorate(
ability_dragon_reward,
ability_dragon_reward,
{registerAbility(nil)},
{kind = "class", name = "ability_dragon_reward"}
)
____exports.ability_dragon_reward = ability_dragon_reward
____exports.modifier_dragon_reward = __TS__Class()
local modifier_dragon_reward = ____exports.modifier_dragon_reward
modifier_dragon_reward.name = "modifier_dragon_reward"
modifier_dragon_reward.____file_path = "scripts/vscripts/abilities/heroes/smaug/ability_dragon_reward.lua"
__TS__ClassExtends(modifier_dragon_reward, BaseModifier)
function modifier_dragon_reward.prototype.____constructor(self, ...)
BaseModifier.prototype.____constructor(self, ...)
self.max = 0
self.bonusAttributes = 0
end
function modifier_dragon_reward.prototype.IsHidden(self)
return false
end
function modifier_dragon_reward.prototype.IsPurgable(self)
return false
end
function modifier_dragon_reward.prototype.IsDebuff(self)
return false
end
function modifier_dragon_reward.prototype.RemoveOnDeath(self)
return false
end
function modifier_dragon_reward.prototype.DeclareFunctions(self)
return {MODIFIER_EVENT_ON_DEATH, MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS}
end
function modifier_dragon_reward.prototype.OnCreated(self)
local ability = self:GetAbility()
if not ability then
return
end
self.max = ability:GetSpecialValueFor("max")
self.bonusAttributes = ability:GetSpecialValueFor("bonus_attributes")
if IsServer() then
self:SetStackCount(0)
end
end
function modifier_dragon_reward.prototype.OnRefresh(self)
local ability = self:GetAbility()
if not ability then
return
end
self.max = ability:GetSpecialValueFor("max")
self.bonusAttributes = ability:GetSpecialValueFor("bonus_attributes")
end
function modifier_dragon_reward.prototype.OnDeath(self, event)
if not IsServer() then
return
end
self:DeathLogic(event)
self:KillLogic(event)
end
function modifier_dragon_reward.prototype.GetModifierBonusStats_Strength(self)
return self:GetStackCount() * self.bonusAttributes
end
function modifier_dragon_reward.prototype.GetModifierBonusStats_Agility(self)
return self:GetStackCount() * self.bonusAttributes
end
function modifier_dragon_reward.prototype.GetModifierBonusStats_Intellect(self)
return self:GetStackCount() * self.bonusAttributes
end
function modifier_dragon_reward.prototype.DeathLogic(self, event)
if not IsServer() then
return
end
local unit = event.unit
if unit == self:GetParent() then
local afterDeath = math.floor(self:GetStackCount())
end
end
function modifier_dragon_reward.prototype.KillLogic(self, event)
if not IsServer() then
return
end
local target = event.unit
local attacker = event.attacker
local parent = self:GetParent()
if attacker == parent and target and attacker:IsAlive() and not target:IsIllusion() and not target:IsBuilding() and not parent:PassivesDisabled() then
self:AddStack(1)
self:PlayEffects(target)
end
end
function modifier_dragon_reward.prototype.AddStack(self, value)
local current = self:GetStackCount()
local after = current + value
if after > self.max then
after = self.max
end
self:SetStackCount(after)
end
function modifier_dragon_reward.prototype.PlayEffects(self, target)
if not IsServer() then
return
end
local projectileName = "particles/econ/items/legion/legion_fallen/legion_fallen_press_buff.vpcf"
local info = {
Target = self:GetParent(),
Source = target,
EffectName = projectileName,
iMoveSpeed = 400,
vSourceLoc = target:GetAbsOrigin(),
bDodgeable = false,
bReplaceExisting = false,
flExpireTime = GameRules:GetGameTime() + 5,
bProvidesVision = false
}
ProjectileManager:CreateTrackingProjectile(info)
end
modifier_dragon_reward = __TS__Decorate(
modifier_dragon_reward,
modifier_dragon_reward,
{registerModifier(nil)},
{kind = "class", name = "modifier_dragon_reward"}
)
____exports.modifier_dragon_reward = modifier_dragon_reward
return ____exports