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_ID = 75 local RING_PARTICLE = "particles/units/heroes/hero_arc_warden/arc_warden_magnetic_tempest_ring.vpcf" local BLAST_PARTICLE = "particles/units/heroes/hero_invoker/invoker_emp_explode.vpcf" local function countEnemiesInBlast(self, team, center, radius) local units = FindUnitsInRadius( team, center, nil, radius, DOTA_UNIT_TARGET_TEAM_ENEMY, bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC), DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false ) return #units end --- Центр взрыва — позиция врага, где в радиусе blast попадает больше всего целей. local function findBestBlastPosition(self, hero, searchRadius, blastRadius) local enemies = FindUnitsInRadius( hero:GetTeamNumber(), hero:GetAbsOrigin(), nil, searchRadius, DOTA_UNIT_TARGET_TEAM_ENEMY, bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC), DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false ) if #enemies == 0 then return nil end local bestPosition = enemies[1]:GetAbsOrigin() local bestHits = -1 local team = hero:GetTeamNumber() for ____, enemy in ipairs(enemies) do local candidate = enemy:GetAbsOrigin() local hits = countEnemiesInBlast(nil, team, candidate, blastRadius) if hits > bestHits then bestHits = hits bestPosition = candidate end end return bestPosition end ____exports.card_75 = __TS__Class() local card_75 = ____exports.card_75 card_75.name = "card_75" card_75.____file_path = "scripts/vscripts/cards/examples/card_75.lua" __TS__ClassExtends(card_75, CardBase) function card_75.prototype.GetModifierName(self) return "modifier_card_75" end card_75 = __TS__Decorate(card_75, card_75, {RegisterCard}, {kind = "class", name = "card_75"}) ____exports.card_75 = card_75 ____exports.modifier_card_75 = __TS__Class() local modifier_card_75 = ____exports.modifier_card_75 modifier_card_75.name = "modifier_card_75" modifier_card_75.____file_path = "scripts/vscripts/cards/examples/card_75.lua" __TS__ClassExtends(modifier_card_75, CardBaseModifier) function modifier_card_75.prototype.getValue(self, key, fallback) return self:getCardValue(key, fallback, CARD_ID) end function modifier_card_75.prototype.OnCustomCreated(self, _params) if not IsServer() then return end local interval = math.max( 0.5, self:getValue("blast_interval_sec", 4) ) self:StartIntervalThink(interval) end function modifier_card_75.prototype.OnCustomRefresh(self, _params) if not IsServer() then return end local interval = math.max( 0.5, self:getValue("blast_interval_sec", 4) ) self:StartIntervalThink(interval) end function modifier_card_75.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 manaCostPct = self:getScaledCardValue("mana_cost_pct", 15) local maxMana = hero:GetMaxMana() if maxMana <= 0 then return end local manaCost = maxMana * (manaCostPct / 100) if hero:GetMana() < manaCost then return end local searchRadius = self:getValue("search_radius", 1000) local blastRadius = self:getValue("blast_radius", 175) local blastCenter = findBestBlastPosition(nil, hero, searchRadius, blastRadius) if not blastCenter then return end hero:SetMana(math.max( 0, hero:GetMana() - manaCost )) local baseDamage = self:getScaledCardValue("base_damage", 90) local damagePct = self:getScaledCardValue("damage_from_max_mana_pct", 5) local damage = baseDamage + maxMana * (damagePct / 100) if damage <= 0 then return end local blastDelay = math.max( 0.1, self:getValue("blast_delay_sec", 1) ) local heroEntIndex = hero:entindex() local ringParticle = ParticleManager:CreateParticle(RING_PARTICLE, PATTACH_WORLDORIGIN, nil) ParticleManager:SetParticleControl(ringParticle, 0, blastCenter) ParticleManager:SetParticleControl( ringParticle, 1, Vector(blastRadius, blastRadius, blastRadius) ) EmitSoundOnLocationWithCaster(blastCenter, "Hero_Invoker.EMP.Charge", hero) Timers:CreateTimer( blastDelay, function() local caster = EntIndexToHScript(heroEntIndex) if not caster or not IsValidEntity(caster) or not caster:IsAlive() then ParticleManager:DestroyParticle(ringParticle, false) ParticleManager:ReleaseParticleIndex(ringParticle) return end ParticleManager:DestroyParticle(ringParticle, false) ParticleManager:ReleaseParticleIndex(ringParticle) local explosion = ParticleManager:CreateParticle(BLAST_PARTICLE, PATTACH_WORLDORIGIN, nil) ParticleManager:SetParticleControl(explosion, 0, blastCenter) ParticleManager:SetParticleControl( explosion, 1, Vector(blastRadius, blastRadius, blastRadius) ) ParticleManager:ReleaseParticleIndex(explosion) EmitSoundOnLocationWithCaster(blastCenter, "Hero_Invoker.EMP.Discharge", caster) local victims = FindUnitsInRadius( caster:GetTeamNumber(), blastCenter, nil, blastRadius, DOTA_UNIT_TARGET_TEAM_ENEMY, bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC), DOTA_UNIT_TARGET_FLAG_NONE, FIND_ANY_ORDER, false ) for ____, victim in ipairs(victims) do do if not victim or not IsValidEntity(victim) or not victim:IsAlive() then goto __continue23 end ApplyDamage({victim = victim, attacker = caster, damage = damage, damage_type = DAMAGE_TYPE_PURE}) end ::__continue23:: end end ) end modifier_card_75 = __TS__Decorate( modifier_card_75, modifier_card_75, {registerModifier(nil)}, {kind = "class", name = "modifier_card_75"} ) ____exports.modifier_card_75 = modifier_card_75 return ____exports