1+ -- レーン・リストリクション
2+ -- Lane Restriction
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- When this card is activated: You can Special Summon 1 of your banished monsters to your rightmost Main Monster Zone
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetCode (EVENT_FREE_CHAIN )
12+ e1 :SetTarget (s .target )
13+ e1 :SetOperation (s .activate )
14+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMINGS_CHECK_MONSTER_E )
15+ c :RegisterEffect (e1 )
16+ -- If your opponent would Normal or Special Summon a monster(s) to their Main Monster Zone, they must use the leftmost unused zone(s)
17+ local e2 = Effect .CreateEffect (c )
18+ e2 :SetType (EFFECT_TYPE_FIELD )
19+ e2 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
20+ e2 :SetCode (EFFECT_FORCE_MZONE )
21+ e2 :SetRange (LOCATION_SZONE )
22+ e2 :SetTargetRange (0 ,1 )
23+ e2 :SetValue (s .forcemzoneval )
24+ c :RegisterEffect (e2 )
25+ end
26+ local offset = Duel .IsDuelType (DUEL_3_COLUMNS_FIELD ) and 1 or 0
27+ local LEFTMOST_SEQ = 0 + offset
28+ local RIGHTMOST_SEQ = 4 - offset
29+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
30+ if chk == 0 then return true end
31+ Duel .SetPossibleOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_REMOVED )
32+ end
33+ function s .spfilter (c ,e ,tp ,rightmost_zone )
34+ return c :IsFaceup () and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEUP ,tp ,rightmost_zone )
35+ end
36+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
37+ local rightmost_zone = 1 << RIGHTMOST_SEQ
38+ if Duel .GetLocationCount (tp ,LOCATION_MZONE ,tp ,nil ,rightmost_zone )<= 0 then return end
39+ local g = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_REMOVED ,0 ,nil ,e ,tp ,rightmost_zone )
40+ if # g > 0 and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
41+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
42+ local sg = g :Select (tp ,1 ,1 ,nil )
43+ if # sg > 0 then
44+ Duel .SpecialSummon (sg ,0 ,tp ,tp ,false ,false ,POS_FACEUP ,rightmost_zone )
45+ end
46+ end
47+ end
48+ function s .forcemzoneval (e ,fp ,rp ,r )
49+ -- Needs to somehow not affect Normal Sets, no way to do that atm
50+ local opp = 1 - e :GetHandlerPlayer ()
51+ for seq = LEFTMOST_SEQ ,RIGHTMOST_SEQ do
52+ if Duel .CheckLocation (opp ,LOCATION_MZONE ,seq ) then
53+ return (1 << seq )|ZONES_EMZ |(ZONES_MMZ << 16 )
54+ end
55+ end
56+ return ZONES_EMZ |(ZONES_MMZ << 16 )
57+ end
0 commit comments