1+ -- 聖月の魔導士エンディミオン
2+ -- Endymion, the Crescent of Magistus
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ -- Link Summon procedure: 2 monsters, including a Level 4 Spellcaster monster
8+ Link .AddProcedure (c ,nil ,2 ,2 ,s .matcheck )
9+ -- Equip 1 Spellcaster monster from your GY or banishment to 1 "Magistus" monster you control
10+ local e1 = Effect .CreateEffect (c )
11+ e1 :SetDescription (aux .Stringid (id ,0 ))
12+ e1 :SetCategory (CATEGORY_EQUIP )
13+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
14+ e1 :SetProperty (EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET )
15+ e1 :SetCode (EVENT_SPSUMMON_SUCCESS )
16+ e1 :SetCountLimit (1 ,id )
17+ e1 :SetCondition (function (e ) return e :GetHandler ():IsLinkSummoned () end )
18+ e1 :SetTarget (s .eqtg )
19+ e1 :SetOperation (s .eqop )
20+ c :RegisterEffect (e1 )
21+ -- Return 1 Spellcaster Monster Card in your Spell & Trap Zone treated as an Equip Spell to the hand
22+ local e2 = Effect .CreateEffect (c )
23+ e2 :SetDescription (aux .Stringid (id ,1 ))
24+ e2 :SetCategory (CATEGORY_TOHAND )
25+ e2 :SetType (EFFECT_TYPE_QUICK_O )
26+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
27+ e2 :SetCode (EVENT_FREE_CHAIN )
28+ e2 :SetRange (LOCATION_MZONE )
29+ e2 :SetHintTiming (0 ,TIMING_MAIN_END |TIMINGS_CHECK_MONSTER )
30+ e2 :SetCountLimit (1 ,id )
31+ e2 :SetCondition (function () return Duel .IsMainPhase () end )
32+ e2 :SetTarget (s .thtg )
33+ e2 :SetOperation (s .thop )
34+ c :RegisterEffect (e2 )
35+ end
36+ s .listes_series = {SET_MAGISTUS }
37+ function s .matfilter (c ,lc ,sumtype ,tp )
38+ return c :IsLevel (4 ) and c :IsRace (RACE_SPELLCASTER ,lc ,sumtype ,tp )
39+ end
40+ function s .matcheck (g ,lc ,sumtype ,tp )
41+ return g :IsExists (s .matfilter ,1 ,nil ,lc ,sumtype ,tp )
42+ end
43+ function s .eqfilter (c ,tp )
44+ return c :IsRace (RACE_SPELLCASTER ) and c :CheckUniqueOnField (tp ) and c :IsFaceup () and not c :IsForbidden ()
45+ end
46+ function s .eqtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
47+ local c = e :GetHandler ()
48+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_MZONE ) and chkc :IsFaceup () and chkc :IsSetCard (SET_MAGISTUS ) end
49+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_SZONE )> 0
50+ and Duel .IsExistingTarget (aux .FaceupFilter (Card .IsSetCard ,SET_MAGISTUS ),tp ,LOCATION_MZONE ,0 ,1 ,nil )
51+ and Duel .IsExistingMatchingCard (s .eqfilter ,tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,nil ,tp ) end
52+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_EQUIP )
53+ Duel .SelectTarget (tp ,aux .FaceupFilter (Card .IsSetCard ,SET_MAGISTUS ),tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil )
54+ Duel .SetOperationInfo (0 ,CATEGORY_EQUIP ,nil ,1 ,tp ,LOCATION_GRAVE |LOCATION_REMOVED )
55+ end
56+ function s .eqop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
57+ local tc = Duel .GetFirstTarget ()
58+ if not (tc :IsFaceup () and tc :IsRelateToEffect (e ) and Duel .GetLocationCount (tp ,LOCATION_SZONE )> 0 ) then return end
59+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_EQUIP )
60+ local ec = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .eqfilter ),tp ,LOCATION_GRAVE |LOCATION_REMOVED ,0 ,1 ,1 ,nil ,tp ):GetFirst ()
61+ if ec and Duel .Equip (tp ,ec ,tc ) then
62+ -- Equip limit
63+ local e1 = Effect .CreateEffect (ec )
64+ e1 :SetType (EFFECT_TYPE_SINGLE )
65+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
66+ e1 :SetCode (EFFECT_EQUIP_LIMIT )
67+ e1 :SetValue (function (e ,c ) return c == tc end )
68+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
69+ ec :RegisterEffect (e1 )
70+ end
71+ end
72+ function s .thfilter (c )
73+ return c :IsRace (RACE_SPELLCASTER ) and c :IsMonsterCard () and c :IsEquipSpell () and c :IsFaceup () and c :IsAbleToHand ()
74+ end
75+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
76+ if chkc then return chkc :IsLocation (LOCATION_STZONE ) and chkc :IsControler (tp ) and s .thfilter (chck ) end
77+ if chk == 0 then return Duel .IsExistingTarget (s .thfilter ,tp ,LOCATION_STZONE ,0 ,1 ,nil ) end
78+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_RTOHAND )
79+ local g = Duel .SelectTarget (tp ,s .thfilter ,tp ,LOCATION_STZONE ,0 ,1 ,1 ,nil )
80+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,g ,1 ,tp ,0 )
81+ end
82+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
83+ local tc = Duel .GetFirstTarget ()
84+ if tc :IsRelateToEffect (e ) then
85+ Duel .SendtoHand (tc ,nil ,REASON_EFFECT )
86+ end
87+ end
0 commit comments