--Runeforged Metalfoes local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcCodeFun(c,80000800,aux.FilterBoolFunction(Card.IsFusionSetCard,0xe1),1,true,true) Auxiliary.Add_Runeslots(c,1) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(cid.rettg) e1:SetOperation(cid.retop) e1:SetCondition(cid.drcon1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetTarget(cid.thtg) e2:SetOperation(cid.thop) c:RegisterEffect(e2) end function cid.drcon1(e,tp,eg,ep,ev,re,r,rp) local red = 0x1ff5 local blue = 0x2ff5 local purple = 0x3ff5 local yellow = 0x4ff5 local orange = 0x5ff5 local green = 0x6ff5 local prismatic = 0x7ff5 return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,yellow) end function cid.retfilter1(c) return c:IsAbleToDeck() end function cid.retfilter2(c) return c:IsAbleToHand() end function cid.rettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(cid.retfilter1,tp,LOCATION_GRAVE,0,2,nil) and Duel.IsExistingTarget(cid.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,cid.retfilter1,tp,LOCATION_GRAVE,0,2,2,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,cid.retfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,g1:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,1,0,0) end function cid.retop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) local g1=g:Filter(Card.IsLocation,nil,LOCATION_GRAVE) if Duel.SendtoDeck(g1,nil,0,REASON_EFFECT)~=0 then local og=Duel.GetOperatedGroup() if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local g2=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD) Duel.SendtoHand(g2,nil,REASON_EFFECT) end end function cid.thfilter(c) return c:IsSetCard(0xfe0) and c:IsAbleToHand() end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and cid.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectTarget(tp,cid.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,1,0,0) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end