1+ -- 道化の一座 ハット
2+ -- Clown Crew Hat
3+ -- Scripted by Eerie Code
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ Pendulum .AddProcedure (c )
7+ -- During your Main Phase: You can send 1 "Clown Crew" card from your Deck to your GY, except a Pendulum Monster, and if you do, Special Summon this card, also you cannot activate the effects of monsters Special Summoned from the Deck or Extra Deck until the end of the next turn
8+ local e1 = Effect .CreateEffect (c )
9+ e1 :SetDescription (aux .Stringid (id ,0 ))
10+ e1 :SetCategory (CATEGORY_TOGRAVE + CATEGORY_SPECIAL_SUMMON )
11+ e1 :SetType (EFFECT_TYPE_IGNITION )
12+ e1 :SetRange (LOCATION_PZONE )
13+ e1 :SetTarget (s .gytg )
14+ e1 :SetOperation (s .gyop )
15+ e1 :SetCountLimit (1 ,{id ,0 })
16+ c :RegisterEffect (e1 )
17+ -- Monsters your opponent controls lose 1500 DEF while you control a Tribute Summoned monster
18+ local e2 = Effect .CreateEffect (c )
19+ e2 :SetType (EFFECT_TYPE_FIELD )
20+ e2 :SetCode (EFFECT_UPDATE_DEFENSE )
21+ e2 :SetRange (LOCATION_MZONE )
22+ e2 :SetTargetRange (0 ,LOCATION_MZONE )
23+ e2 :SetCondition (function (e ) return Duel .IsExistingMatchingCard (Card .IsTributeSummoned ,e :GetHandlerPlayer (),LOCATION_MZONE ,0 ,1 ,nil ) end )
24+ e2 :SetValue (- 1500 )
25+ c :RegisterEffect (e2 )
26+ -- If this card is Tributed: You can activate 1 of these effects (but you can only use each of these effects of "Clown Crew Hat" once per turn);
27+ local e3 = Effect .CreateEffect (c )
28+ e3 :SetDescription (aux .Stringid (id ,1 ))
29+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
30+ e3 :SetProperty (EFFECT_FLAG_DELAY )
31+ e3 :SetCode (EVENT_RELEASE )
32+ e3 :SetTarget (s .efftg )
33+ e3 :SetOperation (s .effop )
34+ c :RegisterEffect (e3 )
35+ end
36+ s .listed_series = {SET_CLOWN_CREW }
37+ function s .gyfilter (c )
38+ return c :IsSetCard (SET_CLOWN_CREW ) and not c :IsPendulumMonster () and c :IsAbleToGrave ()
39+ end
40+ function s .gytg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
41+ local c = e :GetHandler ()
42+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
43+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
44+ and Duel .IsExistingMatchingCard (s .gyfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
45+ Duel .SetOperationInfo (0 ,CATEGORY_TOGRAVE ,nil ,1 ,tp ,LOCATION_DECK )
46+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
47+ end
48+ function s .gyop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
49+ local c = e :GetHandler ()
50+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
51+ local g = Duel .SelectMatchingCard (tp ,s .gyfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
52+ if # g > 0 and Duel .SendtoGrave (g ,REASON_EFFECT )> 0 and c :IsRelateToEffect (e ) then
53+ Duel .SpecialSummon (c ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
54+ end
55+ -- You cannot activate the effects of monsters Special Summoned from the Deck or Extra Deck until the end of the next turn
56+ local e1 = Effect .CreateEffect (c )
57+ e1 :SetDescription (aux .Stringid (id ,2 ))
58+ e1 :SetType (EFFECT_TYPE_FIELD )
59+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
60+ e1 :SetCode (EFFECT_CANNOT_ACTIVATE )
61+ e1 :SetTargetRange (1 ,0 )
62+ e1 :SetValue (s .actval )
63+ e1 :SetReset (RESET_PHASE |PHASE_END ,2 )
64+ Duel .RegisterEffect (e1 ,tp )
65+ end
66+ function s .actval (e ,re ,tp )
67+ local rc = re :GetHandler ()
68+ return re :IsMonsterEffect () and rc :IsLocation (LOCATION_MZONE ) and rc :IsSummonLocation (LOCATION_DECK |LOCATION_EXTRA )
69+ end
70+ function s .spfilter (c ,e ,tp )
71+ if c :IsLocation (LOCATION_DECK ) and Duel .GetLocationCount (tp ,LOCATION_MZONE )<= 0 then return false end
72+ if c :IsLocation (LOCATION_EXTRA ) and Duel .GetLocationCountFromEx (tp ,tp ,nil ,c )<= 0 then return false end
73+ return c :IsSetCard (SET_CLOWN_CREW ) and not c :IsPendulumMonster () and c :IsCanBeSpecialSummoned (e ,0 ,tp ,true ,false )
74+ end
75+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
76+ local b1 = not Duel .HasFlagEffect (tp ,id )
77+ and Duel .IsExistingMatchingCard (aux .AND (Card .IsPendulumMonster ,Card .IsFaceup ,Card .IsAbleToDeck ),tp ,LOCATION_MZONE |LOCATION_EXTRA ,LOCATION_MZONE |LOCATION_EXTRA ,1 ,nil )
78+ local b2 = not Duel .HasFlagEffect (tp ,id + 100 )
79+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp )
80+ if chk == 0 then return b1 or b2 end
81+ local op = Duel .SelectEffect (tp ,
82+ {b1 ,aux .Stringid (id ,3 )},
83+ {b2 ,aux .Stringid (id ,4 )})
84+ e :SetLabel (op )
85+ if op == 1 then
86+ Duel .RegisterFlagEffect (tp ,id ,RESET_PHASE |PHASE_END ,0 ,1 )
87+ e :SetCategory (CATEGORY_TODECK )
88+ Duel .SetOperationInfo (0 ,CATEGORY_TODECK ,nil ,1 ,PLAYER_ALL ,LOCATION_MZONE |LOCATION_EXTRA )
89+ elseif op == 2 then
90+ Duel .RegisterFlagEffect (tp ,id + 100 ,RESET_PHASE |PHASE_END ,0 ,1 )
91+ e :SetCategory (CATEGORY_SPECIAL_SUMMON )
92+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK |LOCATION_EXTRA )
93+ end
94+ end
95+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
96+ local op = e :GetLabel ()
97+ if op == 1 then
98+ -- ● Shuffle all Pendulum Monsters on the field and face-up Extra Decks into the Deck
99+ local g = Duel .GetMatchingGroup (aux .AND (Card .IsPendulumMonster ,Card .IsFaceup ,Card .IsAbleToDeck ),tp ,LOCATION_MZONE |LOCATION_EXTRA ,LOCATION_MZONE |LOCATION_EXTRA ,nil )
100+ if # g > 0 then
101+ Duel .SendtoDeck (g ,nil ,SEQ_DECKSHUFFLE ,REASON_EFFECT )
102+ end
103+ elseif op == 2 then
104+ -- ● Special Summon 1 non-Pendulum "Clown Crew" monster from your Deck or Extra Deck, ignoring its Summoning conditions
105+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
106+ local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_DECK |LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp )
107+ if # g > 0 then
108+ Duel .SpecialSummon (g ,0 ,tp ,tp ,true ,false ,POS_FACEUP )
109+ end
110+ end
111+ end
0 commit comments