name: Test
card_text: 2 monsters including a "Gladiator Beast" monster
  If this card is Link Summoned: You can add 1 "Gladiator Beast" card from your Deck to your hand. You can target 1 "Gladiator Beast" monster you control; shuffle that "Gladiator Beast" monster into the Deck, and if you do, Special Summon 1 "Gladiator Beast" monster with a different original name from your Deck. (This is treated as a Special Summon by a "Gladiator Beast" monster's effect.) You can only use each effect of "Test Panther" once per turn.
external_ids: local SETCARD_ID_0 = 0x1019 --Gladiator
  
lua: local SETCARD_ID_0 = 0x1019 --Gladiator
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TODECK)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x1019)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.tdfilter(c, e, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp, c)
  end
  function s.spfilter(c, e, tp, tc)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsOriginalCodeRule(tc:GetOriginalCodeRule()) and c:IsCanBeSpecialSummoned(e, SUMMON_VALUE_GLADIATOR, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tdfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, tc)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.SpecialSummon(tc, SUMMON_VALUE_GLADIATOR, tp, tp, false, false, POS_FACEUP)
  			tc:RegisterFlagEffect(tc:GetOriginalCode(), RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 0)
  		end
  	end
  end
  
  
source_text: Test
  2 monsters including a "Gladiator Beast" monster
  If this card is Link Summoned: You can add 1 "Gladiator Beast" card from your Deck to your hand. You can target 1 "Gladiator Beast" monster you control; shuffle that "Gladiator Beast" monster into the Deck, and if you do, Special Summon 1 "Gladiator Beast" monster with a different original name from your Deck. (This is treated as a Special Summon by a "Gladiator Beast" monster's effect.) You can only use each effect of "Test Panther" once per turn.
target_text: -- Test
  local SETCARD_ID_0 = 0x1019 --Gladiator
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, nil, 2, 2, s.lcheck)
  	c:EnableReviveLimit()
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TODECK)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.lcheck(g, lc)
  	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x1019)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.tdfilter(c, e, tp)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and Duel.GetMZoneCount(tp, c) > 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_DECK, 0, 1, nil, e, tp, c)
  end
  function s.spfilter(c, e, tp, tc)
  	return c:IsSetCard(SETCARD_ID_0) and not c:IsOriginalCodeRule(tc:GetOriginalCodeRule()) and c:IsCanBeSpecialSummoned(e, SUMMON_VALUE_GLADIATOR, tp, false, false)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tdfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tdfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local g = Duel.SelectTarget(tp, s.tdfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT) ~= 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp, tc)
  		local tc = g:GetFirst()
  		if tc then
  			Duel.SpecialSummon(tc, SUMMON_VALUE_GLADIATOR, tp, tp, false, false, POS_FACEUP)
  			tc:RegisterFlagEffect(tc:GetOriginalCode(), RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 0)
  		end
  	end
  end
  
  