1+ -- 選手の生還
2+ -- The Player Returning Alive
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Send the top 3 cards of your Deck to the GY
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_DECKDES |CATEGORY_TOHAND )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetCondition (s .condition )
13+ e1 :SetCost (s .cost )
14+ e1 :SetTarget (s .target )
15+ e1 :SetOperation (s .activate )
16+ c :RegisterEffect (e1 )
17+ aux .GlobalCheck (s ,function ()
18+ local ge1 = Effect .CreateEffect (c )
19+ ge1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
20+ ge1 :SetCode (EVENT_CHAIN_SOLVED )
21+ ge1 :SetOperation (s .checkop )
22+ Duel .RegisterEffect (ge1 ,0 )
23+ end )
24+ end
25+ function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
26+ if re :GetHandler ():IsCode (id ) then
27+ Duel .RegisterFlagEffect (rp ,id ,RESET_PHASE |PHASE_END ,0 ,1 )
28+ end
29+ end
30+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
31+ return Duel .GetFlagEffect (tp ,id )== 0
32+ end
33+ function s .cfilter (c )
34+ return ((c :IsMonster () and c :IsRace (RACE_WARRIOR )) or (c :IsSpell () and c :IsType (TYPE_FIELD ))) and c :IsAbleToGraveAsCost ()
35+ end
36+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
37+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,e :GetHandler ()) end
38+ end
39+ function s .thfilter (c )
40+ return c :IsLocation (LOCATION_GRAVE ) and c :IsAbleToHand ()
41+ end
42+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
43+ if chk == 0 then return Duel .IsPlayerCanDiscardDeck (tp ,3 ) end
44+ Duel .SetOperationInfo (0 ,CATEGORY_DECKDES ,nil ,0 ,tp ,3 )
45+ end
46+ function s .thfilter2 (c )
47+ return c :IsLevel (4 ,8 ) and c :IsRace (RACE_WARRIOR ) and c :IsAbleToHand ()
48+ end
49+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
50+ -- Requirement
51+ local c = e :GetHandler ()
52+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
53+ local g = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,e :GetHandler ())
54+ if Duel .SendtoGrave (g ,REASON_COST )< 1 then return end
55+ -- Effect
56+ Duel .DiscardDeck (tp ,3 ,REASON_EFFECT )
57+ local g = Duel .GetOperatedGroup ()
58+ if g :FilterCount (s .thfilter ,nil )> 0 then
59+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
60+ local sg = g :FilterSelect (tp ,s .thfilter ,1 ,1 ,nil )
61+ if # sg > 0 then
62+ Duel .SendtoHand (sg ,nil ,REASON_EFFECT )
63+ Duel .ConfirmCards (1 - tp ,sg )
64+ if Duel .IsExistingMatchingCard (Card .IsCode ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,95281259 )
65+ and Duel .IsExistingMatchingCard (aux .NecroValleyFilter (s .thfilter2 ),tp ,LOCATION_GRAVE ,0 ,1 ,nil )
66+ and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
67+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
68+ local g = Duel .SelectMatchingCard (tp ,s .thfilter2 ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil )
69+ if # g > 0 then
70+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
71+ Duel .ConfirmCards (1 - tp ,g )
72+ end
73+ end
74+ end
75+ end
76+ end
0 commit comments