1+ -- 神星なる繋束
2+ -- Stellarnova Bonds
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Activate 1 of these effects
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
10+ e1 :SetCode (EVENT_FREE_CHAIN )
11+ e1 :SetCountLimit (1 ,id ,EFFECT_COUNT_CODE_OATH )
12+ e1 :SetTarget (s .efftg )
13+ e1 :SetOperation (s .effop )
14+ c :RegisterEffect (e1 )
15+ end
16+ s .listed_series = {SET_TELLARKNIGHT ,SET_CONSTELLAR }
17+ function s .spfilter (c ,e ,tp )
18+ return c :IsSetCard ({SET_TELLARKNIGHT ,SET_CONSTELLAR }) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
19+ and not Duel .IsExistingMatchingCard (aux .FaceupFilter (Card .IsRace ,c :GetRace ()),tp ,LOCATION_MZONE ,0 ,1 ,nil )
20+ end
21+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
22+ local b1 = Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
23+ and Duel .IsExistingMatchingCard (Card .IsDiscardable ,tp ,LOCATION_HAND ,0 ,1 ,e :GetHandler (),REASON_EFFECT )
24+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,e ,tp )
25+ local ct = Duel .GetMatchingGroupCount (aux .FaceupFilter (Card .IsSetCard ,{SET_TELLARKNIGHT ,SET_CONSTELLAR }),tp ,LOCATION_MZONE ,0 ,nil )
26+ local b2 = ct > 0 and Duel .IsExistingTarget (Card .IsNegatableMonster ,tp ,0 ,LOCATION_MZONE ,1 ,nil )
27+ if chk == 0 then return b1 or b2 end
28+ local op = Duel .SelectEffect (tp ,
29+ {b1 ,aux .Stringid (id ,1 )},
30+ {b2 ,aux .Stringid (id ,2 )})
31+ e :SetLabel (op )
32+ if op == 1 then
33+ e :SetCategory (CATEGORY_HANDES + CATEGORY_SPECIAL_SUMMON )
34+ e :SetProperty (0 )
35+ Duel .SetOperationInfo (0 ,CATEGORY_HANDES ,nil ,0 ,tp ,1 )
36+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK )
37+ elseif op == 2 then
38+ e :SetCategory (CATEGORY_DISABLE )
39+ e :SetProperty (EFFECT_FLAG_CARD_TARGET )
40+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_NEGATE )
41+ local g = Duel .SelectTarget (tp ,Card .IsNegatableMonster ,tp ,0 ,LOCATION_MZONE ,1 ,ct ,nil )
42+ Duel .SetOperationInfo (0 ,CATEGORY_DISABLE ,g ,# g ,tp ,0 )
43+ end
44+ end
45+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
46+ local op = e :GetLabel ()
47+ local c = e :GetHandler ()
48+ if op == 1 then
49+ -- Discard 1 card, and if you do, Special Summon 1 "tellarknight" or "Constellar" monster from your Deck with a different Type from the monsters you control
50+ if Duel .DiscardHand (tp ,nil ,1 ,1 ,REASON_EFFECT |REASON_DISCARD ,nil )> 0 and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 then
51+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
52+ local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,e ,tp )
53+ if # g > 0 then
54+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
55+ end
56+ end
57+ elseif op == 2 then
58+ -- Negate the effects of face-up monsters your opponent controls, up to the number of "tellarknight" and "Constellar" monsters you control
59+ local tg = Duel .GetTargetCards (e ):Match (Card .IsMonster ,nil )
60+ if # tg > 0 then
61+ for tc in tg :Iter () do
62+ -- Negate their effects until the end of this turn
63+ tc :NegateEffects (c ,RESET_PHASE |PHASE_END )
64+ end
65+ end
66+ end
67+ -- You cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters
68+ local e1 = Effect .CreateEffect (c )
69+ e1 :SetDescription (aux .Stringid (id ,3 ))
70+ e1 :SetType (EFFECT_TYPE_FIELD )
71+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
72+ e1 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
73+ e1 :SetTargetRange (1 ,0 )
74+ e1 :SetTarget (function (e ,c ) return c :IsLocation (LOCATION_EXTRA ) and not c :IsXyzMonster () end )
75+ e1 :SetReset (RESET_PHASE |PHASE_END )
76+ Duel .RegisterEffect (e1 ,tp )
77+ end
0 commit comments