name: Number
card_text: 2 Xyz Monsters with the same Rank, except "Number" monsters
  (This card's original Rank is always treated as 1.)
  Cannot be destroyed by battle, and neither player takes any battle damage from attacks involving this card. At the end of the Damage Step, if this card battled an opponent's monster: You can take control of that opponent's monster until the end of the Battle Phase. If this face-up card on the field would be destroyed by a card effect, you can detach 1 material from this card instead.
external_ids: local SETCARD_ID_0 = 0x48 --Number
  
lua: local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedureLevelFree(c, s.mfilter, s.xyzcheck, 2, 2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--avoid damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_NO_BATTLE_DAMAGE)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  	--control
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetCategory(CATEGORY_CONTROL)
  	e6:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e6:SetCode(EVENT_DAMAGE_STEP_END)
  	e6:SetCondition(aux.dsercon)
  	e6:SetTarget(s.cttg)
  	e6:SetOperation(s.ctop)
  	c:RegisterEffect(e6)
  	--destroy replace
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e7:SetCode(EFFECT_DESTROY_REPLACE)
  	e7:SetRange(LOCATION_MZONE)
  	e7:SetTarget(s.reptg)
  	c:RegisterEffect(e7)
  end
  aux.xyz_number[id] = 0
  function s.mfilter(c, xyzc)
  	return c:IsXyzType(TYPE_XYZ) and not c:IsSetCard(SETCARD_ID_0)
  end
  function s.xyzcheck(g)
  	return g:GetClassCount(Card.GetRank) == 1
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local tc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return tc and tc:IsRelateToBattle() and tc:IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, tc, 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetBattleTarget()
  	if tc:IsRelateToBattle() then
  		Duel.GetControl(tc, tp, PHASE_BATTLE, 1)
  	end
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
  	end
  	if Duel.SelectEffectYesNo(tp, c, 96) then
  		c:RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  
  
source_text: Number
  2 Xyz Monsters with the same Rank, except "Number" monsters
  (This card's original Rank is always treated as 1.)
  Cannot be destroyed by battle, and neither player takes any battle damage from attacks involving this card. At the end of the Damage Step, if this card battled an opponent's monster: You can take control of that opponent's monster until the end of the Battle Phase. If this face-up card on the field would be destroyed by a card effect, you can detach 1 material from this card instead.
target_text: -- Number
  local SETCARD_ID_0 = 0x48 --Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	c:EnableReviveLimit()
  	aux.AddXyzProcedureLevelFree(c, s.mfilter, s.xyzcheck, 2, 2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--avoid damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_NO_BATTLE_DAMAGE)
  	c:RegisterEffect(e4)
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_SINGLE)
  	e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
  	e5:SetValue(1)
  	c:RegisterEffect(e5)
  	--control
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetCategory(CATEGORY_CONTROL)
  	e6:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e6:SetCode(EVENT_DAMAGE_STEP_END)
  	e6:SetCondition(aux.dsercon)
  	e6:SetTarget(s.cttg)
  	e6:SetOperation(s.ctop)
  	c:RegisterEffect(e6)
  	--destroy replace
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e7:SetCode(EFFECT_DESTROY_REPLACE)
  	e7:SetRange(LOCATION_MZONE)
  	e7:SetTarget(s.reptg)
  	c:RegisterEffect(e7)
  end
  aux.xyz_number[id] = 0
  function s.mfilter(c, xyzc)
  	return c:IsXyzType(TYPE_XYZ) and not c:IsSetCard(SETCARD_ID_0)
  end
  function s.xyzcheck(g)
  	return g:GetClassCount(Card.GetRank) == 1
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local tc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return tc and tc:IsRelateToBattle() and tc:IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, tc, 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetBattleTarget()
  	if tc:IsRelateToBattle() then
  		Duel.GetControl(tc, tp, PHASE_BATTLE, 1)
  	end
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
  	end
  	if Duel.SelectEffectYesNo(tp, c, 96) then
  		c:RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  
  