--Necro-Xyz function c500319612.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,500319612) e1:SetTarget(c500319612.target) e1:SetOperation(c500319612.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,500319612) e2:SetCost(c500319612.thcost) e2:SetTarget(c500319612.thtg) e2:SetOperation(c500319612.thop) c:RegisterEffect(e2) end function c500319612.filter(c,e,tp) return c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c500319612.xyzfilter(c,mg) return c:IsSetCard(0x285a) and c:IsXyzSummonable(mg,2,2) end function c500319612.mfilter1(c,mg,exg) return mg:IsExists(c500319612.mfilter2,1,c,c,exg) end function c500319612.mfilter2(c,mc,exg) return exg:IsExists(Card.IsXyzSummonable,1,nil,Group.FromCards(c,mc)) end function c500319612.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(c500319612.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e,tp) local exg=Duel.GetMatchingGroup(c500319612.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.GetLocationCountFromEx(tp)>0 and mg:IsExists(c500319612.mfilter1,1,nil,mg,exg) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg1=mg:FilterSelect(tp,c500319612.mfilter1,1,1,nil,mg,exg) local tc1=sg1:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg2=mg:FilterSelect(tp,c500319612.mfilter2,1,1,tc1,tc1,exg) sg1:Merge(sg2) Duel.SetTargetCard(sg1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0) end function c500319612.filter2(c,e,tp) return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c500319612.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c500319612.filter2,nil,e,tp) if g:GetCount()<2 then return end Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) if Duel.GetLocationCountFromEx(tp,tp,g)<=0 then return end local xyzg=Duel.GetMatchingGroup(c500319612.xyzfilter,tp,LOCATION_EXTRA,0,nil,g) if xyzg:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() Duel.XyzSummon(tp,xyz,g) end end function c500319612.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c500319612.thfilter(c) return (c:IsSetCard(0x285a) and c:IsType(TYPE_MONSTER)) or ((c:IsSetCard(0x85a) or c:IsSetCard(0x85b)) and c:IsType(TYPE_SPELL)) and c:IsAbleToHand() end function c500319612.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c500319612.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c500319612.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c500319612.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end