1+ -- エクソシスター・バト・マーテル
2+ -- Exosister Bat Mater
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- When this card is activated: Add 2 "Exosister" monsters from your Deck to your hand, then discard 1 card
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH + CATEGORY_HANDES )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetCountLimit (1 ,id )
13+ e1 :SetTarget (s .target )
14+ e1 :SetOperation (s .activate )
15+ c :RegisterEffect (e1 )
16+ -- Immediately after this effect resolves, Normal Summon 1 "Exosister" monster that is mentioned on that monster
17+ local e2 = Effect .CreateEffect (c )
18+ e2 :SetDescription (aux .Stringid (id ,1 ))
19+ e2 :SetCategory (CATEGORY_SUMMON )
20+ e2 :SetType (EFFECT_TYPE_IGNITION )
21+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
22+ e2 :SetRange (LOCATION_SZONE )
23+ e2 :SetCountLimit (1 ,{id ,1 })
24+ e2 :SetTarget (s .nstg )
25+ e2 :SetOperation (s .nsop )
26+ c :RegisterEffect (e2 )
27+ -- Make your opponent banish 1 of them
28+ local e3a = Effect .CreateEffect (c )
29+ e3a :SetDescription (aux .Stringid (id ,2 ))
30+ e3a :SetCategory (CATEGORY_REMOVE )
31+ e3a :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
32+ e3a :SetProperty (EFFECT_FLAG_DELAY )
33+ e3a :SetCode (EVENT_CUSTOM + id )
34+ e3a :SetRange (LOCATION_SZONE )
35+ e3a :SetCountLimit (1 ,{id ,2 })
36+ e3a :SetTarget (s .rmtg )
37+ e3a :SetOperation (s .rmop )
38+ c :RegisterEffect (e3a )
39+ local g = Group .CreateGroup ()
40+ e3a :SetLabelObject (g )
41+ -- Keep track of monsters sent to your opponent's GY
42+ local e3b = Effect .CreateEffect (c )
43+ e3b :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
44+ e3b :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
45+ e3b :SetCode (EVENT_TO_GRAVE )
46+ e3b :SetRange (LOCATION_SZONE )
47+ e3b :SetLabelObject (e3a )
48+ e3b :SetOperation (s .regop )
49+ c :RegisterEffect (e3b )
50+ end
51+ s .listed_series = {SET_EXOSISTER }
52+ function s .thfilter (c )
53+ return c :IsSetCard (SET_EXOSISTER ) and c :IsMonster () and c :IsAbleToHand ()
54+ end
55+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
56+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,2 ,nil ) end
57+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,2 ,tp ,LOCATION_DECK )
58+ Duel .SetOperationInfo (0 ,CATEGORY_HANDES ,nil ,1 ,tp ,1 )
59+ end
60+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
61+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
62+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,2 ,2 ,nil )
63+ if # g == 2 and Duel .SendtoHand (g ,nil ,REASON_EFFECT )> 0 then
64+ Duel .ConfirmCards (1 - tp ,g )
65+ Duel .ShuffleHand (tp )
66+ Duel .BreakEffect ()
67+ Duel .DiscardHand (tp ,nil ,1 ,1 ,REASON_EFFECT |REASON_DISCARD ,nil )
68+ end
69+ end
70+ function s .tgfilter (c ,tp )
71+ return c :IsFaceup () and Duel .IsExistingMatchingCard (s .nsfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,1 ,nil ,c )
72+ end
73+ function s .nsfilter (c ,tc )
74+ return c :IsSetCard (SET_EXOSISTER ) and c :IsSummonable (true ,nil ) and tc :ListsCode (c :GetCode ())
75+ end
76+ function s .nstg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
77+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_MZONE ) and s .tgfilter (chkc ,tp ) end
78+ if chk == 0 then return Duel .IsExistingTarget (s .tgfilter ,tp ,LOCATION_MZONE ,0 ,1 ,nil ,tp ) end
79+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
80+ local g = Duel .SelectTarget (tp ,s .tgfilter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil ,tp )
81+ Duel .SetOperationInfo (0 ,CATEGORY_SUMMON ,nil ,1 ,tp ,LOCATION_HAND |LOCATION_MZONE )
82+ end
83+ function s .nsop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
84+ local tc = Duel .GetFirstTarget ()
85+ if tc :IsRelateToEffect (e ) and tc :IsFaceup () then
86+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SUMMON )
87+ local sc = Duel .SelectMatchingCard (tp ,s .nsfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,1 ,1 ,nil ,tc ):GetFirst ()
88+ if sc then
89+ Duel .Summon (tp ,sc ,true ,nil )
90+ end
91+ end
92+ end
93+ function s .regfilter (c ,opp )
94+ return c :IsMonster () and c :IsControler (opp )
95+ end
96+ function s .regop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
97+ local tg = eg :Filter (s .regfilter ,nil ,1 - tp )
98+ if # tg > 0 then
99+ for tc in tg :Iter () do
100+ tc :RegisterFlagEffect (id ,RESET_CHAIN ,0 ,1 )
101+ end
102+ local g = e :GetLabelObject ():GetLabelObject ()
103+ if Duel .GetCurrentChain ()== 0 then g :Clear () end
104+ g :Merge (tg )
105+ g :Remove (function (c ) return c :GetFlagEffect (id )== 0 end ,nil )
106+ e :GetLabelObject ():SetLabelObject (g )
107+ Duel .RaiseSingleEvent (e :GetHandler (),EVENT_CUSTOM + id ,e ,0 ,tp ,tp ,0 )
108+ end
109+ end
110+ function s .rmfilter (c ,opp )
111+ return c :IsControler (opp ) and c :IsLocation (LOCATION_GRAVE ) and c :IsAbleToRemove (opp )
112+ end
113+ function s .rmtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
114+ local g = e :GetLabelObject ():Filter (s .rmfilter ,nil ,1 - tp )
115+ if chk == 0 then return # g > 0 end
116+ Duel .SetTargetCard (g )
117+ Duel .SetOperationInfo (0 ,CATEGORY_REMOVE ,g ,1 ,1 - tp ,0 )
118+ end
119+ function s .rmop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
120+ local g = Duel .GetTargetCards (e )
121+ if # g == 0 then return end
122+ local opp = 1 - tp
123+ Duel .Hint (HINT_SELECTMSG ,opp ,HINTMSG_REMOVE )
124+ g = g :FilterSelect (opp ,Card .IsAbleToRemove ,1 ,1 ,nil ,opp )
125+ if # g > 0 then
126+ Duel .HintSelection (g )
127+ Duel .Remove (g ,POS_FACEUP ,REASON_EFFECT ,PLAYER_NONE ,opp )
128+ end
129+ end
0 commit comments