90 lines
3.3 KiB
Lua
90 lines
3.3 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 = 25
|
|
____exports.card_25 = __TS__Class()
|
|
local card_25 = ____exports.card_25
|
|
card_25.name = "card_25"
|
|
card_25.____file_path = "scripts/vscripts/cards/examples/card_25.lua"
|
|
__TS__ClassExtends(card_25, CardBase)
|
|
function card_25.prototype.GetModifierName(self)
|
|
return "modifier_card_25"
|
|
end
|
|
card_25 = __TS__Decorate(card_25, card_25, {RegisterCard}, {kind = "class", name = "card_25"})
|
|
____exports.card_25 = card_25
|
|
____exports.modifier_card_25 = __TS__Class()
|
|
local modifier_card_25 = ____exports.modifier_card_25
|
|
modifier_card_25.name = "modifier_card_25"
|
|
modifier_card_25.____file_path = "scripts/vscripts/cards/examples/card_25.lua"
|
|
__TS__ClassExtends(modifier_card_25, CardBaseModifier)
|
|
function modifier_card_25.prototype.____constructor(self, ...)
|
|
CardBaseModifier.prototype.____constructor(self, ...)
|
|
self.manaBonusLock = false
|
|
end
|
|
function modifier_card_25.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_25.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_MANA_BONUS, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_25.prototype.getManaSteps(self)
|
|
local hero = self:GetParent()
|
|
if not hero or not IsValidEntity(hero) then
|
|
return 0
|
|
end
|
|
local manaPerStep = math.max(
|
|
1,
|
|
self:getValue("mana_per_step", 100)
|
|
)
|
|
return math.floor(hero:GetMana() / manaPerStep)
|
|
end
|
|
function modifier_card_25.prototype.GetModifierSpellAmplify_Percentage(self)
|
|
local steps = self:getManaSteps()
|
|
if steps <= 0 then
|
|
return 0
|
|
end
|
|
local spellAmpPerStepPct = self:getScaledCardValue("spell_amp_per_step_pct", 0.1)
|
|
return steps * spellAmpPerStepPct
|
|
end
|
|
function modifier_card_25.prototype.GetModifierConstantManaRegen(self)
|
|
local steps = self:getManaSteps()
|
|
if steps <= 0 then
|
|
return 0
|
|
end
|
|
local manaRegenPerStep = self:getScaledCardValue("mana_regen_per_step", 0.1)
|
|
return steps * manaRegenPerStep
|
|
end
|
|
function modifier_card_25.prototype.GetModifierManaBonus(self)
|
|
if not IsServer() then
|
|
return 0
|
|
end
|
|
local pct = self:getScaledCardValue("max_mana_bonus_pct", 0)
|
|
if pct <= 0 then
|
|
return 0
|
|
end
|
|
if self.manaBonusLock then
|
|
return 0
|
|
end
|
|
self.manaBonusLock = true
|
|
local baseMaxMana = self:GetParent():GetMaxMana()
|
|
self.manaBonusLock = false
|
|
return math.floor(baseMaxMana * (pct / 100))
|
|
end
|
|
modifier_card_25 = __TS__Decorate(
|
|
modifier_card_25,
|
|
modifier_card_25,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_25"}
|
|
)
|
|
____exports.modifier_card_25 = modifier_card_25
|
|
return ____exports
|