--Nobless Mansionister --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(cid.target) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.AND(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),aux.TargetBoolFunction(Card.IsRace,RACE_ZOMBIE))) e2:SetValue(cid.efilter) c:RegisterEffect(e2) --shuffle local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id) e3:SetCost(cid.tdcost) e3:SetTarget(cid.tdtg) e3:SetOperation(cid.tdop) c:RegisterEffect(e3) end --ACTIVATE function cid.spfilter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsLevel(2) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_ZOMBIE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cid.spfilter(chkc,e,tp) end if chk==0 then return true end if Duel.IsExistingTarget(cid.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) and Duel.GetFlagEffect(tp,id)<=0 then Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1) e:SetCategory(CATEGORY_SPECIAL_SUMMON) e:SetProperty(EFFECT_FLAG_CARD_TARGET) e:SetOperation(cid.activate) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,cid.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,0,0,0) else e:SetCategory(0) e:SetProperty(0) e:SetOperation(nil) end end function cid.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) then if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and not tc:IsHasEffect(EFFECT_NECRO_VALLEY) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end end --CANNOT BE TARGET function cid.efilter(e,re,rp) return rp==1-e:GetHandlerPlayer() and re:IsActiveType(TYPE_MONSTER) end --SHUFFLE function cid.tdfilter(c) return c:IsType(TYPE_MONSTER) and c:IsLevel(2) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToGraveAsCost() end function cid.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.tdfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cid.tdfilter,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_COST) end end function cid.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=5 and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_GRAVE) end function cid.thfilter(c) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_ZOMBIE) end function cid.tdop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.ConfirmDecktop(p,5) local g=Duel.GetDecktopGroup(p,5) if g:GetCount()>0 and g:IsExists(cid.thfilter,1,nil) then local ct=g:FilterCount(cid.thfilter,nil) Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK) local sg=Duel.SelectMatchingCard(p,aux.NecroValleyFilter(Card.IsAbleToDeck),p,LOCATION_GRAVE,LOCATION_GRAVE,1,ct,nil) if #sg>0 then Duel.HintSelection(g) Duel.SendtoDeck(sg,nil,2,REASON_EFFECT) end end Duel.ShuffleDeck(p) end