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

78 lines
2.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 CARD_ID = 46
____exports.card_46 = __TS__Class()
local card_46 = ____exports.card_46
card_46.name = "card_46"
card_46.____file_path = "scripts/vscripts/cards/examples/card_46.lua"
__TS__ClassExtends(card_46, CardBase)
function card_46.prototype.GetModifierName(self)
return "modifier_card_46"
end
card_46 = __TS__Decorate(card_46, card_46, {RegisterCard}, {kind = "class", name = "card_46"})
____exports.card_46 = card_46
____exports.modifier_card_46 = __TS__Class()
local modifier_card_46 = ____exports.modifier_card_46
modifier_card_46.name = "modifier_card_46"
modifier_card_46.____file_path = "scripts/vscripts/cards/examples/card_46.lua"
__TS__ClassExtends(modifier_card_46, CardBaseModifier)
function modifier_card_46.prototype.getValue(self, key, fallback)
return self:getCardValue(key, fallback, CARD_ID)
end
function modifier_card_46.prototype.DeclareFunctions(self)
return {MODIFIER_EVENT_ON_TAKEDAMAGE, MODIFIER_PROPERTY_TOOLTIP}
end
function modifier_card_46.prototype.OnTakeDamage(self, event)
if not IsServer() then
return
end
local parent = self:GetParent()
if not parent or not IsValidEntity(parent) or not parent:IsAlive() then
return
end
if event.unit ~= parent then
return
end
if not parent:IsRealHero() then
return
end
local damage = event.damage
if damage <= 0 then
return
end
local pct = self:getScaledCardValue("damage_to_mana_pct", 30)
local manaGain = damage * (pct / 100)
if manaGain <= 0 then
return
end
parent:GiveMana(manaGain)
SendOverheadEventMessage(
nil,
OVERHEAD_ALERT_MANA_ADD,
parent,
manaGain,
parent:GetPlayerOwner()
)
end
function modifier_card_46.prototype.GetTexture(self)
return "item_magic_stone"
end
modifier_card_46 = __TS__Decorate(
modifier_card_46,
modifier_card_46,
{registerModifier(nil)},
{kind = "class", name = "modifier_card_46"}
)
____exports.modifier_card_46 = modifier_card_46
return ____exports