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_data = require("cards.card_data") local CARD_DATABASE = ____card_data.CARD_DATABASE local CARD_ID = 12 local MARK_MODIFIER = "modifier_card_12_marked" ____exports.card_12 = __TS__Class() local card_12 = ____exports.card_12 card_12.name = "card_12" card_12.____file_path = "scripts/vscripts/cards/examples/card_12.lua" __TS__ClassExtends(card_12, CardBase) function card_12.prototype.GetModifierName(self) return "modifier_card_12" end card_12 = __TS__Decorate(card_12, card_12, {RegisterCard}, {kind = "class", name = "card_12"}) ____exports.card_12 = card_12 ____exports.modifier_card_12 = __TS__Class() local modifier_card_12 = ____exports.modifier_card_12 modifier_card_12.name = "modifier_card_12" modifier_card_12.____file_path = "scripts/vscripts/cards/examples/card_12.lua" __TS__ClassExtends(modifier_card_12, CardBaseModifier) function modifier_card_12.prototype.IsPurgable(self) return false end function modifier_card_12.prototype.getValues(self) local ____opt_0 = CARD_DATABASE[CARD_ID] return ____opt_0 and ____opt_0.values or ({}) end function modifier_card_12.prototype.getValue(self, key, fallback) local value = self:getValues()[key] if value == nil or value == nil then return fallback end return value end function modifier_card_12.prototype.getMarkedTarget(self) if self.markedTargetEntIndex == nil then return nil end local target = EntIndexToHScript(self.markedTargetEntIndex) if not target or not IsValidEntity(target) or not target:IsAlive() then return nil end return target end function modifier_card_12.prototype.OnCustomCreated(self, params) if not IsServer() then return end self:StartIntervalThink(self:getValue("scan_interval", 8)) self:OnIntervalThink() end function modifier_card_12.prototype.OnCustomRefresh(self, params) if not IsServer() then return end self:StartIntervalThink(self:getValue("scan_interval", 8)) end function modifier_card_12.prototype.OnIntervalThink(self) if not IsServer() then return end local parent = self:GetParent() if not parent or not parent:IsAlive() then return end local radius = self:getValue("scan_radius", 900) local markDuration = self:getValue("mark_duration", 5) local enemies = FindUnitsInRadius( parent:GetTeamNumber(), parent:GetAbsOrigin(), nil, radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NONE, FIND_CLOSEST, false ) local bestTarget = nil local bestMaxHealth = -1 for ____, enemy in ipairs(enemies) do do if not enemy or not enemy:IsAlive() then goto __continue17 end local maxHealth = enemy:GetMaxHealth() if maxHealth > bestMaxHealth then bestMaxHealth = maxHealth bestTarget = enemy end end ::__continue17:: end if not bestTarget then return end self.markedTargetEntIndex = bestTarget:entindex() bestTarget:AddNewModifier( parent, getModifierSourceAbility(nil, parent), MARK_MODIFIER, {duration = markDuration} ) end function modifier_card_12.prototype.DeclareFunctions(self) return {MODIFIER_EVENT_ON_DEATH, MODIFIER_PROPERTY_TOOLTIP} end function modifier_card_12.prototype.OnDeath(self, event) if not IsServer() then return end local parent = self:GetParent() if not parent or not event.unit then return end local markedTarget = self:getMarkedTarget() if markedTarget and event.unit == markedTarget then self.markedTargetEntIndex = nil end if event.attacker ~= parent or not markedTarget or event.unit ~= markedTarget then return end local copies = self:getCardCopies() local healPct = self:getValue("on_kill_heal_pct", 6) * copies local manaGain = self:getValue("on_kill_mana", 35) * copies local healAmount = parent:GetMaxHealth() * (healPct / 100) if healAmount > 0 then parent:Heal(healAmount, nil) end if manaGain > 0 then parent:GiveMana(manaGain) end end modifier_card_12 = __TS__Decorate( modifier_card_12, modifier_card_12, {registerModifier(nil)}, {kind = "class", name = "modifier_card_12"} ) ____exports.modifier_card_12 = modifier_card_12 ____exports.modifier_card_12_marked = __TS__Class() local modifier_card_12_marked = ____exports.modifier_card_12_marked modifier_card_12_marked.name = "modifier_card_12_marked" modifier_card_12_marked.____file_path = "scripts/vscripts/cards/examples/card_12.lua" __TS__ClassExtends(modifier_card_12_marked, CardBaseModifier) function modifier_card_12_marked.prototype.isBossUnit(self, unit) local unitName = tostring(unit:GetUnitName() or "") return __TS__StringIncludes( string.lower(unitName), "boss" ) end function modifier_card_12_marked.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) end function modifier_card_12_marked.prototype.IsDebuff(self) return true end function modifier_card_12_marked.prototype.IsPurgable(self) return false end function modifier_card_12_marked.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP} end function modifier_card_12_marked.prototype.GetModifierIncomingDamage_Percentage(self, event) if not IsServer() then return 0 end local target = self:GetParent() local ownerHero = self:GetCaster() if not target or not ownerHero then return 0 end if not event.attacker or event.attacker ~= ownerHero then return 0 end local ownerMod = ownerHero:FindModifierByName("modifier_card_12") local copies = math.max( 1, math.floor(ownerMod and ownerMod:GetStackCount() or 0) ) local bonusPct = self:getValue("bonus_damage_pct", 22) * copies if self:isBossUnit(target) then local bossPenaltyPct = self:getValue("boss_penalty_pct", 50) bonusPct = bonusPct * (1 - bossPenaltyPct / 100) end return bonusPct end function modifier_card_12_marked.prototype.GetEffectName(self) return "particles/units/heroes/hero_skeletonking/wraith_king_curse_overhead_skull.vpcf" end function modifier_card_12_marked.prototype.GetEffectAttachType(self) return PATTACH_OVERHEAD_FOLLOW end modifier_card_12_marked = __TS__Decorate( modifier_card_12_marked, modifier_card_12_marked, {registerModifier(nil)}, {kind = "class", name = "modifier_card_12_marked"} ) ____exports.modifier_card_12_marked = modifier_card_12_marked return ____exports