1+ -- 超電導戦士 リニア・マグナム±
2+ -- Conduction Warrior Linear Magnum ±
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ -- Must first be Special Summoned (from your hand) by sending 2 "Magnet Warrior" monsters whose original Level is 4 or lower from your hand, Deck, and/or face-up field to the GY
8+ local e0 = Effect .CreateEffect (c )
9+ e0 :SetType (EFFECT_TYPE_FIELD )
10+ e0 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE )
11+ e0 :SetCode (EFFECT_SPSUMMON_PROC )
12+ e0 :SetRange (LOCATION_HAND )
13+ e0 :SetCountLimit (1 ,id ,EFFECT_COUNT_CODE_OATH )
14+ e0 :SetCondition (s .spcon )
15+ e0 :SetTarget (s .sptg )
16+ e0 :SetOperation (s .spop )
17+ c :RegisterEffect (e0 )
18+ -- Gains ATK equal to half of the ATK 1 other EARTH monster on the field
19+ local e1 = Effect .CreateEffect (c )
20+ e1 :SetDescription (aux .Stringid (id ,0 ))
21+ e1 :SetCategory (CATEGORY_ATKCHANGE )
22+ e1 :SetType (EFFECT_TYPE_IGNITION )
23+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
24+ e1 :SetRange (LOCATION_MZONE )
25+ e1 :SetCountLimit (1 ,{id ,1 })
26+ e1 :SetTarget (s .atktg )
27+ e1 :SetOperation (s .atkop )
28+ c :RegisterEffect (e1 )
29+ -- Add this card to your hand
30+ local e2 = Effect .CreateEffect (c )
31+ e2 :SetDescription (aux .Stringid (id ,1 ))
32+ e2 :SetCategory (CATEGORY_TOHAND )
33+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F )
34+ e2 :SetCode (EVENT_TO_GRAVE )
35+ e2 :SetCountLimit (1 ,{id ,2 })
36+ e2 :SetCondition (function (e ) return e :GetHandler ():IsReason (REASON_DESTROY ) end )
37+ e2 :SetTarget (s .thtg )
38+ e2 :SetOperation (s .thop )
39+ c :RegisterEffect (e2 )
40+ end
41+ s .listed_series = {SET_MAGNET_WARRIOR }
42+ function s .spconfilter (c )
43+ return c :IsSetCard (SET_MAGNET_WARRIOR ) and c :IsMonster () and c :GetOriginalLevel ()<= 4
44+ and c :IsAbleToGraveAsCost () and (c :IsFaceup () or not c :IsLocation (LOCATION_MZONE ))
45+ end
46+ function s .spcon (e ,c )
47+ if c == nil then return true end
48+ local tp = c :GetControler ()
49+ local g = Duel .GetMatchingGroup (s .spconfilter ,tp ,LOCATION_HAND |LOCATION_MZONE |LOCATION_DECK ,0 ,nil )
50+ return aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,aux .ChkfMMZ (1 ),0 )
51+ end
52+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,c )
53+ local rg = Duel .GetMatchingGroup (s .spconfilter ,tp ,LOCATION_HAND |LOCATION_MZONE |LOCATION_DECK ,0 ,nil )
54+ local g = aux .SelectUnselectGroup (rg ,e ,tp ,2 ,2 ,aux .ChkfMMZ (1 ),1 ,tp ,HINTMSG_TOGRAVE )
55+ if # g > 0 then
56+ g :KeepAlive ()
57+ e :SetLabelObject (g )
58+ return true
59+ end
60+ return false
61+ end
62+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
63+ local g = e :GetLabelObject ()
64+ if not g then return end
65+ Duel .SendtoGrave (g ,REASON_COST )
66+ g :DeleteGroup ()
67+ end
68+ function s .atkfilter (c )
69+ return c :IsAttribute (ATTRIBUTE_EARTH ) and c :HasNonZeroAttack ()
70+ end
71+ function s .atktg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
72+ local c = e :GetHandler ()
73+ if chkc then return chkc :IsLocation (LOCATION_MZONE ) and s .atkfilter (chkc ) and chkc ~= c end
74+ if chk == 0 then return Duel .IsExistingTarget (s .atkfilter ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,c ) end
75+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
76+ local tc = Duel .SelectTarget (tp ,s .atkfilter ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,1 ,c ):GetFirst ()
77+ Duel .SetOperationInfo (0 ,CATEGORY_ATKCHANGE ,c ,1 ,tp ,tc :GetAttack ()// 2 )
78+ end
79+ function s .atkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
80+ local tc = Duel .GetFirstTarget ()
81+ local c = e :GetHandler ()
82+ if tc :IsFaceup () and tc :IsRelateToEffect (e ) and c :IsFaceup () and c :IsRelateToEffect (e ) then
83+ -- Gains ATK equal to half of that monster's ATK
84+ local e1 = Effect .CreateEffect (c )
85+ e1 :SetType (EFFECT_TYPE_SINGLE )
86+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
87+ e1 :SetValue (tc :GetAttack ()// 2 )
88+ e1 :SetReset (RESETS_STANDARD_DISABLE_PHASE_END )
89+ c :RegisterEffect (e1 )
90+ end
91+ end
92+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
93+ if chk == 0 then return true end
94+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,e :GetHandler (),1 ,tp ,0 )
95+ end
96+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
97+ local c = e :GetHandler ()
98+ if c :IsRelateToEffect (e ) then
99+ Duel .SendtoHand (c ,nil ,REASON_EFFECT )
100+ end
101+ end
0 commit comments