--created by Seth, coded by Lyris --Shadow NOVA - Yamoloxi local s,id,o=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcFunRep(c,s.mfilter,3,false) aux.AddContactFusionProcedure(c,s.cffilter,LOCATION_GRAVE,0,Duel.Remove,POS_FACEUP,REASON_COST) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(function() return not c:IsLocation(LOCATION_EXTRA) end) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CUSTOM+id) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCategory(CATEGORY_DESTROY) e3:SetDescription(1124) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) if not s.global_check then s.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_TO_GRAVE) ge1:SetCondition(s.regcon) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) end local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,id+o*10) e4:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e4:SetCondition(aux.exccon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_SPSUMMON_SUCCESS) e5:SetCountLimit(1,id+o*20) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e5:SetCondition(function() return c:IsPreviousLocation(LOCATION_GRAVE) end) e5:SetTarget(s.tg) e5:SetOperation(s.op) c:RegisterEffect(e5) end function s.mfilter(c,fc,sub,mg,sg) return c:IsFusionSetCard(0xe1f) and c:IsFusionType(TYPE_FUSION) and (not sg or not sg:IsExists(Card.IsFusionCode,1,c,c:GetFusionCode())) end function s.cffilter(c,fc) return c:IsAbleToRemoveAsCost() and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.cfilter(c,tp) local re=c:GetReasonEffect() return c:IsSetCard(0xe1f) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_HAND) and c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_COST) and re:IsActivated() and re:GetOwner()==c end function s.regcon(e,tp,eg,ep,ev,re,r,rp) local v=0 if eg:IsExists(s.cfilter,1,nil,0) then v=v+1 end if eg:IsExists(s.cfilter,1,nil,1) then v=v+2 end if v==0 then return false end e:SetLabel(({0,1,PLAYER_ALL})[v]) return true end function s.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RaiseEvent(eg,EVENT_CUSTOM+id,re,r,rp,ep,e:GetLabel()) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ev==tp or ev==PLAYER_ALL end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD):Select(tp,1,1,nil) Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end function s.filter(c) return c:IsSetCard(0xe1f) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,c):GetClassCount(Card.GetCode)>2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,c):SelectSubGroup(tp,aux.dncheck,false,3,3) if g and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)==3 and not g:IsExists(aux.NOT(Card.IsLocation),1,nil,LOCATION_DECK+LOCATION_EXTRA) and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.sfilter(c,e,tp) return c:IsFaceup() and c:IsSetCard(0xe1f) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.sfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_REMOVED) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.op(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.sfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT+REASON_RETURN)>0 and aux.NecroValleyFilter()(tc) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end