61 lines
2.5 KiB
Lua
61 lines
2.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 ____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 = 32
|
|
____exports.card_32 = __TS__Class()
|
|
local card_32 = ____exports.card_32
|
|
card_32.name = "card_32"
|
|
card_32.____file_path = "scripts/vscripts/cards/examples/card_32.lua"
|
|
__TS__ClassExtends(card_32, CardBase)
|
|
function card_32.prototype.GetModifierName(self)
|
|
return "modifier_card_32"
|
|
end
|
|
card_32 = __TS__Decorate(card_32, card_32, {RegisterCard}, {kind = "class", name = "card_32"})
|
|
____exports.card_32 = card_32
|
|
____exports.modifier_card_32 = __TS__Class()
|
|
local modifier_card_32 = ____exports.modifier_card_32
|
|
modifier_card_32.name = "modifier_card_32"
|
|
modifier_card_32.____file_path = "scripts/vscripts/cards/examples/card_32.lua"
|
|
__TS__ClassExtends(modifier_card_32, CardBaseModifier)
|
|
function modifier_card_32.prototype.____constructor(self, ...)
|
|
CardBaseModifier.prototype.____constructor(self, ...)
|
|
self.deathPenaltyStacks = 0
|
|
end
|
|
function modifier_card_32.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_32.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_COOLDOWN_PERCENTAGE, MODIFIER_EVENT_ON_DEATH, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_32.prototype.GetModifierPercentageCooldown(self)
|
|
local baseCooldownReduction = self:getScaledCardValue("base_cooldown_reduction_pct", 25)
|
|
local cooldownLossPerDeath = self:getValue("cooldown_loss_per_death_pct", 5)
|
|
return math.max(0, baseCooldownReduction - cooldownLossPerDeath * self.deathPenaltyStacks)
|
|
end
|
|
function modifier_card_32.prototype.OnDeath(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if event.unit ~= self:GetParent() then
|
|
return
|
|
end
|
|
self.deathPenaltyStacks = self.deathPenaltyStacks + 1
|
|
end
|
|
modifier_card_32 = __TS__Decorate(
|
|
modifier_card_32,
|
|
modifier_card_32,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_32"}
|
|
)
|
|
____exports.modifier_card_32 = modifier_card_32
|
|
return ____exports
|