1+ -- ドラゴンメイド・シュテルン
2+ -- Dragonmaid Stern
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Dragon Fusion Monsters you control cannot be destroyed by your opponent's card effects
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetType (EFFECT_TYPE_FIELD )
9+ e1 :SetCode (EFFECT_INDESTRUCTABLE_EFFECT )
10+ e1 :SetRange (LOCATION_MZONE )
11+ e1 :SetTargetRange (LOCATION_MZONE ,0 )
12+ e1 :SetTarget (function (e ,c ) return c :IsRace (RACE_DRAGON ) and c :IsType (TYPE_FUSION ) end )
13+ e1 :SetValue (aux .indoval )
14+ c :RegisterEffect (e1 )
15+ -- Special Summon 1 "Dragonmaid" monster from your GY or banishment, except "Dragonmaid Stern"
16+ local e2 = Effect .CreateEffect (c )
17+ e2 :SetDescription (aux .Stringid (id ,0 ))
18+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
19+ e2 :SetType (EFFECT_TYPE_IGNITION )
20+ e2 :SetRange (LOCATION_HAND )
21+ e2 :SetCountLimit (1 ,id )
22+ e2 :SetCost (aux .SelfDiscardCost )
23+ e2 :SetTarget (s .gyrmsptg )
24+ e2 :SetOperation (s .gyrmspop )
25+ c :RegisterEffect (e2 )
26+ -- Return this card to the hand, and if you do, Special Summon 1 Level 4 or lower "Dragonmaid" monster from your hand
27+ local e3 = Effect .CreateEffect (c )
28+ e3 :SetDescription (aux .Stringid (id ,1 ))
29+ e3 :SetCategory (CATEGORY_TOHAND + CATEGORY_SPECIAL_SUMMON )
30+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
31+ e3 :SetCode (EVENT_PHASE + PHASE_BATTLE )
32+ e3 :SetRange (LOCATION_MZONE )
33+ e3 :SetCountLimit (1 ,{id ,1 })
34+ e3 :SetTarget (s .thtg )
35+ e3 :SetOperation (s .thop )
36+ c :RegisterEffect (e3 )
37+ end
38+ s .listed_series = {SET_DRAGONMAID }
39+ s .listed_names = {id }
40+ function s .gyrmspfilter (c ,e ,tp )
41+ return c :IsSetCard (SET_DRAGONMAID ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ) and c :IsFaceup () and not c :IsCode (id )
42+ end
43+ function s .gyrmsptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
44+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
45+ and Duel .IsExistingMatchingCard (s .gyrmspfilter ,tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,nil ,e ,tp ) end
46+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_GRAVE |LOCATION_REMOVED )
47+ end
48+ function s .gyrmspop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
49+ if Duel .GetLocationCount (tp ,LOCATION_MZONE )<= 0 then return end
50+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
51+ local g = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .gyrmspfilter ),tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,1 ,nil ,e ,tp )
52+ if # g > 0 then
53+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
54+ end
55+ end
56+ function s .handspfilter (c ,e ,tp )
57+ return c :IsLevelBelow (4 ) and c :IsSetCard (SET_DRAGONMAID ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
58+ end
59+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
60+ local c = e :GetHandler ()
61+ if chk == 0 then return Duel .GetMZoneCount (tp ,c )> 0 and c :IsAbleToHand ()
62+ and Duel .IsExistingMatchingCard (s .handspfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp ) end
63+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,c ,1 ,tp ,0 )
64+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_HAND )
65+ end
66+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
67+ local c = e :GetHandler ()
68+ if c :IsRelateToEffect (e ) and Duel .SendtoHand (c ,nil ,REASON_EFFECT )> 0 and c :IsLocation (LOCATION_HAND )
69+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 then
70+ Duel .ShuffleHand (tp )
71+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
72+ local g = Duel .SelectMatchingCard (tp ,s .handspfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ,e ,tp )
73+ if # g > 0 then
74+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
75+ end
76+ end
77+ end
0 commit comments