name: Protectcode
card_text: 2+ Effect Monsters
  Your opponent cannot target Link-4 or higher monsters you control with card effects, also they cannot be destroyed by battle. If you control a "Firewall" Link Monster (Quick Effect): You can banish Link Monsters from your GY whose combined Link Ratings equal exactly 3; Special Summon this card from your GY, but banish it when it leaves the field. You can only use this effect of "Protectcode Talker" once per turn.
external_ids: local SETCARD_ID_0 = 0x18f --Firewall
  
lua: local SETCARD_ID_0 = 0x18f --Firewall
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 2)
  	c:EnableReviveLimit()
  	--cannot be target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.imetg)
  	e1:SetValue(aux.tgoval)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.imetg)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--Special Summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.imetg(e, c)
  	return c:IsType(TYPE_LINK) and c:IsLinkAbove(4)
  end
  function s.filter(c)
  	return c:IsType(TYPE_LINK) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.rmfilter(c)
  	return c:IsType(TYPE_LINK) and c:IsLinkBelow(3) and c:IsAbleToRemoveAsCost()
  end
  function s.fselect(g)
  	return g:GetSum(Card.GetLink) == 3
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_GRAVE, 0, c)
  	if chk == 0 then
  		return g:CheckSubGroup(s.fselect, 1, #g)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, s.fselect, false, 1, #g)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e1:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e1)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Protectcode
  2+ Effect Monsters
  Your opponent cannot target Link-4 or higher monsters you control with card effects, also they cannot be destroyed by battle. If you control a "Firewall" Link Monster (Quick Effect): You can banish Link Monsters from your GY whose combined Link Ratings equal exactly 3; Special Summon this card from your GY, but banish it when it leaves the field. You can only use this effect of "Protectcode Talker" once per turn.
target_text: -- Protectcode
  local SETCARD_ID_0 = 0x18f --Firewall
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkType, TYPE_EFFECT), 2)
  	c:EnableReviveLimit()
  	--cannot be target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.imetg)
  	e1:SetValue(aux.tgoval)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.imetg)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--Special Summon
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetRange(LOCATION_GRAVE)
  	e3:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e3:SetCountLimit(1, id)
  	e3:SetCondition(s.spcon)
  	e3:SetCost(s.spcost)
  	e3:SetTarget(s.sptg)
  	e3:SetOperation(s.spop)
  	c:RegisterEffect(e3)
  end
  function s.imetg(e, c)
  	return c:IsType(TYPE_LINK) and c:IsLinkAbove(4)
  end
  function s.filter(c)
  	return c:IsType(TYPE_LINK) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.rmfilter(c)
  	return c:IsType(TYPE_LINK) and c:IsLinkBelow(3) and c:IsAbleToRemoveAsCost()
  end
  function s.fselect(g)
  	return g:GetSum(Card.GetLink) == 3
  end
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	local g = Duel.GetMatchingGroup(s.rmfilter, tp, LOCATION_GRAVE, 0, c)
  	if chk == 0 then
  		return g:CheckSubGroup(s.fselect, 1, #g)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = g:SelectSubGroup(tp, s.fselect, false, 1, #g)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c, 0, tp, tp, false, false, POS_FACEUP) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetReset(RESET_EVENT + RESETS_REDIRECT)
  		e1:SetValue(LOCATION_REMOVED)
  		c:RegisterEffect(e1)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  