1+ -- WAKE CUP! マキ
2+ -- WAKE CUP! Macchi
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Send 1 face-down card on the field to the GY
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOGRAVE )
10+ e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
11+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
12+ e1 :SetCode (EVENT_PHASE + PHASE_END )
13+ e1 :SetRange (LOCATION_MZONE )
14+ e1 :SetCountLimit (1 )
15+ e1 :SetCondition (function (e ,tp ) return Duel .IsTurnPlayer (tp ) end )
16+ e1 :SetTarget (s .tgtg )
17+ e1 :SetOperation (s .tgop )
18+ c :RegisterEffect (e1 )
19+ -- Special Summon both this card and 1 other Flip monster from your hand in face-down Defense Position
20+ local e2 = Effect .CreateEffect (c )
21+ e2 :SetDescription (aux .Stringid (id ,1 ))
22+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
23+ e2 :SetType (EFFECT_TYPE_IGNITION )
24+ e2 :SetRange (LOCATION_HAND )
25+ e2 :SetCountLimit (1 ,id )
26+ e2 :SetCost (s .spcost )
27+ e2 :SetTarget (s .sptg )
28+ e2 :SetOperation (s .spop )
29+ c :RegisterEffect (e2 )
30+ -- Change 1 face-down Defense Position monster on the field to face-up Attack Position
31+ local e3 = Effect .CreateEffect (c )
32+ e3 :SetDescription (aux .Stringid (id ,2 ))
33+ e3 :SetCategory (CATEGORY_POSITION )
34+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F )
35+ e3 :SetProperty (EFFECT_FLAG_CARD_TARGET )
36+ e3 :SetCode (EVENT_FLIP )
37+ e3 :SetCountLimit (1 ,{id ,1 })
38+ e3 :SetTarget (s .postg )
39+ e3 :SetOperation (s .posop )
40+ c :RegisterEffect (e3 )
41+ end
42+ function s .tgtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
43+ if chkc then return chkc :IsOnField () and chkc :IsFacedown () and chkc :IsAbleToGrave () end
44+ if chk == 0 then return Duel .IsExistingTarget (aux .AND (Card .IsFacedown ,Card .IsAbleToGrave ),tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,nil ) end
45+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
46+ local g = Duel .SelectTarget (tp ,aux .AND (Card .IsFacedown ,Card .IsAbleToGrave ),tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,1 ,nil )
47+ Duel .SetOperationInfo (0 ,CATEGORY_TOGRAVE ,g ,1 ,tp ,0 )
48+ end
49+ function s .tgop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
50+ local tc = Duel .GetFirstTarget ()
51+ if tc :IsRelateToEffect (e ) then
52+ Duel .SendtoGrave (tc ,REASON_EFFECT )
53+ end
54+ end
55+ function s .spcostfilter (c ,e ,tp )
56+ return c :IsType (TYPE_FLIP ) and not c :IsPublic () and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEDOWN_DEFENSE )
57+ end
58+ function s .spcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
59+ local c = e :GetHandler ()
60+ if chk == 0 then return not c :IsPublic () and Duel .IsExistingMatchingCard (s .spcostfilter ,tp ,LOCATION_HAND ,0 ,1 ,c ,e ,tp ) end
61+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_CONFIRM )
62+ local rc = Duel .SelectMatchingCard (tp ,s .spcostfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,c ,e ,tp ):GetFirst ()
63+ Duel .ConfirmCards (1 - tp ,Group .FromCards (c ,rc ))
64+ e :SetLabelObject (rc )
65+ rc :CreateEffectRelation (e )
66+ Duel .ShuffleHand (tp )
67+ end
68+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
69+ local c = e :GetHandler ()
70+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )>= 2
71+ and not Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT )
72+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEDOWN_DEFENSE ) end
73+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,Group .FromCards (c ,e :GetLabelObject ()),2 ,tp ,0 )
74+ end
75+ function s .spfilter (c ,e ,tp )
76+ return c :IsRelateToEffect (e ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEDOWN_DEFENSE )
77+ end
78+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
79+ local c = e :GetHandler ()
80+ local g = Group .FromCards (c ,e :GetLabelObject ())
81+ if g :FilterCount (s .spfilter ,nil ,e ,tp )== 2 and Duel .GetLocationCount (tp ,LOCATION_MZONE )>= 2
82+ and not Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT )
83+ and Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEDOWN_DEFENSE )== 2 then
84+ Duel .ConfirmCards (1 - tp ,g )
85+ end
86+ end
87+ function s .postg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
88+ if chkc then return chkc :IsLocation (LOCATION_MZONE ) and chkc :IsPosition (POS_FACEDOWN_DEFENSE ) end
89+ if chk == 0 then return true end
90+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_FACEDOWN )
91+ local g = Duel .SelectTarget (tp ,Card .IsPosition ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,1 ,nil ,POS_FACEDOWN_DEFENSE )
92+ if # g > 0 then
93+ Duel .SetOperationInfo (0 ,CATEGORY_POSITION ,g ,1 ,tp ,0 )
94+ end
95+ end
96+ function s .posop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
97+ local tc = Duel .GetFirstTarget ()
98+ if tc and tc :IsRelateToEffect (e ) then
99+ Duel .ChangePosition (tc ,POS_FACEUP_ATTACK )
100+ end
101+ end
0 commit comments