--created by Swag, coded by Lyris local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_TODECK) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id+100) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCondition(s.condition) e2:SetCategory(CATEGORY_DECKDES) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xd78) and c:IsDiscardable() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) Duel.SendtoGrave(Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,c)+c,REASON_COST+REASON_DISCARD) end function s.filter(c,e) return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_MONSTER) and c:IsCanBeEffectTarget(e) end function s.check(g) return #g>1 and g:IsExists(Card.IsAbleToDeck,#g-1,nil) or #g==1 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc,e) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_REMOVED,0,nil,e) if chk==0 then local res=g:CheckSubGroup(s.check,1,5) return res end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local rg=g:SelectSubGroup(tp,s.check,false,1,5) Duel.SetTargetCard(rg) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,rg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,rg,#rg-1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local dg=g:Select(tp,1,1,nil) if Duel.SendtoGrave(dg,REASON_EFFECT+REASON_RETURN)>0 then Duel.SendtoDeck(g-dg,nil,2,REASON_EFFECT) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) and re and re:GetHandler():IsSetCard(0xd78) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end local g=Duel.GetDecktopGroup(tp,3) Duel.ConfirmCards(tp,g) if Duel.SelectYesNo(tp,1191) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=g:Select(tp,1,1,nil):GetFirst() if tc and tc:IsAbleToGrave() then Duel.SendtoGrave(tc,REASON_EFFECT) Duel.BreakEffect() end end Duel.ShuffleDeck(tp) end