--Legends and Myths, Nyianne the Fallen Tactician local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() aux.AddLinkProcedure(c,aux.FilterBoolFunction(s.matfilter),2,2) --spsummon and banish local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Xyz Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+1) e2:SetCondition(s.spcon2) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) e2:SetHintTiming(0,TIMING_BATTLE_START) c:RegisterEffect(e2) end s.listed_series={0x190} function s.matfilter(c) return c:IsSetCard(0x190) or c:IsSetCard(0xFA0) end function s.spfilter(c,e,tp) return c:IsSetCard(0xFA0) 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.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then Duel.BreakEffect() local g2=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,0,1,1,nil) if #g2>0 then Duel.Remove(g2,POS_FACEUP,REASON_EFFECT) end end end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==tp end function s.filter1(c,e,tp,lg) local rank=c:GetRank() local att=c:GetAttribute() return c:IsFaceup() and c:IsSetCard(0x190) and e:GetHandler():GetLinkedGroup():IsContains(c) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rank+1,att) and aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) end function s.filter2(c,e,tp,mc,rank,att) return mc:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsType(TYPE_XYZ) and c:IsSetCard(0x190) and c:IsRank(rank) and c:IsAttribute(att) and mc:IsCanBeXyzMaterial(c,tp) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local lg=c:GetLinkedGroup() local zone={} lg:AddCard(c) zone[0]=c:GetLinkedZone(0) zone[1]=c:GetLinkedZone(1) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter1(chkc,e,tp,lg,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp,lg,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp,lg,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not aux.MustMaterialCheck(tc,tp,EFFECT_MUST_BE_XMATERIAL) then return end if not tc or tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end local zone={} zone[0]=c:GetLinkedZone(0) zone[1]=c:GetLinkedZone(1) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1,tc:GetAttribute()) local sc=g:GetFirst() if sc then local mg=tc:GetOverlayGroup() if #mg~=0 then Duel.Overlay(sc,mg) end sc:SetMaterial(Group.FromCards(tc)) Duel.Overlay(sc,Group.FromCards(tc)) Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP) sc:CompleteProcedure() end end