1- -- No.99 希望皇ホープドラグナー
1+ -- No.99 希望皇ホープドラグナー
22-- Number 99: Utopia Dragonar
33-- Scripted by Larry126
44local s ,id = GetID ()
55function s .initial_effect (c )
6- -- xyz summon
76 c :EnableReviveLimit ()
7+ -- Xyz Summon procedure: 3+ Level 12 monsters
88 Xyz .AddProcedure (c ,nil ,12 ,3 ,nil ,nil ,Xyz .InfiniteMats )
9- -- Special Summon
9+ -- Special Summon from your Extra Deck, 1 "Number" monster that has a number between "1" and "100" in its name (this is treated as an Xyz Summon)
1010 local e1 = Effect .CreateEffect (c )
1111 e1 :SetDescription (aux .Stringid (id ,0 ))
1212 e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
1313 e1 :SetType (EFFECT_TYPE_QUICK_O )
1414 e1 :SetCode (EVENT_FREE_CHAIN )
1515 e1 :SetRange (LOCATION_MZONE )
16- e1 :SetHintTiming (0 ,TIMINGS_CHECK_MONSTER_E )
1716 e1 :SetCountLimit (1 ,id )
18- e1 :SetCost (s .cost )
19- e1 :SetTarget (s .target )
20- e1 :SetOperation (s .operation )
17+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMINGS_CHECK_MONSTER_E )
18+ e1 :SetCost (Cost .AND (Cost .Detach (2 ),s .spcost ))
19+ e1 :SetTarget (s .sptg )
20+ e1 :SetOperation (s .spop )
2121 c :RegisterEffect (e1 )
22- -- disable attack
22+ -- Change the ATK of the opponent's monster to 0
2323 local e2 = Effect .CreateEffect (c )
2424 e2 :SetDescription (aux .Stringid (id ,1 ))
2525 e2 :SetCategory (CATEGORY_ATKCHANGE )
2626 e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O )
27- e2 :SetRange (LOCATION_MZONE )
2827 e2 :SetCode (EVENT_ATTACK_ANNOUNCE )
28+ e2 :SetRange (LOCATION_MZONE )
2929 e2 :SetCountLimit (1 ,{id ,1 })
30- e2 :SetCondition (s . atkcon )
30+ e2 :SetCondition (function ( e , tp ) return Duel . GetAttacker (): IsControler ( 1 - tp ) end )
3131 e2 :SetTarget (s .atktg )
3232 e2 :SetOperation (s .atkop )
3333 c :RegisterEffect (e2 )
34- Duel .AddCustomActivityCounter (id ,ACTIVITY_SPSUMMON ,s .counterfilter )
34+ -- Keep track of Special Summons and direct attacks
35+ Duel .AddCustomActivityCounter (id ,ACTIVITY_SPSUMMON ,function (c ) return not c :IsSummonLocation (LOCATION_EXTRA ) or c :IsType (TYPE_XYZ ) end )
3536 aux .GlobalCheck (s ,function ()
3637 local ge1 = Effect .CreateEffect (c )
3738 ge1 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
@@ -40,87 +41,74 @@ function s.initial_effect(c)
4041 Duel .RegisterEffect (ge1 ,0 )
4142 end )
4243end
43- s .listed_series = {SET_NUMBER }
4444s .xyz_number = 99
45- function s .counterfilter (c )
46- return c :IsType (TYPE_XYZ ) or c :GetSummonLocation ()~= LOCATION_EXTRA
47- end
45+ s .listed_series = {SET_NUMBER }
4846function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
49- local tc = eg :GetFirst ()
5047 if not Duel .GetAttackTarget () then
5148 Duel .RegisterFlagEffect (ep ,id ,RESET_PHASE |PHASE_END ,0 ,1 )
52- tc :RegisterFlagEffect (id ,RESETS_STANDARD_PHASE_END ,0 ,1 )
49+ eg : GetFirst () :RegisterFlagEffect (id ,RESETS_STANDARD_PHASE_END ,0 ,1 )
5350 end
5451end
55- function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
52+ function s .spcost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
5653 local c = e :GetHandler ()
57- if chk == 0 then return c :CheckRemoveOverlayCard (tp ,2 ,REASON_COST )
58- and Duel .GetCustomActivityCount (id ,tp ,ACTIVITY_SPSUMMON )== 0
59- and (Duel .GetFlagEffect (tp ,id )== 0 or Duel .GetFlagEffect (tp ,id )== c :GetFlagEffect (id )) end
60- c :RemoveOverlayCard (tp ,2 ,2 ,REASON_COST )
61- aux .RegisterClientHint (e :GetHandler (),EFFECT_FLAG_OATH ,tp ,1 ,0 ,aux .Stringid (id ,2 ),nil )
62- local ge1 = Effect .CreateEffect (c )
63- ge1 :SetType (EFFECT_TYPE_FIELD )
64- ge1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH )
65- ge1 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
66- ge1 :SetTargetRange (1 ,0 )
67- ge1 :SetTarget (s .splimit )
68- ge1 :SetReset (RESET_PHASE |PHASE_END )
69- Duel .RegisterEffect (ge1 ,tp )
70- -- lizard check
71- aux .addTempLizardCheck (c ,tp ,s .lizfilter )
72- -- cannot attack directly with other cards
73- local ge2 = Effect .CreateEffect (c )
74- ge2 :SetType (EFFECT_TYPE_FIELD )
75- ge2 :SetCode (EFFECT_CANNOT_DIRECT_ATTACK )
76- ge2 :SetProperty (EFFECT_FLAG_OATH + EFFECT_FLAG_IGNORE_IMMUNE )
77- ge2 :SetTargetRange (LOCATION_MZONE ,0 )
78- ge2 :SetTarget (s .ftarget )
79- ge2 :SetLabel (c :GetFieldID ())
80- ge2 :SetReset (RESET_PHASE |PHASE_END )
81- Duel .RegisterEffect (ge2 ,tp )
82- end
83- function s .splimit (e ,c ,sump ,sumtype ,sumpos ,targetp ,se )
84- return not c :IsType (TYPE_XYZ ) and c :IsLocation (LOCATION_EXTRA )
85- end
86- function s .lizfilter (e ,c )
87- return not c :IsOriginalType (TYPE_XYZ )
88- end
89- function s .ftarget (e ,c )
90- return e :GetLabel ()~= c :GetFieldID ()
54+ if chk == 0 then return Duel .GetCustomActivityCount (id ,tp ,ACTIVITY_SPSUMMON )== 0
55+ and (not Duel .HasFlagEffect (tp ,id ) or Duel .GetFlagEffect (tp ,id )== c :GetFlagEffect (id )) end
56+ local fid = c :GetFieldID ()
57+ -- The turn you activate this effect, other monsters you control cannot attack directly
58+ local e1 = Effect .CreateEffect (c )
59+ e1 :SetType (EFFECT_TYPE_FIELD )
60+ e1 :SetProperty (EFFECT_FLAG_OATH + EFFECT_FLAG_IGNORE_IMMUNE )
61+ e1 :SetCode (EFFECT_CANNOT_DIRECT_ATTACK )
62+ e1 :SetTargetRange (LOCATION_MZONE ,0 )
63+ e1 :SetTarget (function (e ,c ) return c :GetFieldID ()~= fid end )
64+ e1 :SetReset (RESET_PHASE |PHASE_END )
65+ Duel .RegisterEffect (e1 ,tp )
66+ -- Also you cannot Special Summon from the Extra Deck, except Xyz Monsters
67+ local e2 = Effect .CreateEffect (c )
68+ e2 :SetDescription (aux .Stringid (id ,2 ))
69+ e2 :SetType (EFFECT_TYPE_FIELD )
70+ e2 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH + EFFECT_FLAG_CLIENT_HINT )
71+ e2 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
72+ e2 :SetTargetRange (1 ,0 )
73+ e2 :SetTarget (function (e ,c ) return c :IsLocation (LOCATION_EXTRA ) and not c :IsType (TYPE_XYZ ) end )
74+ e2 :SetReset (RESET_PHASE |PHASE_END )
75+ Duel .RegisterEffect (e2 ,tp )
76+ -- "Clock Lizard" check
77+ aux .addTempLizardCheck (c ,tp ,function (e ,c ) return not c :IsOriginalType (TYPE_XYZ ) end )
9178end
92- function s .filter (c ,e ,tp , rp )
93- return c :IsSetCard (SET_NUMBER ) and c .xyz_number and c .xyz_number >= 1 and c .xyz_number <= 100
94- and Duel . GetLocationCountFromEx ( tp , rp , nil , c ) > 0 and c :IsCanBeSpecialSummoned (e ,SUMMON_TYPE_XYZ ,tp ,false ,true )
79+ function s .spfilter (c ,e ,tp )
80+ return c :IsSetCard (SET_NUMBER ) and c .xyz_number and c .xyz_number >= 1 and c .xyz_number <= 100 and Duel . GetLocationCountFromEx ( tp , tp , nil , c ) > 0
81+ and c :IsCanBeSpecialSummoned (e ,SUMMON_TYPE_XYZ ,tp ,false ,false )
9582end
96- function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
97- if chk == 0 then return Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp , rp ) end
83+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
84+ if chk == 0 then return Duel .IsExistingMatchingCard (s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,nil ,e ,tp ) end
9885 Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_EXTRA )
9986end
100- function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
87+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
10188 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
102- local tc = Duel .SelectMatchingCard (tp ,s .filter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ,rp ):GetFirst ()
103- if tc then
104- Duel .SpecialSummon (tc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,true ,POS_FACEUP )
105- tc :CompleteProcedure ()
89+ local sc = Duel .SelectMatchingCard (tp ,s .spfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,1 ,nil ,e ,tp ):GetFirst ()
90+ if not sc then return end
91+ sc :SetMaterial (nil )
92+ if Duel .SpecialSummon (sc ,SUMMON_TYPE_XYZ ,tp ,tp ,false ,false ,POS_FACEUP )> 0 then
93+ sc :CompleteProcedure ()
10694 end
10795end
108- function s .atkcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
109- return Duel .GetAttacker ():IsControler (1 - tp )
110- end
11196function s .atktg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
112- local at = Duel .GetAttacker ()
113- if chk == 0 then return at :IsOnField () and at :HasNonZeroAttack () end
114- Duel .SetTargetCard (at )
97+ local bc = Duel .GetAttacker ()
98+ if chk == 0 then return bc :IsOnField () and bc :HasNonZeroAttack () end
99+ e :SetLabelObject (bc )
100+ bc :CreateEffectRelation (e )
115101end
116102function s .atkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
117- local tc = Duel .GetFirstTarget ()
118- if tc and tc :IsFaceup () and tc :IsRelateToEffect (e ) then
103+ local bc = e :GetLabelObject ()
104+ if bc :IsRelateToEffect (e ) and bc :IsFaceup () and bc :IsControler (1 - tp ) then
105+ -- The ATK of that opponent's monster becomes 0
119106 local e1 = Effect .CreateEffect (e :GetHandler ())
120107 e1 :SetType (EFFECT_TYPE_SINGLE )
108+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
121109 e1 :SetCode (EFFECT_SET_ATTACK_FINAL )
122- e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
123110 e1 :SetValue (0 )
124- tc :RegisterEffect (e1 )
111+ e1 :SetReset (RESET_EVENT |RESETS_STANDARD )
112+ bc :RegisterEffect (e1 )
125113 end
126- end
114+ end
0 commit comments