1+ -- ドラゴン・導きの呼笛
2+ -- The Flute of Guiding Dragon
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- If a Spellcaster monster is on the field: Special Summon 1 Level 5 or higher Dragon monster from your Deck, then if your opponent controls 2 or more monsters, you can Special Summon 1 monster from your Deck with the same name as the Summoned monster, also you cannot Special Summon for the rest of this turn, except Dragon or Spellcaster monsters
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetCountLimit (1 ,{id ,0 })
13+ e1 :SetCondition (function () return Duel .IsExistingMatchingCard (aux .FaceupFilter (Card .IsRace ,RACE_SPELLCASTER ),0 ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,nil ) end )
14+ e1 :SetTarget (s .sptg )
15+ e1 :SetOperation (s .spop )
16+ c :RegisterEffect (e1 )
17+ -- During your Main Phase 2, if this card is in your GY because it was sent there this turn: You can banish it; draw 1 card
18+ local e2 = Effect .CreateEffect (c )
19+ e2 :SetDescription (aux .Stringid (id ,1 ))
20+ e2 :SetCategory (CATEGORY_DRAW )
21+ e2 :SetType (EFFECT_TYPE_IGNITION )
22+ e2 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
23+ e2 :SetRange (LOCATION_GRAVE )
24+ e2 :SetCountLimit (1 ,{id ,1 })
25+ e2 :SetCondition (function (e ) local c = e :GetHandler () return Duel .IsMainPhase2 () and c :GetTurnID ()== Duel .GetTurnCount () and not c :IsReason (REASON_RETURN ) end )
26+ e2 :SetCost (Cost .SelfBanish )
27+ e2 :SetTarget (s .drtg )
28+ e2 :SetOperation (s .drop )
29+ c :RegisterEffect (e2 )
30+ end
31+ function s .spfilter (c ,e ,tp )
32+ return c :IsLevelAbove (5 ) and c :IsRace (RACE_DRAGON ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
33+ end
34+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
35+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
36+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,e ,tp ) end
37+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK )
38+ end
39+ function s .samenamespfilter (c ,e ,tp ,code )
40+ return c :IsCode (code ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
41+ end
42+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
43+ if Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 then
44+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
45+ local sc = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,e ,tp ):GetFirst ()
46+ if sc and Duel .SpecialSummon (sc ,0 ,tp ,tp ,false ,false ,POS_FACEUP )> 0 and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
47+ and Duel .GetFieldGroupCount (tp ,0 ,LOCATION_MZONE )>= 2 then
48+ local code = sc :GetCode ()
49+ if Duel .IsExistingMatchingCard (s .samenamespfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,e ,tp ,code )
50+ and Duel .SelectYesNo (tp ,aux .Stringid (id ,2 )) then
51+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
52+ local g = Duel .SelectMatchingCard (tp ,s .samenamespfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,e ,tp ,code )
53+ if # g > 0 then
54+ Duel .BreakEffect ()
55+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
56+ end
57+ end
58+ end
59+ end
60+ -- You cannot Special Summon for the rest of this turn, except Dragon or Spellcaster monsters
61+ local e1 = Effect .CreateEffect (e :GetHandler ())
62+ e1 :SetDescription (aux .Stringid (id ,3 ))
63+ e1 :SetType (EFFECT_TYPE_FIELD )
64+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
65+ e1 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
66+ e1 :SetTargetRange (1 ,0 )
67+ e1 :SetTarget (function (e ,c ) return c :IsRaceExcept (RACE_DRAGON |RACE_SPELLCASTER ) end )
68+ e1 :SetReset (RESET_PHASE |PHASE_END )
69+ Duel .RegisterEffect (e1 ,tp )
70+ end
71+ function s .drtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
72+ if chk == 0 then return Duel .IsPlayerCanDraw (tp ,1 ) end
73+ Duel .SetTargetPlayer (tp )
74+ Duel .SetTargetParam (1 )
75+ Duel .SetOperationInfo (0 ,CATEGORY_DRAW ,nil ,0 ,tp ,1 )
76+ end
77+ function s .drop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
78+ local p ,d = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PLAYER ,CHAININFO_TARGET_PARAM )
79+ Duel .Draw (p ,d ,REASON_EFFECT )
80+ end
0 commit comments