22-- Amorphous Barrier
33local s ,id = GetID ()
44function s .initial_effect (c )
5- -- Activate
5+ -- Activate only while you control 3 or more monsters. Negate the attack of 1 opponent's monster and end the Battle Phase.
66 local e1 = Effect .CreateEffect (c )
77 e1 :SetType (EFFECT_TYPE_ACTIVATE )
88 e1 :SetCode (EVENT_ATTACK_ANNOUNCE )
99 e1 :SetCondition (s .condition )
1010 e1 :SetOperation (s .activate )
1111 c :RegisterEffect (e1 )
12+ -- When this card is sent to the Graveyard: You can Tribute 1 monster; place this card on top of your Deck.
13+ local e2 = Effect .CreateEffect (c )
14+ e2 :SetDescription (aux .Stringid (id ,0 ))
15+ e2 :SetCategory (CATEGORY_TODECK )
16+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
17+ e2 :SetProperty (EFFECT_FLAG_DAMAGE_STEP )
18+ e2 :SetCode (EVENT_TO_GRAVE )
19+ e2 :SetCost (s .tdcost )
20+ e2 :SetTarget (s .tdtg )
21+ e2 :SetOperation (s .tdop )
22+ c :RegisterEffect (e2 )
1223end
1324function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
1425 return Duel .GetAttacker ():IsControler (1 - tp ) and Duel .GetFieldGroupCount (tp ,LOCATION_MZONE ,0 )>= 3
1526end
1627function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
17- Duel .SkipPhase (1 - tp ,PHASE_BATTLE ,RESET_PHASE + PHASE_BATTLE_STEP ,1 )
18- end
28+ if Duel .NegateAttack () then
29+ Duel .SkipPhase (1 - tp ,PHASE_BATTLE ,RESET_PHASE |PHASE_BATTLE_STEP ,1 )
30+ end
31+ end
32+ function s .tdcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
33+ if chk == 0 then return Duel .CheckReleaseGroupCost (tp ,nil ,1 ,false ,nil ,nil ) end
34+ local g = Duel .SelectReleaseGroupCost (tp ,nil ,1 ,1 ,false ,nil ,nil )
35+ Duel .Release (g ,REASON_COST )
36+ end
37+ function s .tdtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
38+ if chk == 0 then return e :GetHandler ():IsAbleToDeck () end
39+ Duel .SetOperationInfo (0 ,CATEGORY_TODECK ,e :GetHandler (),1 ,0 ,0 )
40+ end
41+ function s .tdop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
42+ if e :GetHandler ():IsRelateToEffect (e ) then
43+ Duel .SendtoDeck (e :GetHandler (),nil ,SEQ_DECKTOP ,REASON_EFFECT )
44+ end
45+ end
0 commit comments