107 lines
3.8 KiB
Lua
107 lines
3.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 = 84
|
|
____exports.card_84 = __TS__Class()
|
|
local card_84 = ____exports.card_84
|
|
card_84.name = "card_84"
|
|
card_84.____file_path = "scripts/vscripts/cards/examples/card_84.lua"
|
|
__TS__ClassExtends(card_84, CardBase)
|
|
function card_84.prototype.GetModifierName(self)
|
|
return "modifier_card_84"
|
|
end
|
|
card_84 = __TS__Decorate(card_84, card_84, {RegisterCard}, {kind = "class", name = "card_84"})
|
|
____exports.card_84 = card_84
|
|
____exports.modifier_card_84 = __TS__Class()
|
|
local modifier_card_84 = ____exports.modifier_card_84
|
|
modifier_card_84.name = "modifier_card_84"
|
|
modifier_card_84.____file_path = "scripts/vscripts/cards/examples/card_84.lua"
|
|
__TS__ClassExtends(modifier_card_84, CardBaseModifier)
|
|
function modifier_card_84.prototype.____constructor(self, ...)
|
|
CardBaseModifier.prototype.____constructor(self, ...)
|
|
self.frozenSpellAmp = 0
|
|
end
|
|
function modifier_card_84.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_84.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
|
|
self:applyFrozenSpellAmpSnapshot(hero)
|
|
if self.frozenSpellAmp <= 0 then
|
|
Timers:CreateTimer(
|
|
0,
|
|
function()
|
|
if self:IsNull() or not IsValidEntity(hero) then
|
|
return nil
|
|
end
|
|
if self.frozenSpellAmp > 0 then
|
|
return nil
|
|
end
|
|
self:applyFrozenSpellAmpSnapshot(hero)
|
|
return nil
|
|
end
|
|
)
|
|
end
|
|
end
|
|
function modifier_card_84.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
|
|
self:applyFrozenSpellAmpSnapshot(hero)
|
|
end
|
|
function modifier_card_84.prototype.applyFrozenSpellAmpSnapshot(self, hero)
|
|
hero:CalculateStatBonus(true)
|
|
local spellAmpFromManaPct = math.max(
|
|
0,
|
|
self:getValue("spell_amp_from_mana_pct", 15)
|
|
)
|
|
local spellAmpManaScale = math.max(
|
|
0,
|
|
self:getValue("spell_amp_mana_scale", 0.1)
|
|
)
|
|
local spellAmpBonus = math.floor(hero:GetMaxMana() * (spellAmpFromManaPct / 100) * spellAmpManaScale)
|
|
self.frozenSpellAmp = self.frozenSpellAmp + math.max(0, spellAmpBonus)
|
|
end
|
|
function modifier_card_84.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_84.prototype.GetModifierSpellAmplify_Percentage(self)
|
|
return self.frozenSpellAmp
|
|
end
|
|
function modifier_card_84.prototype.OnTooltip(self)
|
|
return self:GetModifierSpellAmplify_Percentage()
|
|
end
|
|
function modifier_card_84.prototype.GetTexture(self)
|
|
return "cards/card_" .. tostring(CARD_ID)
|
|
end
|
|
function modifier_card_84.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
modifier_card_84 = __TS__Decorate(
|
|
modifier_card_84,
|
|
modifier_card_84,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_84"}
|
|
)
|
|
____exports.modifier_card_84 = modifier_card_84
|
|
return ____exports
|