70 lines
2.8 KiB
Lua
70 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 = 20
|
|
____exports.card_20 = __TS__Class()
|
|
local card_20 = ____exports.card_20
|
|
card_20.name = "card_20"
|
|
card_20.____file_path = "scripts/vscripts/cards/examples/card_20.lua"
|
|
__TS__ClassExtends(card_20, CardBase)
|
|
function card_20.prototype.GetModifierName(self)
|
|
return "modifier_card_20"
|
|
end
|
|
card_20 = __TS__Decorate(card_20, card_20, {RegisterCard}, {kind = "class", name = "card_20"})
|
|
____exports.card_20 = card_20
|
|
____exports.modifier_card_20 = __TS__Class()
|
|
local modifier_card_20 = ____exports.modifier_card_20
|
|
modifier_card_20.name = "modifier_card_20"
|
|
modifier_card_20.____file_path = "scripts/vscripts/cards/examples/card_20.lua"
|
|
__TS__ClassExtends(modifier_card_20, CardBaseModifier)
|
|
function modifier_card_20.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_20.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_card_20.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE, MODIFIER_PROPERTY_MOVESPEED_LIMIT, MODIFIER_PROPERTY_IGNORE_MOVESPEED_LIMIT, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_20.prototype.GetModifierIgnoreMovespeedLimit(self)
|
|
return 1
|
|
end
|
|
function modifier_card_20.prototype.GetModifierMoveSpeed_Limit(self)
|
|
return self:getValue("speed_limit", 100000)
|
|
end
|
|
function modifier_card_20.prototype.GetModifierMoveSpeedBonus_Percentage(self)
|
|
local hero = self:GetParent()
|
|
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
|
|
return 0
|
|
end
|
|
local playerId = hero:GetPlayerOwnerID()
|
|
if playerId == nil or playerId == nil or playerId < 0 then
|
|
return 0
|
|
end
|
|
local totalGold = PlayerResource:GetGold(playerId)
|
|
local goldPerStep = math.max(
|
|
1,
|
|
self:getValue("gold_per_step", 100)
|
|
)
|
|
local bonusPctPerStep = self:getValue("move_speed_pct_per_step", 1)
|
|
local steps = math.floor(totalGold / goldPerStep)
|
|
return steps * bonusPctPerStep * self:getCardCopies()
|
|
end
|
|
modifier_card_20 = __TS__Decorate(
|
|
modifier_card_20,
|
|
modifier_card_20,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_20"}
|
|
)
|
|
____exports.modifier_card_20 = modifier_card_20
|
|
return ____exports
|