name: Numeron
card_text: During your Main Phase, send 1 "Numeron" Normal Spell Card that meets its activation conditions from your Deck to the GY; this effect becomes that Spell's effect when that card is activated. You can only use this effect of "Numeron Network" once per turn. "Numeron" Xyz Monsters you control can activate effects without detaching material(s).
external_ids: local SETCARD_ID_0 = 0x14a --Numeron
  
lua: local SETCARD_ID_0 = 0x14a --Numeron
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_ACTIVATE)
  	e0:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e0)
  	--copy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_FZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cpcost)
  	e1:SetTarget(s.cptg)
  	e1:SetOperation(s.cpop)
  	c:RegisterEffect(e1)
  	--remove overlay replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.rcon)
  	e2:SetOperation(s.rop)
  	c:RegisterEffect(e2)
  end
  function s.cpfilter(c)
  	return c:GetType() == TYPE_SPELL and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(false, true, false) ~= nil
  end
  function s.cpcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return true
  	end
  end
  function s.cptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() == 0 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.IsExistingMatchingCard(s.cpfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cpfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local te, ceg, cep, cev, cre, cr, crp = g:GetFirst():CheckActivateEffect(false, true, true)
  	Duel.SendtoGrave(g, REASON_COST)
  	e:SetProperty(te:GetProperty())
  	local tg = te:GetTarget()
  	if tg then
  		tg(e, tp, ceg, cep, cev, cre, cr, crp, 1)
  	end
  	te:SetLabelObject(e:GetLabelObject())
  	e:SetLabelObject(te)
  	Duel.ClearOperationInfo(0)
  end
  function s.cpop(e, tp, eg, ep, ev, re, r, rp)
  	local te = e:GetLabelObject()
  	if te then
  		e:SetLabelObject(te:GetLabelObject())
  		local op = te:GetOperation()
  		if op then
  			op(e, tp, eg, ep, ev, re, r, rp)
  		end
  	end
  end
  function s.rcon(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, REASON_COST) ~= 0
  		and re:IsActivated()
  		and re:IsActiveType(TYPE_XYZ)
  		and re:GetHandler():IsSetCard(SETCARD_ID_0)
  		and ep == e:GetOwnerPlayer()
  		and re:GetActivateLocation() & LOCATION_MZONE ~= 0
  end
  function s.rop(e, tp, eg, ep, ev, re, r, rp)
  	return ev
  end
  
  
source_text: Numeron
  During your Main Phase, send 1 "Numeron" Normal Spell Card that meets its activation conditions from your Deck to the GY; this effect becomes that Spell's effect when that card is activated. You can only use this effect of "Numeron Network" once per turn. "Numeron" Xyz Monsters you control can activate effects without detaching material(s).
target_text: -- Numeron
  local SETCARD_ID_0 = 0x14a --Numeron
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--activate
  	local e0 = Effect.CreateEffect(c)
  	e0:SetType(EFFECT_TYPE_ACTIVATE)
  	e0:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e0)
  	--copy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_FZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.cpcost)
  	e1:SetTarget(s.cptg)
  	e1:SetOperation(s.cpop)
  	c:RegisterEffect(e1)
  	--remove overlay replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetCondition(s.rcon)
  	e2:SetOperation(s.rop)
  	c:RegisterEffect(e2)
  end
  function s.cpfilter(c)
  	return c:GetType() == TYPE_SPELL and c:IsSetCard(SETCARD_ID_0) and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(false, true, false) ~= nil
  end
  function s.cpcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	e:SetLabel(1)
  	if chk == 0 then
  		return true
  	end
  end
  function s.cptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		if e:GetLabel() == 0 then
  			return false
  		end
  		e:SetLabel(0)
  		return Duel.IsExistingMatchingCard(s.cpfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	e:SetLabel(0)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cpfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	local te, ceg, cep, cev, cre, cr, crp = g:GetFirst():CheckActivateEffect(false, true, true)
  	Duel.SendtoGrave(g, REASON_COST)
  	e:SetProperty(te:GetProperty())
  	local tg = te:GetTarget()
  	if tg then
  		tg(e, tp, ceg, cep, cev, cre, cr, crp, 1)
  	end
  	te:SetLabelObject(e:GetLabelObject())
  	e:SetLabelObject(te)
  	Duel.ClearOperationInfo(0)
  end
  function s.cpop(e, tp, eg, ep, ev, re, r, rp)
  	local te = e:GetLabelObject()
  	if te then
  		e:SetLabelObject(te:GetLabelObject())
  		local op = te:GetOperation()
  		if op then
  			op(e, tp, eg, ep, ev, re, r, rp)
  		end
  	end
  end
  function s.rcon(e, tp, eg, ep, ev, re, r, rp)
  	return bit.band(r, REASON_COST) ~= 0
  		and re:IsActivated()
  		and re:IsActiveType(TYPE_XYZ)
  		and re:GetHandler():IsSetCard(SETCARD_ID_0)
  		and ep == e:GetOwnerPlayer()
  		and re:GetActivateLocation() & LOCATION_MZONE ~= 0
  end
  function s.rop(e, tp, eg, ep, ev, re, r, rp)
  	return ev
  end
  
  