--Seek Through Time local ref,id=GetID() function ref.initial_effect(c) c:EnableReviveLimit() local magick=Effect.CreateEffect(c) magick:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) magick:SetType(EFFECT_TYPE_TRIGGER_F) magick:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_SET_AVAILABLE) magick:SetTarget(ref.mgtg) magick:SetOperation(ref.mgop) aux.AddMagickProcCustom(c,ref.magcon,aux.MagickMatCost,magick,ref.matfilter,1) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_CAL) e1:SetCondition(aux.dscon) e1:SetTarget(ref.acttg) e1:SetOperation(ref.actop) c:RegisterEffect(e1) end function ref.magcon(e) return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2 end function ref.matfilter(c,sc) return c:IsType(TYPE_MONSTER+TYPE_SPELL) end --Magic function ref.mgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return false end local g=Duel.GetDecktopGroup(tp,3) local result=g:FilterCount(Card.IsAbleToHand,nil)>0 return result end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function ref.mgop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.ConfirmDecktop(p,3) local g=Duel.GetDecktopGroup(p,3) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND) local sg=g:Select(p,1,1,nil) if sg:GetFirst():IsAbleToHand() then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-p,sg) Duel.ShuffleHand(p) else Duel.SendtoGrave(sg,REASON_RULE) end Duel.ShuffleDeck(p) end end --Activate function ref.acttg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and #g>0 end Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,1,0,500) end function ref.actop(e,tp,eg,ep,ev,re,r,rp) local ct=math.min(3,Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)) if ct>0 then local t={} for i=1,ct do t[i]=i end local ac=1 if ct>1 then Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(52112003,1)) ac=Duel.AnnounceNumber(tp,table.unpack(t)) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.MoveSequence(Duel.GetDecktopGroup(tp,ac):Select(tp,1,1,nil):GetFirst(),1) Duel.SortDecktop(tp,tp,ac-1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() if tc then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) e1:SetValue(500) tc:RegisterEffect(e1) end end