name: Relinquished
card_text: Fusion Summon 1 "Eyes Restrict" Fusion Monster from your Extra Deck, by banishing materials from your hand, field, and/or GY. During your Main Phase: You can banish this card from your GY, then target 1 Effect Monster your opponent controls; equip that target to an "Eyes Restrict" Fusion Monster or "Relinquished" you control, as if it were equipped by that monster's effect. You can only use each effect of "Relinquished Fusion" once per turn.
external_ids: local CARD_ID_0 = 64631466 --Relinquished
  local SETCARD_ID_0 = 0x1110 --Eyes
  
lua: local CARD_ID_0 = 64631466 --Relinquished
  local SETCARD_ID_0 = 0x1110 --Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = LOCATION_HAND | LOCATION_MZONE | LOCATION_GRAVE,
  		mat_operation_code_map = {
  			{ [LOCATION_REMOVED] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_BANISH },
  		},
  		extra_target = s.extra_target,
  	})
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.extra_target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE)
  end
  
  function s.filter(c)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToChangeControler()
  end
  
  function s.eqfilter(c)
  	local m = _G["c" .. c:GetCode()]
  	return m and c:IsFaceup() and ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FUSION)) or c:IsCode(CARD_ID_0)) and not c:IsDisabled() and m.can_equip_monster and m.can_equip_monster(c)
  end
  
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil) and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc1 = Duel.GetFirstTarget()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		local tc2 = g:GetFirst()
  		local m = _G["c" .. tc2:GetCode()]
  		if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc1:IsControler(1 - tp) and tc2 then
  			m.equip_monster(tc2, tp, tc1)
  		end
  	end
  end
  
  
source_text: Relinquished
  Fusion Summon 1 "Eyes Restrict" Fusion Monster from your Extra Deck, by banishing materials from your hand, field, and/or GY. During your Main Phase: You can banish this card from your GY, then target 1 Effect Monster your opponent controls; equip that target to an "Eyes Restrict" Fusion Monster or "Relinquished" you control, as if it were equipped by that monster's effect. You can only use each effect of "Relinquished Fusion" once per turn.
target_text: -- Relinquished
  local CARD_ID_0 = 64631466 --Relinquished
  local SETCARD_ID_0 = 0x1110 --Eyes
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = LOCATION_HAND | LOCATION_MZONE | LOCATION_GRAVE,
  		mat_operation_code_map = {
  			{ [LOCATION_REMOVED] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_BANISH },
  		},
  		extra_target = s.extra_target,
  	})
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetCountLimit(1, id)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetCountLimit(1, id + o)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.extra_target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, nil, 1, tp, LOCATION_HAND + LOCATION_ONFIELD + LOCATION_GRAVE)
  end
  
  function s.filter(c)
  	return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToChangeControler()
  end
  
  function s.eqfilter(c)
  	local m = _G["c" .. c:GetCode()]
  	return m and c:IsFaceup() and ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_FUSION)) or c:IsCode(CARD_ID_0)) and not c:IsDisabled() and m.can_equip_monster and m.can_equip_monster(c)
  end
  
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil) and Duel.IsExistingMatchingCard(s.eqfilter, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc1 = Duel.GetFirstTarget()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
  	local g = Duel.SelectMatchingCard(tp, s.eqfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		local tc2 = g:GetFirst()
  		local m = _G["c" .. tc2:GetCode()]
  		if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc1:IsControler(1 - tp) and tc2 then
  			m.equip_monster(tc2, tp, tc1)
  		end
  	end
  end
  
  