1+ -- 楽姫の代演
2+ -- Music Princess's Substitute
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Send the top 3 cards of your Deck to the GY
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_DECKDES |CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetCost (s .cost )
13+ e1 :SetTarget (s .target )
14+ e1 :SetOperation (s .activate )
15+ c :RegisterEffect (e1 )
16+ end
17+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
18+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToGraveAsCost ,tp ,LOCATION_HAND ,0 ,1 ,nil ) end
19+ end
20+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
21+ if chk == 0 then return Duel .IsPlayerCanDiscardDeck (tp ,3 ) end
22+ Duel .SetOperationInfo (0 ,CATEGORY_DECKDES ,nil ,0 ,tp ,3 )
23+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_GRAVE )
24+ end
25+ function s .filter (c )
26+ return c :IsMonster () and not c :IsAttribute (ATTRIBUTE_WIND )
27+ end
28+ function s .spfilter (c ,e ,tp )
29+ return c :IsRace (RACE_WARRIOR ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEUP_DEFENSE )
30+ end
31+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
32+ -- Requirement
33+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
34+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToGraveAsCost ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil )
35+ if Duel .SendtoGrave (g ,REASON_COST )== 0 then return end
36+ -- Effect
37+ Duel .DiscardDeck (tp ,3 ,REASON_EFFECT )
38+ local g2 = Duel .GetMatchingGroup (aux .NecroValleyFilter (s .spfilter ),tp ,LOCATION_GRAVE ,0 ,nil ,e ,tp )
39+ if Duel .IsExistingMatchingCard (Card .IsMonster ,tp ,LOCATION_GRAVE ,0 ,1 ,nil )
40+ and not Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil )
41+ and # g2 > 0 and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
42+ and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
43+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
44+ local sg = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
45+ if # sg > 0 then
46+ Duel .BreakEffect ()
47+ Duel .SpecialSummon (sg ,0 ,tp ,tp ,false ,false ,POS_FACEUP_DEFENSE )
48+ end
49+ end
50+ -- Prevent non-WIND Warriors from attacking
51+ local e1 = Effect .CreateEffect (e :GetHandler ())
52+ e1 :SetType (EFFECT_TYPE_FIELD )
53+ e1 :SetCode (EFFECT_CANNOT_ATTACK )
54+ e1 :SetProperty (EFFECT_FLAG_OATH )
55+ e1 :SetTargetRange (LOCATION_MZONE ,0 )
56+ e1 :SetTarget (s .ftarget )
57+ e1 :SetReset (RESET_PHASE |PHASE_END )
58+ Duel .RegisterEffect (e1 ,tp )
59+ end
60+ function s .ftarget (e ,c )
61+ return not c :IsRace (RACE_WARRIOR ) or not c :IsAttribute (ATTRIBUTE_WIND )
62+ end
0 commit comments