--Legends and Myths, Seer's Coalition local s,id=GetID() function s.initial_effect(c) --Pendulum Set local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetOperation(s.penop) c:RegisterEffect(e1) --destroy and baniish + draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id+1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --spsummon synchro local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,3)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_REMOVE) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id+2) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e3:SetCondition(s.spcon1) e3:SetTarget(s.sptg1) e3:SetOperation(s.spop1) c:RegisterEffect(e3) --spsummon xyz local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,4)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_REMOVE) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,id+2) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCondition(s.spcon2) e4:SetTarget(s.sptg2) e4:SetOperation(s.spop2) c:RegisterEffect(e4) --spsummon link local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,5)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_REMOVE) e5:SetRange(LOCATION_SZONE) e5:SetCountLimit(1,id+2) e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e5:SetCondition(s.spcon3) e5:SetTarget(s.sptg3) e5:SetOperation(s.spop3) c:RegisterEffect(e5) end function s.penfilter(c) return c:IsSetCard(0xFA0) and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return false end local g=Duel.GetMatchingGroup(s.penfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,s.penfilter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) if tc:IsLocation(LOCATION_PZONE) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetLabelObject(tc) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end end end end function s.aclimit(e,re,tp) local tc=e:GetLabelObject() return re:GetHandler():IsCode(tc:GetCode()) end function s.desfilter(c) return (c:IsSetCard(0x190) or c:IsSetCard(0xFA0)) end function s.remfilter(c) return c:IsAbleToRemove() and (c:IsLocation(LOCATION_GRAVE+LOCATION_ONFIELD+LOCATION_HAND) or (c:IsLocation(LOCATION_EXTRA) and c:IsFaceup())) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler())end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.remfilter),tp,LOCATION_GRAVE+LOCATION_ONFIELD+LOCATION_HAND+LOCATION_EXTRA,0,e:GetHandler()) if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=g:Select(tp,1,1,nil) Duel.Remove(g1,POS_FACEUP,REASON_EFFECT) Duel.Draw(tp,1,REASON_EFFECT) end end end function s.cfilter(c,tp) return c:IsSetCard(0xFA0) or c:IsSetCard(0x190) end function s.confilter1(c) return c:IsFaceup() and c:IsSetCard(0x190) and c:IsType(TYPE_SYNCHRO) end function s.confilter2(c) return c:IsFaceup() and c:IsSetCard(0x190) and c:IsType(TYPE_XYZ) end function s.confilter3(c) return c:IsFaceup() and c:IsSetCard(0x190) and c:IsType(TYPE_LINK) end function s.spcon1(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.confilter1,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_DECK,0,1,nil,e,tp) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.confilter2,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_GRAVE,0,1,nil) end function s.spcon3(e,tp,eg,ep,ev,re,r,rp) local zone=Duel.GetLinkedZone(tp)&0x1f return eg:IsExists(s.cfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.confilter3,tp,LOCATION_MZONE,0,1,nil) and zone~=0 and Duel.IsExistingMatchingCard(s.spfilter3,tp,LOCATION_REMOVED,0,1,nil,e,tp,zone) end function s.spfilter1(c,e,tp) return c:IsSetCard(0xFA0) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then local tc=g:GetFirst() while tc do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(s.matlimit) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) tc:RegisterEffect(e2,true) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) tc:RegisterEffect(e3,true) local e4=e1:Clone() e4:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) tc:RegisterEffect(e4,true) tc:RegisterFlagEffect(0,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,8)) tc=g:GetNext() end Duel.SpecialSummonComplete() end end function s.matlimit(e,c) if not c then return false end return not c:IsSetCard(0x190) end function s.setfilter(c) return c:IsSetCard(0x190) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable() end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_GRAVE,0,1,nil) end end function s.spop2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.GetMatchingGroup(s.setfilter,tp,LOCATION_GRAVE,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,4)) then Duel.BreakEffect() local sg=g:Select(tp,1,1,nil) if Duel.SSet(tp,sg)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) sg:GetFirst():RegisterEffect(e1,true) end end end function s.spfilter3(c,e,tp,zone) return c:IsSetCard(0xFA0) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,zone) and c:IsFaceup() end function s.sptg3(e,tp,eg,ep,ev,re,r,rp,chk) local zone=Duel.GetLinkedZone(tp)&0x1f if chk==0 then return zone>0 and Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(s.spfilter3,tp,LOCATION_REMOVED,0,1,nil,e,tp,zone) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop3(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCountFromEx(tp)<=0 and zone~=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local zone=Duel.GetLinkedZone(tp)&0x1f local g=Duel.SelectMatchingCard(tp,s.spfilter3,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,zone) if g:GetCount()>0 then local tc=g:GetFirst() while tc do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(s.matlimit) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) tc:RegisterEffect(e2,true) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) tc:RegisterEffect(e3,true) local e4=e1:Clone() e4:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) tc:RegisterEffect(e4,true) local e5=Effect.CreateEffect(e:GetHandler()) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_DISABLE) e5:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e5,true) local e6=Effect.CreateEffect(e:GetHandler()) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_DISABLE_EFFECT) e6:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e6,true) tc:RegisterFlagEffect(0,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,8)) tc=g:GetNext() end Duel.SpecialSummonComplete() end end