--Temporius in the Past - "Dragon Ruler" local s,id=GetID() function s.initial_effect(c) aux.AddOrigTimeleapType(c,false) aux.AddTimeleapProc(c,8,s.sumcon,s.tlfilter) c:EnableReviveLimit() --If this card is in your GY: You can banish 2 other "Temporius" cards and/or Dragon monsters from your hand and/or GY; Special Summon this card. local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --If this card is banished: You can add 1 "Temporius" Spell/Trap card from your Deck to your hand. local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_REMOVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_REMOVE) ge1:SetLabel(id) ge1:SetCondition(s.regcon) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_TO_GRAVE) ge2:SetLabel(id) Duel.RegisterEffect(ge2,0) end) end function s.sumcon(e,c) return Duel.GetFlagEffect(e:GetHandlerPlayer(),id)>0 end function s.tlfilter(c,e,mg) local tp=c:GetControler() local ef=e:GetHandler():GetFuture() return c:IsLevelBelow(ef-1) and c:IsRace(RACE_DRAGON) end function s.rfilter(c) return (c:IsRace(RACE_DRAGON) or c:IsSetCard(0x723)) and c:IsAbleToRemoveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,2,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.rfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,2,2,e:GetHandler()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) then --but return it to the Extra Deck during your opponent's End Phase. local fid=c:GetFieldID() c:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(id,0)) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(c) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) if Duel.GetTurnPlayer()~=1-tp then return false end if e:GetLabelObject():GetFlagEffectLabel(id)==e:GetLabel() then return true end e:Reset() return false end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoDeck(e:GetLabelObject(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end function s.thfilter(c) return c:IsSetCard(0x723) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsRace,1,nil,RACE_DRAGON) end function s.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1) Duel.RegisterFlagEffect(1-tp,id,RESET_PHASE+PHASE_END,0,1) end