Files
Dota-Zombie-Invasion/scripts/vscripts/cards/examples/card_82.lua
T
2026-05-29 15:11:31 +07:00

91 lines
3.6 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 ____modifier_card_cursed = require("cards.modifier_card_cursed")
local addCursedStack = ____modifier_card_cursed.addCursedStack
local CARD_ID = 82
____exports.card_82 = __TS__Class()
local card_82 = ____exports.card_82
card_82.name = "card_82"
card_82.____file_path = "scripts/vscripts/cards/examples/card_82.lua"
__TS__ClassExtends(card_82, CardBase)
function card_82.prototype.GetModifierName(self)
return "modifier_card_82"
end
card_82 = __TS__Decorate(card_82, card_82, {RegisterCard}, {kind = "class", name = "card_82"})
____exports.card_82 = card_82
____exports.modifier_card_82 = __TS__Class()
local modifier_card_82 = ____exports.modifier_card_82
modifier_card_82.name = "modifier_card_82"
modifier_card_82.____file_path = "scripts/vscripts/cards/examples/card_82.lua"
__TS__ClassExtends(modifier_card_82, CardBaseModifier)
function modifier_card_82.prototype.____constructor(self, ...)
CardBaseModifier.prototype.____constructor(self, ...)
self.manaBonusSnapshot = 0
end
function modifier_card_82.prototype.getValue(self, key, fallback)
return self:getCardValue(key, fallback, CARD_ID)
end
function modifier_card_82.prototype.OnCustomCreated(self, _params)
if not IsServer() then
return
end
local hero = self:GetParent()
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
return
end
addCursedStack(nil, hero)
local manaPct = self:getValue("max_mana_pct", 20)
local manaBonus = math.floor(hero:GetMaxMana() * (math.max(0, manaPct) / 100))
self.manaBonusSnapshot = self.manaBonusSnapshot + math.max(0, manaBonus)
hero:CalculateStatBonus(true)
end
function modifier_card_82.prototype.OnCustomRefresh(self, _params)
if not IsServer() then
return
end
local hero = self:GetParent()
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
return
end
local manaPct = self:getValue("max_mana_pct", 20)
local manaBonus = math.floor(hero:GetMaxMana() * (math.max(0, manaPct) / 100))
self.manaBonusSnapshot = self.manaBonusSnapshot + math.max(0, manaBonus)
hero:CalculateStatBonus(true)
end
function modifier_card_82.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_EXTRA_HEALTH_PERCENTAGE, MODIFIER_PROPERTY_MANA_BONUS, MODIFIER_PROPERTY_TOOLTIP}
end
function modifier_card_82.prototype.GetModifierExtraHealthPercentage(self)
return self:getScaledCardValue("max_health_pct", 20)
end
function modifier_card_82.prototype.GetModifierManaBonus(self)
return self.manaBonusSnapshot
end
function modifier_card_82.prototype.OnTooltip(self)
return self:getScaledCardValue("max_health_pct", 20)
end
function modifier_card_82.prototype.IsHidden(self)
return false
end
function modifier_card_82.prototype.GetTexture(self)
return "cards/card_" .. tostring(CARD_ID)
end
modifier_card_82 = __TS__Decorate(
modifier_card_82,
modifier_card_82,
{registerModifier(nil)},
{kind = "class", name = "modifier_card_82"}
)
____exports.modifier_card_82 = modifier_card_82
return ____exports