name: Number
card_text: 3 Level 5 LIGHT monsters
  You can also Xyz Summon this card by using a Rank 4 "Utopia" monster you control as material. (Transfer its materials to this card.) Cannot be used as material for an Xyz Summon. If this card battles, your opponent cannot activate cards or effects until the end of the Damage Step. Once per Chain, during damage calculation, if this card battles an opponent's monster while this card has a "Utopia" Xyz Monster as material (Quick Effect): You can detach 2 materials from this card; this card's ATK becomes 5000 during that damage calculation only.
external_ids: local SETCARD_ID_0 = 0x107f --Utopia
  
lua: local SETCARD_ID_0 = 0x107f --Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), 5, 3, s.ovfilter, aux.Stringid(id, 0))
  	c:EnableReviveLimit()
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--actlimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetValue(1)
  	e2:SetCondition(s.actcon)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e3:SetCondition(s.atkcon)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  aux.xyz_number[id] = 39
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ) and c:IsRank(4)
  end
  function s.actcon(e)
  	return Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler()
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetBattleTarget() ~= nil and e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard, 1, nil, 0x107f)
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 2, REASON_COST) and c:GetFlagEffect(id) == 0
  	end
  	c:RemoveOverlayCard(tp, 2, 2, REASON_COST)
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL, 0, 1)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_PHASE + PHASE_DAMAGE_CAL)
  		e1:SetValue(5000)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Number
  3 Level 5 LIGHT monsters
  You can also Xyz Summon this card by using a Rank 4 "Utopia" monster you control as material. (Transfer its materials to this card.) Cannot be used as material for an Xyz Summon. If this card battles, your opponent cannot activate cards or effects until the end of the Damage Step. Once per Chain, during damage calculation, if this card battles an opponent's monster while this card has a "Utopia" Xyz Monster as material (Quick Effect): You can detach 2 materials from this card; this card's ATK becomes 5000 during that damage calculation only.
target_text: -- Number
  local SETCARD_ID_0 = 0x107f --Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), 5, 3, s.ovfilter, aux.Stringid(id, 0))
  	c:EnableReviveLimit()
  	--
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
  	e1:SetValue(1)
  	c:RegisterEffect(e1)
  	--actlimit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e2:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTargetRange(0, 1)
  	e2:SetValue(1)
  	e2:SetCondition(s.actcon)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_ATKCHANGE)
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e3:SetCondition(s.atkcon)
  	e3:SetCost(s.atkcost)
  	e3:SetOperation(s.atkop)
  	c:RegisterEffect(e3)
  end
  aux.xyz_number[id] = 39
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_XYZ) and c:IsRank(4)
  end
  function s.actcon(e)
  	return Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler()
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetBattleTarget() ~= nil and e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard, 1, nil, 0x107f)
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:CheckRemoveOverlayCard(tp, 2, REASON_COST) and c:GetFlagEffect(id) == 0
  	end
  	c:RemoveOverlayCard(tp, 2, 2, REASON_COST)
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL, 0, 1)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetReset(RESET_PHASE + PHASE_DAMAGE_CAL)
  		e1:SetValue(5000)
  		c:RegisterEffect(e1)
  	end
  end
  
  