name: Number
card_text: 3 "Number" Xyz Monsters with the same Rank
  (This card's original Rank is always treated as 1.) You can also Xyz Summon this card by discarding 1 "Rank-Up-Magic" Normal Spell Card, then using a "Utopia" monster you control as the Xyz Material. (Transfer its Xyz Materials to this card.) This card's Xyz Summon cannot be negated. When Xyz Summoned, your opponent's cards and effects cannot be activated. Gains 1000 ATK and DEF for each Xyz Material attached to it. Once per opponent's turn (Quick Effect): You can detach 1 Xyz Material from this card; your opponent's cards and effects cannot be activated this turn.
external_ids: local SETCARD_ID_0 = 0x107f --Utopia
  local SETCARD_ID_1 = 0x95 --Rank-Up-Magic
  local SETCARD_ID_2 = 0x48 --Number
  
lua: local SETCARD_ID_0 = 0x107f --Utopia
  local SETCARD_ID_1 = 0x95 --Rank-Up-Magic
  local SETCARD_ID_2 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedureLevelFree(c, s.mfilter, s.xyzcheck, 3, 3, s.ovfilter, aux.Stringid(id, 0), s.xyzop)
  	--cannot disable spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCondition(s.effcon)
  	c:RegisterEffect(e2)
  	--summon success
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetCondition(s.effcon2)
  	e3:SetOperation(s.spsumsuc)
  	c:RegisterEffect(e3)
  	--atk & def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	local e5 = e4:Clone()
  	e5:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e5)
  	--activate limit
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 1))
  	e6:SetType(EFFECT_TYPE_QUICK_O)
  	e6:SetCode(EVENT_FREE_CHAIN)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetHintTiming(0, TIMING_DRAW_PHASE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.actcon)
  	e6:SetCost(s.actcost)
  	e6:SetOperation(s.actop)
  	c:RegisterEffect(e6)
  end
  aux.xyz_number[id] = 0
  function s.mfilter(c, xyzc)
  	return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsSetCard(SETCARD_ID_2)
  end
  function s.xyzcheck(g)
  	return g:GetClassCount(Card.GetRank) == 1
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_2) and c:GetType() == TYPE_SPELL and c:IsDiscardable()
  end
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_2)
  end
  function s.xyzop(e, tp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.DiscardHand(tp, s.cfilter, 1, 1, REASON_COST + REASON_DISCARD, nil)
  end
  function s.effcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.effcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.spsumsuc(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SetChainLimitTillChainEnd(s.chlimit)
  end
  function s.chlimit(e, ep, tp)
  	return tp == ep
  end
  function s.atkval(e, c)
  	return c:GetOverlayCount() * 1000
  end
  function s.actcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.actcost(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.actop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetTargetRange(0, 1)
  	e1:SetValue(aux.TRUE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  
  
source_text: Number
  3 "Number" Xyz Monsters with the same Rank
  (This card's original Rank is always treated as 1.) You can also Xyz Summon this card by discarding 1 "Rank-Up-Magic" Normal Spell Card, then using a "Utopia" monster you control as the Xyz Material. (Transfer its Xyz Materials to this card.) This card's Xyz Summon cannot be negated. When Xyz Summoned, your opponent's cards and effects cannot be activated. Gains 1000 ATK and DEF for each Xyz Material attached to it. Once per opponent's turn (Quick Effect): You can detach 1 Xyz Material from this card; your opponent's cards and effects cannot be activated this turn.
target_text: -- Number
  local SETCARD_ID_0 = 0x107f --Utopia
  local SETCARD_ID_1 = 0x95 --Rank-Up-Magic
  local SETCARD_ID_2 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedureLevelFree(c, s.mfilter, s.xyzcheck, 3, 3, s.ovfilter, aux.Stringid(id, 0), s.xyzop)
  	--cannot disable spsummon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetCondition(s.effcon)
  	c:RegisterEffect(e2)
  	--summon success
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e3:SetCondition(s.effcon2)
  	e3:SetOperation(s.spsumsuc)
  	c:RegisterEffect(e3)
  	--atk & def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	local e5 = e4:Clone()
  	e5:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e5)
  	--activate limit
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 1))
  	e6:SetType(EFFECT_TYPE_QUICK_O)
  	e6:SetCode(EVENT_FREE_CHAIN)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetHintTiming(0, TIMING_DRAW_PHASE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.actcon)
  	e6:SetCost(s.actcost)
  	e6:SetOperation(s.actop)
  	c:RegisterEffect(e6)
  end
  aux.xyz_number[id] = 0
  function s.mfilter(c, xyzc)
  	return c:IsFaceup() and c:IsXyzType(TYPE_XYZ) and c:IsSetCard(SETCARD_ID_2)
  end
  function s.xyzcheck(g)
  	return g:GetClassCount(Card.GetRank) == 1
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_2) and c:GetType() == TYPE_SPELL and c:IsDiscardable()
  end
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_2)
  end
  function s.xyzop(e, tp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.DiscardHand(tp, s.cfilter, 1, 1, REASON_COST + REASON_DISCARD, nil)
  end
  function s.effcon(e)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.effcon2(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
  end
  function s.spsumsuc(e, tp, eg, ep, ev, re, r, rp)
  	Duel.SetChainLimitTillChainEnd(s.chlimit)
  end
  function s.chlimit(e, ep, tp)
  	return tp == ep
  end
  function s.atkval(e, c)
  	return c:GetOverlayCount() * 1000
  end
  function s.actcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.actcost(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.actop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetTargetRange(0, 1)
  	e1:SetValue(aux.TRUE)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  
  