name: Quadborrel
card_text: 2 Dragon monsters, including a "Rokket" monster
  You can discard 1 card, then target 1 face-up monster on the field; you cannot Special Summon Link-2 or lower monsters from the Extra Deck for the rest of the turn, also destroy the targeted monster, then, if it was a Link Monster, you can Special Summon any number of "Rokket" monsters with different names, from your hand or GY, up to its Link Rating. You can only use this effect of "Quadborrel Dragon" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 77189532 --Rokket Coder
  local SETCARD_ID_0 = 0x102 --Rokket
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 77189532 --Rokket Coder
  local SETCARD_ID_0 = 0x102 --Rokket
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.mfilter(c)
  	return c:IsLinkRace(RACE_DRAGON) or c:IsHasEffect(CARD_ID_1)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x102)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 and tc:IsType(TYPE_LINK) then
  		local ct = math.min((Duel.GetLocationCount(tp, LOCATION_MZONE)), tc:GetLink())
  		if ct > 0 then
  			if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  				ct = 1
  			end
  			local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  			if #g > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  				Duel.BreakEffect()
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  				local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct)
  				Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  			end
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return c:IsType(TYPE_LINK) and c:IsLinkBelow(2) and c:IsLocation(LOCATION_EXTRA)
  end
  
  
source_text: Quadborrel
  2 Dragon monsters, including a "Rokket" monster
  You can discard 1 card, then target 1 face-up monster on the field; you cannot Special Summon Link-2 or lower monsters from the Extra Deck for the rest of the turn, also destroy the targeted monster, then, if it was a Link Monster, you can Special Summon any number of "Rokket" monsters with different names, from your hand or GY, up to its Link Rating. You can only use this effect of "Quadborrel Dragon" once per turn.
target_text: -- Quadborrel
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 77189532 --Rokket Coder
  local SETCARD_ID_0 = 0x102 --Rokket
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, s.mfilter, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.mfilter(c)
  	return c:IsLinkRace(RACE_DRAGON) or c:IsHasEffect(CARD_ID_1)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x102)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.spfilter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.Destroy(tc, REASON_EFFECT) ~= 0 and tc:IsType(TYPE_LINK) then
  		local ct = math.min((Duel.GetLocationCount(tp, LOCATION_MZONE)), tc:GetLink())
  		if ct > 0 then
  			if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  				ct = 1
  			end
  			local g = Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter), tp, LOCATION_HAND + LOCATION_GRAVE, 0, nil, e, tp)
  			if #g > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  				Duel.BreakEffect()
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  				local sg = g:SelectSubGroup(tp, aux.dncheck, false, 1, ct)
  				Duel.SpecialSummon(sg, 0, tp, tp, false, false, POS_FACEUP)
  			end
  		end
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTarget(s.splimit)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c, tp, sumtp, sumpos)
  	return c:IsType(TYPE_LINK) and c:IsLinkBelow(2) and c:IsLocation(LOCATION_EXTRA)
  end
  
  