1+ -- ミラーバリア
2+ -- Mirror Barrier
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Equip this card to 1 face-up monster you control as an Equip Card with this effect: ● Once per Battle Step, if the equipped monster battles an opponent's monster: You can destroy that opponent's monster.
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_EQUIP )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
12+ e1 :SetCode (EVENT_FREE_CHAIN )
13+ e1 :SetCost (aux .RemainFieldCost )
14+ e1 :SetTarget (s .target )
15+ e1 :SetOperation (s .operation )
16+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMING_BATTLE_PHASE |TIMINGS_CHECK_MONSTER_E )
17+ c :RegisterEffect (e1 )
18+ -- Add 1 "Armament Reincarnation" from your Deck to your hand
19+ local e2 = Effect .CreateEffect (c )
20+ e2 :SetDescription (aux .Stringid (id ,1 ))
21+ e2 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
22+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
23+ e2 :SetProperty (EFFECT_FLAG_DELAY )
24+ e2 :SetCode (EVENT_DESTROYED )
25+ e2 :SetCountLimit (1 ,id )
26+ e2 :SetTarget (s .thtg )
27+ e2 :SetOperation (s .thop )
28+ c :RegisterEffect (e2 )
29+ end
30+ s .listed_names = {100450002 } -- "Armament Reincarnation"
31+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
32+ if chkc then return chkc :IsControler (tp ) and chkc :IsLocation (LOCATION_MZONE ) and chkc :IsFaceup () end
33+ if chk == 0 then return Duel .IsExistingTarget (Card .IsFaceup ,tp ,LOCATION_MZONE ,0 ,1 ,nil ) end
34+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_EQUIP )
35+ Duel .SelectTarget (tp ,Card .IsFaceup ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil )
36+ Duel .SetOperationInfo (0 ,CATEGORY_EQUIP ,e :GetHandler (),1 ,tp ,0 )
37+ end
38+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
39+ local c = e :GetHandler ()
40+ if not c :IsRelateToEffect (e ) or c :IsStatus (STATUS_LEAVE_CONFIRMED ) then return end
41+ local tc = Duel .GetFirstTarget ()
42+ if tc :IsRelateToEffect (e ) and tc :IsFaceup () and Duel .Equip (tp ,c ,tc ) then
43+ -- ● Once per Battle Step, if the equipped monster battles an opponent's monster: You can destroy that opponent's monster.
44+ local e1 = Effect .CreateEffect (c )
45+ e1 :SetDescription (aux .Stringid (id ,2 ))
46+ e1 :SetCategory (CATEGORY_DESTROY )
47+ e1 :SetType (EFFECT_TYPE_QUICK_O )
48+ e1 :SetCode (EVENT_FREE_CHAIN )
49+ e1 :SetRange (LOCATION_SZONE )
50+ e1 :SetCondition (s .descon )
51+ e1 :SetTarget (s .destg )
52+ e1 :SetOperation (s .desop )
53+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
54+ e1 :SetHintTiming (TIMING_BATTLE_PHASE )
55+ c :RegisterEffect (e1 )
56+ -- Equip limit
57+ local e2 = Effect .CreateEffect (c )
58+ e2 :SetType (EFFECT_TYPE_SINGLE )
59+ e2 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
60+ e2 :SetCode (EFFECT_EQUIP_LIMIT )
61+ e2 :SetValue (function (e ,c ) return c == tc end )
62+ e2 :SetReset (RESET_EVENT |RESETS_STANDARD )
63+ c :RegisterEffect (e2 )
64+ else
65+ c :CancelToGrave (false )
66+ end
67+ end
68+ function s .thfilter (c )
69+ return c :IsCode (100450002 ) and c :IsAbleToHand ()
70+ end
71+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
72+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ) end
73+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK )
74+ end
75+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
76+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
77+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
78+ if # g > 0 then
79+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
80+ Duel .ConfirmCards (1 - tp ,g )
81+ end
82+ end
83+ function s .descon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
84+ local c = e :GetHandler ()
85+ if not (Duel .IsBattleStep () and not c :HasFlagEffect (id )) then return false end
86+ local ec = c :GetEquipTarget ()
87+ local bc = ec :GetBattleTarget ()
88+ return ec and ec :IsRelateToBattle () and bc and bc :IsControler (1 - tp )
89+ end
90+ function s .destg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
91+ if chk == 0 then return true end
92+ local c = e :GetHandler ()
93+ local bc = c :GetEquipTarget ():GetBattleTarget ()
94+ e :SetLabelObject (bc )
95+ bc :CreateEffectRelation (e )
96+ c :RegisterFlagEffect (id ,RESET_EVENT |RESETS_STANDARD |RESET_PHASE |PHASE_DAMAGE ,0 ,1 )
97+ Duel .SetOperationInfo (0 ,CATEGORY_DESTROY ,bc ,1 ,tp ,0 )
98+ end
99+ function s .desop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
100+ local bc = e :GetLabelObject ()
101+ if bc :IsRelateToEffect (e ) and bc :IsControler (1 - tp ) then
102+ Duel .Destroy (bc ,REASON_EFFECT )
103+ end
104+ end
0 commit comments