name: Number
card_text: 2 Level 4 monsters
  You can detach 2 materials from this card, then target 1 Special Summoned monster your opponent controls in face-up Attack Position; attach it to this card as material. You can only use this effect of "Number 101: Silent Honor ARK" once per turn. If this face-up card on the field would be destroyed by battle or card effect, you can detach 1 material from this card instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTarget(s.reptg)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 101
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 2, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 2, 2, REASON_COST)
  end
  function s.filter(c)
  	return c:IsPosition(POS_FACEUP_ATTACK) and c:IsSummonType(SUMMON_TYPE_SPECIAL) and c:IsCanOverlay()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  end
  function s.operation(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 not tc:IsImmuneToEffect(e) and tc:IsType(TYPE_MONSTER) and tc:IsCanOverlay() then
  		local og = tc:GetOverlayGroup()
  		if og:GetCount() > 0 then
  			Duel.SendtoGrave(og, REASON_RULE)
  		end
  		Duel.Overlay(c, Group.FromCards(tc))
  	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_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		c:RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  
  
source_text: Number
  2 Level 4 monsters
  You can detach 2 materials from this card, then target 1 Special Summoned monster your opponent controls in face-up Attack Position; attach it to this card as material. You can only use this effect of "Number 101: Silent Honor ARK" once per turn. If this face-up card on the field would be destroyed by battle or card effect, you can detach 1 material from this card instead.
target_text: -- Number
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 4, 2)
  	c:EnableReviveLimit()
  	--material
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetTarget(s.reptg)
  	c:RegisterEffect(e2)
  end
  aux.xyz_number[id] = 101
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 2, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 2, 2, REASON_COST)
  end
  function s.filter(c)
  	return c:IsPosition(POS_FACEUP_ATTACK) and c:IsSummonType(SUMMON_TYPE_SPECIAL) and c:IsCanOverlay()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
  	Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  end
  function s.operation(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 not tc:IsImmuneToEffect(e) and tc:IsType(TYPE_MONSTER) and tc:IsCanOverlay() then
  		local og = tc:GetOverlayGroup()
  		if og:GetCount() > 0 then
  			Duel.SendtoGrave(og, REASON_RULE)
  		end
  		Duel.Overlay(c, Group.FromCards(tc))
  	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_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
  	end
  	if Duel.SelectEffectYesNo(tp, e:GetHandler(), 96) then
  		c:RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
  		return true
  	else
  		return false
  	end
  end
  
  