local ____lualib = require("lualib_bundle") local __TS__Class = ____lualib.__TS__Class local __TS__ClassExtends = ____lualib.__TS__ClassExtends local __TS__Decorate = ____lualib.__TS__Decorate local __TS__StringIncludes = ____lualib.__TS__StringIncludes 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 = 35 local POISON_MODIFIER = "modifier_card_35_poison" ____exports.card_35 = __TS__Class() local card_35 = ____exports.card_35 card_35.name = "card_35" card_35.____file_path = "scripts/vscripts/cards/examples/card_35.lua" __TS__ClassExtends(card_35, CardBase) function card_35.prototype.GetModifierName(self) return "modifier_card_35" end card_35 = __TS__Decorate(card_35, card_35, {RegisterCard}, {kind = "class", name = "card_35"}) ____exports.card_35 = card_35 ____exports.modifier_card_35 = __TS__Class() local modifier_card_35 = ____exports.modifier_card_35 modifier_card_35.name = "modifier_card_35" modifier_card_35.____file_path = "scripts/vscripts/cards/examples/card_35.lua" __TS__ClassExtends(modifier_card_35, CardBaseModifier) function modifier_card_35.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) end function modifier_card_35.prototype.DeclareFunctions(self) return {MODIFIER_EVENT_ON_ATTACK_LANDED, MODIFIER_PROPERTY_TOOLTIP} end function modifier_card_35.prototype.OnAttackLanded(self, event) if not IsServer() then return end local attacker = self:GetParent() if not attacker or not IsValidEntity(attacker) or event.attacker ~= attacker then return end local target = event.target if not target or not IsValidEntity(target) or not target:IsAlive() then return end if target:GetTeamNumber() == attacker:GetTeamNumber() then return end local duration = self:getValue("poison_duration", 3) target:AddNewModifier( attacker, getModifierSourceAbility(nil, attacker), POISON_MODIFIER, {duration = duration} ) end modifier_card_35 = __TS__Decorate( modifier_card_35, modifier_card_35, {registerModifier(nil)}, {kind = "class", name = "modifier_card_35"} ) ____exports.modifier_card_35 = modifier_card_35 ____exports.modifier_card_35_poison = __TS__Class() local modifier_card_35_poison = ____exports.modifier_card_35_poison modifier_card_35_poison.name = "modifier_card_35_poison" modifier_card_35_poison.____file_path = "scripts/vscripts/cards/examples/card_35.lua" __TS__ClassExtends(modifier_card_35_poison, CardBaseModifier) function modifier_card_35_poison.prototype.getCardCopiesFromOwner(self) local owner = self:GetCaster() if not owner or not IsValidEntity(owner) then return 1 end local cardMod = owner:FindModifierByName("modifier_card_35") return math.max( 1, math.floor(cardMod and cardMod:GetStackCount() or 0) ) end function modifier_card_35_poison.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) * self:getCardCopiesFromOwner() end function modifier_card_35_poison.prototype.IsDebuff(self) return true end function modifier_card_35_poison.prototype.IsPurgable(self) return true end function modifier_card_35_poison.prototype.GetEffectName(self) return "particles/units/heroes/hero_viper/viper_poison_debuff.vpcf" end function modifier_card_35_poison.prototype.GetEffectAttachType(self) return PATTACH_ABSORIGIN_FOLLOW end function modifier_card_35_poison.prototype.OnCustomCreated(self, params) if not IsServer() then return end local tickInterval = self:getValue("poison_tick_interval", 1) self:StartIntervalThink(math.max(0.1, tickInterval)) end function modifier_card_35_poison.prototype.OnCustomRefresh(self, params) if not IsServer() then return end local tickInterval = self:getValue("poison_tick_interval", 1) self:StartIntervalThink(math.max(0.1, tickInterval)) end function modifier_card_35_poison.prototype.isBoss(self, unit) local unitName = string.lower(tostring(unit:GetUnitName() or "")) return __TS__StringIncludes(unitName, "npc_boss") or __TS__StringIncludes(unitName, "wave_boss") or __TS__StringIncludes(unitName, "boss") end function modifier_card_35_poison.prototype.OnIntervalThink(self) if not IsServer() then return end local target = self:GetParent() local attacker = self:GetCaster() if not target or not IsValidEntity(target) or not target:IsAlive() then return end if not attacker or not IsValidEntity(attacker) then return end local hpPct = self:isBoss(target) and self:getValue("boss_damage_current_hp_pct", 1) or self:getValue("damage_current_hp_pct", 5) local damage = target:GetHealth() * (hpPct / 100) if damage <= 0 then return end local dealtDamage = ApplyDamage({victim = target, attacker = attacker, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL}) if dealtDamage > 0 then SendOverheadEventMessage( nil, OVERHEAD_ALERT_BONUS_SPELL_DAMAGE, target, math.floor(dealtDamage), attacker:GetPlayerOwner() ) end end modifier_card_35_poison = __TS__Decorate( modifier_card_35_poison, modifier_card_35_poison, {registerModifier(nil)}, {kind = "class", name = "modifier_card_35_poison"} ) ____exports.modifier_card_35_poison = modifier_card_35_poison return ____exports