name: Number
card_text: 2 Level 8 monsters
  Your opponent cannot target this card with card effects. You can detach 1 material from this card; take 2 Dragon "Number" monsters with different names from your Extra Deck and/or GY, except "Number 97: Draglubion", Special Summon 1 of them and attach the other to it as material, also for the rest of this turn you cannot Special Summon other monsters, or declare an attack, except with that Special Summoned monster. You can only use this effect of "Number 97: Draglubion" once per turn.
external_ids: local SETCARD_ID_0 = 0x48 --Number
  
lua: local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 8, 2)
  	c:EnableReviveLimit()
  	--cannot be target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(aux.tgoval)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 97
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.cfilter(c, tc)
  	return c:IsRace(RACE_DRAGON) and c:IsSetCard(SETCARD_ID_0) and not c:IsCode(id) and c:IsCanOverlay() and not c:IsCode(tc:GetCode())
  end
  function s.spfilter(c, e, tp)
  	return c:IsRace(RACE_DRAGON)
  		and c:IsSetCard(SETCARD_ID_0)
  		and not c:IsCode(id)
  		and c:IsType(TYPE_XYZ)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and (c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0 or c:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, c, c)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter), tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	local fid = 0
  	if tc then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  		local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.cfilter), tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, 1, tc, tc)
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.Overlay(tc, g2)
  		fid = tc:GetFieldID()
  	end
  	local e1 = Effect.CreateEffect(c)
  	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)
  	Duel.RegisterEffect(e1, tp)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.ftarget)
  	e2:SetLabel(fid)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFieldID()
  end
  
  
source_text: Number
  2 Level 8 monsters
  Your opponent cannot target this card with card effects. You can detach 1 material from this card; take 2 Dragon "Number" monsters with different names from your Extra Deck and/or GY, except "Number 97: Draglubion", Special Summon 1 of them and attach the other to it as material, also for the rest of this turn you cannot Special Summon other monsters, or declare an attack, except with that Special Summoned monster. You can only use this effect of "Number 97: Draglubion" once per turn.
target_text: -- Number
  local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 8, 2)
  	c:EnableReviveLimit()
  	--cannot be target
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetValue(aux.tgoval)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCost(s.spcost)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 97
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.cfilter(c, tc)
  	return c:IsRace(RACE_DRAGON) and c:IsSetCard(SETCARD_ID_0) and not c:IsCode(id) and c:IsCanOverlay() and not c:IsCode(tc:GetCode())
  end
  function s.spfilter(c, e, tp)
  	return c:IsRace(RACE_DRAGON)
  		and c:IsSetCard(SETCARD_ID_0)
  		and not c:IsCode(id)
  		and c:IsType(TYPE_XYZ)
  		and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  		and (c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp, tp, nil, c) > 0 or c:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0)
  		and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, c, c)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA + LOCATION_GRAVE)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.spfilter), tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	local fid = 0
  	if tc then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  		local g2 = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.cfilter), tp, LOCATION_EXTRA + LOCATION_GRAVE, 0, 1, 1, tc, tc)
  		Duel.SpecialSummon(tc, 0, tp, tp, false, false, POS_FACEUP)
  		Duel.Overlay(tc, g2)
  		fid = tc:GetFieldID()
  	end
  	local e1 = Effect.CreateEffect(c)
  	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)
  	Duel.RegisterEffect(e1, tp)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
  	e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  	e2:SetTargetRange(LOCATION_MZONE, 0)
  	e2:SetTarget(s.ftarget)
  	e2:SetLabel(fid)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFieldID()
  end
  
  