1+ --
2+ -- Steel-Stringed Sacrifice
3+ -- Scripted by Hatter
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_IGNITION )
10+ e1 :SetRange (LOCATION_HAND |LOCATION_GRAVE )
11+ e1 :SetCost (s .effcost )
12+ e1 :SetTarget (s .efftg )
13+ e1 :SetOperation (s .effop )
14+ c :RegisterEffect (e1 )
15+ end
16+ function s .effcostfilter (c )
17+ return c :IsLevelAbove (5 ) and not c :IsPublic ()
18+ end
19+ function s .effcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
20+ if chk == 0 then return Duel .IsExistingMatchingCard (s .effcostfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ) end
21+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_CONFIRM )
22+ local rc = Duel .SelectMatchingCard (tp ,s .effcostfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil ):GetFirst ()
23+ Duel .ConfirmCards (1 - tp ,rc )
24+ Duel .ShuffleHand (tp )
25+ e :SetLabelObject (rc )
26+ e :SetLabel (rc :GetOriginalCodeRule ())
27+ rc :RegisterFlagEffect (id ,RESETS_STANDARD_PHASE_END ,EFFECT_FLAG_CLIENT_HINT ,1 ,0 ,aux .Stringid (id ,1 ))
28+ end
29+ function s .thfilter (c )
30+ return c :IsLevelAbove (5 ) and c :IsAbleToHand ()
31+ end
32+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
33+ local c = e :GetHandler ()
34+ local b1 = c :IsLocation (LOCATION_HAND ) and not Duel .HasFlagEffect (tp ,id )
35+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
36+ local b2 = c :IsLocation (LOCATION_GRAVE ) and not Duel .HasFlagEffect (tp ,id + 100 ) and c :IsAbleToHand ()
37+ local b3 = c :IsLocation (LOCATION_GRAVE ) and not Duel .HasFlagEffect (tp ,id + 200 )
38+ and c :IsAbleToRemove () and Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,c )
39+ if chk == 0 then return b1 or b2 or b3 end
40+ local op = Duel .SelectEffect (tp ,
41+ {b1 ,aux .Stringid (id ,2 )},
42+ {b2 ,aux .Stringid (id ,3 )},
43+ {b3 ,aux .Stringid (id ,4 )})
44+ Duel .SetTargetParam (op )
45+ Duel .RegisterFlagEffect (tp ,id + (op - 1 )* 100 ,RESET_PHASE |PHASE_END ,0 ,1 )
46+ if op == 1 then
47+ e :SetCategory (CATEGORY_SPECIAL_SUMMON )
48+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
49+ elseif op == 2 then
50+ e :SetCategory (CATEGORY_TOHAND )
51+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,c ,1 ,tp ,0 )
52+ elseif op == 3 then
53+ e :SetCategory (CATEGORY_REMOVE + CATEGORY_TOHAND )
54+ Duel .SetOperationInfo (0 ,CATEGORY_REMOVE ,c ,1 ,tp ,0 )
55+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_GRAVE )
56+ end
57+ end
58+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
59+ local c = e :GetHandler ()
60+ local code = e :GetLabel ()
61+ local rc = e :GetLabelObject ()
62+ aux .RegisterClientHint (c ,0 ,tp ,1 ,0 ,aux .Stringid (id ,5 ))
63+ -- Register if the player Normal Summons the revealed monster or a monster with the same original name
64+ local e1 = Effect .CreateEffect (c )
65+ e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
66+ e1 :SetCode (EVENT_SUMMON_SUCCESS )
67+ e1 :SetCountLimit (1 )
68+ e1 :SetCondition (function (e ,tp ,eg ,ep ) return ep == tp and ((rc :HasFlagEffect (id ) and eg :IsContains (rc ) and rc :IsFaceup ()) or eg :IsExists (aux .FaceupFilter (Card .IsOriginalCodeRule ,code ),1 ,nil )) end )
69+ e1 :SetOperation (function (e ) e :SetLabel (1 ) end )
70+ e1 :SetReset (RESET_PHASE |PHASE_END )
71+ Duel .RegisterEffect (e1 ,tp )
72+ -- During the End Phase of this turn, lose 1000 LP if you did not Normal Summon the revealed monster, or a monster with the same original name
73+ local e2 = e1 :Clone ()
74+ e2 :SetDescription (aux .Stringid (id ,6 ))
75+ e2 :SetCode (EVENT_PHASE + PHASE_END )
76+ e2 :SetCondition (function () return e1 :GetLabel ()== 0 end )
77+ e2 :SetOperation (function (e ,tp ) Duel .SetLP (tp ,Duel .GetLP (tp )- 1000 ) end )
78+ Duel .RegisterEffect (e2 ,tp )
79+ if not c :IsRelateToEffect (e ) then return end
80+ local op = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PARAM )
81+ if op == 1 then
82+ -- Special Summon this card from your hand
83+ Duel .SpecialSummon (c ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
84+ elseif op == 2 then
85+ -- Add this card from your GY to your hand
86+ Duel .SendtoHand (c ,nil ,REASON_EFFECT )
87+ Duel .ConfirmCards (1 - tp ,c )
88+ elseif op == 3 then
89+ -- Banish this card from your GY, and if you do, add 1 Level 5 or higher monster from your GY to your hand
90+ if Duel .Remove (c ,POS_FACEUP ,REASON_EFFECT )== 0 or not c :IsLocation (LOCATION_REMOVED ) then return end
91+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
92+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil )
93+ if # g > 0 then
94+ Duel .HintSelection (g )
95+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
96+ end
97+ end
98+ end
0 commit comments