11-- Sp-遺言状
2+ -- Speed Spell - Last Will
23local s ,id = GetID ()
34function s .initial_effect (c )
45 -- Activate
56 local e1 = Effect .CreateEffect (c )
67 e1 :SetType (EFFECT_TYPE_ACTIVATE )
78 e1 :SetCode (EVENT_FREE_CHAIN )
89 e1 :SetCost (s .cost )
10+ e1 :SetTarget (s .target )
911 e1 :SetOperation (s .operation )
1012 c :RegisterEffect (e1 )
13+ -- Checks if a monster you control was sent to your GY this turn
14+ aux .GlobalCheck (s ,function ()
15+ local ge1 = Effect .CreateEffect (c )
16+ ge1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
17+ ge1 :SetCode (EVENT_TO_GRAVE )
18+ ge1 :SetOperation (s .checkop )
19+ Duel .RegisterEffect (ge1 ,0 )
20+ end )
21+ end
22+ function s .checkfilter (c ,tp )
23+ return c :IsControler (tp ) and c :IsPreviousControler (tp ) and c :IsPreviousLocation (LOCATION_MZONE )
24+ end
25+ function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
26+ for p = 0 ,1 do
27+ if eg :IsExists (s .checkfilter ,1 ,nil ,p ) then
28+ Duel .RegisterFlagEffect (p ,id ,RESET_PHASE |PHASE_END ,0 ,1 )
29+ end
30+ end
1131end
1232function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
1333 local tc = Duel .GetFieldCard (tp ,LOCATION_FZONE ,0 )
1434 if chk == 0 then return tc and tc :IsCanRemoveCounter (tp ,0x91 ,5 ,REASON_COST ) end
1535 Duel .Hint (HINT_OPSELECTED ,1 - tp ,e :GetDescription ())
1636 tc :RemoveCounter (tp ,0x91 ,5 ,REASON_COST )
1737end
18- function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
19- -- spsummon
20- local e1 = Effect .CreateEffect (e :GetHandler ())
21- e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
22- e1 :SetCode (EVENT_TO_GRAVE )
23- e1 :SetCondition (s .check )
24- e1 :SetReset (RESET_PHASE + PHASE_END )
25- Duel .RegisterEffect (e1 ,tp )
26- local e2 = Effect .CreateEffect (e :GetHandler ())
27- e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
28- e2 :SetCode (EVENT_SUMMON_SUCCESS )
29- e2 :SetCondition (s .spcon )
30- e2 :SetOperation (s .spop )
31- e2 :SetLabelObject (e1 )
32- e2 :SetReset (RESET_PHASE + PHASE_END )
33- Duel .RegisterEffect (e2 ,tp )
34- local e3 = e2 :Clone ()
35- e3 :SetCode (EVENT_SPSUMMON_SUCCESS )
36- e3 :SetCondition (s .spcon2 )
37- Duel .RegisterEffect (e3 ,tp )
38- local e4 = e2 :Clone ()
39- e4 :SetCode (EVENT_CHAIN_END )
40- Duel .RegisterEffect (e4 ,tp )
41- local e5 = e2 :Clone ()
42- e5 :SetCode (EVENT_ATTACK_ANNOUNCE )
43- Duel .RegisterEffect (e5 ,tp )
44- local e6 = e2 :Clone ()
45- e6 :SetCode (EVENT_DAMAGE_STEP_END )
46- Duel .RegisterEffect (e6 ,tp )
47- local e7 = e2 :Clone ()
48- e7 :SetCode (EVENT_PHASE + PHASE_END )
49- Duel .RegisterEffect (e7 ,tp )
50- end
51- function s .cfilter (c ,tp )
52- return c :IsControler (tp ) and c :IsPreviousControler (tp ) and c :IsPreviousLocation (LOCATION_MZONE )
53- end
54- function s .check (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
55- if e :GetLabel ()== 2 then return end
56- if eg :IsExists (s .cfilter ,1 ,nil ,tp ) then
38+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
39+ if chk == 0 then return true end
40+ if Duel .HasFlagEffect (tp ,id ) then
41+ e :SetCategory (CATEGORY_SPECIAL_SUMMON )
42+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_DECK )
5743 e :SetLabel (1 )
44+ else
45+ e :SetCategory (0 )
46+ e :SetLabel (0 )
5847 end
5948end
6049function s .spfilter (c ,e ,tp )
6150 return c :IsAttackBelow (1500 ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
6251end
63- function s .spcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
64- return e :GetLabelObject ():GetLabel ()== 1
65- end
66- function s .spcon2 (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
67- return e :GetLabelObject ():GetLabel ()== 1 and Duel .GetCurrentChain ()== 0
68- end
69- function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
70- if Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
52+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
53+ if e :GetLabel ()== 1
54+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
7155 and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,e ,tp )
7256 and Duel .SelectYesNo (tp ,aux .Stringid (id ,0 )) then
73- Duel .Hint (HINT_CARD ,0 ,id )
74- Duel .Hint (HINT_OPSELECTED ,tp ,HINTMSG_SPSUMMON )
57+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
7558 local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,e ,tp )
7659 Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
77- e :GetLabelObject ():SetLabel (2 )
7860 else
79- e :GetLabelObject ():SetLabel (0 )
61+ local e1 = Effect .CreateEffect (e :GetHandler ())
62+ e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
63+ e1 :SetCode (EVENT_FREE_CHAIN )
64+ e1 :SetCountLimit (1 )
65+ e1 :SetCondition (s .spcon )
66+ e1 :SetOperation (s .spop )
67+ e1 :SetReset (RESET_PHASE |PHASE_END )
68+ Duel .RegisterEffect (e1 ,tp )
8069 end
81- end
70+ end
71+ function s .spcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
72+ return Duel .HasFlagEffect (tp ,id ) and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
73+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,e ,tp )
74+ end
75+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
76+ Duel .Hint (HINT_CARD ,0 ,id )
77+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
78+ local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,e ,tp )
79+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
80+ end
0 commit comments