name: Fusion
card_text: Reveal 1 Fusion Monster in your Extra Deck and add 1 of the Fusion Materials whose name is specifically listed on that card from your Deck or Graveyard to your hand, and if you do, for the rest of this turn after this card resolves, you cannot Normal Summon/Set or Special Summon monsters with the added monster's name, also your monsters with that name cannot activate their effects. You can only activate 1 "Fusion Conscription" per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, tp)
  	return c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil, c)
  end
  function s.filter2(c, fc)
  	return aux.IsMaterialListCode(fc, c:GetCode()) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_EXTRA, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_EXTRA, 0, 1, 1, nil, tp)
  	if cg:GetCount() == 0 then
  		return
  	end
  	Duel.ConfirmCards(1 - tp, cg)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil, cg:GetFirst())
  	local tc = g:GetFirst()
  	if not tc then
  		return
  	end
  	if Duel.SendtoHand(tc, nil, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_HAND) then
  		Duel.ConfirmCards(1 - tp, tc)
  		if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  			return
  		end
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_SUMMON)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(1, 0)
  		e1:SetTarget(s.sumlimit)
  		e1:SetLabel(tc:GetCode())
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		Duel.RegisterEffect(e2, tp)
  		local e3 = e1:Clone()
  		e3:SetCode(EFFECT_CANNOT_MSET)
  		Duel.RegisterEffect(e3, tp)
  		local e4 = e1:Clone()
  		e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  		e4:SetValue(s.aclimit)
  		Duel.RegisterEffect(e4, tp)
  	end
  end
  function s.sumlimit(e, c)
  	return c:IsCode(e:GetLabel())
  end
  function s.aclimit(e, re, tp)
  	return re:GetHandler():IsCode(e:GetLabel()) and re:IsActiveType(TYPE_MONSTER)
  end
  
  
source_text: Fusion
  Reveal 1 Fusion Monster in your Extra Deck and add 1 of the Fusion Materials whose name is specifically listed on that card from your Deck or Graveyard to your hand, and if you do, for the rest of this turn after this card resolves, you cannot Normal Summon/Set or Special Summon monsters with the added monster's name, also your monsters with that name cannot activate their effects. You can only activate 1 "Fusion Conscription" per turn.
target_text: -- Fusion
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.filter1(c, tp)
  	return c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, nil, c)
  end
  function s.filter2(c, fc)
  	return aux.IsMaterialListCode(fc, c:GetCode()) and c:IsAbleToHand()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter1, tp, LOCATION_EXTRA, 0, 1, nil, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_GRAVE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.filter1, tp, LOCATION_EXTRA, 0, 1, 1, nil, tp)
  	if cg:GetCount() == 0 then
  		return
  	end
  	Duel.ConfirmCards(1 - tp, cg)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, aux.NecroValleyFilter(s.filter2), tp, LOCATION_DECK + LOCATION_GRAVE, 0, 1, 1, nil, cg:GetFirst())
  	local tc = g:GetFirst()
  	if not tc then
  		return
  	end
  	if Duel.SendtoHand(tc, nil, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_HAND) then
  		Duel.ConfirmCards(1 - tp, tc)
  		if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then
  			return
  		end
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_FIELD)
  		e1:SetCode(EFFECT_CANNOT_SUMMON)
  		e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  		e1:SetTargetRange(1, 0)
  		e1:SetTarget(s.sumlimit)
  		e1:SetLabel(tc:GetCode())
  		e1:SetReset(RESET_PHASE + PHASE_END)
  		Duel.RegisterEffect(e1, tp)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  		Duel.RegisterEffect(e2, tp)
  		local e3 = e1:Clone()
  		e3:SetCode(EFFECT_CANNOT_MSET)
  		Duel.RegisterEffect(e3, tp)
  		local e4 = e1:Clone()
  		e4:SetCode(EFFECT_CANNOT_ACTIVATE)
  		e4:SetValue(s.aclimit)
  		Duel.RegisterEffect(e4, tp)
  	end
  end
  function s.sumlimit(e, c)
  	return c:IsCode(e:GetLabel())
  end
  function s.aclimit(e, re, tp)
  	return re:GetHandler():IsCode(e:GetLabel()) and re:IsActiveType(TYPE_MONSTER)
  end
  
  