name: The
card_text: Declare 1 card name; excavate the top card of your Deck, and if it is the declared card, add it to your hand, then you can add to your hand, or Special Summon, 1 DIVINE monster from your Deck. Otherwise, send it to the GY. You can only activate 1 "The True Name" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_DECKDES + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_DIVINE) and (c:IsAbleToHand() or (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(tp, 1) and Duel.IsExistingMatchingCard(Card.IsAbleToHand, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CODE)
  	getmetatable(e:GetHandler()).announce_filter = { TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK, OPCODE_ISTYPE, OPCODE_NOT }
  	local ac = Duel.AnnounceCard(tp, table.unpack(getmetatable(e:GetHandler()).announce_filter))
  	Duel.SetTargetParam(ac)
  	Duel.SetOperationInfo(0, CATEGORY_ANNOUNCE, nil, 0, tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) <= 0 then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 1)
  	local g = Duel.GetDecktopGroup(tp, 1)
  	local tc = g:GetFirst()
  	local ac = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	if tc:IsCode(ac) and tc:IsAbleToHand() then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
  		if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  			local sg = g:Select(tp, 1, 1, nil)
  			local sc = sg:GetFirst()
  			local b1 = sc:IsAbleToHand()
  			local b2 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and sc:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			local op = 0
  			if b1 and b2 then
  				op = Duel.SelectOption(tp, 1190, 1152)
  			elseif b1 then
  				op = 0
  			else
  				op = 1
  			end
  			if op == 0 then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			else
  				Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
  			end
  		else
  			Duel.DisableShuffleCheck()
  		end
  		Duel.ShuffleHand(tp)
  	else
  		Duel.DisableShuffleCheck()
  		Duel.SendtoGrave(tc, REASON_EFFECT + REASON_REVEAL)
  	end
  end
  
  
source_text: The
  Declare 1 card name; excavate the top card of your Deck, and if it is the declared card, add it to your hand, then you can add to your hand, or Special Summon, 1 DIVINE monster from your Deck. Otherwise, send it to the GY. You can only activate 1 "The True Name" per turn.
target_text: -- The
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_DECKDES + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.filter(c, e, tp)
  	return c:IsAttribute(ATTRIBUTE_DIVINE) and (c:IsAbleToHand() or (Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDiscardDeck(tp, 1) and Duel.IsExistingMatchingCard(Card.IsAbleToHand, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CODE)
  	getmetatable(e:GetHandler()).announce_filter = { TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK, OPCODE_ISTYPE, OPCODE_NOT }
  	local ac = Duel.AnnounceCard(tp, table.unpack(getmetatable(e:GetHandler()).announce_filter))
  	Duel.SetTargetParam(ac)
  	Duel.SetOperationInfo(0, CATEGORY_ANNOUNCE, nil, 0, tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetFieldGroupCount(tp, LOCATION_DECK, 0) <= 0 then
  		return
  	end
  	Duel.ConfirmDecktop(tp, 1)
  	local g = Duel.GetDecktopGroup(tp, 1)
  	local tc = g:GetFirst()
  	local ac = Duel.GetChainInfo(0, CHAININFO_TARGET_PARAM)
  	if tc:IsCode(ac) and tc:IsAbleToHand() then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_DECK, 0, nil, e, tp)
  		if g:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  			Duel.BreakEffect()
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPERATECARD)
  			local sg = g:Select(tp, 1, 1, nil)
  			local sc = sg:GetFirst()
  			local b1 = sc:IsAbleToHand()
  			local b2 = Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and sc:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  			local op = 0
  			if b1 and b2 then
  				op = Duel.SelectOption(tp, 1190, 1152)
  			elseif b1 then
  				op = 0
  			else
  				op = 1
  			end
  			if op == 0 then
  				Duel.SendtoHand(sc, nil, REASON_EFFECT)
  				Duel.ConfirmCards(1 - tp, sc)
  			else
  				Duel.SpecialSummon(sc, 0, tp, tp, false, false, POS_FACEUP)
  			end
  		else
  			Duel.DisableShuffleCheck()
  		end
  		Duel.ShuffleHand(tp)
  	else
  		Duel.DisableShuffleCheck()
  		Duel.SendtoGrave(tc, REASON_EFFECT + REASON_REVEAL)
  	end
  end
  
  