22-- Fiendish Engine Ω
33local s ,id = GetID ()
44function s .initial_effect (c )
5- -- token
5+ -- Special Summon 1 "Engine Token"
66 local e1 = Effect .CreateEffect (c )
77 e1 :SetDescription (aux .Stringid (id ,0 ))
88 e1 :SetCategory (CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN )
@@ -14,15 +14,27 @@ function s.initial_effect(c)
1414 e1 :SetTarget (s .sptg )
1515 e1 :SetOperation (s .spop )
1616 c :RegisterEffect (e1 )
17- -- atkup
17+ -- Gain 1000 ATK
1818 local e2 = Effect .CreateEffect (c )
1919 e2 :SetDescription (aux .Stringid (id ,1 ))
2020 e2 :SetCategory (CATEGORY_ATKCHANGE )
2121 e2 :SetType (EFFECT_TYPE_IGNITION )
2222 e2 :SetRange (LOCATION_MZONE )
2323 e2 :SetCountLimit (1 )
24+ e2 :SetTarget (s .atktg )
2425 e2 :SetOperation (s .atkop )
2526 c :RegisterEffect (e2 )
27+ -- Destroy this card during the End Phase
28+ local e3 = Effect .CreateEffect (c )
29+ e3 :SetDescription (aux .Stringid (id ,2 ))
30+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F )
31+ e3 :SetCode (EVENT_PHASE + PHASE_END )
32+ e3 :SetRange (LOCATION_MZONE )
33+ e3 :SetCountLimit (1 )
34+ e3 :SetCondition (function (e ) return e :GetHandler ():HasFlagEffect (id ) end )
35+ e3 :SetTarget (s .selfdestg )
36+ e3 :SetOperation (s .selfdesop )
37+ c :RegisterEffect (e3 )
2638end
2739s .listed_names = {TOKEN_ENGINE }
2840function s .spcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
@@ -40,6 +52,11 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
4052 Duel .SpecialSummon (token ,0 ,tp ,tp ,false ,false ,POS_FACEUP_ATTACK )
4153 end
4254end
55+ function s .atktg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
56+ if chk == 0 then return true end
57+ e :GetHandler ():RegisterFlagEffect (id ,RESETS_STANDARD_PHASE_END ,EFFECT_FLAG_OATH ,1 )
58+ Duel .SetOperationInfo (0 ,CATEGORY_ATKCHANGE ,e :GetHandler (),1 ,tp ,1000 )
59+ end
4360function s .atkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
4461 local c = e :GetHandler ()
4562 if not c :IsRelateToEffect (e ) or c :IsFacedown () then return end
@@ -48,26 +65,16 @@ function s.atkop(e,tp,eg,ep,ev,re,r,rp)
4865 e1 :SetProperty (EFFECT_FLAG_COPY_INHERIT )
4966 e1 :SetCode (EFFECT_UPDATE_ATTACK )
5067 e1 :SetValue (1000 )
51- e1 :SetReset (RESET_EVENT + RESETS_STANDARD_DISABLE + RESET_PHASE + PHASE_END )
68+ e1 :SetReset (RESET_EVENT | RESETS_STANDARD_DISABLE | RESET_PHASE | PHASE_END )
5269 c :RegisterEffect (e1 )
53- local e2 = Effect .CreateEffect (c )
54- e2 :SetDescription (aux .Stringid (id ,2 ))
55- e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F )
56- e2 :SetCode (EVENT_PHASE + PHASE_END )
57- e2 :SetRange (LOCATION_MZONE )
58- e2 :SetCountLimit (1 )
59- e2 :SetTarget (s .destg )
60- e2 :SetOperation (s .desop )
61- e2 :SetReset (RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END )
62- c :RegisterEffect (e2 )
6370end
64- function s .destg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
71+ function s .selfdestg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
6572 if chk == 0 then return true end
6673 Duel .SetOperationInfo (0 ,CATEGORY_DESTROY ,e :GetHandler (),1 ,0 ,0 )
6774end
68- function s .desop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
75+ function s .selfdesop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
6976 local c = e :GetHandler ()
70- if c :IsRelateToEffect (e ) then
77+ if c :IsRelateToEffect (e ) and c : IsFaceup () then
7178 Duel .Destroy (c ,REASON_EFFECT )
7279 end
73- end
80+ end
0 commit comments