name: Number
card_text: 2 Level 4 monsters
  (Quick Effect): You can detach 1 material from this card; add 1 "Double or Nothing!" from your Deck to your hand, then Special Summon from your Extra Deck, 1 "Utopia" Xyz Monster, except "Number 39: Utopia Double", by using this face-up card you control as material, and if you do, its ATK becomes doubled, but it cannot attack directly. (This is treated as an Xyz Summon. Transfer its materials to the Summoned monster.) You can only use this effect of "Number 39: Utopia Double" once per turn.
external_ids: local CARD_ID_0 = 94770493 --Double or Nothing!
  local SETCARD_ID_0 = 0x107f --Utopia
  
lua: local CARD_ID_0 = 94770493 --Double or Nothing!
  local SETCARD_ID_0 = 0x107f --Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  aux.xyz_number[id] = 39
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	c:RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.spfilter(c, e, tp, mc)
  	return not c:IsCode(id)
  		and c:IsType(TYPE_XYZ)
  		and c:IsSetCard(SETCARD_ID_0)
  		and mc:IsCanBeXyzMaterial(c)
  		and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_XYZ, tp, false, false)
  		and Duel.GetLocationCountFromEx(tp, tp, mc, c) > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  			and aux.MustMaterialCheck(e:GetHandler(), tp, EFFECT_MUST_BE_XMATERIAL)
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g1 = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g1:GetCount() == 0 then
  		return
  	end
  	Duel.SendtoHand(g1, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, g1)
  	local c = e:GetHandler()
  	if aux.MustMaterialCheck(c, tp, EFFECT_MUST_BE_XMATERIAL) then
  		if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsControler(tp) and not c:IsImmuneToEffect(e) then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, c)
  			local sc = g:GetFirst()
  			if sc then
  				Duel.BreakEffect()
  				local mg = c:GetOverlayGroup()
  				if mg:GetCount() ~= 0 then
  					Duel.Overlay(sc, mg)
  				end
  				sc:SetMaterial(Group.FromCards(c))
  				Duel.Overlay(sc, Group.FromCards(c))
  				if Duel.SpecialSummonStep(sc, SUMMON_TYPE_XYZ, tp, tp, false, false, POS_FACEUP) then
  					local e1 = Effect.CreateEffect(c)
  					e1:SetType(EFFECT_TYPE_SINGLE)
  					e1:SetCode(EFFECT_SET_ATTACK)
  					e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  					e1:SetValue(sc:GetAttack() * 2)
  					sc:RegisterEffect(e1)
  					local e2 = Effect.CreateEffect(c)
  					e2:SetType(EFFECT_TYPE_SINGLE)
  					e2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  					e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  					sc:RegisterEffect(e2)
  				end
  				Duel.SpecialSummonComplete()
  				sc:CompleteProcedure()
  			end
  		end
  	end
  end
  
  
source_text: Number
  2 Level 4 monsters
  (Quick Effect): You can detach 1 material from this card; add 1 "Double or Nothing!" from your Deck to your hand, then Special Summon from your Extra Deck, 1 "Utopia" Xyz Monster, except "Number 39: Utopia Double", by using this face-up card you control as material, and if you do, its ATK becomes doubled, but it cannot attack directly. (This is treated as an Xyz Summon. Transfer its materials to the Summoned monster.) You can only use this effect of "Number 39: Utopia Double" once per turn.
target_text: -- Number
  local CARD_ID_0 = 94770493 --Double or Nothing!
  local SETCARD_ID_0 = 0x107f --Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.spcost)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	c:RegisterEffect(e1)
  end
  aux.xyz_number[id] = 39
  function s.spcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	c:RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.thfilter(c)
  	return c:IsCode(CARD_ID_0) and c:IsAbleToHand()
  end
  function s.spfilter(c, e, tp, mc)
  	return not c:IsCode(id)
  		and c:IsType(TYPE_XYZ)
  		and c:IsSetCard(SETCARD_ID_0)
  		and mc:IsCanBeXyzMaterial(c)
  		and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_XYZ, tp, false, false)
  		and Duel.GetLocationCountFromEx(tp, tp, mc, c) > 0
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  			and aux.MustMaterialCheck(e:GetHandler(), tp, EFFECT_MUST_BE_XMATERIAL)
  			and Duel.IsExistingMatchingCard(s.spfilter, tp, LOCATION_EXTRA, 0, 1, nil, e, tp, e:GetHandler())
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_EXTRA)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g1 = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g1:GetCount() == 0 then
  		return
  	end
  	Duel.SendtoHand(g1, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, g1)
  	local c = e:GetHandler()
  	if aux.MustMaterialCheck(c, tp, EFFECT_MUST_BE_XMATERIAL) then
  		if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsControler(tp) and not c:IsImmuneToEffect(e) then
  			Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  			local g = Duel.SelectMatchingCard(tp, s.spfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, e, tp, c)
  			local sc = g:GetFirst()
  			if sc then
  				Duel.BreakEffect()
  				local mg = c:GetOverlayGroup()
  				if mg:GetCount() ~= 0 then
  					Duel.Overlay(sc, mg)
  				end
  				sc:SetMaterial(Group.FromCards(c))
  				Duel.Overlay(sc, Group.FromCards(c))
  				if Duel.SpecialSummonStep(sc, SUMMON_TYPE_XYZ, tp, tp, false, false, POS_FACEUP) then
  					local e1 = Effect.CreateEffect(c)
  					e1:SetType(EFFECT_TYPE_SINGLE)
  					e1:SetCode(EFFECT_SET_ATTACK)
  					e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  					e1:SetValue(sc:GetAttack() * 2)
  					sc:RegisterEffect(e1)
  					local e2 = Effect.CreateEffect(c)
  					e2:SetType(EFFECT_TYPE_SINGLE)
  					e2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
  					e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  					sc:RegisterEffect(e2)
  				end
  				Duel.SpecialSummonComplete()
  				sc:CompleteProcedure()
  			end
  		end
  	end
  end
  
  