1+ -- シャドウフォース・エクスプロージョン
2+ -- Shadowforce Explosion
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Add monsters from the grave to the hand
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
10+ e1 :SetCategory (CATEGORY_TOHAND )
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+ s .listed_names = {160024042 }
26+ function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
27+ if re :GetHandler ():IsCode (160024042 ) then
28+ Duel .RegisterFlagEffect (rp ,id ,RESET_PHASE |PHASE_END ,0 ,1 )
29+ end
30+ end
31+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
32+ return Duel .GetFlagEffect (tp ,id )== 0
33+ end
34+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
35+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToDeckOrExtraAsCost ,tp ,LOCATION_HAND ,0 ,1 ,e :GetHandler ()) end
36+ end
37+ function s .filter (c )
38+ return c :IsAttribute (ATTRIBUTE_DARK ) and c :IsRace (RACE_GALAXY ) and c :IsLevelBelow (8 ) and c :IsAbleToHand ()
39+ end
40+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
41+ local g = Duel .GetMatchingGroup (s .filter ,tp ,LOCATION_GRAVE ,0 ,nil )
42+ if chk == 0 then return aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,0 ) end
43+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_GRAVE )
44+ end
45+ function s .rescon (sg ,e ,tp ,mg )
46+ return sg :GetClassCount (Card .GetCode )==# sg
47+ end
48+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
49+ local c = e :GetHandler ()
50+ -- Requirement
51+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
52+ local td = Duel .SelectMatchingCard (tp ,Card .IsAbleToDeckOrExtraAsCost ,tp ,LOCATION_HAND ,0 ,1 ,1 ,c )
53+ local opt = Duel .SelectOption (tp ,aux .Stringid (id ,1 ),aux .Stringid (id ,2 ))
54+ if opt == 0 then
55+ Duel .SendtoDeck (td ,nil ,SEQ_DECKTOP ,REASON_COST )
56+ elseif opt == 1 then
57+ Duel .SendtoDeck (td ,nil ,SEQ_DECKBOTTOM ,REASON_COST )
58+ end
59+ -- Effect
60+ local g = Duel .GetMatchingGroup (s .filter ,tp ,LOCATION_GRAVE ,0 ,nil )
61+ local cg = aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,1 ,tp ,HINTMSG_TOHAND )
62+ if # cg > 0 then
63+ Duel .SendtoHand (cg ,nil ,REASON_EFFECT )
64+ Duel .ConfirmCards (1 - tp ,cg )
65+ end
66+ end
0 commit comments