name: Specimen
card_text: Reveal 1 "Fossil Fusion" in your hand; send 1 monster from your hand to the GY, and if you do, declare a Type and a Level, then your opponent looks at their hand and Deck, and sends 1 monster with the declared Type and Level from one of them to the GY (if possible). You can only activate 1 "Specimen Inspection" per turn.
external_ids: local CARD_ID_0 = 59419719 --Fossil Fusion
  
lua: local CARD_ID_0 = 59419719 --Fossil Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_0) and not c:IsPublic()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.ShuffleHand(tp)
  end
  function s.tgfilter0(c)
  	return not c:IsPublic() or c:IsType(TYPE_MONSTER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if not Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_HAND, 0, 1, nil, TYPE_MONSTER) then
  			return false
  		end
  		local mc = Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK)
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_HAND)
  		return mc > 0 or g and g:IsExists(s.tgfilter0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgfilter(c, race, lv)
  	return c:IsType(TYPE_MONSTER) and c:IsRace(race) and c:IsLevel(lv) and c:IsAbleToGrave()
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_HAND, 0, 1, 1, nil, TYPE_MONSTER)
  	if g:GetCount() > 0 and Duel.SendtoGrave(g, REASON_EFFECT) and g:GetFirst():IsLocation(LOCATION_GRAVE) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RACE)
  		local race = Duel.AnnounceRace(tp, 1, RACE_ALL)
  		Duel.Hint(HINT_SELECTMSG, tp, HINGMSG_LVRANK)
  		local lv = Duel.AnnounceLevel(tp)
  		local cg = Duel.GetFieldGroup(tp, 0, LOCATION_HAND + LOCATION_DECK)
  		Duel.ConfirmCards(1 - tp, cg)
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  		local sg = cg:FilterSelect(1 - tp, s.tgfilter, 1, 1, nil, race, lv)
  		if sg:GetCount() > 0 then
  			Duel.SendtoGrave(sg, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Specimen
  Reveal 1 "Fossil Fusion" in your hand; send 1 monster from your hand to the GY, and if you do, declare a Type and a Level, then your opponent looks at their hand and Deck, and sends 1 monster with the declared Type and Level from one of them to the GY (if possible). You can only activate 1 "Specimen Inspection" per turn.
target_text: -- Specimen
  local CARD_ID_0 = 59419719 --Fossil Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOGRAVE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsCode(CARD_ID_0) and not c:IsPublic()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g)
  	Duel.ShuffleHand(tp)
  end
  function s.tgfilter0(c)
  	return not c:IsPublic() or c:IsType(TYPE_MONSTER)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if not Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_HAND, 0, 1, nil, TYPE_MONSTER) then
  			return false
  		end
  		local mc = Duel.GetFieldGroupCount(tp, 0, LOCATION_DECK)
  		local g = Duel.GetFieldGroup(tp, 0, LOCATION_HAND)
  		return mc > 0 or g and g:IsExists(s.tgfilter0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgfilter(c, race, lv)
  	return c:IsType(TYPE_MONSTER) and c:IsRace(race) and c:IsLevel(lv) and c:IsAbleToGrave()
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, Card.IsType, tp, LOCATION_HAND, 0, 1, 1, nil, TYPE_MONSTER)
  	if g:GetCount() > 0 and Duel.SendtoGrave(g, REASON_EFFECT) and g:GetFirst():IsLocation(LOCATION_GRAVE) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RACE)
  		local race = Duel.AnnounceRace(tp, 1, RACE_ALL)
  		Duel.Hint(HINT_SELECTMSG, tp, HINGMSG_LVRANK)
  		local lv = Duel.AnnounceLevel(tp)
  		local cg = Duel.GetFieldGroup(tp, 0, LOCATION_HAND + LOCATION_DECK)
  		Duel.ConfirmCards(1 - tp, cg)
  		Duel.Hint(HINT_SELECTMSG, 1 - tp, HINTMSG_TOGRAVE)
  		local sg = cg:FilterSelect(1 - tp, s.tgfilter, 1, 1, nil, race, lv)
  		if sg:GetCount() > 0 then
  			Duel.SendtoGrave(sg, REASON_EFFECT)
  		end
  	end
  end
  
  