1+ -- レスキューキャット
2+ -- Rescue Cat
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Special Summon
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,1 ))
9+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_IGNITION )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetCountLimit (1 ,0 ,EFFECT_COUNT_CODE_SINGLE )
13+ e1 :SetCost (s .cost )
14+ e1 :SetTarget (s .target )
15+ e1 :SetOperation (s .operation )
16+ c :RegisterEffect (e1 )
17+ end
18+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
19+ if chk == 0 then return e :GetHandler ():IsAbleToGraveAsCost () end
20+ end
21+ function s .spfilter (c ,e ,tp )
22+ return c :IsRace (RACE_BEAST ) and c :IsLevelBelow (3 ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
23+ end
24+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
25+ if chk == 0 then return not Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT )
26+ and Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
27+ and Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_GRAVE ,0 ,2 ,nil ,e ,tp ) end
28+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,2 ,tp ,LOCATION_GRAVE )
29+ end
30+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
31+ -- Requirement
32+ local c = e :GetHandler ()
33+ if Duel .SendtoGrave (c ,REASON_COST )< 1 then return end
34+ -- Effect
35+ if Duel .GetLocationCount (tp ,LOCATION_MZONE )< 2 or Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT ) then return end
36+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
37+ local g = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_GRAVE ,0 ,2 ,2 ,nil ,e ,tp )
38+ local fid = c :GetFieldID ()
39+ for tc in g :Iter () do
40+ Duel .SpecialSummonStep (tc ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
41+ tc :RegisterFlagEffect (id ,RESET_EVENT |RESETS_STANDARD ,0 ,1 ,fid )
42+ end
43+ Duel .SpecialSummonComplete ()
44+ g :KeepAlive ()
45+ -- Destroy them during the End Phase
46+ local e1 = Effect .CreateEffect (c )
47+ e1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
48+ e1 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
49+ e1 :SetCode (EVENT_PHASE + PHASE_END )
50+ e1 :SetCountLimit (1 )
51+ e1 :SetLabel (fid )
52+ e1 :SetLabelObject (g )
53+ e1 :SetCondition (s .descon )
54+ e1 :SetOperation (s .desop )
55+ Duel .RegisterEffect (e1 ,tp )
56+ local e2 = Effect .CreateEffect (e :GetHandler ())
57+ e2 :SetDescription (aux .Stringid (id ,1 ))
58+ e2 :SetType (EFFECT_TYPE_FIELD )
59+ e2 :SetCode (EFFECT_CANNOT_ACTIVATE )
60+ e2 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
61+ e2 :SetTargetRange (1 ,0 )
62+ e2 :SetValue (s .aclimit )
63+ e2 :SetReset (RESET_PHASE |PHASE_END )
64+ Duel .RegisterEffect (e2 ,tp )
65+ end
66+ function s .desfilter (c ,fid )
67+ return c :GetFlagEffectLabel (id )== fid
68+ end
69+ function s .descon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
70+ local g = e :GetLabelObject ()
71+ if not g :IsExists (s .desfilter ,1 ,nil ,e :GetLabel ()) then
72+ g :DeleteGroup ()
73+ e :Reset ()
74+ return false
75+ else return true end
76+ end
77+ function s .desop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
78+ local g = e :GetLabelObject ()
79+ local tg = g :Filter (s .desfilter ,nil ,e :GetLabel ())
80+ Duel .Destroy (tg ,REASON_EFFECT )
81+ end
82+ function s .aclimit (e ,re ,tp )
83+ return re :GetHandler ():IsCode (14878871 )
84+ end
0 commit comments