--Abysslym Ragnaserk local s,id=GetID() function s.initial_effect(c) --self special summon local e1=Effect.CreateEffect(c) e1:Desc(4) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --send to grave local e2=Effect.CreateEffect(c) e2:Desc(0) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:HOPT() e2:SetCost(s.tgcost) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:Desc(1) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:HOPT() e3:SetCost(s.sscost) e3:SetTarget(s.sstg) e3:SetOperation(s.ssop) c:RegisterEffect(e3) --Return to Grave and Deck local e4=Effect.CreateEffect(c) e4:Desc(2) e4:SetCategory(CATEGORY_TODECK|CATEGORY_TOGRAVE|CATEGORY_GRAVE_ACTION) e4:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY|EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_REMOVE) e4:HOPT() e4:SetTarget(s.rettg) e4:SetOperation(s.retop) c:RegisterEffect(e4) end function s.spfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(ARCHE_ABYSSLYM) and c:IsDiscardable() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,c) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #rg>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=Duel.Select(HINTMSG_DISCARD,false,tp,s.spfilter,tp,LOCATION_HAND,0,1,1,c) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_COST|REASON_DISCARD) g:DeleteGroup() end function s.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(ARCHE_ABYSSLYM) and c:IsAbleToRemoveAsCost() end function s.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.tgfilter(c) return c:IsSetCard(ARCHE_ABYSSLYM) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.sscost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsReleasable() and Duel.GetMZoneCount(tp,c)>0 end Duel.Release(e:GetHandler(),REASON_COST) end function s.ssfilter(c,e,sp) return c:IsSetCard(ARCHE_ABYSSLYM) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.ssfilter(chkc,e,tp) end if chk==0 then return (e:IsCostChecked() or Duel.GetLocationCount(tp,LOCATION_MZONE)>0) and Duel.IsExistingTarget(s.ssfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.ssfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetCardOperationInfo(g,CATEGORY_SPECIAL_SUMMON) end function s.ssop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToChain() then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.retfilter(c) return c:IsFaceup() and c:IsSetCard(ARCHE_ABYSSLYM) and c:IsType(TYPE_MONSTER) end function s.retfilter2(c) return c:IsSetCard(ARCHE_ABYSSLYM) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.retfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.retfilter,tp,LOCATION_REMOVED,0,1,nil) end local rg=Duel.Group(s.retfilter,tp,LOCATION_REMOVED,0,nil):Filter(Card.IsCanBeEffectTarget,nil,e) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=rg:Select(tp,1,#rg,nil) Duel.SetTargetCard(g) Duel.SetCardOperationInfo(g,CATEGORY_TOGRAVE) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) end function s.retop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards() if #g>0 and Duel.SendtoGrave(g,REASON_EFFECT|REASON_RETURN)>0 and aux.PLChk(g,nil,LOCATION_GRAVE) then local g2=Duel.Group(aux.Necro(s.retfilter2),tp,LOCATION_GRAVE,0,nil) if g2:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then local g3=g2:Select(tp,1,#g2,nil) if g3:GetCount()>0 then Duel.BreakEffect() Duel.HintSelection(g3) Duel.SendtoDeck(g3,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end end end