1+ -- 水霊術師エリア
2+ -- Eria the Water Spiritualist
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- recycle and draw
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TODECK + CATEGORY_DRAW )
10+ e1 :SetType (EFFECT_TYPE_IGNITION )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetCountLimit (1 )
13+ e1 :SetCondition (s .condition )
14+ e1 :SetCost (s .cost )
15+ e1 :SetTarget (s .target )
16+ e1 :SetOperation (s .operation )
17+ c :RegisterEffect (e1 )
18+ end
19+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
20+ local c = e :GetHandler ()
21+ return c :IsSummonPhaseMain () and c :IsStatus (STATUS_SUMMON_TURN + STATUS_SPSUMMON_TURN )
22+ end
23+ function s .costfilter (c )
24+ return c :IsMonster () and c :IsAbleToGraveAsCost ()
25+ end
26+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
27+ if chk == 0 then return Duel .IsExistingMatchingCard (s .costfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,1 ,nil ) end
28+ end
29+ function s .tdfilter (c )
30+ return c :IsAbleToDeck () and c :IsMonster ()
31+ end
32+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
33+ if chk == 0 then return Duel .IsExistingMatchingCard (s .tdfilter ,tp ,0 ,LOCATION_GRAVE ,1 ,nil ) end
34+ Duel .SetOperationInfo (0 ,CATEGORY_TODECK ,nil ,1 ,0 ,LOCATION_GRAVE )
35+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_DRAW ,nil ,1 ,tp ,1 )
36+ end
37+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
38+ local c = e :GetHandler ()
39+ -- Requirement
40+ local tg = Duel .SelectMatchingCard (tp ,s .costfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,1 ,1 ,nil )
41+ if Duel .SendtoGrave (tg ,REASON_COST )< 1 then return end
42+ -- Effect
43+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
44+ local tg = Duel .SelectMatchingCard (tp ,s .tdfilter ,tp ,0 ,LOCATION_GRAVE ,1 ,1 ,nil )
45+ local tc = tg :GetFirst ()
46+ Duel .HintSelection (tg )
47+ Duel .SendtoDeck (tg ,nil ,SEQ_DECKTOP ,REASON_EFFECT )
48+ -- Can only Special Summon in face-down Defense Position
49+ local e1 = Effect .CreateEffect (e :GetHandler ())
50+ e1 :SetDescription (aux .Stringid (id ,1 ))
51+ e1 :SetType (EFFECT_TYPE_FIELD )
52+ e1 :SetCode (EFFECT_FORCE_SPSUMMON_POSITION )
53+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
54+ e1 :SetTargetRange (0 ,1 )
55+ e1 :SetTarget (s .sumlimit )
56+ e1 :SetLabel (tc :GetOriginalCodeRule ())
57+ e1 :SetValue (POS_FACEDOWN_DEFENSE )
58+ e1 :SetReset (RESET_PHASE |PHASE_END ,2 )
59+ Duel .RegisterEffect (e1 ,tp )
60+ -- Prevent players from Summoning monsters with the same name
61+ local e2 = Effect .CreateEffect (e :GetHandler ())
62+ e2 :SetDescription (aux .Stringid (id ,1 ))
63+ e2 :SetType (EFFECT_TYPE_FIELD )
64+ e2 :SetCode (EFFECT_CANNOT_SUMMON )
65+ e2 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
66+ e2 :SetTargetRange (0 ,1 )
67+ e2 :SetTarget (s .sumlimit )
68+ e2 :SetLabel (tc :GetOriginalCodeRule ())
69+ e2 :SetReset (RESET_PHASE |PHASE_END ,2 )
70+ Duel .RegisterEffect (e2 ,tp )
71+ local e3 = Effect .CreateEffect (c )
72+ e3 :SetDescription (aux .Stringid (id ,1 ))
73+ e3 :SetType (EFFECT_TYPE_FIELD )
74+ e3 :SetCode (EFFECT_CANNOT_ACTIVATE )
75+ e3 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
76+ e3 :SetTargetRange (1 ,0 )
77+ e3 :SetValue (s .aclimit )
78+ e3 :SetReset (RESET_PHASE |PHASE_END )
79+ Duel .RegisterEffect (e3 ,tp )
80+ end
81+ function s .sumlimit (e ,c ,sump ,sumtype ,sumpos ,targetp ,se )
82+ return c :IsOriginalCodeRule (e :GetLabel ())
83+ end
84+ function s .aclimit (e ,re ,tp )
85+ return re :GetHandler ():IsCode (id )
86+ end
0 commit comments