1+ -- 混絶獄神ヴィードリウム
2+ -- Vidrium the Power Patron of Chaos Extermination
3+ -- scripted by Hatter
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ Pendulum .AddProcedure (c )
8+ -- Must be Special Summoned (from your face-up Extra Deck or GY) by returning 1 Fusion, 1 Synchro, and 1 Xyz Monster from your face-up field and/or GY to the Extra Deck
9+ c :AddMustBeSpecialSummoned ()
10+ local e0 = Effect .CreateEffect (c )
11+ e0 :SetDescription (aux .Stringid (id ,0 ))
12+ e0 :SetType (EFFECT_TYPE_FIELD )
13+ e0 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE )
14+ e0 :SetCode (EFFECT_SPSUMMON_PROC )
15+ e0 :SetRange (LOCATION_EXTRA |LOCATION_GRAVE )
16+ e0 :SetCondition (s .selfspcon )
17+ e0 :SetTarget (s .selfsptg )
18+ e0 :SetOperation (s .selfspop )
19+ c :RegisterEffect (e0 )
20+ -- Activate 1 of these effects
21+ local e1 = Effect .CreateEffect (c )
22+ e1 :SetDescription (aux .Stringid (id ,1 ))
23+ e1 :SetType (EFFECT_TYPE_IGNITION )
24+ e1 :SetRange (LOCATION_PZONE )
25+ e1 :SetCountLimit (1 ,{id ,0 })
26+ e1 :SetTarget (s .efftg )
27+ e1 :SetOperation (s .effop )
28+ c :RegisterEffect (e1 )
29+ -- If this card is added to your Extra Deck face-up: You can add 1 "Power Patron" card from your Deck to your hand
30+ local e2 = Effect .CreateEffect (c )
31+ e2 :SetDescription (aux .Stringid (id ,2 ))
32+ e2 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
33+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
34+ e2 :SetProperty (EFFECT_FLAG_DELAY )
35+ e2 :SetCode (EVENT_TO_DECK )
36+ e2 :SetCountLimit (1 ,{id ,1 })
37+ e2 :SetCondition (s .thcon )
38+ e2 :SetTarget (s .thtg )
39+ e2 :SetOperation (s .thop )
40+ c :RegisterEffect (e2 )
41+ -- If this card is Special Summoned: Banish (face-down) all cards from the GYs
42+ local e3 = Effect .CreateEffect (c )
43+ e3 :SetDescription (aux .Stringid (id ,3 ))
44+ e3 :SetCategory (CATEGORY_REMOVE )
45+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F )
46+ e3 :SetCode (EVENT_SPSUMMON_SUCCESS )
47+ e3 :SetTarget (s .rmtg )
48+ e3 :SetOperation (s .rmop )
49+ c :RegisterEffect (e3 )
50+ -- Unaffected by monster effects, except "Power Patron" monsters
51+ local e4 = Effect .CreateEffect (c )
52+ e4 :SetType (EFFECT_TYPE_SINGLE )
53+ e4 :SetProperty (EFFECT_FLAG_SINGLE_RANGE )
54+ e4 :SetCode (EFFECT_IMMUNE_EFFECT )
55+ e4 :SetRange (LOCATION_MZONE )
56+ e4 :SetValue (function (e ,te ) return te :IsMonsterEffect () and not te :GetOwner ():IsSetCard (SET_POWER_PATRON ) end )
57+ c :RegisterEffect (e4 )
58+ end
59+ s .listed_series = {SET_POWER_PATRON }
60+ local TYPES_FSX = TYPE_FUSION |TYPE_SYNCHRO |TYPE_XYZ
61+ function s .tdfilter (c )
62+ return c :IsType (TYPES_FSX ) and c :IsAbleToExtraAsCost ()
63+ end
64+ function s .tdrescon (sg ,e ,tp ,mg )
65+ return Duel .GetMZoneCount (tp ,sg )> 0 and sg :GetBitwiseOr (Card .GetType )&TYPES_FSX == TYPES_FSX
66+ end
67+ function s .selfspcon (e ,c )
68+ if c == nil then return true end
69+ local tp = e :GetHandlerPlayer ()
70+ local g = Duel .GetMatchingGroup (s .tdfilter ,tp ,LOCATION_MZONE |LOCATION_GRAVE ,0 ,nil )
71+ return aux .SelectUnselectGroup (g ,e ,tp ,3 ,3 ,s .tdrescon ,0 )
72+ end
73+ function s .selfsptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,c )
74+ local g = Duel .GetMatchingGroup (s .tdfilter ,tp ,LOCATION_MZONE |LOCATION_GRAVE ,0 ,nil )
75+ local rg = aux .SelectUnselectGroup (g ,e ,tp ,3 ,3 ,s .tdrescon ,1 ,tp ,HINTMSG_TODECK ,nil ,nil ,true )
76+ if # rg ~= 3 then return false end
77+ e :SetLabelObject (rg )
78+ return true
79+ end
80+ function s .selfspop (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
81+ local g = e :GetLabelObject ()
82+ Duel .HintSelection (g )
83+ Duel .SendtoDeck (g ,nil ,SEQ_DECKSHUFFLE ,REASON_COST )
84+ end
85+ function s .spfilter (c ,e ,tp )
86+ return c :IsSetCard (SET_POWER_PATRON ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
87+ end
88+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
89+ if chk == 0 then return true end
90+ local b1 = Duel .GetMZoneCount (tp )> 0 and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND |LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp )
91+ local op = Duel .SelectEffect (tp ,
92+ {b1 ,aux .Stringid (id ,4 )},
93+ {true ,aux .Stringid (id ,5 )})
94+ e :SetLabel (op )
95+ local c = e :GetHandler ()
96+ if op == 1 then
97+ e :SetCategory (CATEGORY_DESTROY + CATEGORY_SPECIAL_SUMMON )
98+ Duel .SetOperationInfo (0 ,CATEGORY_DESTROY ,c ,1 ,tp ,0 )
99+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_HAND |LOCATION_GRAVE )
100+ elseif op == 2 then
101+ e :SetCategory (CATEGORY_DESTROY )
102+ Duel .SetOperationInfo (0 ,CATEGORY_DESTROY ,c ,1 ,tp ,0 )
103+ end
104+ end
105+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
106+ local c = e :GetHandler ()
107+ local op = e :GetLabel ()
108+ if op == 1 then
109+ -- Destroy this card, and if you do, Special Summon 1 "Power Patron" monster from your hand or GY
110+ if c :IsRelateToEffect (e ) and Duel .Destroy (c ,REASON_EFFECT )> 0 and Duel .GetMZoneCount (tp )> 0 then
111+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
112+ local g = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .spfilter ),tp ,LOCATION_HAND |LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
113+ if # g > 0 then
114+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
115+ end
116+ end
117+ elseif op == 2 then
118+ -- Destroy this card, also this turn, "Power Patron" monsters you control whose original Level is 12 gain 5000 ATK
119+ if c :IsRelateToEffect (e ) then
120+ Duel .Destroy (c ,REASON_EFFECT )
121+ end
122+ aux .RegisterClientHint (c ,nil ,tp ,1 ,0 ,aux .Stringid (id ,6 ))
123+ -- "Power Patron" monsters you control whose original Level is 12 gain 5000 ATK
124+ local e1 = Effect .CreateEffect (c )
125+ e1 :SetType (EFFECT_TYPE_FIELD )
126+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
127+ e1 :SetTargetRange (LOCATION_MZONE ,0 )
128+ e1 :SetTarget (function (e ,c ) return c :IsSetCard (SET_POWER_PATRON ) and c :IsOriginalLevel (12 ) end )
129+ e1 :SetValue (5000 )
130+ e1 :SetReset (RESET_PHASE |PHASE_END )
131+ Duel .RegisterEffect (e1 ,tp )
132+ end
133+ end
134+ function s .thcon (e )
135+ local c = e :GetHandler ()
136+ return c :IsLocation (LOCATION_EXTRA ) and c :IsFaceup ()
137+ end
138+ function s .thfilter (c )
139+ return c :IsSetCard (SET_POWER_PATRON ) and c :IsAbleToHand ()
140+ end
141+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
142+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
143+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
144+ end
145+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
146+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
147+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
148+ if # g > 0 then
149+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
150+ Duel .ConfirmCards (1 - tp ,g )
151+ end
152+ end
153+ function s .rmtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
154+ if chk == 0 then return true end
155+ local g = Duel .GetMatchingGroup (Card .IsAbleToRemove ,tp ,LOCATION_GRAVE ,LOCATION_GRAVE ,nil ,nil ,POS_FACEDOWN )
156+ Duel .SetOperationInfo (0 ,CATEGORY_REMOVE ,g ,# g ,0 ,0 )
157+ end
158+ function s .rmop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
159+ local g = Duel .GetMatchingGroup (Card .IsAbleToRemove ,tp ,LOCATION_GRAVE ,LOCATION_GRAVE ,nil ,nil ,POS_FACEDOWN )
160+ if # g > 0 then
161+ Duel .Remove (g ,POS_FACEDOWN ,REASON_EFFECT )
162+ end
163+ end
0 commit comments