--Magium Abyss-sword local m=888820 local cm=_G["c"..m] function cm.initial_effect(c) aux.AddLinkProcedure(c,cm.mfilter,1,1) c:EnableReviveLimit() c:SetSPSummonOnce(m) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,m) e1:SetCost(cm.tgcost) e1:SetTarget(cm.settg) e1:SetOperation(cm.setop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,m) e2:SetCost(aux.bfgcost) e2:SetTarget(cm.target) e2:SetOperation(cm.operation) c:RegisterEffect(e2) end function cm.mfilter(c) return c:IsLevelBelow(4) and c:IsSetCard(0xffc) end function cm.setfilter(c) return c:IsSetCard(0xffc) and c:IsType(TYPE_SPELL) and c:IsSSetable() end function cm.thfilter(c) return c:IsCode(88810101) and c:IsAbleToDeckAsCost() end function cm.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SendtoDeck(g,nil,1,REASON_COST) end function cm.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_DECK,0,1,nil) end end function cm.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,cm.setfilter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if g:GetCount()>0 then Duel.SSet(tp,g:GetFirst()) if tc:IsType(TYPE_QUICKPLAY) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) end Duel.ConfirmCards(1-tp,g) end end function cm.filter(c) return c:IsSetCard(0xffc) and not c:IsCode(m) and c:IsAbleToGrave() and c:IsType(TYPE_MONSTER) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cm.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end