1+ -- 自動ネジマキ機
12-- Automatic Gearspring Machine
23local s ,id = GetID ()
4+ local COUNTER_GEARSPRING = 0x107
35function s .initial_effect (c )
4- c :EnableCounterPermit (0x107 )
5- -- Activate
6+ c :EnableCounterPermit (COUNTER_GEARSPRING )
7+ -- When you activate this card: Place 2 Gearspring Counters on it
68 local e1 = Effect .CreateEffect (c )
9+ e1 :SetDescription (aux .Stringid (id ,0 ))
710 e1 :SetCategory (CATEGORY_COUNTER )
811 e1 :SetType (EFFECT_TYPE_ACTIVATE )
912 e1 :SetCode (EVENT_FREE_CHAIN )
1013 e1 :SetTarget (s .target )
1114 e1 :SetOperation (s .activate )
1215 c :RegisterEffect (e1 )
13- -- add counter
16+ -- During each of your Standby Phases, place 1 Gearspring Counter on this card
1417 local e2 = Effect .CreateEffect (c )
1518 e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
19+ e2 :SetCode (EVENT_PHASE + PHASE_STANDBY )
1620 e2 :SetRange (LOCATION_SZONE )
1721 e2 :SetCountLimit (1 )
18- e2 :SetCode (EVENT_PHASE + PHASE_STANDBY )
19- e2 :SetCondition (s .ctcon )
20- e2 :SetOperation (s .ctop )
22+ e2 :SetCondition (function (e ,tp ) return Duel .IsTurnPlayer (tp ) and e :GetHandler ():IsCanAddCounter (COUNTER_GEARSPRING ,1 ) end )
23+ e2 :SetOperation (s .standbycounterop )
2124 c :RegisterEffect (e2 )
22- -- place
23- local e4 = Effect .CreateEffect (c )
24- e4 : SetCategory ( CATEGORY_COUNTER )
25- e4 : SetDescription ( aux . Stringid ( 47408488 , 1 ) )
26- e4 :SetType (EFFECT_TYPE_IGNITION )
27- e4 :SetRange (LOCATION_SZONE )
28- e4 :SetCost (s .plcost )
29- e4 :SetTarget (s .pltg )
30- e4 :SetOperation (s .plop )
31- c :RegisterEffect (e4 )
25+ -- Place Gearspring Counters on another card you can place a Gearspring Counter on, equal to the number of Gearspring Counters that were on this card
26+ local e3 = Effect .CreateEffect (c )
27+ e3 : SetDescription ( aux . Stringid ( id , 1 ) )
28+ e3 : SetCategory ( CATEGORY_COUNTER )
29+ e3 :SetType (EFFECT_TYPE_IGNITION )
30+ e3 :SetRange (LOCATION_SZONE )
31+ e3 :SetCost (s .maincountercost )
32+ e3 :SetTarget (s .maincountertg )
33+ e3 :SetOperation (s .maincounterop )
34+ c :RegisterEffect (e3 )
3235end
36+ s .counter_place_list = {COUNTER_GEARSPRING }
3337function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
34- if chk == 0 then return true end
35- Duel .SetOperationInfo (0 ,CATEGORY_COUNTER ,nil ,2 ,0 ,0x107 )
38+ local c = e :GetHandler ()
39+ if chk == 0 then return c :IsCanAddCounter (COUNTER_GEARSPRING ,2 ,false ,LOCATION_SZONE ) end
40+ Duel .SetOperationInfo (0 ,CATEGORY_COUNTER ,c ,2 ,tp ,COUNTER_GEARSPRING )
3641end
3742function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
3843 local c = e :GetHandler ()
39- if c :IsRelateToEffect (e ) then
40- c :AddCounter (0x107 ,2 )
41- Duel .RaiseEvent (c ,id + 1 ,e ,REASON_EFFECT ,tp ,tp ,0x107 )
44+ if c :IsRelateToEffect (e ) and c :AddCounter (COUNTER_GEARSPRING ,2 ) then
45+ Duel .RaiseEvent (c ,EVENT_CUSTOM + 511002905 ,e ,REASON_EFFECT ,tp ,tp ,2 )
4246 end
4347end
44- function s .ctcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
45- return Duel .GetTurnPlayer ()== tp
46- end
47- function s .ctop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
48+ function s .standbycounterop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
4849 local c = e :GetHandler ()
49- c :AddCounter (0x107 ,1 )
50- Duel .RaiseSingleEvent (c ,id + 1 ,e ,0 ,0 ,tp ,0 )
50+ if c :AddCounter (COUNTER_GEARSPRING ,1 ) then
51+ Duel .RaiseEvent (c ,EVENT_CUSTOM + 511002905 ,e ,REASON_EFFECT ,tp ,tp ,1 )
52+ end
5153end
52- function s .plcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
53- if chk == 0 then return e :GetHandler ():IsAbleToGraveAsCost () end
54- e :SetLabel (e :GetHandler ():GetCounter (0x107 ))
55- Duel .SendtoGrave (e :GetHandler (),REASON_COST )
54+ function s .maincountercost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
55+ local c = e :GetHandler ()
56+ if chk == 0 then return c :IsAbleToGraveAsCost () end
57+ e :SetLabel (c :GetCounter (COUNTER_GEARSPRING ))
58+ Duel .SendtoGrave (c ,REASON_COST )
5659end
57- function s .pltg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
60+ function s .maincountertg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
5861 if chk == 0 then
5962 local c = e :GetHandler ()
60- local ct = c :GetCounter (0x107 )
61- return ct > 0 and Duel .IsExistingMatchingCard (Card .IsCanAddCounter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,c ,0x107 ,ct )
63+ local ct = c :GetCounter (COUNTER_GEARSPRING )
64+ return ct > 0 and Duel .IsExistingMatchingCard (Card .IsCanAddCounter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,c ,COUNTER_GEARSPRING ,ct )
6265 end
63- Duel .SetTargetParam (e :GetLabel ())
64- e :SetLabel (0 )
65- Duel .SetOperationInfo (0 ,CATEGORY_COUNTER ,nil ,ct ,0 ,0x107 )
66+ Duel .SetOperationInfo (0 ,CATEGORY_COUNTER ,nil ,e :GetLabel (),tp ,COUNTER_GEARSPRING )
6667end
67- function s .plop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
68- local ct = Duel . GetChainInfo ( 0 , CHAININFO_TARGET_PARAM )
69- Duel .Hint (HINT_SELECTMSG ,tp ,aux . Stringid ( 73853830 , 1 ) )
70- local g = Duel .SelectMatchingCard (tp ,Card .IsCanAddCounter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,1 ,nil ,0x107 ,ct )
71- local tc = g : GetFirst ()
72- if tc then
73- Duel . HintSelection ( g )
74- tc : AddCounter ( 0x107 ,ct )
75- Duel . RaiseEvent ( tc , id + 1 , e , REASON_EFFECT , tp , tp , 0x107 )
68+ function s .maincounterop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
69+ local ct = e : GetLabel ( )
70+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_COUNTER )
71+ local sc = Duel .SelectMatchingCard (tp ,Card .IsCanAddCounter ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,1 ,nil ,COUNTER_GEARSPRING ,ct ): GetFirst ( )
72+ if sc then
73+ Duel . HintSelection ( sc )
74+ if sc : AddCounter ( COUNTER_GEARSPRING , ct ) then
75+ Duel . RaiseEvent ( sc , EVENT_CUSTOM + 511002905 , e , REASON_EFFECT , tp , tp ,ct )
76+ end
7677 end
77- end
78+ end
0 commit comments