1+ -- 超電導戦士 リニア・マグナム±
2+ -- Conduction Warrior Linear Magnum ±
3+ local s ,id = GetID ()
4+ function s .initial_effect (c )
5+ c :EnableReviveLimit ()
6+ -- special summon
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_FIELD )
10+ e1 :SetCode (EFFECT_SPSUMMON_PROC )
11+ e1 :SetProperty (EFFECT_FLAG_UNCOPYABLE )
12+ e1 :SetRange (LOCATION_HAND )
13+ e1 :SetCondition (s .spcon )
14+ e1 :SetTarget (s .sptg )
15+ e1 :SetOperation (s .spop )
16+ c :RegisterEffect (e1 )
17+ -- Increase ATK
18+ local e2 = Effect .CreateEffect (c )
19+ e2 :SetDescription (aux .Stringid (id ,1 ))
20+ e2 :SetCategory (CATEGORY_ATKCHANGE )
21+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
22+ e2 :SetCode (EVENT_ATTACK_ANNOUNCE )
23+ e2 :SetProperty (EFFECT_FLAG_CARD_TARGET )
24+ e2 :SetTarget (s .atkgtg )
25+ e2 :SetOperation (s .atkgop )
26+ c :RegisterEffect (e2 )
27+ end
28+ function s .spfilter (c ,tpe )
29+ return c :IsType (tpe ) and c :IsAbleToGraveAsCost () and not c :IsCode (id )
30+ end
31+ function s .rescon (sg ,e ,tp ,mg )
32+ return aux .ChkfMMZ (1 )(sg ,e ,tp ,mg ) and sg :IsExists (s .chk ,1 ,nil ,sg )
33+ end
34+ function s .chk (c ,sg )
35+ return c :IsType (TYPE_PLUS ) and sg :IsExists (Card .IsType ,1 ,c ,TYPE_MINUS )
36+ end
37+ function s .spcon (e ,c )
38+ if c == nil then return true end
39+ local tp = c :GetControler ()
40+ local g1 = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,nil ,TYPE_PLUS )
41+ local g2 = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,nil ,TYPE_MINUS )
42+ local g = g1 :Clone ()
43+ g :Merge (g2 )
44+ return Duel .GetLocationCount (tp ,LOCATION_MZONE )>- 2 and # g1 > 0 and # g2 > 0 and # g > 1
45+ and aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,0 )
46+ end
47+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
48+ local g = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_HAND |LOCATION_MZONE ,0 ,nil ,TYPE_PLUS + TYPE_MINUS )
49+ local sg = aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,1 ,tp ,HINTMSG_TOGRAVE ,nil ,nil ,true )
50+ local cg = sg :Filter (Card .IsFacedown ,nil )
51+ if # cg > 0 then
52+ Duel .ConfirmCards (1 - tp ,cg )
53+ end
54+ if # sg > 0 then
55+ sg :KeepAlive ()
56+ e :SetLabelObject (sg )
57+ return true
58+ end
59+ return false
60+ end
61+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
62+ local g = e :GetLabelObject ()
63+ if not g then return end
64+ Duel .SendtoGrave (g ,REASON_COST )
65+ c :SetMaterial (g )
66+ g :DeleteGroup ()
67+ end
68+ function s .filter (c )
69+ return c :IsFaceup () and c :IsType (TYPE_PLUS + TYPE_MINUS )
70+ end
71+ function s .atkgtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
72+ if chkc then return chkc :IsLocation (LOCATION_MZONE ) and s .filter (chkc ) and chkc ~= e :GetHandler () end
73+ if chk == 0 then return Duel .IsExistingTarget (s .filter ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,e :GetHandler ()) end
74+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_FACEUP )
75+ Duel .SelectTarget (tp ,s .filter ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,1 ,e :GetHandler ())
76+ end
77+ function s .atkgop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
78+ local c = e :GetHandler ()
79+ local tc = Duel .GetFirstTarget ()
80+ if tc :IsRelateToEffect (e ) and tc :IsFaceup () and c :IsRelateToEffect (e ) and c :IsFaceup () then
81+ local atk = tc :GetAttack ()/ 2
82+ if atk < 0 then return end
83+ local e1 = Effect .CreateEffect (c )
84+ e1 :SetType (EFFECT_TYPE_SINGLE )
85+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
86+ e1 :SetValue (atk )
87+ e1 :SetReset (RESET_EVENT + RESETS_STANDARD_DISABLE + RESET_PHASE + PHASE_END )
88+ c :RegisterEffect (e1 )
89+ end
90+ end
0 commit comments