22-- Call of the Haunted
33local s ,id = GetID ()
44function s .initial_effect (c )
5- -- Activate
5+ -- Activate this card by targeting 1 monster in your GY; Special Summon that target in Attack Position
66 local e1 = Effect .CreateEffect (c )
7+ e1 :SetDescription (aux .Stringid (id ,0 ))
78 e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
89 e1 :SetType (EFFECT_TYPE_ACTIVATE )
9- e1 :SetCode (EVENT_FREE_CHAIN )
10- e1 :SetHintTiming (0 ,TIMING_END_PHASE )
1110 e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
1212 e1 :SetTarget (s .target )
13- e1 :SetOperation (s .operation )
13+ e1 :SetOperation (s .activate )
14+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMINGS_CHECK_MONSTER_E )
1415 c :RegisterEffect (e1 )
15- -- Destroy
16+ -- When this card leaves the field, destroy that monster
1617 local e2 = Effect .CreateEffect (c )
17- e2 :SetType (EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE )
18+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS )
1819 e2 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
1920 e2 :SetCode (EVENT_LEAVE_FIELD_P )
20- e2 :SetOperation (s . checkop )
21+ e2 :SetOperation (function ( e ) e : SetLabel ( e : GetHandler (): IsDisabled () and 1 or 0 ) end )
2122 c :RegisterEffect (e2 )
2223 local e3 = Effect .CreateEffect (c )
23- e3 :SetType (EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE )
24+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS )
2425 e3 :SetCode (EVENT_LEAVE_FIELD )
25- e3 :SetOperation (s .desop )
26+ e3 :SetOperation (s .mondesop )
2627 e3 :SetLabelObject (e2 )
2728 c :RegisterEffect (e3 )
28- -- Destroy2
29+ -- When that monster is destroyed, destroy this card
2930 local e4 = Effect .CreateEffect (c )
30- e4 :SetType (EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD )
31- e4 :SetRange (LOCATION_SZONE )
31+ e4 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
3232 e4 :SetCode (EVENT_LEAVE_FIELD )
33- e4 :SetCondition (s .descon2 )
34- e4 :SetOperation (s .desop2 )
33+ e4 :SetRange (LOCATION_SZONE )
34+ e4 :SetCondition (s .selfdescon )
35+ e4 :SetOperation (function (e ) Duel .Destroy (e :GetHandler (),REASON_EFFECT ) end )
3536 c :RegisterEffect (e4 )
3637end
37- function s .filter (c ,e ,tp )
38- return c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
38+ function s .spfilter (c ,e ,tp )
39+ return c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false , POS_FACEUP_ATTACK )
3940end
4041function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
41- if chkc then return chkc :IsLocation (LOCATION_GRAVE ) and chkc :IsControler (tp )
42- and chkc :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ) end
42+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_GRAVE ) and s .spfilter (chkc ,e ,tp ) end
4343 if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
44- and Duel .IsExistingTarget (s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp ) end
44+ and Duel .IsExistingTarget (s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp ) end
4545 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
46- local g = Duel .SelectTarget (tp ,s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
47- Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,g ,1 ,0 ,0 )
46+ local g = Duel .SelectTarget (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
47+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,g ,1 ,tp ,0 )
4848end
49- function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
49+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
5050 local c = e :GetHandler ()
5151 local tc = Duel .GetFirstTarget ()
52- if c :IsRelateToEffect (e ) and tc : IsRelateToEffect ( e )
53- and Duel . SpecialSummonStep ( tc , 0 , tp , tp , false , false , POS_FACEUP_ATTACK ) then
52+ if tc :IsRelateToEffect (e ) and Duel . SpecialSummonStep ( tc , 0 , tp , tp , false , false , POS_FACEUP_ATTACK )
53+ and c : IsRelateToEffect ( e ) then
5454 c :SetCardTarget (tc )
55- Duel .SpecialSummonComplete ()
5655 end
56+ Duel .SpecialSummonComplete ()
5757end
58- function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
59- if e :GetHandler ():IsDisabled () then
60- e :SetLabel (1 )
61- else e :SetLabel (0 ) end
62- end
63- function s .desop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
58+ function s .mondesop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
6459 if e :GetLabelObject ():GetLabel ()~= 0 then return end
6560 local tc = e :GetHandler ():GetFirstCardTarget ()
6661 if tc and tc :IsLocation (LOCATION_MZONE ) then
6762 Duel .Destroy (tc ,REASON_EFFECT )
6863 end
6964end
70- function s .descon2 (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
65+ function s .selfdescon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
7166 local tc = e :GetHandler ():GetFirstCardTarget ()
7267 return tc and eg :IsContains (tc ) and tc :IsReason (REASON_DESTROY )
7368end
74- function s .desop2 (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
75- Duel .Destroy (e :GetHandler (),REASON_EFFECT )
76- end
0 commit comments