--Zerost Null --Zerost Nullo --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 hand or field as Fusion Material. You can also use "Zerost" monsters from your Deck as Fusion Material up to the result.]] local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DICE|CATEGORIES_FUSION_SUMMON|CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT(true) 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:IsType(TYPE_MONSTER) and c:IsSetCard(ARCHE_ZEROST) and c:IsCanBeFusionMaterial() and c:IsAbleToGrave() end function s.fcheckfilter(c,extra_mats,chk) return c:IsLocation(LOCATION_DECK) 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) local mg2=Duel.GetMatchingGroup(s.fexfilter,tp,LOCATION_DECK,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(s.filter1,nil,e) local exmat=false local mg2=Duel.GetMatchingGroup(s.fexfilter,tp,LOCATION_DECK,0,nil) 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) Duel.SendtoGrave(mat1,REASON_EFFECT|REASON_MATERIAL|REASON_FUSION) 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