1+ -- 月の魔術師
2+ -- Moon Magician
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- If your opponent controls an Xyz Monster, you can Special Summon this card (from your hand)
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_FIELD )
10+ e1 :SetProperty (EFFECT_FLAG_UNCOPYABLE )
11+ e1 :SetCode (EFFECT_SPSUMMON_PROC )
12+ e1 :SetRange (LOCATION_HAND )
13+ e1 :SetCountLimit (1 ,id ,EFFECT_COUNT_CODE_OATH )
14+ e1 :SetCondition (s .selfspcon )
15+ c :RegisterEffect (e1 )
16+ -- Special Summon 1 Level 4 LIGHT monster from your GY
17+ local e2 = Effect .CreateEffect (c )
18+ e2 :SetDescription (aux .Stringid (id ,1 ))
19+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
20+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
21+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY )
22+ e2 :SetCode (EVENT_SUMMON_SUCCESS )
23+ e2 :SetCountLimit (1 ,{id ,1 })
24+ e2 :SetTarget (s .sptg )
25+ e2 :SetOperation (s .spop )
26+ c :RegisterEffect (e2 )
27+ local e3 = e2 :Clone ()
28+ e3 :SetCode (EVENT_SPSUMMON_SUCCESS )
29+ c :RegisterEffect (e3 )
30+ end
31+ s .listed_names = {id }
32+ function s .selfspcon (e ,c )
33+ if c == nil then return true end
34+ local tp = c :GetControler ()
35+ return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
36+ and Duel .IsExistingMatchingCard (aux .FaceupFilter (Card .IsType ,TYPE_XYZ ),tp ,0 ,LOCATION_MZONE ,1 ,nil )
37+ end
38+ function s .spfilter (c ,e ,tp )
39+ return c :IsLevel (4 ) and c :IsAttribute (ATTRIBUTE_LIGHT ) and not c :IsCode (id ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
40+ end
41+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
42+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_GRAVE ) and s .spfilter (chkc ,e ,tp ) end
43+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
44+ and Duel .IsExistingTarget (s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp ) end
45+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
46+ local g = Duel .SelectTarget (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
47+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,g ,1 ,tp ,0 )
48+ end
49+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
50+ local tc = Duel .GetFirstTarget ()
51+ if tc :IsRelateToEffect (e ) and Duel .SpecialSummonStep (tc ,0 ,tp ,tp ,false ,false ,POS_FACEUP ) then
52+ -- Negate its effects
53+ tc :NegateEffects (e :GetHandler ())
54+ end
55+ Duel .SpecialSummonComplete ()
56+ end
0 commit comments