1+ -- 次元の盟友 レイフ
2+ -- Reifu the Dimensional Sworn Ally
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Reduce ATK
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,1 ))
9+ e1 :SetCategory (CATEGORY_ATKCHANGE + CATEGORY_DRAW )
10+ e1 :SetType (EFFECT_TYPE_IGNITION )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetCountLimit (1 )
13+ e1 :SetCondition (s .condition )
14+ e1 :SetCost (s .cost )
15+ e1 :SetTarget (s .target )
16+ e1 :SetOperation (s .operation )
17+ c :RegisterEffect (e1 )
18+ end
19+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
20+ local c = e :GetHandler ()
21+ return c :IsSummonPhaseMain () and c :IsStatus (STATUS_SUMMON_TURN + STATUS_SPSUMMON_TURN )
22+ end
23+ function s .cfilter (c )
24+ return c :IsMonster () and c :IsRace (RACE_CYBERSE ) and not c :IsPublic ()
25+ end
26+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
27+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ) end
28+ end
29+ function s .filter (c ,lvl )
30+ return c :IsFaceup () and c :IsNotMaximumModeSide ()
31+ end
32+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
33+ if chk == 0 then return Duel .IsExistingMatchingCard (s .filter ,tp ,0 ,LOCATION_MZONE ,1 ,nil ,e :GetHandler ():GetLevel ()) end
34+ Duel .SetOperationInfo (0 ,CATEGORY_ATKCHANGE ,nil ,1 ,tp ,- 400 )
35+ end
36+ function s .thfilter (c )
37+ return c :IsCode (160220034 ) and c :IsAbleToHand ()
38+ end
39+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
40+ local c = e :GetHandler ()
41+ -- Requirement
42+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_CONFIRM )
43+ local tc = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil )
44+ Duel .ConfirmCards (1 - tp ,tc )
45+ Duel .ShuffleHand (tp )
46+ -- Effect
47+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATKDEF )
48+ local g = Duel .SelectMatchingCard (tp ,s .filter ,tp ,0 ,LOCATION_MZONE ,1 ,1 ,nil ,c :GetLevel ())
49+ if # g > 0 then
50+ Duel .HintSelection (g )
51+ local e1 = Effect .CreateEffect (c )
52+ e1 :SetType (EFFECT_TYPE_SINGLE )
53+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
54+ e1 :SetValue (- 400 )
55+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
56+ g :GetFirst ():RegisterEffect (e1 )
57+ if Duel .IsExistingMatchingCard (aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,nil ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
58+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
59+ local g2 = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil )
60+ if # g2 > 0 then
61+ Duel .BreakEffect ()
62+ Duel .SendtoHand (g2 ,nil ,REASON_EFFECT )
63+ Duel .ConfirmCards (1 - tp ,g2 )
64+ end
65+ end
66+ end
67+ end
0 commit comments