name: Number
card_text: 3 Level 4 LIGHT monsters
  You can also Xyz Summon this card by using a "Number 39: Utopia" you control as material. (Transfer its materials to this card.) You can detach 1 material from this card; it gains 500 ATK until the end of this turn, and if it does, 1 monster your opponent controls loses 1000 ATK until the end of this turn. You must have 1000 LP or less to activate and to resolve this effect.
external_ids: local CARD_ID_0 = 84013237 --Number 39: Utopia
  
lua: local CARD_ID_0 = 84013237 --Number 39: Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), 4, 3, s.ovfilter, aux.Stringid(id, 1))
  	--attack up
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  aux.xyz_number[id] = 39
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetLP(tp) <= 1000
  end
  function s.cost(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.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLP(tp) > 1000 then
  		return
  	end
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  		local g = Duel.SelectMatchingCard(tp, Card.IsFaceup, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		if g:GetCount() > 0 then
  			Duel.HintSelection(g)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetValue(-1000)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			g:GetFirst():RegisterEffect(e2)
  		end
  	end
  end
  
  
source_text: Number
  3 Level 4 LIGHT monsters
  You can also Xyz Summon this card by using a "Number 39: Utopia" you control as material. (Transfer its materials to this card.) You can detach 1 material from this card; it gains 500 ATK until the end of this turn, and if it does, 1 monster your opponent controls loses 1000 ATK until the end of this turn. You must have 1000 LP or less to activate and to resolve this effect.
target_text: -- Number
  local CARD_ID_0 = 84013237 --Number 39: Utopia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedure(c, aux.FilterBoolFunction(Card.IsAttribute, ATTRIBUTE_LIGHT), 4, 3, s.ovfilter, aux.Stringid(id, 1))
  	--attack up
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  aux.xyz_number[id] = 39
  function s.ovfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetLP(tp) <= 1000
  end
  function s.cost(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.operation(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLP(tp) > 1000 then
  		return
  	end
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(500)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  		local g = Duel.SelectMatchingCard(tp, Card.IsFaceup, tp, 0, LOCATION_MZONE, 1, 1, nil)
  		if g:GetCount() > 0 then
  			Duel.HintSelection(g)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_SINGLE)
  			e2:SetCode(EFFECT_UPDATE_ATTACK)
  			e2:SetValue(-1000)
  			e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  			g:GetFirst():RegisterEffect(e2)
  		end
  	end
  end
  
  