Files
Dota-Zombie-Invasion/scripts/vscripts/cards/examples/card_2.lua
T
2026-05-29 15:11:31 +07:00

90 lines
3.5 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_bat_stacking = require("cards.card_bat_stacking")
local applyHeroTargetBat = ____card_bat_stacking.applyHeroTargetBat
local computeAttackSpeedBonusForTargetBat = ____card_bat_stacking.computeAttackSpeedBonusForTargetBat
local MODIFIER_CARD_43 = ____card_bat_stacking.MODIFIER_CARD_43
local CARD_ID = 2
local DEFAULT_MOVE_SPEED_LIMIT = 550
____exports.card_2 = __TS__Class()
local card_2 = ____exports.card_2
card_2.name = "card_2"
card_2.____file_path = "scripts/vscripts/cards/examples/card_2.lua"
__TS__ClassExtends(card_2, CardBase)
function card_2.prototype.GetModifierName(self)
return "modifier_card_2"
end
card_2 = __TS__Decorate(card_2, card_2, {RegisterCard}, {kind = "class", name = "card_2"})
____exports.card_2 = card_2
____exports.modifier_card_2 = __TS__Class()
local modifier_card_2 = ____exports.modifier_card_2
modifier_card_2.name = "modifier_card_2"
modifier_card_2.____file_path = "scripts/vscripts/cards/examples/card_2.lua"
__TS__ClassExtends(modifier_card_2, CardBaseModifier)
function modifier_card_2.prototype.CheckState(self)
if self:getCardValue("pass_through_units", 0, CARD_ID) <= 0 then
return {}
end
return {[MODIFIER_STATE_NO_UNIT_COLLISION] = true}
end
function modifier_card_2.prototype.DeclareFunctions(self)
return {MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_MOVESPEED_LIMIT, MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_TOOLTIP}
end
function modifier_card_2.prototype.GetModifierMoveSpeedBonus_Constant(self)
return self:getScaledCardValue("speed_bonus", 45, CARD_ID)
end
function modifier_card_2.prototype.GetModifierMoveSpeed_Limit(self)
local limit = self:getCardValue("speed_limit", 0, CARD_ID)
if limit <= DEFAULT_MOVE_SPEED_LIMIT then
return DEFAULT_MOVE_SPEED_LIMIT
end
return limit * self:getCardCopies()
end
function modifier_card_2.prototype.GetModifierAttackSpeedBonus_Constant(self)
local attackTimeReductionPct = self:getScaledCardValue("attacktime", 0, CARD_ID)
if attackTimeReductionPct <= 0 then
return 0
end
local parent = self:GetParent()
if not parent or not IsValidEntity(parent) then
return 0
end
if parent:HasModifier(MODIFIER_CARD_43) then
return 0
end
if IsServer() then
applyHeroTargetBat(nil, parent, 0)
end
return computeAttackSpeedBonusForTargetBat(nil, parent, 0)
end
function modifier_card_2.prototype.OnCustomCreated(self)
if not IsServer() then
return
end
local parent = self:GetParent()
if not parent or not IsValidEntity(parent) or parent:HasModifier(MODIFIER_CARD_43) then
return
end
if self:getCardValue("attacktime", 0, CARD_ID) > 0 then
applyHeroTargetBat(nil, parent, 0)
end
end
modifier_card_2 = __TS__Decorate(
modifier_card_2,
modifier_card_2,
{registerModifier(nil)},
{kind = "class", name = "modifier_card_2"}
)
____exports.modifier_card_2 = modifier_card_2
return ____exports