1+ -- 超量士ブラックレイヤー
2+ -- Super Quantum Black Layer
3+ -- scripted by Hatter
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Discard 1 other card, and if you do, Special Summon this card from your hand
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_HANDES + CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_QUICK_O )
11+ e1 :SetCode (EVENT_CHAINING )
12+ e1 :SetRange (LOCATION_HAND )
13+ e1 :SetCountLimit (1 ,id )
14+ e1 :SetCondition (function (e ,tp ,eg ,ep ,ev ,re ,r ,rp ) return rp == 1 - tp and re :IsMonsterEffect () end )
15+ e1 :SetTarget (s .selfsptg )
16+ e1 :SetOperation (s .selfspop )
17+ c :RegisterEffect (e1 )
18+ -- Special Summon 1 "Super Quantal Mech Beast" Xyz Monster from your Extra Deck
19+ local e2 = Effect .CreateEffect (c )
20+ e2 :SetDescription (aux .Stringid (id ,1 ))
21+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
22+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
23+ e2 :SetProperty (EFFECT_FLAG_DELAY )
24+ e2 :SetCode (EVENT_SPSUMMON_SUCCESS )
25+ e2 :SetCountLimit (1 ,{id ,1 })
26+ e2 :SetTarget (s .xyzsptg )
27+ e2 :SetOperation (s .xyzspop )
28+ c :RegisterEffect (e2 )
29+ -- Add 1 "Super Quant" Spell from your Deck to your hand
30+ local e3 = Effect .CreateEffect (c )
31+ e3 :SetDescription (aux .Stringid (id ,2 ))
32+ e3 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
33+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
34+ e3 :SetProperty (EFFECT_FLAG_DELAY )
35+ e3 :SetCode (EVENT_TO_GRAVE )
36+ e3 :SetCountLimit (1 ,{id ,2 })
37+ e3 :SetTarget (s .thtg )
38+ e3 :SetOperation (s .thop )
39+ c :RegisterEffect (e3 )
40+ end
41+ s .listed_series = {SET_SUPER_QUANT ,SET_SUPER_QUANTAL_MECH_BEAST }
42+ function s .selfsptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
43+ local c = e :GetHandler ()
44+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsDiscardable ,tp ,LOCATION_HAND ,0 ,1 ,c ,REASON_EFFECT )
45+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
46+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )end
47+ Duel .SetOperationInfo (0 ,CATEGORY_HANDES ,nil ,0 ,tp ,1 )
48+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
49+ end
50+ function s .selfspop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
51+ local c = e :GetHandler ()
52+ local exc = c :IsRelateToEffect (e ) and c or nil
53+ if Duel .DiscardHand (tp ,Card .IsDiscardable ,1 ,1 ,REASON_EFFECT |REASON_DISCARD ,exc )> 0 and c :IsRelateToEffect (e ) then
54+ Duel .SpecialSummon (c ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
55+ end
56+ end
57+ function s .xyzspfilter (c ,e ,tp ,mc ,chk_att )
58+ return c :IsSetCard (SET_SUPER_QUANTAL_MECH_BEAST ) and c :IsType (TYPE_XYZ ,c ,SUMMON_TYPE_XYZ ,tp ) and mc :IsCanBeXyzMaterial (c ,tp )
59+ and Duel .GetLocationCountFromEx (tp ,tp ,mc ,c )> 0 and c :IsCanBeSpecialSummoned (e ,SUMMON_TYPE_XYZ ,tp ,false ,false )
60+ and (not chk_att or Duel .IsExistingMatchingCard (s .attachfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,tp ,c ))
61+ end
62+ function s .attachfilter (c ,tp ,xc )
63+ return c :IsSetCard (SET_SUPER_QUANT ) and c :IsMonster () and c :IsCanBeXyzMaterial (xc ,tp ,REASON_EFFECT )
64+ end
65+ function s .xyzsptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
66+ if chk == 0 then
67+ local c = e :GetHandler ()
68+ local pg = aux .GetMustBeMaterialGroup (tp ,Group .FromCards (c ),tp ,nil ,nil ,REASON_XYZ )
69+ return (# pg <= 0 or (# pg == 1 and pg :IsContains (c )))
70+ and Duel .IsExistingMatchingCard (s .xyzspfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp ,c ,true )
71+ end
72+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_EXTRA )
73+ Duel .SetOperationInfo (0 ,CATEGORY_LEAVE_GRAVE ,nil ,1 ,tp ,0 )
74+ end
75+ function s .xyzspop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
76+ local c = e :GetHandler ()
77+ if c :IsFacedown () or not c :IsRelateToEffect (e ) or c :IsControler (1 - tp ) or c :IsImmuneToEffect (e ) then return end
78+ local pg = aux .GetMustBeMaterialGroup (tp ,Group .FromCards (c ),tp ,nil ,nil ,REASON_XYZ )
79+ if # pg > 1 or (# pg == 1 and not pg :IsContains (c )) then return end
80+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
81+ local xc = Duel .SelectMatchingCard (tp ,s .xyzspfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ,c ,false ):GetFirst ()
82+ if not xc then return end
83+ xc :SetMaterial (c )
84+ Duel .Overlay (xc ,c )
85+ if Duel .SpecialSummon (xc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,false ,POS_FACEUP )== 0 then return end
86+ xc :CompleteProcedure ()
87+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATTACH )
88+ local ac = Duel .SelectMatchingCard (tp ,s .attachfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,tp ,xc ):GetFirst ()
89+ if ac then
90+ Duel .Overlay (xc ,ac )
91+ end
92+ end
93+ function s .thfilter (c )
94+ return c :IsSetCard (SET_SUPER_QUANT ) and c :IsSpell () and c :IsAbleToHand ()
95+ end
96+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
97+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
98+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
99+ end
100+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
101+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
102+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
103+ if # g > 0 then
104+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
105+ Duel .ConfirmCards (1 - tp ,g )
106+ end
107+ end
0 commit comments