--Lord of the Spiral Galaxy local s,id=GetID() function s.initial_effect(c) aux.AddOrigTimeleapType(c,false) aux.AddTimeleapProc(c,9,s.sumcon,s.tlfilter) c:EnableReviveLimit() aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROY) ge1:SetLabel(id) ge1:SetCondition(s.regcon) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) end) --Gains 100 ATK/DEF for each banished card. local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.value) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --Cannot be targeted or destroyed by monster effects with the same Attribute and/or Type as a banished monster. --cannot be target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(s.efilter) c:RegisterEffect(e3) --cannot be destroyed local e4=e3:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e4) --If this card is Time Leap Summoned: Target 1 banished card; shuffle all other banished cards into the Decks, then, if this card was Time Leap Summoned using a Bigbang Monster as Material, banish all cards from the GYs. local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_TODECK+CATEGORY_REMOVE) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e5:SetCode(EVENT_SPSUMMON_SUCCESS) e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e5:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL) e5:SetCondition(s.tdcon) e5:SetTarget(s.tdtg) e5:SetOperation(s.tdop) c:RegisterEffect(e5) 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:IsAttribute(ATTRIBUTE_DARK+ATTRIBUTE_FIRE) end function s.value(e,c) return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_REMOVED,LOCATION_REMOVED)*100 end function s.ebfilter(c,t,a) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and (c:GetRace()==t or c:GetAttribute()==a) end function s.efilter(e,re,rp) local rc=re:GetHandler() local t=rc:GetRace() local a=rc:GetAttribute() return re:IsActiveType(TYPE_EFFECT) and Duel.IsExistingMatchingCard(s.ebfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil,t,a) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_TIMELEAP) end function s.tdfilter(c) return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,c) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil) local sg=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,g) Duel.SetOperationInfo(0,CATEGORY_TODECK,sg,sg:GetCount(),PLAYER_ALL,LOCATION_REMOVED) if e:GetHandler():GetMaterial():IsExists(Card.IsType,1,nil,TYPE_BIGBANG) and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) then local g2=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g2,g2:GetCount(),0,0) end end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_REMOVED,LOCATION_REMOVED,tc) if tc:IsRelateToEffect(e) then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) if c:GetMaterial():IsExists(Card.IsType,1,nil,TYPE_BIGBANG) then Duel.BreakEffect() local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(Card.IsAbleToRemove),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil) if g2:GetCount()>0 then Duel.Remove(g2,POS_FACEUP,REASON_EFFECT) end end end end function s.regfilter(c,r) return c:IsType(TYPE_MONSTER) end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.regfilter,1,nil,r) 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