1+ -- 2つに1つ
2+ -- One of Two
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Reveal 1 monster and 2 Traps from your Deck, your opponent randomly picks 1, you look at the rest and banish 1 Trap, then your opponent chooses 1 of these effects for you to apply
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_REMOVE + CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetTarget (s .target )
13+ e1 :SetOperation (s .activate )
14+ c :RegisterEffect (e1 )
15+ end
16+ function s .rescon (sg ,e ,tp ,mg )
17+ return sg :IsExists (Card .IsMonster ,1 ,nil ) and sg :IsExists (Card .IsTrap ,2 ,nil )
18+ end
19+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
20+ local g = Duel .GetMatchingGroup (aux .OR (Card .IsMonster ,Card .IsTrap ),tp ,LOCATION_DECK ,0 ,nil )
21+ if chk == 0 then return # g >= 3 and Duel .IsPlayerCanRemove (tp ) and aux .SelectUnselectGroup (g ,e ,tp ,3 ,3 ,s .rescon ,0 ) end
22+ Duel .SetOperationInfo (0 ,CATEGORY_REMOVE ,nil ,1 ,tp ,LOCATION_DECK )
23+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
24+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK )
25+ end
26+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
27+ if not Duel .IsPlayerCanRemove (tp ) then return end
28+ local g = Duel .GetMatchingGroup (aux .OR (Card .IsMonster ,Card .IsTrap ),tp ,LOCATION_DECK ,0 ,nil )
29+ if # g < 3 then return end
30+ local sg = aux .SelectUnselectGroup (g ,e ,tp ,3 ,3 ,s .rescon ,1 ,tp ,HINTMSG_CONFIRM )
31+ if # sg == 0 then return end
32+ local opp = 1 - tp
33+ Duel .ConfirmCards (opp ,sg )
34+ local picked_card = sg :RandomSelect (opp ,1 ):GetFirst ()
35+ sg :RemoveCard (picked_card )
36+ Duel .ConfirmCards (tp ,sg )
37+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_REMOVE )
38+ local banished_card = sg :FilterSelect (tp ,aux .AND (Card .IsTrap ,Card .IsAbleToRemove ),1 ,1 ,nil )
39+ if # banished_card == 0 or Duel .Remove (banished_card ,POS_FACEUP ,REASON_EFFECT )== 0 then return end
40+ sg :RemoveCard (banished_card )
41+ local op = Duel .SelectEffect (opp ,
42+ {true ,aux .Stringid (id ,1 )},
43+ {true ,aux .Stringid (id ,2 )})
44+ Duel .BreakEffect ()
45+ if op == 1 then
46+ -- ● Show the picked card, and if it is a monster, either add it to your hand or Special Summon it. Otherwise, banish it. Shuffle the remaining card into the Deck
47+ Duel .ConfirmCards (opp ,picked_card )
48+ if picked_card :IsMonster () then
49+ aux .ToHandOrElse (picked_card ,tp ,
50+ function ()
51+ return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and picked_card :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
52+ end ,
53+ function ()
54+ Duel .SpecialSummon (picked_card ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
55+ end ,
56+ aux .Stringid (id ,3 )
57+ )
58+ else
59+ Duel .Remove (picked_card ,POS_FACEUP ,REASON_EFFECT )
60+ end
61+ elseif op == 2 then
62+ -- ● Show the card that was not picked nor banished, and if it is a monster, add it to your hand. Otherwise, banish it. Shuffle the remaining card into the Deck
63+ local other_card = sg :GetFirst ()
64+ Duel .ConfirmCards (opp ,other_card )
65+ if other_card :IsMonster () then
66+ Duel .SendtoHand (other_card ,nil ,REASON_EFFECT )
67+ else
68+ Duel .Remove (other_card ,POS_FACEUP ,REASON_EFFECT )
69+ end
70+ end
71+ Duel .ShuffleDeck (tp )
72+ end
0 commit comments