1+ -- スペア・ガジェット
2+ -- Spare Gadget
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Gain ATK
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,1 ))
9+ e1 :SetCategory (CATEGORY_ATKCHANGE |CATEGORY_TOHAND )
10+ e1 :SetType (EFFECT_TYPE_IGNITION )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetCountLimit (1 )
13+ e1 :SetCost (s .cost )
14+ e1 :SetTarget (s .target )
15+ e1 :SetOperation (s .operation )
16+ c :RegisterEffect (e1 )
17+ end
18+ s .listed_names = {41172955 ,86445415 ,13839120 }
19+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
20+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToGraveAsCost ,tp ,LOCATION_HAND ,0 ,1 ,nil ) end
21+ end
22+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
23+ if chk == 0 then return true end
24+ Duel .SetOperationInfo (0 ,CATEGORY_ATKCHANGE ,e :GetHandler (),1 ,tp ,800 )
25+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_GRAVE )
26+ end
27+ function s .thfilter (c )
28+ return c :IsCode (41172955 ,86445415 ,13839120 ) and c :IsAbleToHand ()
29+ end
30+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
31+ -- Requirement
32+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
33+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToGraveAsCost ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil )
34+ if Duel .SendtoGrave (g ,REASON_COST )< 1 then return end
35+ -- Effect
36+ local c = e :GetHandler ()
37+ local e1 = Effect .CreateEffect (c )
38+ e1 :SetType (EFFECT_TYPE_SINGLE )
39+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
40+ e1 :SetValue (800 )
41+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD_DISABLE |RESET_PHASE |PHASE_END ,2 )
42+ c :RegisterEffect (e1 )
43+ if Duel .IsExistingMatchingCard (aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,nil ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
44+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
45+ local g = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil )
46+ if # g > 0 then
47+ Duel .BreakEffect ()
48+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
49+ Duel .ConfirmCards (1 - tp ,g )
50+ end
51+ end
52+ end
0 commit comments