name: Formud
card_text: During your Main Phase: You can reveal 1 Link Monster in your Extra Deck, and if you do, when you Link Summon this turn, you can treat this card as Link Material with the same name, Type, and Attribute as the revealed monster. If this card is sent to the GY as Link Material: You can add 1 Level 5 or higher Cyberse monster from your Deck to your hand. You can only use each effect of "Formud Skipper" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c, tc)
  	return c:IsType(TYPE_LINK) and not c:IsCode(tc:GetLinkCode())
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, c)
  	if cg:GetCount() == 0 then
  		return
  	end
  	Duel.ConfirmCards(1 - tp, cg)
  	local code1, code2 = cg:GetFirst():GetOriginalCodeRule()
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_ADD_LINK_CODE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e1:SetValue(code1)
  	c:RegisterEffect(e1)
  	if code2 then
  		local e2 = e1:Clone()
  		e2:SetValue(code2)
  		c:RegisterEffect(e2)
  	end
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_ADD_LINK_ATTRIBUTE)
  	e3:SetValue(cg:GetFirst():GetOriginalAttribute())
  	c:RegisterEffect(e3)
  	local e4 = e1:Clone()
  	e4:SetCode(EFFECT_ADD_LINK_RACE)
  	e4:SetValue(cg:GetFirst():GetOriginalRace())
  	c:RegisterEffect(e4)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_LINK
  end
  function s.thfilter(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsLevelAbove(5) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Formud
  During your Main Phase: You can reveal 1 Link Monster in your Extra Deck, and if you do, when you Link Summon this turn, you can treat this card as Link Material with the same name, Type, and Attribute as the revealed monster. If this card is sent to the GY as Link Material: You can add 1 Level 5 or higher Cyberse monster from your Deck to your hand. You can only use each effect of "Formud Skipper" once per turn.
target_text: -- Formud
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--search
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.thcon)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.cfilter(c, tc)
  	return c:IsType(TYPE_LINK) and not c:IsCode(tc:GetLinkCode())
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_EXTRA, 0, 1, nil, e:GetHandler())
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local cg = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_EXTRA, 0, 1, 1, nil, c)
  	if cg:GetCount() == 0 then
  		return
  	end
  	Duel.ConfirmCards(1 - tp, cg)
  	local code1, code2 = cg:GetFirst():GetOriginalCodeRule()
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_ADD_LINK_CODE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	e1:SetValue(code1)
  	c:RegisterEffect(e1)
  	if code2 then
  		local e2 = e1:Clone()
  		e2:SetValue(code2)
  		c:RegisterEffect(e2)
  	end
  	local e3 = e1:Clone()
  	e3:SetCode(EFFECT_ADD_LINK_ATTRIBUTE)
  	e3:SetValue(cg:GetFirst():GetOriginalAttribute())
  	c:RegisterEffect(e3)
  	local e4 = e1:Clone()
  	e4:SetCode(EFFECT_ADD_LINK_RACE)
  	e4:SetValue(cg:GetFirst():GetOriginalRace())
  	c:RegisterEffect(e4)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_LINK
  end
  function s.thfilter(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsLevelAbove(5) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  