1+ -- マグネット・スピーダー
2+ -- Magnet Speeder
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ local params = {nil ,s .matfilter }
7+ -- Add card to hand
8+ local e1 = Effect .CreateEffect (c )
9+ e1 :SetDescription (aux .Stringid (id ,0 ))
10+ e1 :SetCategory (CATEGORY_TOHAND )
11+ e1 :SetType (EFFECT_TYPE_IGNITION )
12+ e1 :SetRange (LOCATION_MZONE )
13+ e1 :SetCountLimit (1 )
14+ e1 :SetCost (s .cost )
15+ e1 :SetTarget (s .target )
16+ e1 :SetOperation (s .operation (Fusion .SummonEffTG (table.unpack (params )),Fusion .SummonEffOP (table.unpack (params ))))
17+ c :RegisterEffect (e1 )
18+ end
19+ function s .matfilter (c )
20+ return c :IsLocation (LOCATION_HAND |LOCATION_MZONE ) and c :IsRace (RACE_ROCK ) and c :IsAbleToGrave ()
21+ end
22+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
23+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToDeckOrExtraAsCost ,tp ,LOCATION_HAND ,0 ,1 ,e :GetHandler ()) end
24+ end
25+ function s .thfilter (c )
26+ return c :IsRace (RACE_ROCK ) and (c :IsType (TYPE_NORMAL ) or c :IsDefense (2100 )) and c :IsAbleToHand ()
27+ end
28+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
29+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ) end
30+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_GRAVE )
31+ end
32+ function s .operation (fustg ,fusop )
33+ return function (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
34+ -- Requirement
35+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
36+ local td = Duel .SelectMatchingCard (tp ,Card .IsAbleToDeckOrExtraAsCost ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil )
37+ if Duel .SendtoDeck (td ,nil ,SEQ_DECKBOTTOM ,REASON_COST )< 1 then return end
38+ -- Effect
39+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
40+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,e :GetHandler ())
41+ if # g > 0 then
42+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
43+ Duel .ConfirmCards (1 - tp ,g )
44+ if fustg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,0 ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
45+ Duel .BreakEffect ()
46+ fusop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
47+ end
48+ end
49+ end
50+ end
0 commit comments