name: Cyber
card_text: Target 1 Machine "Cyber" Fusion Monster in your GY; return it to the Extra Deck or Special Summon it, ignoring its Summoning conditions. If a Machine "Cyber" Fusion Monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only use each effect of "Cyber Eternal" once per turn.
external_ids: local SETCARD_ID_0 = 0x93 --Cyber
  
lua: local SETCARD_ID_0 = 0x93 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOEXTRA + CATEGORY_GRAVE_ACTION + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION) and (c:IsAbleToExtra() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if tc:IsRelateToEffect(e) then
  		if aux.NecroValleyNegateCheck(tc) then
  			return
  		end
  		if ft > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, true, false) and (not tc:IsAbleToExtra() or Duel.SelectOption(tp, aux.Stringid(id, 0), 1152) == 1) then
  			Duel.SpecialSummon(tc, 0, tp, tp, true, false, POS_FACEUP)
  		else
  			Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  		end
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsRace(RACE_MACHINE)
  		and c:IsType(TYPE_FUSION)
  		and c:IsLocation(LOCATION_MZONE)
  		and c:IsControler(tp)
  		and c:IsReason(REASON_EFFECT + REASON_BATTLE)
  		and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  
source_text: Cyber
  Target 1 Machine "Cyber" Fusion Monster in your GY; return it to the Extra Deck or Special Summon it, ignoring its Summoning conditions. If a Machine "Cyber" Fusion Monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only use each effect of "Cyber Eternal" once per turn.
target_text: -- Cyber
  local SETCARD_ID_0 = 0x93 --Cyber
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOEXTRA + CATEGORY_GRAVE_ACTION + CATEGORY_GRAVE_SPSUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--destroy replace
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EFFECT_DESTROY_REPLACE)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.reptg)
  	e2:SetValue(s.repval)
  	e2:SetOperation(s.repop)
  	c:RegisterEffect(e2)
  end
  function s.spfilter(c, e, tp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION) and (c:IsAbleToExtra() or (ft > 0 and c:IsCanBeSpecialSummoned(e, 0, tp, true, false)))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TARGET)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if tc:IsRelateToEffect(e) then
  		if aux.NecroValleyNegateCheck(tc) then
  			return
  		end
  		if ft > 0 and tc:IsCanBeSpecialSummoned(e, 0, tp, true, false) and (not tc:IsAbleToExtra() or Duel.SelectOption(tp, aux.Stringid(id, 0), 1152) == 1) then
  			Duel.SpecialSummon(tc, 0, tp, tp, true, false, POS_FACEUP)
  		else
  			Duel.SendtoDeck(tc, nil, SEQ_DECKSHUFFLE, REASON_EFFECT)
  		end
  	end
  end
  function s.repfilter(c, tp)
  	return c:IsFaceup()
  		and c:IsSetCard(SETCARD_ID_0)
  		and c:IsRace(RACE_MACHINE)
  		and c:IsType(TYPE_FUSION)
  		and c:IsLocation(LOCATION_MZONE)
  		and c:IsControler(tp)
  		and c:IsReason(REASON_EFFECT + REASON_BATTLE)
  		and not c:IsReason(REASON_REPLACE)
  end
  function s.reptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter, 1, nil, tp)
  	end
  	return Duel.SelectEffectYesNo(tp, e:GetHandler(), 96)
  end
  function s.repval(e, c)
  	return s.repfilter(c, e:GetHandlerPlayer())
  end
  function s.repop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_EFFECT)
  end
  
  