22-- Cyberdark Cannon
33local s ,id = GetID ()
44function s .initial_effect (c )
5- -- search
5+ -- Draw 1 card
66 local e1 = Effect .CreateEffect (c )
7- e1 :SetDescription (aux .Stringid (id ,1 ))
8- e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
9- e1 :SetType (EFFECT_TYPE_IGNITION )
10- e1 :SetRange ( LOCATION_HAND )
11- e1 :SetCountLimit ( 1 , id )
12- e1 :SetCost ( Cost . SelfDiscard )
13- e1 :SetTarget (s .target )
14- e1 :SetOperation (s .operation )
7+ e1 :SetDescription (aux .Stringid (id ,0 ))
8+ e1 :SetCategory (CATEGORY_DRAW )
9+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
10+ e1 :SetProperty ( EFFECT_FLAG_DELAY )
11+ e1 :SetCode ( EVENT_TO_GRAVE )
12+ e1 :SetCondition ( s . drwcon )
13+ e1 :SetTarget (s .drwtg )
14+ e1 :SetOperation (s .drwop )
1515 c :RegisterEffect (e1 )
16- -- send to grave
16+ -- Add 1 Machine "Cyberdark" monster from your Deck to your hand
1717 local e2 = Effect .CreateEffect (c )
18- e2 :SetDescription (aux .Stringid (id ,2 ))
19- e2 :SetCategory (CATEGORY_TOGRAVE )
20- e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
21- e2 :SetCode (EVENT_PRE_DAMAGE_CALCULATE )
22- e2 :SetRange (LOCATION_SZONE )
23- e2 :SetCountLimit (1 ,{id ,1 })
24- e2 :SetCondition (s .gycon )
25- e2 :SetTarget (s .gytg )
26- e2 :SetOperation (s .gyop )
18+ e2 :SetDescription (aux .Stringid (id ,1 ))
19+ e2 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
20+ e2 :SetType (EFFECT_TYPE_IGNITION )
21+ e2 :SetRange (LOCATION_HAND )
22+ e2 :SetCountLimit (1 ,id )
23+ e2 :SetCost (Cost .SelfDiscard )
24+ e2 :SetTarget (s .thtg )
25+ e2 :SetOperation (s .thop )
2726 c :RegisterEffect (e2 )
28- -- draw
27+ -- Send 1 monster from your Deck to the GY
2928 local e3 = Effect .CreateEffect (c )
30- e3 :SetDescription (aux .Stringid (id ,0 ))
31- e3 :SetCategory (CATEGORY_DRAW )
32- e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
33- e3 :SetProperty (EFFECT_FLAG_DELAY )
34- e3 :SetCode (EVENT_TO_GRAVE )
35- e3 :SetCondition (s .con )
36- e3 :SetTarget (s .tg )
37- e3 :SetOperation (s .op )
29+ e3 :SetDescription (aux .Stringid (id ,2 ))
30+ e3 :SetCategory (CATEGORY_TOGRAVE )
31+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
32+ e3 :SetCode (EVENT_PRE_DAMAGE_CALCULATE )
33+ e3 :SetRange (LOCATION_SZONE )
34+ e3 :SetCountLimit (1 ,{id ,1 })
35+ e3 :SetCondition (s .tgcon )
36+ e3 :SetTarget (s .tgtg )
37+ e3 :SetOperation (s .tgop )
3838 c :RegisterEffect (e3 )
3939end
4040s .listed_series = {SET_CYBERDARK }
41- function s .filter (c )
41+ function s .drwcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
42+ local c = e :GetHandler ()
43+ return c :IsPreviousLocation (LOCATION_SZONE ) and c :GetPreviousEquipTarget () and not c :IsReason (REASON_LOST_TARGET )
44+ end
45+ function s .drwtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
46+ if chk == 0 then return Duel .IsPlayerCanDraw (tp ,1 ) end
47+ Duel .SetTargetPlayer (tp )
48+ Duel .SetTargetParam (1 )
49+ Duel .SetOperationInfo (0 ,CATEGORY_DRAW ,nil ,0 ,tp ,1 )
50+ end
51+ function s .drwop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
52+ local p ,d = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PLAYER ,CHAININFO_TARGET_PARAM )
53+ Duel .Draw (p ,d ,REASON_EFFECT )
54+ end
55+ function s .thfilter (c )
4256 return c :IsSetCard (SET_CYBERDARK ) and c :IsRace (RACE_MACHINE ) and c :IsAbleToHand ()
4357end
44- function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
45- if chk == 0 then return Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
58+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
59+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
4660 Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
4761end
48- function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
62+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
4963 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
50- local tg = Duel .SelectMatchingCard (tp ,s .filter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
64+ local tg = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
5165 if # tg > 0 then
5266 Duel .SendtoHand (tg ,nil ,REASON_EFFECT )
5367 Duel .ConfirmCards (1 - tp ,tg )
5670function s .tgfilter (c )
5771 return c :IsMonster () and c :IsAbleToGrave ()
5872end
59- function s .gycon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
73+ function s .tgcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
6074 local ec = e :GetHandler ():GetEquipTarget ()
6175 return ec and (ec == Duel .GetAttacker () or ec == Duel .GetAttackTarget ())
6276end
63- function s .gytg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
77+ function s .tgtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
6478 if chk == 0 then return Duel .IsExistingMatchingCard (s .tgfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
6579 Duel .SetOperationInfo (0 ,CATEGORY_TOGRAVE ,nil ,1 ,tp ,LOCATION_DECK )
6680end
67- function s .gyop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
81+ function s .tgop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
6882 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
6983 local g = Duel .SelectMatchingCard (tp ,s .tgfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
7084 if # g > 0 then
7185 Duel .SendtoGrave (g ,REASON_EFFECT )
7286 end
73- end
74- function s .con (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
75- local c = e :GetHandler ()
76- return c :GetPreviousLocation ()== LOCATION_SZONE and not c :IsReason (REASON_LOST_TARGET )
77- end
78- function s .tg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
79- if chk == 0 then return Duel .IsPlayerCanDraw (tp ,1 ) end
80- Duel .SetTargetPlayer (tp )
81- Duel .SetTargetParam (1 )
82- Duel .SetOperationInfo (0 ,CATEGORY_DRAW ,nil ,0 ,tp ,1 )
83- end
84- function s .op (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
85- local p ,d = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PLAYER ,CHAININFO_TARGET_PARAM )
86- Duel .Draw (p ,d ,REASON_EFFECT )
8787end
0 commit comments