74 lines
2.8 KiB
Lua
74 lines
2.8 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 ____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 = 16
|
|
____exports.card_16 = __TS__Class()
|
|
local card_16 = ____exports.card_16
|
|
card_16.name = "card_16"
|
|
card_16.____file_path = "scripts/vscripts/cards/examples/card_16.lua"
|
|
__TS__ClassExtends(card_16, CardBase)
|
|
function card_16.prototype.GetModifierName(self)
|
|
return "modifier_card_16"
|
|
end
|
|
card_16 = __TS__Decorate(card_16, card_16, {RegisterCard}, {kind = "class", name = "card_16"})
|
|
____exports.card_16 = card_16
|
|
____exports.modifier_card_16 = __TS__Class()
|
|
local modifier_card_16 = ____exports.modifier_card_16
|
|
modifier_card_16.name = "modifier_card_16"
|
|
modifier_card_16.____file_path = "scripts/vscripts/cards/examples/card_16.lua"
|
|
__TS__ClassExtends(modifier_card_16, CardBaseModifier)
|
|
function modifier_card_16.prototype.____constructor(self, ...)
|
|
CardBaseModifier.prototype.____constructor(self, ...)
|
|
self.voidStacks = 0
|
|
end
|
|
function modifier_card_16.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_16.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_DEATH, MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_16.prototype.OnDeath(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
if not parent or not IsValidEntity(parent) then
|
|
return
|
|
end
|
|
if not event.attacker or event.attacker ~= parent then
|
|
return
|
|
end
|
|
if not event.unit or not IsValidEntity(event.unit) or event.unit == parent then
|
|
return
|
|
end
|
|
if event.unit:GetTeamNumber() == parent:GetTeamNumber() then
|
|
return
|
|
end
|
|
local maxStacks = self:getValue("max_stacks", 200)
|
|
if self.voidStacks >= maxStacks then
|
|
return
|
|
end
|
|
self.voidStacks = math.min(maxStacks, self.voidStacks + 1)
|
|
end
|
|
function modifier_card_16.prototype.GetModifierSpellAmplify_Percentage(self)
|
|
local perStackPct = self:getValue("spell_amp_per_stack_pct", 0.1)
|
|
return self.voidStacks * perStackPct * self:getCardCopies()
|
|
end
|
|
modifier_card_16 = __TS__Decorate(
|
|
modifier_card_16,
|
|
modifier_card_16,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_16"}
|
|
)
|
|
____exports.modifier_card_16 = modifier_card_16
|
|
return ____exports
|