1+ -- オノマトカゲ
2+ -- Onomatokage
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- This card is always treated as a "Zubaba" card (required due to current cdb limitations)
7+ c :AddSetcodesRule (id ,true ,SET_ZUBABA )
8+ -- Special Summon this card, but banish it when it leaves the field
9+ local e1 = Effect .CreateEffect (c )
10+ e1 :SetDescription (aux .Stringid (id ,0 ))
11+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
12+ e1 :SetType (EFFECT_TYPE_IGNITION )
13+ e1 :SetRange (LOCATION_HAND |LOCATION_GRAVE )
14+ e1 :SetCountLimit (1 ,id )
15+ e1 :SetCondition (s .spcon )
16+ e1 :SetTarget (s .sptg )
17+ e1 :SetOperation (s .spop )
18+ c :RegisterEffect (e1 )
19+ -- Return up to 2 Xyz Monsters from your GY to the Extra Deck
20+ local e2 = Effect .CreateEffect (c )
21+ e2 :SetDescription (aux .Stringid (id ,1 ))
22+ e2 :SetCategory (CATEGORY_TOEXTRA )
23+ e2 :SetType (EFFECT_TYPE_IGNITION )
24+ e2 :SetRange (LOCATION_GRAVE )
25+ e2 :SetCountLimit (1 ,{id ,1 })
26+ e2 :SetCost (Cost .SelfBanish )
27+ e2 :SetTarget (s .textg )
28+ e2 :SetOperation (s .texop )
29+ c :RegisterEffect (e2 )
30+ end
31+ s .listed_series = {SET_ZUBABA ,SET_GAGAGA ,SET_GOGOGO ,SET_DODODO }
32+ function s .spcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
33+ return Duel .IsExistingMatchingCard (aux .FaceupFilter (Card .IsSetCard ,{SET_ZUBABA ,SET_GAGAGA ,SET_GOGOGO ,SET_DODODO }),tp ,LOCATION_MZONE ,0 ,1 ,nil )
34+ end
35+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
36+ local c = e :GetHandler ()
37+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
38+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ) end
39+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
40+ end
41+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
42+ local c = e :GetHandler ()
43+ if c :IsRelateToEffect (e ) and Duel .SpecialSummon (c ,0 ,tp ,tp ,false ,false ,POS_FACEUP )> 0 then
44+ -- Banish it when it leaves the field
45+ local e1 = Effect .CreateEffect (c )
46+ e1 :SetDescription (3300 )
47+ e1 :SetType (EFFECT_TYPE_SINGLE )
48+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CLIENT_HINT )
49+ e1 :SetCode (EFFECT_LEAVE_FIELD_REDIRECT )
50+ e1 :SetValue (LOCATION_REMOVED )
51+ e1 :SetReset (RESET_EVENT |RESETS_REDIRECT )
52+ c :RegisterEffect (e1 ,true )
53+ end
54+ end
55+ function s .texfilter (c )
56+ return c :IsType (TYPE_XYZ ) and c :IsAbleToExtra ()
57+ end
58+ function s .textg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
59+ if chk == 0 then return Duel .IsExistingMatchingCard (s .texfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,e :GetHandler ()) end
60+ Duel .SetOperationInfo (0 ,CATEGORY_TOEXTRA ,nil ,1 ,tp ,LOCATION_GRAVE )
61+ end
62+ function s .texop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
63+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
64+ local g = Duel .SelectMatchingCard (tp ,s .texfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,2 ,nil )
65+ if # g > 0 then
66+ Duel .HintSelection (g )
67+ Duel .SendtoDeck (g ,nil ,SEQ_DECKSHUFFLE ,REASON_EFFECT )
68+ end
69+ end
0 commit comments