name: Number
card_text: 2+ Level 5 monsters
  Gains 1000 ATK for each material attached to it. This card with material can attack all monsters your opponent controls once each. At the end of the Battle Phase, if this card battled: You can activate one of the following effects.
  ● Target 1 monster in your GY; attach it to this card as material.
  ● Target 1 card in your opponent's GY; place it on top of their Deck.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 5, 2, nil, nil, 99)
  	c:EnableReviveLimit()
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--attack all
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_ALL)
  	e2:SetCondition(s.allcon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--attach
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCode(EVENT_PHASE + PHASE_BATTLE)
  	e3:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.con)
  	e3:SetTarget(s.mttg)
  	e3:SetOperation(s.mtop)
  	c:RegisterEffect(e3)
  	--return
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_TODECK)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetCode(EVENT_PHASE + PHASE_BATTLE)
  	e4:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCondition(s.con)
  	e4:SetTarget(s.rettg)
  	e4:SetOperation(s.retop)
  	c:RegisterEffect(e4)
  end
  aux.xyz_number[id] = 5
  function s.atkval(e, c)
  	return c:GetOverlayCount() * 1000
  end
  function s.allcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsType(TYPE_XYZ) and e:GetHandler():GetOverlayCount() > 0
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetBattledGroupCount() > 0
  end
  function s.mtfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsCanOverlay()
  end
  function s.mttg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.mtfilter(chkc)
  	end
  	if chk == 0 then
  		return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(s.mtfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  	local sg = Duel.SelectTarget(tp, s.mtfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, sg, 1, 0, 0)
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsCanOverlay() then
  		Duel.Overlay(c, Group.FromCards(tc))
  	end
  end
  function s.rettg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1 - tp) and chkc:IsAbleToDeck()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAbleToDeck, 1 - tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local sg = Duel.SelectTarget(tp, Card.IsAbleToDeck, 1 - tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, sg, 1, 0, 0)
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		Duel.SendtoDeck(tc, nil, SEQ_DECKTOP, REASON_EFFECT)
  	end
  end
  
  
source_text: Number
  2+ Level 5 monsters
  Gains 1000 ATK for each material attached to it. This card with material can attack all monsters your opponent controls once each. At the end of the Battle Phase, if this card battled: You can activate one of the following effects.
  ● Target 1 monster in your GY; attach it to this card as material.
  ● Target 1 card in your opponent's GY; place it on top of their Deck.
target_text: -- Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 5, 2, nil, nil, 99)
  	c:EnableReviveLimit()
  	--atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(s.atkval)
  	c:RegisterEffect(e1)
  	--attack all
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_ATTACK_ALL)
  	e2:SetCondition(s.allcon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	--attach
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetCode(EVENT_PHASE + PHASE_BATTLE)
  	e3:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.con)
  	e3:SetTarget(s.mttg)
  	e3:SetOperation(s.mtop)
  	c:RegisterEffect(e3)
  	--return
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_TODECK)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e4:SetCode(EVENT_PHASE + PHASE_BATTLE)
  	e4:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCondition(s.con)
  	e4:SetTarget(s.rettg)
  	e4:SetOperation(s.retop)
  	c:RegisterEffect(e4)
  end
  aux.xyz_number[id] = 5
  function s.atkval(e, c)
  	return c:GetOverlayCount() * 1000
  end
  function s.allcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsType(TYPE_XYZ) and e:GetHandler():GetOverlayCount() > 0
  end
  function s.con(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetBattledGroupCount() > 0
  end
  function s.mtfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsCanOverlay()
  end
  function s.mttg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.mtfilter(chkc)
  	end
  	if chk == 0 then
  		return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(s.mtfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  	local sg = Duel.SelectTarget(tp, s.mtfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, sg, 1, 0, 0)
  end
  function s.mtop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsCanOverlay() then
  		Duel.Overlay(c, Group.FromCards(tc))
  	end
  end
  function s.rettg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1 - tp) and chkc:IsAbleToDeck()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsAbleToDeck, 1 - tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TODECK)
  	local sg = Duel.SelectTarget(tp, Card.IsAbleToDeck, 1 - tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_TODECK, sg, 1, 0, 0)
  end
  function s.retop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc and tc:IsRelateToEffect(e) then
  		Duel.SendtoDeck(tc, nil, SEQ_DECKTOP, REASON_EFFECT)
  	end
  end
  
  