33-- Scripted by Eerie Code
44local s ,id = GetID ()
55function s .initial_effect (c )
6- -- Activate
6+ -- Reveal it during the Draw Phase
77 local e1 = Effect .CreateEffect (c )
88 e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS )
99 e1 :SetCode (EVENT_DRAW )
1010 e1 :SetCondition (s .regcon )
1111 e1 :SetOperation (s .regop )
1212 c :RegisterEffect (e1 )
13+ -- Activate 1 of these effects
1314 local e2 = Effect .CreateEffect (c )
1415 e2 :SetType (EFFECT_TYPE_ACTIVATE )
1516 e2 :SetCode (EVENT_FREE_CHAIN )
1617 e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
17- e2 :SetCondition (s . condition )
18+ e2 :SetCondition (function () return Duel . IsPhase ( PHASE_MAIN1 ) end )
1819 e2 :SetCost (s .cost )
1920 e2 :SetTarget (s .target )
21+ e2 :SetOperation (s .operation )
2022 c :RegisterEffect (e2 )
2123end
2224s .listed_series = {SET_UTOPIA ,SET_ZW }
@@ -35,17 +37,14 @@ function s.regop(e,tp,eg,ep,ev,re,r,rp)
3537 c :RegisterFlagEffect (id ,RESET_EVENT |RESETS_STANDARD |RESET_PHASE |PHASE_MAIN1 ,EFFECT_FLAG_CLIENT_HINT ,1 ,0 ,66 )
3638 end
3739end
38- function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
39- return Duel .IsPhase (PHASE_MAIN1 )
40- end
4140function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
4241 if chk == 0 then return e :GetHandler ():GetFlagEffect (id )~= 0 end
4342end
44- function s .filter (c )
43+ function s .utopiafilter (c )
4544 return c :IsFaceup () and c :IsType (TYPE_XYZ ) and c :IsSetCard (SET_UTOPIA )
4645end
47- function s .filter2 (c ,e ,tp )
48- return s .filter (c ) and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp ,c )
46+ function s .utopiafilter2 (c ,e ,tp )
47+ return s .utopiafilter (c ) and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp ,c )
4948end
5049function s .spfilter (c ,e ,tp ,mc )
5150 if c .rum_limit and not c .rum_limit (mc ,e ) then return false end
5857function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
5958 if chkc then
6059 local b = chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_MZONE )
61- if e :GetLabel ()== 0 then return b and s .filter (chkc )
62- else return b and s .filter2 (chkc ,e ,tp ) end
60+ if e :GetLabel ()== 0 then
61+ return b and s .utopiafilter (chkc )
62+ else
63+ return b and s .filter2 (chkc ,e ,tp )
64+ end
6365 end
6466 local ct = Duel .GetLocationCount (tp ,LOCATION_SZONE )
65- local b1 = Duel .IsExistingTarget (s .filter ,tp ,LOCATION_MZONE ,0 ,1 ,nil ) and Duel .IsExistingMatchingCard (s .eqfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,1 ,nil ,tp ) and (ct > 1 or (ct > 0 and not e :GetHandler ():IsLocation (LOCATION_HAND )))
66- local b2 = Duel .IsExistingTarget (s .filter2 ,tp ,LOCATION_MZONE ,0 ,1 ,nil ,e ,tp )
67+ if e :GetHandler ():IsLocation (LOCATION_HAND ) then ct = ct - 1 end
68+ local b1 = Duel .IsExistingTarget (s .utopiafilter ,tp ,LOCATION_MZONE ,0 ,1 ,nil )
69+ and ct >= 1 and Duel .IsExistingMatchingCard (s .eqfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,1 ,nil ,tp )
70+ local b2 = Duel .IsExistingTarget (s .utopiafilter2 ,tp ,LOCATION_MZONE ,0 ,1 ,nil ,e ,tp )
6771 if chk == 0 then return b1 or b2 end
68- local op = 0
69- if b1 and b2 then
70- op = Duel .SelectOption (tp ,aux .Stringid (id ,1 ),aux .Stringid (id ,2 ))
71- elseif b1 then
72- op = Duel .SelectOption (tp ,aux .Stringid (id ,1 ))
73- else
74- op = Duel .SelectOption (tp ,aux .Stringid (id ,2 ))+ 1
75- end
72+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
73+ Duel .SelectTarget (tp ,s .utopiafilter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil )
74+ local op = Duel .SelectEffect (tp ,
75+ {b1 ,aux .Stringid (id ,1 )},
76+ {b2 ,aux .Stringid (id ,2 )})
7677 e :SetLabel (op )
77- if op == 0 then
78+ if op == 1 then
7879 e :SetCategory (CATEGORY_EQUIP )
79- e :SetOperation (s .eqop )
80- Duel .SelectTarget (tp ,s .filter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil )
81- else
82- e :SetCategory (0 )
83- e :SetOperation (s .spop )
84- Duel .SelectTarget (tp ,s .filter2 ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil ,e ,tp )
80+ Duel .SetOperationInfo (0 ,CATEGORY_EQUIP ,nil ,1 ,tp ,LOCATION_DECK |LOCATION_EXTRA )
81+ elseif op == 2 then
82+ e :SetCategory (CATEGORY_SPECIAL_SUMMON )
83+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_EXTRA )
8584 end
8685end
87- function s .eqop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
86+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
87+ local op = e :GetLabel ()
8888 local tc = Duel .GetFirstTarget ()
89- local ft = Duel .GetLocationCount (tp ,LOCATION_SZONE )
90- local g = Duel .GetMatchingGroup (s .eqfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,nil ,tp )
91- if tc :IsFaceup () and tc :IsRelateToEffect (e ) and # g > 0 and ft > 0 then
92- local sg = aux .SelectUnselectGroup (g ,e ,tp ,1 ,ft ,aux .dncheck ,1 ,tp ,HINTMSG_EQUIP )
93- local sc = sg :GetFirst ()
94- for sc in aux .Next (sg ) do
95- Duel .Equip (tp ,sc ,tc ,true )
96- local e1 = Effect .CreateEffect (e :GetHandler ())
97- e1 :SetType (EFFECT_TYPE_SINGLE )
98- e1 :SetCode (EFFECT_EQUIP_LIMIT )
99- e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
100- e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
101- e1 :SetValue (s .eqlimit )
102- e1 :SetLabelObject (tc )
103- sc :RegisterEffect (e1 )
89+ if tc :IsFacedown () or not tc :IsRelateToEffect (e ) then return end
90+ if op == 1 then
91+ -- Equip any number of "ZW -" monsters with different names from your Deck/Extra Deck to it
92+ local ft = Duel .GetLocationCount (tp ,LOCATION_SZONE )
93+ local g = Duel .GetMatchingGroup (s .eqfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,nil ,tp )
94+ if # g > 0 and ft > 0 then
95+ local sg = aux .SelectUnselectGroup (g ,e ,tp ,1 ,ft ,aux .dncheck ,1 ,tp ,HINTMSG_EQUIP )
96+ for sc in sg :Iter () do
97+ Duel .Equip (tp ,sc ,tc ,true )
98+ local e1 = Effect .CreateEffect (e :GetHandler ())
99+ e1 :SetType (EFFECT_TYPE_SINGLE )
100+ e1 :SetCode (EFFECT_EQUIP_LIMIT )
101+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
102+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
103+ e1 :SetValue (s .eqlimit )
104+ e1 :SetLabelObject (tc )
105+ sc :RegisterEffect (e1 )
106+ end
107+ Duel .EquipComplete ()
108+ end
109+ elseif op == 2 then
110+ -- Special Summon from your Extra Deck, 1 "Utopia" Xyz Monster with a different name from that target, by using that target as material
111+ if tc :IsControler (1 - tp ) or tc :IsImmuneToEffect (e ) then return end
112+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
113+ local sc = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ,tc ):GetFirst ()
114+ if sc then
115+ sc :SetMaterial (tc )
116+ Duel .Overlay (sc ,tc )
117+ Duel .SpecialSummon (sc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,false ,POS_FACEUP )
118+ sc :CompleteProcedure ()
104119 end
105- Duel .EquipComplete ()
106120 end
107121end
108122function s .eqlimit (e ,c )
109123 return c == e :GetLabelObject ()
110- end
111- function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
112- local tc = Duel .GetFirstTarget ()
113- if not tc or tc :IsFacedown () or not tc :IsRelateToEffect (e ) or tc :IsControler (1 - tp ) or tc :IsImmuneToEffect (e ) then return end
114- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
115- local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ,tc )
116- local sc = g :GetFirst ()
117- if sc then
118- sc :SetMaterial (tc )
119- Duel .Overlay (sc ,tc )
120- Duel .SpecialSummon (sc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,false ,POS_FACEUP )
121- sc :CompleteProcedure ()
122- end
123124end
0 commit comments