--Runecrafter Malkir local cid,id=GetID() function cid.initial_effect(c) Auxiliary.Ability_Infused(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,80008001) e1:SetTarget(cid.target) e1:SetOperation(cid.operation) c:RegisterEffect(e1) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(26077387,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,80008002) e2:SetCondition(cid.spcon2) e2:SetCost(cid.thcost) e2:SetTarget(cid.sptg2) e2:SetOperation(cid.spop2) c:RegisterEffect(e2) end function cid.filter(c) return c:IsSetCard(0xfe0) and c:IsAbleToHand() and c:IsType(TYPE_SPELL+TYPE_TRAP) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(cid.filter,tp,LOCATION_DECK,0,nil) local tg=g:Select(tp,1,1,nil) if tg:GetCount() >= 0 then Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) end end function cid.cfilter(c,tp,rp) return c:IsPreviousSetCard(0xfe9) and c:IsType(TYPE_MONSTER) end function cid.spcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(cid.cfilter,1,nil,tp,rp) and not eg:IsContains(e:GetHandler()) end function cid.thfilter(c) return c:IsSetCard(0xfe0) and not c:IsCode(id) end function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function cid.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function cid.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end