1+ -- ヤミー☆サプライズ
2+ -- Yummy☆Surprise
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Activate 1 of these effects
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
10+ e1 :SetCode (EVENT_FREE_CHAIN )
11+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMING_BATTLE_START |TIMINGS_CHECK_MONSTER_E )
12+ e1 :SetCost (s .effcost )
13+ e1 :SetTarget (s .efftg )
14+ e1 :SetOperation (s .effop )
15+ c :RegisterEffect (e1 )
16+ end
17+ s .listed_series = {SET_YUMMY }
18+ function s .monoppthfilter (c ,e ,tp )
19+ return ((c :IsAttribute (ATTRIBUTE_LIGHT ) and c :IsRace (RACE_BEAST ) and c :IsControler (tp )) or c :IsControler (1 - tp ))
20+ and c :IsCanBeEffectTarget (e ) and c :IsAbleToHand ()
21+ end
22+ function s .rescon (sg ,e ,tp ,mg )
23+ return sg :FilterCount (Card .IsControler ,nil ,tp )== 2
24+ end
25+ function s .spfilter (c ,e ,tp )
26+ return c :IsSetCard (SET_YUMMY ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
27+ end
28+ function s .fieldspellthfilter (c )
29+ return c :IsFieldSpell () and c :IsFaceup () and c :IsAbleToHand ()
30+ end
31+ function s .effcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
32+ e :SetLabel (- 100 )
33+ local g = Duel .GetMatchingGroup (s .monoppthfilter ,tp ,LOCATION_MZONE ,LOCATION_ONFIELD ,nil ,e ,tp )
34+ local b1 = not Duel .HasFlagEffect (tp ,id ) and # g >= 4
35+ and aux .SelectUnselectGroup (g ,e ,tp ,4 ,4 ,s .rescon ,0 )
36+ local b2 = not Duel .HasFlagEffect (tp ,id + 100 ) and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
37+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND |LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp )
38+ local b3 = not Duel .HasFlagEffect (tp ,id + 200 )
39+ and Duel .IsExistingMatchingCard (s .fieldspellthfilter ,tp ,LOCATION_ONFIELD |LOCATION_GRAVE ,0 ,1 ,nil )
40+ if chk == 0 then return b1 or b2 or b3 end
41+ end
42+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
43+ if chkc then return false end
44+ local cost_skip = e :GetLabel ()~=- 100
45+ local g = Duel .GetMatchingGroup (s .monoppthfilter ,tp ,LOCATION_MZONE ,LOCATION_ONFIELD ,nil ,e ,tp )
46+ local b1 = not Duel .HasFlagEffect (tp ,id ) and # g >= 4
47+ and aux .SelectUnselectGroup (g ,e ,tp ,4 ,4 ,s .rescon ,0 )
48+ local b2 = not Duel .HasFlagEffect (tp ,id + 100 ) and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
49+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_HAND |LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp )
50+ local b3 = not Duel .HasFlagEffect (tp ,id + 200 )
51+ and Duel .IsExistingMatchingCard (s .fieldspellthfilter ,tp ,LOCATION_ONFIELD |LOCATION_GRAVE ,0 ,1 ,nil )
52+ if chk == 0 then e :SetLabel (0 ) return b1 or b2 or b3 end
53+ local op = Duel .SelectEffect (tp ,
54+ {b1 ,aux .Stringid (id ,1 )},
55+ {b2 ,aux .Stringid (id ,2 )},
56+ {b3 ,aux .Stringid (id ,3 )})
57+ e :SetLabel (op )
58+ if op == 1 then
59+ e :SetCategory (CATEGORY_TOHAND )
60+ e :SetProperty (EFFECT_FLAG_CARD_TARGET )
61+ if not cost_skip then Duel .RegisterFlagEffect (tp ,id ,RESET_PHASE |PHASE_END ,0 ,1 ) end
62+ local tg = aux .SelectUnselectGroup (g ,e ,tp ,4 ,4 ,s .rescon ,1 ,tp ,HINTMSG_RTOHAND )
63+ Duel .SetTargetCard (tg )
64+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,tg ,4 ,tp ,0 )
65+ elseif op == 2 then
66+ e :SetCategory (CATEGORY_SPECIAL_SUMMON )
67+ e :SetProperty (0 )
68+ if not cost_skip then Duel .RegisterFlagEffect (tp ,id + 100 ,RESET_PHASE |PHASE_END ,0 ,1 ) end
69+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_HAND |LOCATION_GRAVE )
70+ elseif op == 3 then
71+ e :SetCategory (CATEGORY_TOHAND )
72+ e :SetProperty (0 )
73+ if not cost_skip then Duel .RegisterFlagEffect (tp ,id + 200 ,RESET_PHASE |PHASE_END ,0 ,1 ) end
74+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_ONFIELD |LOCATION_GRAVE )
75+ end
76+ end
77+ function s .plfilter (c )
78+ return c :IsSetCard (SET_YUMMY ) and c :IsFieldSpell () and not c :IsForbidden ()
79+ end
80+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
81+ local op = e :GetLabel ()
82+ if op == 1 then
83+ -- Return 2 LIGHT Beast monsters you control and 2 cards your opponent controls to the hand
84+ local tg = Duel .GetTargetCards (e )
85+ if # tg > 0 then
86+ Duel .SendtoHand (tg ,nil ,REASON_EFFECT )
87+ end
88+ elseif op == 2 then
89+ -- Special Summon 1 "Yummy" monster from your hand or GY, but it cannot attack directly this turn
90+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
91+ local sc = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .spfilter ),tp ,LOCATION_HAND |LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp ):GetFirst ()
92+ if sc and Duel .SpecialSummon (sc ,0 ,tp ,tp ,false ,false ,POS_FACEUP )> 0 then
93+ -- It cannot attack directly this turn
94+ local e1 = Effect .CreateEffect (e :GetHandler ())
95+ e1 :SetDescription (3207 )
96+ e1 :SetType (EFFECT_TYPE_SINGLE )
97+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CLIENT_HINT )
98+ e1 :SetCode (EFFECT_CANNOT_DIRECT_ATTACK )
99+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
100+ sc :RegisterEffect (e1 )
101+ end
102+ elseif op == 3 then
103+ -- Return 1 Field Spell from your face-up field or GY to the hand, then you can place 1 "Yummy" Field Spell from your hand face-up on your field
104+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
105+ local sc = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .fieldspellthfilter ),tp ,LOCATION_ONFIELD |LOCATION_GRAVE ,0 ,1 ,1 ,nil ):GetFirst ()
106+ if sc and Duel .SendtoHand (sc ,nil ,REASON_EFFECT )> 0 and sc :IsLocation (LOCATION_HAND ) then
107+ Duel .ConfirmCards (1 - tp ,sc )
108+ Duel .ShuffleHand (tp )
109+ if Duel .IsExistingMatchingCard (s .plfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,4 )) then
110+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOFIELD )
111+ local plc = Duel .SelectMatchingCard (tp ,s .plfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ):GetFirst ()
112+ if plc then
113+ Duel .BreakEffect ()
114+ local fc = Duel .GetFieldCard (tp ,LOCATION_FZONE ,0 )
115+ if fc then
116+ Duel .SendtoGrave (fc ,REASON_RULE )
117+ Duel .BreakEffect ()
118+ end
119+ Duel .MoveToField (plc ,tp ,tp ,LOCATION_FZONE ,POS_FACEUP ,true )
120+ end
121+ end
122+ end
123+ end
124+ end
0 commit comments