1+ -- 獄神機Doom-Z
2+ -- Power Patron Machine Doom-Z
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- You cannot Special Summon from the Extra Deck, except Xyz Monsters
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetType (EFFECT_TYPE_FIELD )
9+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
10+ e1 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetTargetRange (1 ,0 )
13+ e1 :SetTarget (function (e ,c ) return c :IsLocation (LOCATION_EXTRA ) and not c :IsType (TYPE_XYZ ) end )
14+ c :RegisterEffect (e1 )
15+ aux .addContinuousLizardCheck (c ,LOCATION_MZONE ,function (e ,c ) return not c :IsOriginalType (TYPE_XYZ ) end )
16+ -- Special Summon from your Extra Deck, 1 "Doom-Z" Xyz Monster or "Jupiter the Power Patron of Destruction" by using another Effect monster as material
17+ local e2 = Effect .CreateEffect (c )
18+ e2 :SetDescription (aux .Stringid (id ,0 ))
19+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
20+ e2 :SetType (EFFECT_TYPE_IGNITION )
21+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
22+ e2 :SetRange (LOCATION_MZONE )
23+ e2 :SetCountLimit (1 ,id )
24+ e2 :SetTarget (s .sptg )
25+ e2 :SetOperation (s .spop )
26+ c :RegisterEffect (e2 )
27+ -- Add 1 "Doom-Z" card from your Deck to your hand
28+ local e3 = Effect .CreateEffect (c )
29+ e3 :SetDescription (aux .Stringid (id ,1 ))
30+ e3 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
31+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
32+ e3 :SetProperty (EFFECT_FLAG_DELAY )
33+ e3 :SetCode (EVENT_DESTROYED )
34+ e3 :SetCountLimit (1 ,{id ,1 })
35+ e3 :SetTarget (s .thtg )
36+ e3 :SetOperation (s .thop )
37+ c :RegisterEffect (e3 )
38+ end
39+ s .listed_series = {SET_DOOM_Z }
40+ s .listed_names = {101302044 } -- "Jupiter the Power Patron of Destruction"
41+ function s .xyzmatfilter (c ,e ,tp )
42+ local mustg = aux .GetMustBeMaterialGroup (tp ,Group .FromCards (c ),tp ,nil ,nil ,REASON_XYZ )
43+ return # mustg <= 1 and c :IsFaceup () and c :IsType (TYPE_EFFECT ) and c :HasLevel ()
44+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp ,c ,c :GetLevel (),mustg )
45+ end
46+ function s .spfilter (c ,e ,tp ,mc ,lv ,mustg )
47+ return c :IsType (TYPE_XYZ ) and (c :IsSetCard (SET_DOOM_Z ) or c :IsCode (101302044 ))
48+ and c :IsRank (lv ) and mc :IsCanBeXyzMaterial (c ,tp ) and c :IsCanBeSpecialSummoned (e ,SUMMON_TYPE_XYZ ,tp ,false ,false )
49+ and (# mustg <= 0 or mustg :IsContains (mc )) and Duel .GetLocationCountFromEx (tp ,tp ,mc ,c )> 0
50+ end
51+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
52+ local c = e :GetHandler ()
53+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_MZONE ) and chkc ~= c and s .xyzmatfilter (chkc ,e ,tp )end
54+ if chk == 0 then return Duel .IsExistingTarget (s .xyzmatfilter ,tp ,LOCATION_MZONE ,0 ,1 ,c ,e ,tp ) end
55+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
56+ Duel .SelectTarget (tp ,s .xyzmatfilter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,c ,e ,tp )
57+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_EXTRA )
58+ Duel .SetOperationInfo (0 ,CATEGORY_EQUIP ,c ,1 ,tp ,LOCATION_MZONE )
59+ end
60+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
61+ local tc = Duel .GetFirstTarget ()
62+ if not (tc :IsRelateToEffect (e ) and tc :IsFaceup () and tc :IsControler (tp ) and not tc :IsImmuneToEffect (e )) then return end
63+ local mustg = aux .GetMustBeMaterialGroup (tp ,Group .FromCards (tc ),tp ,nil ,nil ,REASON_XYZ )
64+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
65+ local sc = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ,tc ,tc :GetLevel (),mustg ):GetFirst ()
66+ if sc then
67+ sc :SetMaterial (tc )
68+ Duel .Overlay (sc ,tc )
69+ if Duel .SpecialSummon (sc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,false ,POS_FACEUP )== 0 then return end
70+ sc :CompleteProcedure ()
71+ local c = e :GetHandler ()
72+ if c :IsRelateToEffect (e ) and c :IsControler (tp ) and Duel .Equip (tp ,c ,sc ) then
73+ -- Equip limit
74+ local e1 = Effect .CreateEffect (c )
75+ e1 :SetType (EFFECT_TYPE_SINGLE )
76+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
77+ e1 :SetCode (EFFECT_EQUIP_LIMIT )
78+ e1 :SetValue (1 )
79+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
80+ c :RegisterEffect (e1 )
81+ end
82+ end
83+ end
84+ function s .thfilter (c )
85+ return c :IsSetCard (SET_DOOM_Z ) and c :IsAbleToHand ()
86+ end
87+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
88+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
89+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
90+ end
91+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
92+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
93+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
94+ if # g > 0 then
95+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
96+ Duel .ConfirmCards (1 - tp ,g )
97+ end
98+ end
0 commit comments