74 lines
3.2 KiB
Lua
74 lines
3.2 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__StringStartsWith = ____lualib.__TS__StringStartsWith
|
|
local ____exports = {}
|
|
local ____CardSystem = require("cards.CardSystem")
|
|
local CardBase = ____CardSystem.CardBase
|
|
local RegisterCard = ____CardSystem.RegisterCard
|
|
local ____CardBaseModifier = require("cards.CardBaseModifier")
|
|
local CardBaseModifier = ____CardBaseModifier.CardBaseModifier
|
|
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
local CARD_ID = 21
|
|
____exports.card_21 = __TS__Class()
|
|
local card_21 = ____exports.card_21
|
|
card_21.name = "card_21"
|
|
card_21.____file_path = "scripts/vscripts/cards/examples/card_21.lua"
|
|
__TS__ClassExtends(card_21, CardBase)
|
|
function card_21.prototype.GetModifierName(self)
|
|
return "modifier_card_21"
|
|
end
|
|
card_21 = __TS__Decorate(card_21, card_21, {RegisterCard}, {kind = "class", name = "card_21"})
|
|
____exports.card_21 = card_21
|
|
____exports.modifier_card_21 = __TS__Class()
|
|
local modifier_card_21 = ____exports.modifier_card_21
|
|
modifier_card_21.name = "modifier_card_21"
|
|
modifier_card_21.____file_path = "scripts/vscripts/cards/examples/card_21.lua"
|
|
__TS__ClassExtends(modifier_card_21, CardBaseModifier)
|
|
function modifier_card_21.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_21.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_PURE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_21.prototype.GetModifierProcAttack_BonusDamage_Pure(self, event)
|
|
if not IsServer() then
|
|
return 0
|
|
end
|
|
local attacker = self:GetParent()
|
|
if not attacker or not IsValidEntity(attacker) or event.attacker ~= attacker then
|
|
return 0
|
|
end
|
|
local target = event.target
|
|
if not target or not IsValidEntity(target) or not target:IsAlive() then
|
|
return 0
|
|
end
|
|
if target:GetTeamNumber() == attacker:GetTeamNumber() then
|
|
return 0
|
|
end
|
|
local targetName = target:GetUnitName()
|
|
if not targetName or not __TS__StringStartsWith(targetName, "npc_wave") then
|
|
return 0
|
|
end
|
|
local basePureDamage = self:getValue("wave_pure_damage_base", 125)
|
|
local ownerAttackDamage = attacker:GetAverageTrueAttackDamage(target)
|
|
local totalPureDamage = math.max(0, basePureDamage + ownerAttackDamage)
|
|
local particle = ParticleManager:CreateParticle("particles/units/heroes/hero_omniknight/omniknight_shard_hammer_of_purity_target.vpcf", PATTACH_ABSORIGIN_FOLLOW, target)
|
|
ParticleManager:ReleaseParticleIndex(particle)
|
|
if totalPureDamage <= 0 then
|
|
return 0
|
|
end
|
|
local copies = self:getCardCopies()
|
|
return (self:getValue("wave_pure_damage_base", 125) + event.attacker:GetAverageTrueAttackDamage(event.target) * self:getValue("wave_pure_damage_base_hand", 0.25)) * copies
|
|
end
|
|
modifier_card_21 = __TS__Decorate(
|
|
modifier_card_21,
|
|
modifier_card_21,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_21"}
|
|
)
|
|
____exports.modifier_card_21 = modifier_card_21
|
|
return ____exports
|