--Orizzonte Maestà Nottesfumo --Script by XGlitchy30 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT() e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCode(EVENT_FREE_CHAIN) e2:SHOPT() e2:SetCost(aux.bfgcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end --filters function s.filter(c) return c:IsFaceup() and c:IsSetCard(ARCHE_NIGHTSHADE) end function s.tgfilter(c,e) return c:IsSetCard(ARCHE_NIGHTSHADE) and (c:IsAbleToRemove() or c:IsAbleToDeck()) and c:IsCanBeEffectTarget(e) end function s.rmfilter(c,g) return c:IsAbleToRemove() and g:IsExists(Card.IsAbleToDeck,2,c) end function s.gcheck(g) return g:IsExists(s.rmfilter,1,nil,g) end function s.thfilter(c) return c:IsSetCard(ARCHE_NIGHTSHADE) and c:IsAbleToHand() and c:IsFaceup() end --Activate function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.targfilter(chkc,tp) end local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_GRAVE,0,nil,e) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and g:CheckSubGroup(s.gcheck,3,3) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tg=g:SelectSubGroup(tp,s.gcheck,false,3,3) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_REMOVE,tg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,tg,2,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards() if #tg<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=tg:FilterSelect(tp,s.rmfilter,1,1,nil,tg) if #rg>0 then Duel.HintSelection(rg) if Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)>0 then tg:Sub(rg) if #tg>0 and Duel.ShuffleIntoDeck(tg)>0 then if Duel.IsPlayerCanDraw(tp,1) then Duel.BreakEffect() end Duel.Draw(tp,1,REASON_EFFECT) end end end end --to hand function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_REMOVED,0,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) if #g>0 and Duel.SearchAndCheck(g,tp) then local tc=g:GetFirst() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) e1:SetLabel(tc:GetCode()) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) Duel.RegisterEffect(e2,tp) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON) Duel.RegisterEffect(e3,tp) local e4=e1:Clone() e4:SetCode(EFFECT_CANNOT_ACTIVATE) e4:SetValue(s.aclimit) Duel.RegisterEffect(e4,tp) Duel.RegisterHint(tp,id,PHASE_END,1,id,2) end end function s.sumlimit(e,c) return c:IsCode(e:GetLabel()) end function s.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabel()) end