22local s ,id = GetID ()
33function s .initial_effect (c )
44 aux .AddSkillProcedure (c ,1 ,false ,s .flipcon ,s .flipop ,1 )
5- Duel .AddCustomActivityCounter (id ,ACTIVITY_SUMMON ,s .counterfilter )
6- end
7- s .listed_names = {66516792 }
8- function s .counterfilter (c )
9- return not c :IsCode (66516792 )
10- end
11- function s .cfilter (c )
12- return c :IsFaceup () and c :IsCode (66516792 )
13- end
14- function s .thfilter (c )
15- return c :IsMonster () and c :IsAbleToHand ()
5+ Duel .AddCustomActivityCounter (id ,ACTIVITY_SUMMON ,function (c ) return not c :IsCode (66516792 ) end )
6+ Duel .AddCustomActivityCounter (id + 100 ,ACTIVITY_NORMALSUMMON ,function (c ) return not c :IsCode (66516792 ) end )
167end
8+ s .listed_names = {66516792 } -- "Serpent Night Dragon"
179function s .flipcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
1810 -- condition
1911 local dg = Duel .GetFieldGroup (tp ,LOCATION_DECK ,0 )
2012 local fg = Duel .GetFieldGroup (tp ,LOCATION_MZONE ,0 )
21- return aux .CanActivateSkill (tp )
22- and Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_MZONE ,0 ,1 ,nil )
23- and # dg > 3 and # fg == 1
13+ return aux .CanActivateSkill (tp ) and Duel .IsExistingMatchingCard (aux .FaceupFilter (Card .IsCode ,66516792 ),tp ,LOCATION_MZONE ,0 ,1 ,nil )
14+ and # dg > 3 and # fg == 1 and Duel .GetCustomActivityCount (id ,tp ,ACTIVITY_SUMMON )== 0 and Duel .GetCustomActivityCount (id + 100 ,tp ,ACTIVITY_NORMALSUMMON )== 0
2415end
2516function s .flipop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
2617 Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(1 << 32 ))
2718 Duel .Hint (HINT_CARD ,tp ,id )
2819 Duel .ConfirmDecktop (tp ,4 )
2920 local g = Duel .GetDecktopGroup (tp ,4 )
3021 local ct = g :FilterCount (Card .IsMonster ,nil )
22+ if ct == 0 then return end
3123 if ct == 1 then
3224 -- Add 1 of the revealed monsters to your hand
3325 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
34- local sg = g :FilterSelect (tp ,s .thfilter ,1 ,1 ,nil )
35- Duel .DisableShuffleCheck ()
36- Duel .SendtoHand (sg ,nil ,REASON_EFFECT )
37- Duel .ConfirmCards (1 - tp ,sg )
38- g :RemoveCard (sg :GetFirst ())
26+ local sg = g :FilterSelect (tp ,aux .AND (Card .IsMonster ,Card .IsAbleToHand ),1 ,1 ,nil )
27+ local tc = sg :GetFirst ()
28+ if tc then
29+ Duel .DisableShuffleCheck ()
30+ Duel .SendtoHand (tc ,nil ,REASON_EFFECT )
31+ Duel .ConfirmCards (1 - tp ,tc )
32+ end
33+ g :RemoveCard (tc )
3934 Duel .ShuffleHand (tp )
4035 Duel .MoveToDeckBottom (g ,tp )
4136 Duel .SortDeckbottom (tp ,tp ,3 )
4237 -- Destroy 1 face-up card your opponent controls
4338 elseif ct == 2 then
4439 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DESTROY )
4540 local dg = Duel .SelectMatchingCard (tp ,Card .IsFaceup ,tp ,0 ,LOCATION_ONFIELD ,1 ,1 ,nil )
46- Duel .HintSelection (dg )
47- Duel .Destroy (dg ,REASON_EFFECT )
41+ if # dg > 0 then
42+ Duel .HintSelection (dg )
43+ Duel .Destroy (dg ,REASON_EFFECT )
44+ end
4845 Duel .MoveToDeckBottom (g ,tp )
4946 Duel .SortDeckbottom (tp ,tp ,4 )
5047 -- Apply both effects in sequence
51- else
48+ elseif ct >= 3 then
5249 -- Add 1 revealed monster
5350 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
54- local sg = g :FilterSelect (tp ,s .thfilter ,1 ,1 ,nil )
55- Duel .DisableShuffleCheck ()
56- Duel .SendtoHand (sg ,nil ,REASON_EFFECT )
57- Duel .ConfirmCards (1 - tp ,sg )
58- g :RemoveCard (sg :GetFirst ())
51+ local sg = g :FilterSelect (tp ,aux .AND (Card .IsMonster ,Card .IsAbleToHand ),1 ,1 ,nil )
52+ local tc = sg :GetFirst ()
53+ if tc then
54+ Duel .DisableShuffleCheck ()
55+ Duel .SendtoHand (tc ,nil ,REASON_EFFECT )
56+ Duel .ConfirmCards (1 - tp ,tc )
57+ end
58+ g :RemoveCard (tc )
5959 Duel .ShuffleHand (tp )
6060 -- Destroy 1 face-up card your controls
6161 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DESTROY )
@@ -84,4 +84,4 @@ function s.flipop(e,tp,eg,ep,ev,re,r,rp)
8484 local e4 = e1 :Clone ()
8585 e4 :SetCode (EFFECT_CANNOT_MSET )
8686 Duel .RegisterEffect (e4 ,tp )
87- end
87+ end
0 commit comments