86 lines
3.3 KiB
Lua
86 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 ShowCardSelectionToPlayer = ____CardSystem.ShowCardSelectionToPlayer
|
|
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_value_resolver = require("cards.card_value_resolver")
|
|
local getCardValueByLevel = ____card_value_resolver.getCardValueByLevel
|
|
____exports.card_3 = __TS__Class()
|
|
local card_3 = ____exports.card_3
|
|
card_3.name = "card_3"
|
|
card_3.____file_path = "scripts/vscripts/cards/examples/card_3.lua"
|
|
__TS__ClassExtends(card_3, CardBase)
|
|
function card_3.prototype.GetModifierName(self)
|
|
return "modifier_card_3"
|
|
end
|
|
card_3 = __TS__Decorate(card_3, card_3, {RegisterCard}, {kind = "class", name = "card_3"})
|
|
____exports.card_3 = card_3
|
|
____exports.modifier_card_3 = __TS__Class()
|
|
local modifier_card_3 = ____exports.modifier_card_3
|
|
modifier_card_3.name = "modifier_card_3"
|
|
modifier_card_3.____file_path = "scripts/vscripts/cards/examples/card_3.lua"
|
|
__TS__ClassExtends(modifier_card_3, CardBaseModifier)
|
|
function modifier_card_3.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
|
|
local playerId = hero:GetPlayerID()
|
|
local card53Copies = self:getCard53Copies(hero)
|
|
if playerId ~= -1 and card53Copies > 0 then
|
|
local extraChoicesPerCopy = math.max(
|
|
1,
|
|
math.floor(getCardValueByLevel(
|
|
nil,
|
|
53,
|
|
hero,
|
|
"extra_card_choices",
|
|
3
|
|
))
|
|
)
|
|
local totalExtraChoices = extraChoicesPerCopy * card53Copies
|
|
ShowCardSelectionToPlayer(nil, playerId, totalExtraChoices, "card_3_with_card_53")
|
|
end
|
|
end
|
|
function modifier_card_3.prototype.getCard53Copies(self, hero)
|
|
local copies = 0
|
|
do
|
|
local i = 0
|
|
while i < hero:GetModifierCount() do
|
|
if hero:GetModifierNameByIndex(i) == "modifier_card_53" then
|
|
copies = copies + 1
|
|
end
|
|
i = i + 1
|
|
end
|
|
end
|
|
return copies
|
|
end
|
|
function modifier_card_3.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_3.prototype.GetModifierSpellAmplify_Percentage(self, _event)
|
|
return self:getScaledCardValue("damage_pct", 5, 3)
|
|
end
|
|
function modifier_card_3.prototype.GetModifierDamageOutgoing_Percentage(self, _event)
|
|
return self:getScaledCardValue("damage_pct", 5, 3)
|
|
end
|
|
modifier_card_3 = __TS__Decorate(
|
|
modifier_card_3,
|
|
modifier_card_3,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_3"}
|
|
)
|
|
____exports.modifier_card_3 = modifier_card_3
|
|
return ____exports
|