1+ -- Japanese name
2+ -- Shadow Severing Strike
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Activate
7+ local e0 = Effect .CreateEffect (c )
8+ e0 :SetType (EFFECT_TYPE_ACTIVATE )
9+ e0 :SetCode (EVENT_FREE_CHAIN )
10+ c :RegisterEffect (e0 )
11+ -- Apply 1 of the following effects based on 1 of the card types banished
12+ local e1 = Effect .CreateEffect (c )
13+ e1 :SetDescription (aux .Stringid (id ,0 ))
14+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
15+ e1 :SetProperty (EFFECT_FLAG_DELAY )
16+ e1 :SetCode (EVENT_CUSTOM + id )
17+ e1 :SetRange (LOCATION_SZONE )
18+ e1 :SetCountLimit (1 ,id )
19+ e1 :SetCondition (function () return not Duel .IsPhase (PHASE_DAMAGE ) end )
20+ e1 :SetTarget (s .efftg )
21+ e1 :SetOperation (s .effop )
22+ e1 :SetLabel (0 )
23+ c :RegisterEffect (e1 )
24+ -- Register cards banished
25+ local e1a = Effect .CreateEffect (c )
26+ e1a :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
27+ e1a :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
28+ e1a :SetCode (EVENT_REMOVE )
29+ e1a :SetRange (LOCATION_SZONE )
30+ e1a :SetLabelObject (e1 )
31+ e1a :SetOperation (s .regop )
32+ c :RegisterEffect (e1a )
33+ e1 :SetLabelObject (e1a )
34+ -- Add 1 of your other banished cards to your hand
35+ local e2 = Effect .CreateEffect (c )
36+ e2 :SetDescription (aux .Stringid (id ,1 ))
37+ e2 :SetCategory (CATEGORY_TOHAND )
38+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
39+ e2 :SetProperty (EFFECT_FLAG_DELAY )
40+ e2 :SetCode (EVENT_REMOVE )
41+ e2 :SetCountLimit (1 ,{id ,1 })
42+ e2 :SetCondition (function (e ,tp ,eg ,ep ,ev ,re ,r ,rp ) return e :GetHandler ():IsReason (REASON_COST ) and re :IsActivated () and re :IsMonsterEffect () end )
43+ e2 :SetTarget (s .thtg )
44+ e2 :SetOperation (s .thop )
45+ c :RegisterEffect (e2 )
46+ end
47+ function s .regfilter (c )
48+ return c :IsFaceup () and c :IsPreviousLocation (LOCATION_HAND |LOCATION_ONFIELD ) and c :IsReason (REASON_COST )
49+ end
50+ function s .regop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
51+ if not (re and re :IsActivated () and re :IsMonsterEffect ()) then return false end
52+ local og = eg :Filter (s .regfilter ,nil )
53+ if # og > 0 then
54+ local types = 0
55+ for tc in og :Iter () do
56+ types = types |tc :GetType ()&(TYPE_MONSTER |TYPE_SPELL |TYPE_TRAP )
57+ end
58+ local label = e :GetLabel ()
59+ e :SetLabel (label |types )
60+ Duel .RaiseSingleEvent (e :GetHandler (),EVENT_CUSTOM + id ,e ,0 ,tp ,tp ,0 )
61+ end
62+ end
63+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
64+ local types = e :GetLabelObject ():GetLabel ()> 0 and e :GetLabelObject ():GetLabel () or e :GetLabel ()
65+ local b1 = types &TYPE_MONSTER > 0 and Duel .IsExistingMatchingCard (Card .IsNegatableSpellTrap ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,nil )
66+ local b2 = types &TYPE_SPELL > 0 and Duel .IsPlayerCanDraw (tp ,2 )
67+ local b3 = types &TYPE_TRAP > 0 and Duel .IsExistingMatchingCard (Card .IsAbleToRemove ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,nil )
68+ e :GetLabelObject ():SetLabel (0 )
69+ e :SetLabel (types )
70+ if chk == 0 then return (b1 or b2 or b3 ) end
71+ local cat = 0
72+ if types &TYPE_MONSTER > 0 then
73+ cat = cat |CATEGORY_DISABLE
74+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_DISABLE ,nil ,1 ,PLAYER_ALL ,LOCATION_ONFIELD )
75+ end
76+ if types &TYPE_SPELL > 0 then
77+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_DRAW ,nil ,0 ,tp ,2 )
78+ end
79+ if types &TYPE_TRAP > 0 then
80+ cat = cat |CATEGORY_REMOVE
81+ local g = Duel .GetMatchingGroup (Card .IsAbleToRemove ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,nil )
82+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_REMOVE ,g ,1 ,tp ,0 )
83+ end
84+ e :SetCategory (cat )
85+ end
86+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
87+ local types = e :GetLabel ()
88+ local b1 = types &TYPE_MONSTER > 0 and Duel .IsExistingMatchingCard (Card .IsNegatableSpellTrap ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,nil )
89+ local b2 = types &TYPE_SPELL > 0 and Duel .IsPlayerCanDraw (tp ,2 )
90+ local b3 = types &TYPE_TRAP > 0 and Duel .IsExistingMatchingCard (Card .IsAbleToRemove ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,nil )
91+ if not (b1 or b2 or b3 ) then return end
92+ local op = Duel .SelectEffect (tp ,
93+ {b1 ,aux .Stringid (id ,2 )},
94+ {b2 ,aux .Stringid (id ,3 )},
95+ {b3 ,aux .Stringid (id ,4 )})
96+ if op == 1 then
97+ -- Negate the effects of 1 face-up Spell/Trap on the field until the end of this turn
98+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_NEGATE )
99+ local tc = Duel .SelectMatchingCard (tp ,Card .IsNegatableSpellTrap ,tp ,LOCATION_ONFIELD ,LOCATION_ONFIELD ,1 ,1 ,nil ):GetFirst ()
100+ if tc then
101+ Duel .HintSelection (tc )
102+ tc :NegateEffects (e :GetHandler (),RESET_PHASE |PHASE_END )
103+ end
104+ elseif op == 2 then
105+ -- Draw 2 cards
106+ Duel .Draw (tp ,2 ,REASON_EFFECT )
107+ elseif op == 3 then
108+ -- Banish 1 monster on the field
109+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_REMOVE )
110+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToRemove ,tp ,LOCATION_MZONE ,LOCATION_MZONE ,1 ,1 ,nil )
111+ if # g > 0 then
112+ Duel .HintSelection (g )
113+ Duel .Remove (g ,POS_FACEUP ,REASON_EFFECT )
114+ end
115+ end
116+ end
117+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
118+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToHand ,tp ,LOCATION_REMOVED ,0 ,1 ,e :GetHandler ()) end
119+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_REMOVED )
120+ end
121+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
122+ local c = e :GetHandler ()
123+ local exc = c :IsRelateToEffect (e ) and c or nil
124+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
125+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToHand ,tp ,LOCATION_REMOVED ,0 ,1 ,1 ,exc )
126+ if # g > 0 then
127+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
128+ Duel .ConfirmCards (1 - tp ,g )
129+ end
130+ end
0 commit comments