--Guidance of the Lanternal local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(cid.target) e1:SetOperation(cid.activate) c:RegisterEffect(e1) --set local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1,id) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(cid.setcon) e2:SetTarget(cid.settg) e2:SetOperation(cid.setop) c:RegisterEffect(e2) end --filters function cid.filter(c,e,tp) return c:IsSetCard(0xd2e) end function cid.mfilter(c) return c:GetLevel()>0 and c:IsRace(RACE_PYRO) and c:IsAbleToDeck() end function cid.rccfilter(c) return c:IsFaceup() and c:IsSetCard(0xd2e) end --Activate function cid.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg1=Duel.GetRitualMaterial(tp) local mg2=Duel.GetMatchingGroup(cid.mfilter,tp,LOCATION_GRAVE,0,nil) return Duel.IsExistingMatchingCard(aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,nil,cid.filter,e,tp,mg1,mg2,Card.GetLevel,"Equal") end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) local mg1=Duel.GetRitualMaterial(tp) local mg2=Duel.GetMatchingGroup(cid.mfilter,tp,LOCATION_GRAVE,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.RitualUltimateFilter,tp,LOCATION_HAND,0,1,1,nil,cid.filter,e,tp,mg1,mg2,Card.GetLevel,"Equal") local tc=g:GetFirst() if tc then local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc) mg:Merge(mg2) if tc.mat_filter then mg=mg:Filter(tc.mat_filter,tc,tp) else mg:RemoveCard(tc) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel(),"Equal") local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel(),tp,tc,tc:GetLevel(),"Equal") aux.GCheckAdditional=nil if not mat or mat:GetCount()==0 then return end tc:SetMaterial(mat) local mat2=mat:Filter(Card.IsLocation,nil,LOCATION_GRAVE):Filter(Card.IsRace,nil,RACE_PYRO) mat:Sub(mat2) Duel.ReleaseRitualMaterial(mat) Duel.SendtoDeck(mat2,nil,2,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP) tc:CompleteProcedure() end end --set function cid.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp and Duel.IsExistingMatchingCard(cid.rccfilter,tp,LOCATION_MZONE,0,1,nil) end function cid.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function cid.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) Duel.ConfirmCards(1-tp,c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_DECKBOT) c:RegisterEffect(e1) end end