--Diabolical Warden of Imprisoning Chains local s,id=GetID() function s.initial_effect(c) aux.AddOrigTimeleapType(c,false) aux.AddTimeleapProc(c,10,aux.FALSE,aux.FALSE) c:EnableReviveLimit() Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) --Must be Time Leap Summoned. local e0=Effect.CreateEffect(c) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(s.tllimit) c:RegisterEffect(e0) --If you control 3 or less cards, you can also Time Leap Summon this card by using any Normal Summoned monster. --Any monster used for this card's Time Leap Summon is Tributed instead of being banished. local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_EXTRA) e1:SetCondition(s.sumcon) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) e1:SetValue(SUMMON_TYPE_TIMELEAP) c:RegisterEffect(e1) --If this card is Time Leap Summoned: Tribute as many other monsters you control as possible, also, it becomes the End Phase. This activation and effect cannot be negated. local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_RELEASE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CAN_FORBIDDEN) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.epcon) e2:SetOperation(s.epop) c:RegisterEffect(e2) --While this card is in the Extra Monster Zone, neither player can banish cards, nor add cards from the Deck to their hand, except during the Draw Phase. local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_TO_HAND) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,1) e3:SetTarget(aux.TargetBoolFunction(Card.IsLocation,LOCATION_DECK)) e3:SetCondition(s.flcon) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_DRAW) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetTargetRange(1,1) e4:SetCondition(s.flcon) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_CANNOT_REMOVE) e5:SetRange(LOCATION_MZONE) e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e5:SetTargetRange(1,1) e5:SetValue(1) e5:SetCondition(s.flcon2) c:RegisterEffect(e5) --During your Draw Phase, return this card to the Extra Deck instead of conducting your normal draw. local e6=Effect.CreateEffect(c) --e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e6:SetCategory(CATEGORY_TOEXTRA) e6:SetCountLimit(1) e6:SetCode(EVENT_PREDRAW) e6:SetRange(LOCATION_MZONE) e6:SetCondition(function(_,tp) return Duel.IsTurnPlayer(tp) end) --e6:SetCondition(s.thcon) --e6:SetTarget(s.thtg) e6:SetOperation(s.thop) c:RegisterEffect(e6) end function s.sumcon(e) local c=e:GetHandler() local tp=c:GetControler() return Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)~=0 and Duel.IsExistingMatchingCard(s.tlfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and s.checkatls(c,e,tp) end function s.tlfilter(c,e,tp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,0,nil) return c:IsFaceup() and ((c:IsLevel(9) and c:IsType(TYPE_EFFECT) and c:IsCanBeTimeleapMaterial()) or (c:IsSummonType(SUMMON_TYPE_NORMAL) and #g<=3)) and c:IsReleasable() end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk,c) s.performatls(tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TRIBUTE) local g=Duel.SelectMatchingCard(tp,s.tlfilter,tp,LOCATION_MZONE,0,0,1,nil,e,tp) if #g==0 then return false end if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end end function s.sumop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end c:SetMaterial(g) Duel.Release(g,REASON_MATERIAL+REASON_TIMELEAP) aux.TimeleapHOPT(tp) end function s.epcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_TIMELEAP) end function s.epop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rg=Duel.GetMatchingGroup(Card.IsReleasableByEffect,tp,LOCATION_MZONE,0,c) if #rg>0 then Duel.Release(rg,REASON_EFFECT) end local turnp=Duel.GetTurnPlayer() Duel.SkipPhase(turnp,PHASE_MAIN1,RESET_PHASE+PHASE_END,1) Duel.SkipPhase(turnp,PHASE_BATTLE,RESET_PHASE+PHASE_END,1,1) Duel.SkipPhase(turnp,PHASE_MAIN2,RESET_PHASE+PHASE_END,1) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BP) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,turnp) end function s.flcon(e) return e:GetHandler():GetSequence()>4 and Duel.GetCurrentPhase()~=PHASE_DRAW end function s.flcon2(e) return e:GetHandler():GetSequence()>4 end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dt=Duel.GetDrawCount(tp) if dt~=0 then aux.DrawReplaceCount=0 aux.DrawReplaceMax=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE+PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,e:GetHandler(),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local dt=Duel.GetDrawCount(tp) if dt~=0 then aux.DrawReplaceCount=0 aux.DrawReplaceMax=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE+PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end aux.DrawReplaceCount=aux.DrawReplaceCount+1 if aux.DrawReplaceCount<=aux.DrawReplaceMax then Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.chainfilter(re,tp,cid) return not (re:IsActiveType(TYPE_MONSTER) and re:GetActivateLocation()==LOCATION_HAND) end function s.tllimit(e,se,sp,st) return st&SUMMON_TYPE_TIMELEAP==SUMMON_TYPE_TIMELEAP end --STUFF TO MAKE IT WORK WITH EFFECT_EXTRA_TIMELEAP_SUMMON function s.checkatls(c,e,tp) if c==nil then return true end if (c:IsType(TYPE_PENDULUM) or c:IsType(TYPE_PANDEMONIUM)) and c:IsFaceup() then return false end local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_TIMELEAP_SUMMON)} local exsumcheck=false for _,te in ipairs(eset) do if not te:GetValue() or type(te:GetValue())=="number" or te:GetValue()(e,c) then exsumcheck=true end end eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_IGNORE_TIMELEAP_HOPT)} local ignsumcheck=false for _,te in ipairs(eset) do if te:CheckCountLimit(tp) then ignsumcheck=true break end end return (Duel.GetFlagEffect(tp,828)<=0 or (exsumcheck and Duel.GetFlagEffect(tp,830)<=0) or c:IsHasEffect(EFFECT_IGNORE_TIMELEAP_HOPT) or ignsumcheck) end function s.performatls(tp) local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_TIMELEAP_SUMMON)} local igneset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_IGNORE_TIMELEAP_HOPT)} local exsumeff,ignsumeff local options={} if (#eset>0 and Duel.GetFlagEffect(tp,830)<=0) or #igneset>0 then local cond=1 if Duel.GetFlagEffect(tp,828)<=0 then table.insert(options,aux.Stringid(433005,15)) cond=0 end for _,te in ipairs(eset) do table.insert(options,te:GetDescription()) end for _,te in ipairs(igneset) do if te:CheckCountLimit(tp) then table.insert(options,te:GetDescription()) end end local op=Duel.SelectOption(tp,table.unpack(options))+cond if op>0 then if op<=#eset then exsumeff=eset[op] else ignsumeff=igneset[op-#eset] end end end if exsumeff~=nil then Duel.RegisterFlagEffect(tp,829,RESET_PHASE+PHASE_END,0,1) Duel.Hint(HINT_CARD,0,exsumeff:GetHandler():GetOriginalCode()) elseif ignsumeff~=nil then Duel.Hint(HINT_CARD,0,ignsumeff:GetHandler():GetOriginalCode()) ignsumeff:UseCountLimit(tp) end end