1+ -- 黒き竜のエクレシア
2+ -- Ecclesia of the Black Dragon
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ -- Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters
8+ Synchro .AddProcedure (c ,nil ,1 ,1 ,Synchro .NonTuner (nil ),1 ,99 )
9+ -- Banish this card (until the End Phase), and if you do, Special Summon 1 "Fallen of Albaz" or 1 Level 4 or lower monster that mentions it from your Deck or GY
10+ local e1 = Effect .CreateEffect (c )
11+ e1 :SetDescription (aux .Stringid (id ,0 ))
12+ e1 :SetCategory (CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON )
13+ e1 :SetType (EFFECT_TYPE_QUICK_O )
14+ e1 :SetCode (EVENT_FREE_CHAIN )
15+ e1 :SetRange (LOCATION_MZONE )
16+ e1 :SetCountLimit (1 ,{id ,0 })
17+ e1 :SetCondition (function () return Duel .IsMainPhase () end )
18+ e1 :SetTarget (s .rmsptg )
19+ e1 :SetOperation (s .rmspop )
20+ e1 :SetHintTiming (0 ,TIMING_MAIN_END |TIMINGS_CHECK_MONSTER )
21+ c :RegisterEffect (e1 )
22+ -- Shuffle both 1 Level 8 Fusion Monster in your GY or banishment and 1 card on the field, and this card into the Deck
23+ local e2 = Effect .CreateEffect (c )
24+ e2 :SetDescription (aux .Stringid (id ,1 ))
25+ e2 :SetCategory (CATEGORY_TODECK + CATEGORY_TOEXTRA )
26+ e2 :SetType (EFFECT_TYPE_IGNITION )
27+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
28+ e2 :SetRange (LOCATION_GRAVE )
29+ e2 :SetCountLimit (1 ,{id ,1 })
30+ e2 :SetTarget (s .tdtg )
31+ e2 :SetOperation (s .tdop )
32+ c :RegisterEffect (e2 )
33+ end
34+ s .listed_names = {CARD_ALBAZ }
35+ function s .spfilter (c ,e ,tp )
36+ return (c :IsCode (CARD_ALBAZ ) or (c :IsLevelBelow (4 ) and c :ListsCode (CARD_ALBAZ ))) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
37+ end
38+ function s .rmsptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
39+ local c = e :GetHandler ()
40+ if chk == 0 then return c :IsAbleToRemove () and Duel .GetMZoneCount (tp ,c )> 0
41+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK |LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp ) end
42+ Duel .SetOperationInfo (0 ,CATEGORY_REMOVE ,c ,1 ,tp ,0 )
43+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK |LOCATION_GRAVE )
44+ end
45+ function s .rmspop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
46+ local c = e :GetHandler ()
47+ if c :IsRelateToEffect (e ) and aux .RemoveUntil (c ,nil ,REASON_EFFECT ,PHASE_END ,id ,e ,tp ,aux .DefaultFieldReturnOp )
48+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 then
49+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
50+ local g = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .spfilter ),tp ,LOCATION_DECK |LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
51+ if # g > 0 then
52+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
53+ end
54+ end
55+ end
56+ function s .fustdfilter (c ,e )
57+ return c :IsLevel (8 ) and c :IsFusionMonster () and c :IsFaceup () and c :IsAbleToExtra () and c :IsCanBeEffectTarget (e )
58+ end
59+ function s .fieldtdfilter (c ,e )
60+ return c :IsAbleToDeck () and c :IsCanBeEffectTarget (e )
61+ end
62+ function s .tdtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
63+ if chkc then return false end
64+ local c = e :GetHandler ()
65+ if chk == 0 then return c :IsAbleToExtra ()
66+ and Duel .IsExistingMatchingCard (s .fustdfilter ,tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,c ,e )
67+ and Duel .IsExistingMatchingCard (s .fieldtdfilter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,nil ,e ) end
68+ local fusiong = Group .CreateGroup ()
69+ local fieldg = Group .CreateGroup ()
70+ repeat
71+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
72+ fusiong = Duel .SelectMatchingCard (tp ,s .fustdfilter ,tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,1 ,c ,e )
73+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
74+ fieldg = Duel .SelectMatchingCard (tp ,s .fieldtdfilter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,1 ,true ,nil ,e )
75+ until fieldg ~= nil
76+ local tg = fusiong :Merge (fieldg )
77+ Duel .SetTargetCard (tg )
78+ Duel .SetOperationInfo (0 ,CATEGORY_TODECK ,tg + c ,3 ,tp ,0 )
79+ end
80+ function s .tdop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
81+ local c = e :GetHandler ()
82+ local tg = Duel .GetTargetCards (e )
83+ if c :IsRelateToEffect (e ) and # tg == 2 then
84+ Duel .SendtoDeck (tg + c ,nil ,SEQ_DECKSHUFFLE ,REASON_EFFECT )
85+ end
86+ end
0 commit comments