--created by Discord \ LeonDuvall, coded by Discord \ XGlitchy30, art from Cardfight!! Vanguard's "Arch-aider, Malkuth-melekh" --Glitchy, Angelic Guardian of YC.Org local s,id,o=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x96b),aux.NonTuner(nil),1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_HANDES) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetCondition(s.hdcon) e2:SetCost(s.hdcost) e2:SetTarget(s.hdtg) e2:SetOperation(s.hdop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,id) e3:SetCondition(s.spcon2) e3:SetCost(s.spcost2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end function s.lfilter(c,cc) return c:IsFaceup() and c:IsSetCard(0x96b) and c:GetLinkedGroup():IsContains(cc) end function s.hdcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsExistingMatchingCard(s.lfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c) end function s.filter1(c) return c:IsSetCard(0x96b) and c:IsAbleToRemoveAsCost() end function s.hdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_HAND,0,1,nil) and Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_HAND,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_GRAVE,0,1,1,nil) g1:Merge(g2) if g1:GetCount()==2 then Duel.Remove(g1,POS_FACEUP,REASON_COST) end end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)>0 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.DiscardHand(p,nil,d,d,REASON_EFFECT+REASON_DISCARD) end function s.costfilter(c,e,tp) return c:IsSetCard(0x96b) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_HAND+LOCATION_REMOVED,0,1,nil,e,tp,c:GetCode()) end function s.spfilter2(c,e,tp,code) return (not c:IsLocation(LOCATION_REMOVED) or c:IsFaceup()) and c:IsSetCard(0x96b) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(code) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) end function s.spcost2(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) if chk==0 then return true end end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) Duel.SetTargetCard(g) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_REMOVED) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not tc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_HAND+LOCATION_REMOVED,0,1,1,nil,tc,e,tp,tc:GetCode()) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.splimit(e,c) return not c:IsSetCard(0x96b) end