name: The
card_text: (This card is also always treated as "Legendary Dragon Timaeus".)
  Target 1 "Dark Magician" monster you control; Fusion Summon 1 Fusion Monster from your Extra Deck that mentions that monster on the field as material, using it as the Fusion Material. You can only activate 1 "The Eye of Timaeus" per turn.
external_ids: local SETCARD_ID_0 = 0x10a2 --Dark
  
lua: local SETCARD_ID_0 = 0x10a2 --Dark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--add code
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_ADD_CODE)
  	e2:SetValue(10000050)
  	c:RegisterEffect(e2)
  end
  function s.tgfilter(c, e, tp)
  	return c:IsFaceup()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeFusionMaterial()
  		and aux.MustMaterialCheck(c, tp, EFFECT_MUST_BE_FMATERIAL)
  		and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, c)
  end
  function s.spfilter(c, e, tp, tc)
  	return c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c, tc:GetCode()) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, tc, c) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc == 0 then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not aux.MustMaterialCheck(tc, tp, EFFECT_MUST_BE_FMATERIAL) then
  		return
  	end
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsCanBeFusionMaterial() and not tc:IsImmuneToEffect(e) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, tc)
  		local sc = sg:GetFirst()
  		if sc then
  			sc:SetMaterial(Group.FromCards(tc))
  			Duel.SendtoGrave(tc, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION)
  			Duel.BreakEffect()
  			Duel.SpecialSummon(sc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
  			sc:CompleteProcedure()
  		end
  	end
  end
  
  
source_text: The
  (This card is also always treated as "Legendary Dragon Timaeus".)
  Target 1 "Dark Magician" monster you control; Fusion Summon 1 Fusion Monster from your Extra Deck that mentions that monster on the field as material, using it as the Fusion Material. You can only activate 1 "The Eye of Timaeus" per turn.
target_text: -- The
  local SETCARD_ID_0 = 0x10a2 --Dark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--add code
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCode(EFFECT_ADD_CODE)
  	e2:SetValue(10000050)
  	c:RegisterEffect(e2)
  end
  function s.tgfilter(c, e, tp)
  	return c:IsFaceup()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsCanBeFusionMaterial()
  		and aux.MustMaterialCheck(c, tp, EFFECT_MUST_BE_FMATERIAL)
  		and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, c)
  end
  function s.spfilter(c, e, tp, tc)
  	return c:IsType(TYPE_FUSION) and aux.IsMaterialListCode(c, tc:GetCode()) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) and Duel.GetLocationCountFromEx(tp, tp, tc, c) > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc == 0 then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.tgfilter, tp, LOCATION_MZONE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	Duel.SelectTarget(tp, s.tgfilter, tp, LOCATION_MZONE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if not aux.MustMaterialCheck(tc, tp, EFFECT_MUST_BE_FMATERIAL) then
  		return
  	end
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsCanBeFusionMaterial() and not tc:IsImmuneToEffect(e) then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, tc)
  		local sc = sg:GetFirst()
  		if sc then
  			sc:SetMaterial(Group.FromCards(tc))
  			Duel.SendtoGrave(tc, REASON_EFFECT + REASON_MATERIAL + REASON_FUSION)
  			Duel.BreakEffect()
  			Duel.SpecialSummon(sc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
  			sc:CompleteProcedure()
  		end
  	end
  end
  
  