1+ -- 希望の絆
12-- Bonds of Hope
23-- scripted by Shad3, fixed by MLD
34local s ,id = GetID ()
45function s .initial_effect (c )
5- -- Activate
6+ -- Special Summon 1 Xyz Monster from your GY, then attach this card and all materials from 1 Xyz Monster on your field to 1 other Xyz Monster on the field
67 local e1 = Effect .CreateEffect (c )
78 e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
8- e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
99 e1 :SetType (EFFECT_TYPE_ACTIVATE )
10+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
1011 e1 :SetCode (EVENT_SPSUMMON_SUCCESS )
11- e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
12- e1 :SetCondition (s .condition )
12+ e1 :SetCondition (function (e ,tp ,eg ,ep ,ev ,re ,r ,rp ) return eg :IsExists (s .cfilter ,1 ,nil ,tp ) end )
1313 e1 :SetTarget (s .target )
14- e1 :SetOperation (s .activate )
14+ e1 :SetOperation (s .operation )
1515 c :RegisterEffect (e1 )
1616end
1717function s .cfilter (c ,tp )
1818 return c :IsType (TYPE_XYZ ) and c :IsControler (tp )
1919end
20- function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
21- return eg :IsExists (s .cfilter ,1 ,nil ,tp )
22- end
23- function s .filter (c ,e ,tp )
20+ function s .spfilter (c ,e ,tp )
2421 return c :IsType (TYPE_XYZ ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
2522end
26- function s .filter2 (c )
27- return c :IsType (TYPE_XYZ ) and c :IsFaceup () and c :GetOverlayCount ()~= 0
28- end
29- function s .filter3 (c )
30- return c :IsType (TYPE_XYZ ) and c :IsFaceup ()
23+ function s .detachfilter (c ,tp )
24+ return c :IsFaceup () and c :IsType (TYPE_XYZ ) and c :CheckRemoveOverlayCard (tp ,1 ,REASON_EFFECT )
3125end
3226function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
33- if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_GRAVE ) and s .filter (chkc ,e ,tp ) end
27+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_GRAVE ) and s .spfilter (chkc ,e ,tp ) end
3428 if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and e :IsHasType (EFFECT_TYPE_ACTIVATE )
35- and Duel .IsExistingTarget (s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,e :GetHandler (),e ,tp )
36- and Duel .IsExistingMatchingCard (s .filter2 ,tp ,LOCATION_MZONE ,0 ,1 ,nil )
29+ and Duel .IsExistingTarget (s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,e ,tp )
3730 end
3831 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
39- local g = Duel .SelectTarget (tp ,s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
40- Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,g ,1 ,0 , 0 )
32+ local g = Duel .SelectTarget (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e ,tp )
33+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,g ,1 ,tp , LOCATION_GRAVE )
4134end
42- function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
35+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
4336 local c = e :GetHandler ()
4437 local tc = Duel .GetFirstTarget ()
4538 if not tc or not tc :IsRelateToEffect (e ) or Duel .SpecialSummon (tc ,0 ,tp ,tp ,false ,false ,POS_FACEUP )<= 0 then return end
46- local xc
47- local og = Group .CreateGroup ()
48- if c :IsRelateToEffect (e ) then
49- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_REMOVEXYZ )
50- local xg = Duel .SelectMatchingCard (tp ,s .filter2 ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil ,TYPE_XYZ )
51- if # xg > 0 then
52- Duel .HintSelection (xg )
53- xc = xg :GetFirst ()
54- og = xc :GetOverlayGroup ()
55- c :CancelToGrave ()
56- og :AddCard (c )
57- end
58- end
59- if # og > 0 then
60- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
61- local ng = Duel .SelectMatchingCard (tp ,s .filter3 ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,xc )
62- Duel .HintSelection (ng )
63- local nc = ng :GetFirst ()
64- Duel .Overlay (nc ,og )
39+ Duel .BreakEffect ()
40+ local tg = Duel .GetMatchingGroup (s .detachfilter ,tp ,LOCATION_MZONE ,0 ,nil ,tp )
41+ if # tg > 0 then
42+ c :CancelToGrave ()
43+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DEATTACHFROM )
44+ local detachxyz = tg :FilterSelect (tp ,Card .CheckRemoveOverlayCard ,1 ,1 ,nil ,tp ,1 ,REASON_EFFECT ):GetFirst ()
45+ local attachxyz = Duel .SelectMatchingCard (tp ,aux .FaceupFilter (Card .IsType ,TYPE_XYZ ),tp ,LOCATION_MZONE ,0 ,1 ,1 ,detachxyz ):GetFirst ()
46+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATTACH )
47+ local attach_group = detachxyz :GetOverlayGroup ()
48+ if # attach_group > 0 and c :IsOnField () then attach_group :AddCard (c ) end
49+ Duel .Overlay (attachxyz ,attach_group )
50+ Duel .RaiseSingleEvent (detachxyz ,EVENT_DETACH_MATERIAL ,e ,0 ,0 ,0 ,0 )
51+ else
52+ c :CancelToGrave ()
53+ local attachxyz = Duel .SelectMatchingCard (tp ,aux .FaceupFilter (Card .IsType ,TYPE_XYZ ),tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil ):GetFirst ()
54+ Duel .Overlay (attachxyz ,c )
6555 end
6656 local e1 = Effect .CreateEffect (c )
6757 e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
68- e1 :SetCode (EVENT_PHASE + PHASE_END )
6958 e1 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
70- e1 :SetReset ( RESET_PHASE + PHASE_END )
59+ e1 :SetCode ( EVENT_PHASE + PHASE_END )
7160 e1 :SetCountLimit (1 )
72- e1 :SetOperation (s .desop )
7361 e1 :SetLabelObject (tc )
62+ e1 :SetOperation (s .desop )
63+ e1 :SetReset (RESET_PHASE |PHASE_END )
7464 Duel .RegisterEffect (e1 ,tp )
7565end
7666function s .desop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
7767 local tc = e :GetLabelObject ()
7868 if tc and tc :IsOnField () then Duel .Destroy (tc ,REASON_EFFECT ) end
79- end
69+ end
0 commit comments