75 lines
2.9 KiB
Lua
75 lines
2.9 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 ____modifier_card_cursed = require("cards.modifier_card_cursed")
|
|
local getCursedStackCount = ____modifier_card_cursed.getCursedStackCount
|
|
local CARD_ID = 71
|
|
____exports.card_71 = __TS__Class()
|
|
local card_71 = ____exports.card_71
|
|
card_71.name = "card_71"
|
|
card_71.____file_path = "scripts/vscripts/cards/examples/card_71.lua"
|
|
__TS__ClassExtends(card_71, CardBase)
|
|
function card_71.prototype.GetModifierName(self)
|
|
return "modifier_card_71"
|
|
end
|
|
card_71 = __TS__Decorate(card_71, card_71, {RegisterCard}, {kind = "class", name = "card_71"})
|
|
____exports.card_71 = card_71
|
|
____exports.modifier_card_71 = __TS__Class()
|
|
local modifier_card_71 = ____exports.modifier_card_71
|
|
modifier_card_71.name = "modifier_card_71"
|
|
modifier_card_71.____file_path = "scripts/vscripts/cards/examples/card_71.lua"
|
|
__TS__ClassExtends(modifier_card_71, CardBaseModifier)
|
|
function modifier_card_71.prototype.OnCustomCreated(self, params)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self:StartIntervalThink(1)
|
|
end
|
|
function modifier_card_71.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local hero = self:GetParent()
|
|
if not hero or not IsValidEntity(hero) or not hero:IsAlive() or not hero:IsRealHero() then
|
|
return
|
|
end
|
|
local dotPct = self:getScaledCardValue("self_damage_max_hp_pct_per_sec", 2.5, CARD_ID)
|
|
local hpLoss = hero:GetMaxHealth() * (math.max(0, dotPct) / 100)
|
|
if hpLoss <= 0 then
|
|
return
|
|
end
|
|
local newHealth = math.max(
|
|
1,
|
|
hero:GetHealth() - hpLoss
|
|
)
|
|
hero:ModifyHealth(newHealth, nil, false, 0)
|
|
end
|
|
function modifier_card_71.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_EXTRA_HEALTH_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_71.prototype.GetModifierExtraHealthPercentage(self)
|
|
local hero = self:GetParent()
|
|
if not hero or not IsValidEntity(hero) or not hero:IsRealHero() then
|
|
return 0
|
|
end
|
|
local perCurse = self:getScaledCardValue("max_health_pct_per_curse_stack", 1, CARD_ID)
|
|
return getCursedStackCount(nil, hero) * perCurse
|
|
end
|
|
modifier_card_71 = __TS__Decorate(
|
|
modifier_card_71,
|
|
modifier_card_71,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_71"}
|
|
)
|
|
____exports.modifier_card_71 = modifier_card_71
|
|
return ____exports
|