name: Voltester
card_text: If this card is Special Summoned to a zone a Link Monster points to: Destroy all Link Monsters that point to this card, then destroy all other monsters that those Link Monsters pointed to, and follow the Link Arrows of all those destroyed monsters, destroying everything they point to, and repeating the process, until there are no more to destroy. (This card cannot be destroyed by this effect.) You can only use this effect of "Voltester" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local lg1 = Duel.GetLinkedGroup(tp, 1, 1)
  	local lg2 = Duel.GetLinkedGroup(1 - tp, 1, 1)
  	lg1:Merge(lg2)
  	return lg1 and lg1:IsContains(e:GetHandler())
  end
  function s.desfilter1(c, mc)
  	return c:IsFaceup() and c:IsType(TYPE_LINK) and c:GetLinkedGroup():IsContains(mc)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(s.desfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, nil, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desfilter2(g)
  	local sg = Group.CreateGroup()
  	local tc = g:GetFirst()
  	while tc do
  		local fid = tc:GetFieldID()
  		tc:RegisterFlagEffect(id + 1, RESET_CHAIN, 0, 1, fid)
  		local lg = tc:GetLinkedGroup()
  		local sc = lg:GetFirst()
  		while sc do
  			sc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_CHAIN, 0, 1, fid)
  			sg:AddCard(sc)
  			sc = lg:GetNext()
  		end
  		tc = g:GetNext()
  	end
  	return sg
  end
  function s.desfilter3(c, g)
  	local tc = g:GetFirst()
  	while tc do
  		local fid = tc:GetFlagEffectLabel(18585766)
  		if fid ~= nil and c:GetFlagEffectLabel(id) == fid then
  			return true
  		end
  		tc = g:GetNext()
  	end
  	return false
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.desfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, nil, e:GetHandler())
  	local lg = s.desfilter2(g)
  	if g:GetCount() > 0 and Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  		local og = Duel.GetOperatedGroup()
  		local sg = lg:Filter(s.desfilter3, e:GetHandler(), og)
  		while sg:GetCount() > 0 do
  			Duel.BreakEffect()
  			lg = s.desfilter2(sg)
  			if Duel.Destroy(sg, REASON_EFFECT) == 0 then
  				return
  			end
  			og = Duel.GetOperatedGroup()
  			sg = lg:Filter(s.desfilter3, e:GetHandler(), og)
  		end
  	end
  end
  
  
source_text: Voltester
  If this card is Special Summoned to a zone a Link Monster points to: Destroy all Link Monsters that point to this card, then destroy all other monsters that those Link Monsters pointed to, and follow the Link Arrows of all those destroyed monsters, destroying everything they point to, and repeating the process, until there are no more to destroy. (This card cannot be destroyed by this effect.) You can only use this effect of "Voltester" once per turn.
target_text: -- Voltester
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.descon)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local lg1 = Duel.GetLinkedGroup(tp, 1, 1)
  	local lg2 = Duel.GetLinkedGroup(1 - tp, 1, 1)
  	lg1:Merge(lg2)
  	return lg1 and lg1:IsContains(e:GetHandler())
  end
  function s.desfilter1(c, mc)
  	return c:IsFaceup() and c:IsType(TYPE_LINK) and c:GetLinkedGroup():IsContains(mc)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(s.desfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, nil, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desfilter2(g)
  	local sg = Group.CreateGroup()
  	local tc = g:GetFirst()
  	while tc do
  		local fid = tc:GetFieldID()
  		tc:RegisterFlagEffect(id + 1, RESET_CHAIN, 0, 1, fid)
  		local lg = tc:GetLinkedGroup()
  		local sc = lg:GetFirst()
  		while sc do
  			sc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_CHAIN, 0, 1, fid)
  			sg:AddCard(sc)
  			sc = lg:GetNext()
  		end
  		tc = g:GetNext()
  	end
  	return sg
  end
  function s.desfilter3(c, g)
  	local tc = g:GetFirst()
  	while tc do
  		local fid = tc:GetFlagEffectLabel(18585766)
  		if fid ~= nil and c:GetFlagEffectLabel(id) == fid then
  			return true
  		end
  		tc = g:GetNext()
  	end
  	return false
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(s.desfilter1, tp, LOCATION_MZONE, LOCATION_MZONE, nil, e:GetHandler())
  	local lg = s.desfilter2(g)
  	if g:GetCount() > 0 and Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  		local og = Duel.GetOperatedGroup()
  		local sg = lg:Filter(s.desfilter3, e:GetHandler(), og)
  		while sg:GetCount() > 0 do
  			Duel.BreakEffect()
  			lg = s.desfilter2(sg)
  			if Duel.Destroy(sg, REASON_EFFECT) == 0 then
  				return
  			end
  			og = Duel.GetOperatedGroup()
  			sg = lg:Filter(s.desfilter3, e:GetHandler(), og)
  		end
  	end
  end
  
  