--Vine Rituals function c160005512.initial_effect(c) ---Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,160005512) e1:SetTarget(c160005512.target) e1:SetOperation(c160005512.activate) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCondition(c160005512.thcon) e2:SetCost(c160005512.thcost) e2:SetTarget(c160005512.thtg) e2:SetOperation(c160005512.thop) c:RegisterEffect(e2) end function c160005512.filter(c,e,tp,m1,m2) if (not c:IsSetCard(0x85a) and not c:IsSetCard(0x85b)) or bit.band(c:GetType(),0x81)~=0x81 or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c) mg:Merge(m2) if c:IsCode(21105106) then return c:ritual_custom_condition(mg) end if c.mat_filter then mg=mg:Filter(c.mat_filter,nil) end return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c) end function c160005512.mfilter(c,e,tp) return (c:IsSetCard(0x85a) or c:IsSetCard(0x85b)) and c:IsType(TYPE_MONSTER) and c:GetLevel()>0 and c:IsAbleToRemove() end function c160005512.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg1=Duel.GetRitualMaterial(tp) local mg2=Duel.GetMatchingGroup(c160005512.mfilter,tp,LOCATION_GRAVE,0,nil) return Duel.IsExistingMatchingCard(c160005512.filter,tp,LOCATION_HAND,0,1,nil,e,tp,mg1,mg2) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function c160005512.activate(e,tp,eg,ep,ev,re,r,rp) local mg1=Duel.GetRitualMaterial(tp) local mg2=Duel.GetMatchingGroup(c160005512.mfilter,tp,LOCATION_GRAVE,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectMatchingCard(tp,c160005512.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg1,mg2) local tc=tg:GetFirst() if tc then local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc) mg:Merge(mg2) if tc:IsCode(21105106) then tc:ritual_custom_operation(mg) local mat=tc:GetMaterial() Duel.ReleaseRitualMaterial(mat) else if tc.mat_filter then mg=mg:Filter(tc.mat_filter,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc) tc:SetMaterial(mat) Duel.ReleaseRitualMaterial(mat) end Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP) tc:CompleteProcedure() end end function c160005512.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function c160005512.cfilter(c) return (c:IsSetCard(0x85a) or c:IsSetCard(0x85b)) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost() end function c160005512.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(c160005512.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c160005512.cfilter,tp,LOCATION_GRAVE,0,1,1,nil) g:AddCard(e:GetHandler()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c160005512.thfilter(c,e,tp) return (c:IsSetCard(0x85a) or c:IsSetCard(0x85b)) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c160005512.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and c160005512.thfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c160005512.thfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c160005512.thfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c160005512.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end