83 lines
2.8 KiB
Lua
83 lines
2.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 = 47
|
|
local START_BONUS_LEVELS = 1
|
|
local MAX_HERO_LEVEL = 30
|
|
____exports.card_47 = __TS__Class()
|
|
local card_47 = ____exports.card_47
|
|
card_47.name = "card_47"
|
|
card_47.____file_path = "scripts/vscripts/cards/examples/card_47.lua"
|
|
__TS__ClassExtends(card_47, CardBase)
|
|
function card_47.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local hero = self:GetHero()
|
|
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
|
|
return
|
|
end
|
|
do
|
|
local i = 0
|
|
while i < START_BONUS_LEVELS do
|
|
if hero:GetLevel() >= MAX_HERO_LEVEL then
|
|
break
|
|
end
|
|
hero:HeroLevelUp(true)
|
|
i = i + 1
|
|
end
|
|
end
|
|
end
|
|
function card_47.prototype.GetModifierName(self)
|
|
return "modifier_card_47"
|
|
end
|
|
card_47 = __TS__Decorate(card_47, card_47, {RegisterCard}, {kind = "class", name = "card_47"})
|
|
____exports.card_47 = card_47
|
|
____exports.modifier_card_47 = __TS__Class()
|
|
local modifier_card_47 = ____exports.modifier_card_47
|
|
modifier_card_47.name = "modifier_card_47"
|
|
modifier_card_47.____file_path = "scripts/vscripts/cards/examples/card_47.lua"
|
|
__TS__ClassExtends(modifier_card_47, CardBaseModifier)
|
|
function modifier_card_47.prototype.IsPermanent(self)
|
|
return false
|
|
end
|
|
function modifier_card_47.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_card_47.prototype.OnCustomCreated(self)
|
|
local durationSec = math.max(
|
|
0.1,
|
|
self:getCardValue("exp_boost_duration_sec", 180, CARD_ID)
|
|
)
|
|
self:SetDuration(durationSec, true)
|
|
end
|
|
function modifier_card_47.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_EXP_RATE_BOOST, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_47.prototype.GetModifierPercentageExpRateBoost(self)
|
|
return self:getScaledCardValue("exp_bonus_pct", 100, CARD_ID)
|
|
end
|
|
function modifier_card_47.prototype.OnTooltip(self)
|
|
return self:GetModifierPercentageExpRateBoost()
|
|
end
|
|
function modifier_card_47.prototype.GetTexture(self)
|
|
return "default_items/xp"
|
|
end
|
|
modifier_card_47 = __TS__Decorate(
|
|
modifier_card_47,
|
|
modifier_card_47,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_47"}
|
|
)
|
|
____exports.modifier_card_47 = modifier_card_47
|
|
return ____exports
|