--created by Thauma, coded by Lyris local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,nil,2,2,function(g) return g:IsExists(Card.IsLinkSetCard,1,nil,0xa44) end) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCategory(CATEGORY_TOHAND) e2:SetCondition(s.condition) e2:SetTarget(s.tg) e2:SetOperation(s.op) c:RegisterEffect(e2) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCategory(CATEGORY_DICE+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e1:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.toss_dice=true function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_DECK,0,1,nil,0xa44) end Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function s.spfilter(c,e,tp) return c:IsSetCard(0xa44) and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) or c:IsAbleToHand()) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return end local dc=Duel.TossDice(tp,1) Duel.ConfirmDecktop(tp,dc) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Duel.GetDecktopGroup(tp,dc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:FilterSelect(tp,s.spfilter,1,1,nil,e,tp):GetFirst() if sg then local b1,b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and sg:IsCanBeSpecialSummoned(e,0,tp,false,false),sg:IsAbleToHand() if b2 and (not b1 or Duel.SelectOption(tp,1190,1152)==0) then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) else Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP) end end Duel.ShuffleDeck(tp) end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_PZONE) and c:GetPreviousControler()==tp end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsSetCard(0xa44) and c:IsAbleToHand() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function s.op(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end