--Zerost Emptiness --Vacuità Zerost --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) --[[Roll a six-sided die, and Fusion Summon 1 "Zerost" Fusion Monster from your Extra Deck, using monsters from your field as Fusion Material. You can also shuffle into the Deck, your "Zerost" monsters that are banished, and/or in your GY, up to the result.]] local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DICE|CATEGORIES_FUSION_SUMMON|CATEGORY_GRAVE_ACTION) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT(true) e1:SetHintTiming(0,RELEVANT_TIMINGS) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --[[You can banish this card from your GY; the next time a player rolls a dice because of an activated card effect, you can increase or reduce the result of that die roll by 1.]] aux.AddZerostDiceModifier(c,id) end s.toss_dice = true function s.filter1(c,e) return not c:IsImmuneToEffect(e) end function s.filter2(c,e,tp,m,f,chkf) return c:IsMonster(TYPE_FUSION) and c:IsSetCard(ARCHE_ZEROST) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function s.fexfilter(c) return c:IsFaceupEx() and c:IsType(TYPE_MONSTER) and c:IsSetCard(ARCHE_ZEROST) and c:IsCanBeFusionMaterial() and c:IsAbleToDeck() end function s.fcheckfilter(c,extra_mats,chk) return c:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and (not chk or chk~=0 or (not extra_mats or not extra_mats:IsContains(c))) and (not aux.UsedExtraFusionMaterialGroup or not aux.UsedExtraFusionMaterialGroup:IsContains(c)) end function s.frcheck(dc) return function(tp,sg,fc,original_mats,extra_mats,eset,extra_maxs,chk) return sg:FilterCount(s.fcheckfilter,nil,extra_mats,chk)<=dc end end function s.gcheck(dc) return function(sg) return sg:FilterCount(s.fcheckfilter,nil)<=dc end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil) local mg2=Duel.GetMatchingGroup(s.fexfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,nil) mg1:Merge(mg2) local res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) if not res then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg2=fgroup(ce,e,tp) local mf=ce:GetValue() res=Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf) end end return res end Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local dc=Duel.TossDice(tp,1) local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil):Filter(s.filter1,nil,e) local exmat=false local mg2=Duel.GetMatchingGroup(s.fexfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,nil):Filter(s.filter1,nil,e) if #mg2>0 then mg1:Merge(mg2) exmat=true end if exmat then aux.FCheckAdditional=s.frcheck(dc) aux.GCheckAdditional=s.gcheck(dc) end local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) aux.FCheckAdditional=nil aux.GCheckAdditional=nil local mg2=nil local sg2=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg2=fgroup(ce,e,tp) local mf=ce:GetValue() sg2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf) end if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then local sg=sg1:Clone() if sg2 then sg:Merge(sg2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if exmat then aux.FCheckAdditional=s.frcheck(dc) aux.GCheckAdditional=s.gcheck(dc) end local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) aux.FCheckAdditional=nil aux.GCheckAdditional=nil tc:SetMaterial(mat1) local rg=mat1:Filter(Card.IsLocation,nil,LOCATION_ONFIELD) mat1:Sub(rg) Duel.SendtoGrave(rg,REASON_EFFECT|REASON_MATERIAL|REASON_FUSION) if #mat1>0 then Duel.HintSelection(mat1) Duel.SendtoDeck(mat1,nil,SEQ_DECKSHUFFLE,REASON_EFFECT|REASON_MATERIAL|REASON_FUSION) end Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat2) end tc:CompleteProcedure() end end