1+ -- ディスジャーキー・ドラゴン
2+ -- Benevolent Dragon
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Return to hand
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON )
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+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
19+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToGraveAsCost ,tp ,LOCATION_ONFIELD ,0 ,1 ,e :GetHandler ()) end
20+ end
21+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
22+ if chk == 0 then return e :GetHandler ():IsAbleToHand () end
23+ end
24+ function s .spfilter (c ,e ,tp )
25+ return c :IsLevel (7 ) and c :IsRace (RACE_DRAGON ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
26+ end
27+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
28+ local c = e :GetHandler ()
29+ -- Requirement
30+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
31+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToGraveAsCost ,tp ,LOCATION_ONFIELD ,0 ,1 ,1 ,c )
32+ if Duel .SendtoGrave (g ,REASON_COST )== 0 then return end
33+ -- Effect
34+ local g = Duel .GetMatchingGroup (aux .NecroValleyFilter (s .spfilter ),tp ,LOCATION_GRAVE ,0 ,nil ,e ,tp )
35+ if Duel .SendtoHand (c ,nil ,REASON_EFFECT ) and # g > 0 and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
36+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
37+ local sg = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
38+ Duel .SpecialSummon (sg ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
39+ end
40+ local e1 = Effect .CreateEffect (c )
41+ e1 :SetDescription (aux .Stringid (id ,1 ))
42+ e1 :SetType (EFFECT_TYPE_FIELD )
43+ e1 :SetCode (EFFECT_CANNOT_ACTIVATE )
44+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
45+ e1 :SetTargetRange (1 ,0 )
46+ e1 :SetValue (s .aclimit )
47+ e1 :SetReset (RESET_PHASE |PHASE_END )
48+ Duel .RegisterEffect (e1 ,tp )
49+ end
50+ function s .aclimit (e ,re ,tp )
51+ return re :GetHandler ():IsCode (id )
52+ end
0 commit comments