--[[ Abyss Script - Origin Story Card Author: Cosmicfab Scripted by: XGlitchy30 ]] local s,id,o=GetID() function s.initial_effect(c) aux.AddSetNameMonsterList(c,0x10ec) --[[Fusion Summon 1 "Abyss Actor" Fusion Monster from your Extra Deck, using monsters you control and/or by using cards in your Pendulum Zones as Fusion Material. If your opponent controls a monster, you can also shuffle "Abyss Actor" Pendulum Monsters from the Extra Deck to the Main Deck as Fusion Material.]] local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON|CATEGORY_FUSION_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --[[If this Set card in its owner's control is destroyed by an opponent's card effect, and you have a face-up "Abyss Actor" Pendulum Monster in your Extra Deck: You can Special Summon 1 of your "Abyss Actor" monsters that is banished or in your Extra Deck, then you can shuffle 1 of your opponent's cards that are banished or in their GY into the Deck."]] local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON|CATEGORY_TODECK|CATEGORY_GRAVE_ACTION) e2:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end --E1 function s.filter0(c,e) return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) end function s.filter1(c,e) return c:IsOnField() and not c:IsImmuneToEffect(e) end function s.tdfilter(c,e) return c:IsFaceup() and c:IsMonster(TYPE_PENDULUM) and c:IsSetCard(0x10ec) and c:IsCanBeFusionMaterial() and c:IsAbleToDeck() and not c:IsImmuneToEffect(e) end function s.filter2(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsSetCard(0x10ec) 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.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):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) local mgp=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_PZONE,0,nil,e) mg1:Merge(mgp) if Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 then local mge=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_EXTRA,0,nil,e) mg1:Merge(mge) end 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_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,0,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsOnField,nil):Filter(aux.NOT(Card.IsImmuneToEffect),nil,e) local mgp=Duel.GetMatchingGroup(s.filter0,tp,LOCATION_PZONE,0,nil,e) mg1:Merge(mgp) if Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 then local mge=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_EXTRA,0,nil,e) mg1:Merge(mge) end local sg1=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) 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>0 or (sg2~=nil and #sg2>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 local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) tc:SetMaterial(mat1) local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_EXTRA) mat1:Sub(mat2) if #mat2>0 then Duel.HintSelection(mat2) end Duel.SendtoGrave(mat1,REASON_EFFECT|REASON_MATERIAL|REASON_FUSION) Duel.SendtoDeck(mat2,nil,SEQ_DECKSHUFFLE,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 --E2 function s.edfilter(c) return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsSetCard(0x10ec) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) end function s.spfilter(c,e,tp) return c:NotBanishedOrFaceup() and c:IsSetCard(0x10ec) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetMZoneCountFromLocation(tp,tp,nil,c)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED|LOCATION_EXTRA,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(s.edfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED|LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_REMOVED|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED|LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(aux.Necro(Card.IsAbleToDeck),tp,0,LOCATION_REMOVED|LOCATION_GRAVE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local tg=Duel.SelectMatchingCard(tp,aux.Necro(Card.IsAbleToDeck),tp,0,LOCATION_REMOVED|LOCATION_GRAVE,1,1,nil) if #tg>0 then Duel.HintSelection(tg) Duel.BreakEffect() Duel.SendtoDeck(tg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end end