--created by Seth, coded by Lyris --Mextro Dextras local s,id,o=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddLinkProcedure(c,s.mfilter,1,1) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:HOPT() e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:HOPT() e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,aux.FilterBoolFunction(Card.IsSetCard,0xee5)) if not s.global_check then s.global_check=true local mg,mc=Card.GetMutualLinkedGroup,Card.GetMutualLinkedGroupCount Card.GetMutualLinkedGroup=function(c) local g=mg(c) local ct=c:GetFlagEffectLabel(19520843) if ct and c:GetCardTargetCount()+1>=ct then g:Merge(Duel.GetMatchingGroup(s.lfilter,tp,LOCATION_MZONE,0,nil)) end return g end Card.GetMutualLinkedGroupCount=function(c) return math.max(#mg(c),mc(c)) end if not Mextro then Mextro={} end Mextro.MutualLinkFilter=Mextro.MutualLinkFilter or function(c) local ct=c:GetFlagEffectLabel(19520843) return ct and c:GetCardTargetCount()+1>=ct end end end function s.mfilter(c) return c:IsSetCard(0xee5) and not c:IsType(TYPE_LINK) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.filter(c) return c:IsSetCard(0xee5) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() 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.filter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return ph==PHASE_MAIN1 or ph==PHASE_MAIN2 end function s.cfilter(c) return c:IsSetCard(0xee5) and c:IsAbleToRemoveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)<1 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(aux.TargetBoolFunction(aux.NOT(Card.IsSetCard),0xee5)) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Remove(Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil),POS_FACEUP,REASON_COST) end function s.sfilter(c,e,tp) return c:IsLinkBelow(2) and c:IsSetCard(0xee5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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 Duel.IsExistingMatchingCard(s.sfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.sfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() if not tc then return end if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2) end Duel.SpecialSummonComplete() if not c:IsRelateToEffect(e) then return end Duel.BreakEffect() for _,sc in ipairs{c,tc} do sc:RegisterFlagEffect(19520843,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,2,aux.Stringid(19520843,0)) end c:SetCardTarget(tc) tc:SetCardTarget(c) end