1+ -- ウィッチクラフト・ピューピルズ
2+ -- Witchcrafter Pupils
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ -- Fusion Materials: 1 "Witchcrafter" monster + 1 Spellcaster monster
8+ Fusion .AddProcMix (c ,true ,true ,aux .FilterBoolFunctionEx (Card .IsSetCard ,SET_WITCHCRAFTER ),aux .FilterBoolFunctionEx (Card .IsRace ,RACE_SPELLCASTER ))
9+ -- During the Main or Battle Phase (Quick Effect): You can activate 1 of these effects;
10+ local e1 = Effect .CreateEffect (c )
11+ e1 :SetDescription (aux .Stringid (id ,0 ))
12+ e1 :SetType (EFFECT_TYPE_QUICK_O )
13+ e1 :SetCode (EVENT_FREE_CHAIN )
14+ e1 :SetRange (LOCATION_MZONE )
15+ e1 :SetCountLimit (1 ,{id ,0 })
16+ e1 :SetCondition (function () return Duel .IsMainPhase () or Duel .IsBattlePhase () end )
17+ e1 :SetCost (Cost .Choice (
18+ -- ● Add 1 "Witchcrafter" Spell from your Deck to your hand
19+ {aux .TRUE ,aux .Stringid (id ,2 ),function (e ,tp ) return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end },
20+ -- ● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect
21+ {Cost .Reveal (s .revealfilter ,nil ,1 ,1 ,function (e ,tp ,og ) e :SetLabelObject (og ) end ),aux .Stringid (id ,3 ),nil }
22+ )
23+ )
24+ e1 :SetTarget (s .efftg )
25+ e1 :SetOperation (s .effop )
26+ e1 :SetHintTiming (0 ,TIMING_MAIN_END |TIMING_BATTLE_START |TIMING_BATTLE_END |TIMINGS_CHECK_MONSTER )
27+ c :RegisterEffect (e1 )
28+ -- During your End Phase: You can return 1 of your banished "Witchcrafter" cards to the GY
29+ local e2 = Effect .CreateEffect (c )
30+ e2 :SetDescription (aux .Stringid (id ,1 ))
31+ e2 :SetCategory (CATEGORY_TOGRAVE )
32+ e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
33+ e2 :SetCode (EVENT_PHASE + PHASE_END )
34+ e2 :SetRange (LOCATION_MZONE )
35+ e2 :SetCountLimit (1 ,{id ,1 })
36+ e2 :SetCondition (function (e ,tp ) return Duel .IsTurnPlayer (tp ) end )
37+ e2 :SetTarget (s .rtgtg )
38+ e2 :SetOperation (s .rtgop )
39+ c :RegisterEffect (e2 )
40+ end
41+ s .listed_series = {SET_WITCHCRAFTER }
42+ s .material_setcode = SET_WITCHCRAFTER
43+ function s .thfilter (c )
44+ return c :IsSetCard (SET_WITCHCRAFTER ) and c :IsSpell () and c :IsAbleToHand ()
45+ end
46+ function s .revealfilter (c )
47+ return c :IsSetCard (SET_WITCHCRAFTER ) and (c :IsNormalSpell () or c :IsQuickPlaySpell ())
48+ and c :CheckActivateEffect (true ,true ,false )~= nil
49+ and c :CheckActivateEffect (true ,true ,false ):GetOperation ()~= nil
50+ end
51+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
52+ if chk == 0 then return true end
53+ local op = e :GetLabel ()
54+ if op == 1 then
55+ -- ● Add 1 "Witchcrafter" Spell from your Deck to your hand
56+ e :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
57+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
58+ elseif op == 2 then
59+ -- ● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect
60+ e :SetCategory (0 )
61+ local revealed_card = e :GetLabelObject ():GetFirst ()
62+ local te ,ceg ,cep ,cev ,cre ,cr ,crp = revealed_card :CheckActivateEffect (true ,true ,true )
63+ Duel .ClearTargetCard ()
64+ local tg = te :GetTarget ()
65+ e :SetProperty (te :GetProperty ())
66+ if tg then tg (e ,tp ,ceg ,cep ,cev ,cre ,cr ,crp ,1 ) end
67+ te :SetLabelObject (e :GetLabelObject ())
68+ e :SetLabelObject (te )
69+ e :SetCategory (0 )
70+ Duel .ClearOperationInfo (0 )
71+ end
72+ end
73+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
74+ local op = e :GetLabel ()
75+ if op == 1 then
76+ -- ● Add 1 "Witchcrafter" Spell from your Deck to your hand
77+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
78+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
79+ if # g > 0 then
80+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
81+ Duel .ConfirmCards (1 - tp ,g )
82+ end
83+ elseif op == 2 then
84+ -- ● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect
85+ local te = e :GetLabelObject ()
86+ if not te then return end
87+ e :SetLabelObject (te :GetLabelObject ())
88+ local op = te :GetOperation ()
89+ if op then
90+ op (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
91+ end
92+ end
93+ end
94+ function s .rtgfilter (c )
95+ return c :IsSetCard (SET_WITCHCRAFTER ) and c :IsFaceup () and c :IsAbleToGrave ()
96+ end
97+ function s .rtgtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
98+ if chk == 0 then return Duel .IsExistingMatchingCard (s .rtgfilter ,tp ,LOCATION_REMOVED ,0 ,1 ,nil ) end
99+ Duel .SetOperationInfo (0 ,CATEGORY_TOGRAVE ,nil ,1 ,tp ,LOCATION_REMOVED )
100+ end
101+ function s .rtgop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
102+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_RTOGRAVE )
103+ local g = Duel .SelectMatchingCard (tp ,s .rtgfilter ,tp ,LOCATION_REMOVED ,0 ,1 ,1 ,nil )
104+ if # g > 0 then
105+ Duel .HintSelection (g )
106+ Duel .SendtoGrave (g ,REASON_EFFECT )
107+ end
108+ end
0 commit comments