--Nobless Butlair --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCost(cid.drawcost) e1:SetTarget(cid.drawtg) e1:SetOperation(cid.drawop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(cid.drawcon) --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,id+100) e4:SetCost(cid.drawcost2) e4:SetTarget(cid.tdtg) e4:SetOperation(cid.tdop) c:RegisterEffect(e4) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,cid.counterfilter) Duel.AddCustomActivityCounter(id+100,ACTIVITY_SPSUMMON,cid.counterfilter2) end --DRAW function cid.cfilter(c) if c:IsLocation(LOCATION_MZONE) then return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_ZOMBIE) else return c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousAttributeOnField(),ATTRIBUTE_DARK)~=0 and bit.band(c:GetPreviousRaceOnField(),RACE_ZOMBIE) end end function cid.drawcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not eg:IsContains(c) and eg:IsExists(cid.cfilter,1,nil) end function cid.counterfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and (c:IsHasNoArchetype() or c:IsType(TYPE_EXTRA)) end function cid.counterfilter2(c) return c:IsAttribute(ATTRIBUTE_DARK) end function cid.drawcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(cid.splimit) Duel.RegisterEffect(e1,tp) end function cid.drawcost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id+100,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(cid.splimit2) Duel.RegisterEffect(e1,tp) end function cid.splimit(e,c) return not (c:IsAttribute(ATTRIBUTE_DARK) and (c:IsHasNoArchetype() or c:IsType(TYPE_EXTRA))) end function cid.splimit2(e,c) return not c:IsAttribute(ATTRIBUTE_DARK) end function cid.filter(c) return c:IsFaceup() and c:IsLevel(2) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_MONSTER) end function cid.drawtg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=Duel.GetMatchingGroupCount(cid.filter,tp,LOCATION_MZONE,0,nil) if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,ct,tp,LOCATION_HAND) end function cid.drawop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ct=Duel.GetMatchingGroupCount(cid.filter,p,LOCATION_MZONE,0,nil) if ct<=0 then return end local draw=Duel.Draw(p,ct,REASON_EFFECT) if draw==ct then local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,p,LOCATION_HAND,0,nil) if #g<=0 then return end Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE) local sg=g:Select(p,draw,draw,nil) if #sg<=0 then return end Duel.SendtoGrave(sg,REASON_EFFECT) end end --SPSUMMON function cid.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function cid.tdfilter(c) return c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function cid.thfilter(c,e,tp) return c:IsLevel(2) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,cid.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g>0 and Duel.SendtoDeck(g,nil,2,REASON_EFFECT)~=0 and g:GetFirst():IsLocation(LOCATION_DECK+LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g1>0 and Duel.SpecialSummonStep(g1:GetFirst(),0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT+RESET_PHASE+PHASE_END) e1:SetValue(LOCATION_DECKSHF) g1:GetFirst():RegisterEffect(e1) end Duel.SpecialSummonComplete() end end