Как сделать защиту линки от кастомных спеллов

  • Автор темы Автор темы Se7eN
  • Дата начала Дата начала

Se7eN

Друзья CG
22 Ноя 2014
334
18
Скрипт а-ля

ЕСЛИ есть_линка() ТО
Сбить_Линку() и РЕТУРН НОЗИНГ
ЗАКОНЧИТЬ
 
Код:
	if target:TriggerSpellAbsorb(ability) then
		return 
	end
 
Кроме стандартного модификатора линки можно использовать луа модификатор с MODIFIER_PROPERTY_ABSORB_SPELL
 
Вот более кашерный вариант
Код:
function modifier_item_void_gem_active:DeclareFunctions()
  local funcs = {
    MODIFIER_PROPERTY_REFLECT_SPELL
  }

  return funcs
end

function modifier_item_void_gem_active:GetReflectSpell(kv)
  if self.stored ~= nil then
    self.stored:RemoveSelf() --we make sure to remove previous spell.
  end
  local hCaster = self:GetParent()
  local hAbility = hCaster:AddAbility(kv.ability:GetAbilityName())
  hAbility:SetStolen(true) --just to be safe with some interactions.
  hAbility:SetHidden(true) --hide the ability.
  hAbility:SetLevel(kv.ability:GetLevel()) --same level of ability as the origin.
  hCaster:SetCursorCastTarget(kv.ability:GetCaster()) --lets send this spell back.
  hAbility:OnSpellStart() --cast the spell.
  self.stored = hAbility --store the spell reference for future use.

  ParticleManager:CreateParticle("particles/items3_fx/lotus_orb_reflect.vpcf" , PATTACH_POINT_FOLLOW, self:GetParent())     
  if IsServer() then   
    EmitSoundOn( "Hero_AbyssalUnderlord.Firestorm.Target", self:GetParent( ))
    EmitSoundOn( "Hero_AbyssalUnderlord.Pit.TargetHero", self:GetParent( ))
    EmitSoundOn ("Hero_AbyssalUnderlord.Firestorm.Start", self:GetParent())
    EmitSoundOn ("Hero_AbyssalUnderlord.Firestorm.Cast", self:GetParent())
  end
end
 
Последнее редактирование модератором:
Реклама: