1+ -- ブレインコントローラー
2+ -- Brain Controller
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Add 1 "Brain Control" from your Deck to your hand
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
10+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
11+ e1 :SetProperty (EFFECT_FLAG_DELAY )
12+ e1 :SetCode (EVENT_SUMMON_SUCCESS )
13+ e1 :SetCountLimit (1 ,id )
14+ e1 :SetTarget (s .thtg )
15+ e1 :SetOperation (s .thop )
16+ c :RegisterEffect (e1 )
17+ local e2 = e1 :Clone ()
18+ e2 :SetCode (EVENT_SPSUMMON_SUCCESS )
19+ c :RegisterEffect (e2 )
20+ -- Change the Level of 1 face-up monster on the field
21+ local e3 = Effect .CreateEffect (c )
22+ e3 :SetDescription (aux .Stringid (id ,1 ))
23+ e3 :SetCategory (CATEGORY_LVCHANGE )
24+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
25+ e3 :SetProperty (EFFECT_FLAG_DELAY + EFFECT_FLAG_CARD_TARGET )
26+ e3 :SetCode (EVENT_PAY_LPCOST )
27+ e3 :SetRange (LOCATION_MZONE )
28+ e3 :SetCountLimit (1 ,{id ,1 })
29+ e3 :SetCondition (function (e ,tp ,eg ,ep ) return ep == tp end )
30+ e3 :SetTarget (s .lvtg )
31+ e3 :SetOperation (s .lvop )
32+ c :RegisterEffect (e3 )
33+ -- Special Summon this card to your opponent's field in Defense Position
34+ local e4 = Effect .CreateEffect (c )
35+ e4 :SetDescription (aux .Stringid (id ,2 ))
36+ e4 :SetCategory (CATEGORY_SPECIAL_SUMMON )
37+ e4 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
38+ e4 :SetProperty (EFFECT_FLAG_DELAY )
39+ e4 :SetCode (EVENT_BE_MATERIAL )
40+ e4 :SetCountLimit (1 ,{id ,2 })
41+ e4 :SetCondition (function (e ,tp ,eg ,ep ,ev ,re ,r ,rp ) return e :GetHandler ():IsLocation (LOCATION_GRAVE ) and r == REASON_SYNCHRO end )
42+ e4 :SetTarget (s .sptg )
43+ e4 :SetOperation (s .spop )
44+ c :RegisterEffect (e4 )
45+ end
46+ s .listed_names = {87910978 } -- "Brain Control"
47+ function s .thfilter (c )
48+ return c :IsCode (87910978 ) and c :IsAbleToHand ()
49+ end
50+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
51+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
52+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
53+ end
54+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
55+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
56+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
57+ if # g > 0 then
58+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
59+ Duel .ConfirmCards (1 - tp ,g )
60+ end
61+ end
62+ function s .lvtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
63+ if chkc then return chkc :IsLocation (LOCATION_MZONE ) and chkc :HasLevel () and chkc :IsFaceup () end
64+ if chk == 0 then return Duel .IsExistingTarget (aux .FaceupFilter (Card .HasLevel ),tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,nil ) end
65+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
66+ local g = Duel .SelectTarget (tp ,aux .FaceupFilter (Card .HasLevel ),tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,1 ,nil )
67+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_LVRANK )
68+ local lv = Duel .AnnounceLevel (tp ,1 ,8 ,g :GetFirst ():GetLevel ())
69+ Duel .SetTargetParam (lv )
70+ Duel .SetOperationInfo (0 ,CATEGORY_LVCHANGE ,g ,1 ,tp ,lv )
71+ end
72+ function s .lvop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
73+ local tc = Duel .GetFirstTarget ()
74+ local lv = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PARAM )
75+ if tc :IsFaceup () and tc :IsRelateToEffect (e ) then
76+ -- It becomes the declared Level
77+ local e1 = Effect .CreateEffect (e :GetHandler ())
78+ e1 :SetType (EFFECT_TYPE_SINGLE )
79+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
80+ e1 :SetCode (EFFECT_CHANGE_LEVEL )
81+ e1 :SetValue (lv )
82+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
83+ tc :RegisterEffect (e1 )
84+ end
85+ end
86+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
87+ local c = e :GetHandler ()
88+ if chk == 0 then return Duel .GetLocationCount (1 - tp ,LOCATION_MZONE )> 0
89+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEUP_DEFENSE ,1 - tp ) end
90+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
91+ end
92+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
93+ local c = e :GetHandler ()
94+ if c :IsRelateToEffect (e ) and Duel .SpecialSummonStep (c ,0 ,tp ,1 - tp ,false ,false ,POS_FACEUP_DEFENSE ) then
95+ c :NegateEffects (c )
96+ end
97+ Duel .SpecialSummonComplete ()
98+ end
0 commit comments