@@ -4,101 +4,66 @@ local s,id=GetID()
44function s .initial_effect (c )
55 aux .AddSkillProcedure (c ,1 ,false ,s .flipcon ,s .flipop )
66end
7- -- Fusion Summon Functions
87function s .flipcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
9- -- condition
10- return aux .CanActivateSkill (tp ) and Duel .GetFlagEffect (tp ,id )== 0 and s .fusTarget (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,0 )
8+ return aux .CanActivateSkill (tp ) and s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,0 ) and not Duel .HasFlagEffect (tp ,id )
119end
12- function s .fusfilter (c ,e ,tp ,m ,f ,chkf )
13- return c :IsType (TYPE_FUSION ) and (not f or f (c )) and c :IsRace (RACE_MACHINE )
14- and c :IsCanBeSpecialSummoned (e ,SUMMON_TYPE_FUSION ,tp ,false ,false ) and c :CheckFusionMaterial (m ,nil ,chkf )
15- end
16- function s .cfilter (c ,e ,tp )
10+ function s .costfilter (c ,e ,tp ,eg ,ep ,ev ,re ,r ,rp )
1711 if not c :IsDiscardable () then return false end
18- local chkf = tp
19- local mg1 = Duel .GetFusionMaterial (tp ):Filter (aux .NOT (Card .IsImmuneToEffect ),nil ,e )
20- local res = Duel .IsExistingMatchingCard (s .fusfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,c ,e ,tp ,mg1 - c ,nil ,chkf )
21- if not res then
22- local ce = Duel .GetChainMaterial (tp )
23- if ce ~= nil then
24- local fgroup = ce :GetTarget ()
25- local mg2 = fgroup (ce ,e ,tp )
26- local mf = ce :GetValue ()
27- res = Duel .IsExistingMatchingCard (s .fusfilter ,tp ,LOCATION_EXTRA ,0 ,1 ,c ,e ,tp ,mg2 - c ,mf ,chkf )
28- end
29- end
30- return res
12+ local params = {fusfilter = aux .FilterBoolFunction (Card .IsRace ,RACE_MACHINE ),extrafil = s .fextra (c ),stage2 = s .stage2 }
13+ return Fusion .SummonEffTG (params )(e ,tp ,eg ,ep ,ev ,re ,r ,rp ,0 )
3114end
32- function s .fusTarget (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
33- if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp ) end
34- Duel .DiscardHand (tp ,s .cfilter ,1 ,1 ,REASON_COST + REASON_DISCARD ,nil ,e ,tp )
35- Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,1 ,tp ,LOCATION_EXTRA )
15+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
16+ if chk == 0 then return Duel .IsExistingMatchingCard (s .costfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ,e ,tp ,eg ,ep ,ev ,re ,r ,rp ) end
17+ Duel .DiscardHand (tp ,s .costfilter ,1 ,1 ,REASON_COST |REASON_DISCARD ,nil ,e ,tp ,eg ,ep ,ev ,re ,r ,rp )
3618end
37- function s .flipop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
38- Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(1 << 32 ))
39- Duel .Hint (HINT_CARD ,tp ,id )
40- -- Fusion Summon "Elemental HERO" Fusion monster
41- local g2 = s .fusTarget (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,0 )
42- -- OPD Register
43- Duel .RegisterFlagEffect (tp ,id ,0 ,0 ,0 )
44- -- Fusion Procedure
45- s .fusTarget (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,1 )
46- local chkf = tp
47- local mg1 = Duel .GetFusionMaterial (tp ):Filter (aux .NOT (Card .IsImmuneToEffect ),nil ,e )
48- local sg1 = Duel .GetMatchingGroup (s .fusfilter ,tp ,LOCATION_EXTRA ,0 ,nil ,e ,tp ,mg1 ,nil ,chkf )
49- local mg2 ,sg2 = nil ,nil
50- local ce = Duel .GetChainMaterial (tp )
51- if ce ~= nil then
52- local fgroup = ce :GetTarget ()
53- mg2 = fgroup (ce ,e ,tp )
54- local mf = ce :GetValue ()
55- sg2 = Duel .GetMatchingGroup (s .fusfilter ,tp ,LOCATION_EXTRA ,0 ,nil ,e ,tp ,mg2 ,mf ,chkf )
19+ function s .fextra (exc )
20+ return function (e ,tp ,mg )
21+ return nil ,s .fcheck (exc )
22+ end
23+ end
24+ function s .fcheck (exc )
25+ return function (tp ,sg ,fc )
26+ return not (exc and sg :IsContains (exc ))
5627 end
57- if sg1 :GetCount ()> 0 or (sg2 ~= nil and sg2 :GetCount ()> 0 ) then
58- local sg = sg1 :Clone ()
59- if sg2 then sg :Merge (sg2 ) end
60- Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
61- local tg = sg :Select (tp ,1 ,1 ,nil )
62- local tc = tg :GetFirst ()
63- if sg1 :IsContains (tc ) and (sg2 == nil or not sg2 :IsContains (tc ) or not Duel .SelectYesNo (tp ,ce :GetDescription ())) then
64- local mat1 = Duel .SelectFusionMaterial (tp ,tc ,mg1 ,nil ,chkf )
65- tc :SetMaterial (mat1 )
66- Duel .SendtoGrave (mat1 ,REASON_EFFECT + REASON_MATERIAL + REASON_FUSION )
67- Duel .BreakEffect ()
68- Duel .SpecialSummon (tc ,SUMMON_TYPE_FUSION ,tp ,tp ,false ,false ,POS_FACEUP )
69- else
70- local mat2 = Duel .SelectFusionMaterial (tp ,tc ,mg2 ,nil ,chkf )
71- local fop = ce :GetOperation ()
72- fop (ce ,e ,tp ,tc ,mat2 )
73- end
74- tc :CompleteProcedure ()
75- -- Gains ATK equal to its original ATK
28+ end
29+ function s .stage2 (e ,tc ,tp ,sg ,chk )
30+ if chk == 0 then
31+ -- Gains ATK equal to its original ATK until the end of this turn
7632 local e1 = Effect .CreateEffect (e :GetHandler ())
77- e1 :SetType (EFFECT_TYPE_SINGLE )
78- e1 :SetCode (EFFECT_UPDATE_ATTACK )
79- e1 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
80- e1 :SetValue (tc :GetBaseAttack ())
81- e1 :SetReset (RESET_EVENT | RESETS_STANDARD )
82- tc :RegisterEffect (e1 ,true )
83- -- Cannot attack directly
84- local e2 = Effect .CreateEffect (e :GetHandler ())
85- e2 :SetType (EFFECT_TYPE_SINGLE )
33+ e1 :SetType (EFFECT_TYPE_SINGLE )
34+ e1 :SetCode (EFFECT_UPDATE_ATTACK )
35+ e1 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
36+ e1 :SetValue (tc :GetBaseAttack ())
37+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
38+ tc :RegisterEffect (e1 ,true )
39+ -- Cannot attack directly this turn
40+ local e2 = Effect .CreateEffect (e :GetHandler ())
41+ e2 :SetType (EFFECT_TYPE_SINGLE )
8642 e2 :SetCode (EFFECT_CANNOT_DIRECT_ATTACK )
8743 e2 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
8844 e2 :SetRange (LOCATION_MZONE )
89- e2 :SetReset (RESET_EVENT | RESETS_STANDARD | RESET_PHASE | PHASE_END )
45+ e2 :SetReset (RESETS_STANDARD_PHASE_END )
9046 tc :RegisterEffect (e2 )
91- -- Take damage at the End Phase
92- local e3 = Effect .CreateEffect (e :GetHandler ())
93- e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
94- e3 :SetCode (EVENT_PHASE + PHASE_END )
95- e3 :SetCountLimit (1 )
96- e3 :SetLabel (tc :GetBaseAttack ())
97- e3 :SetReset (RESET_PHASE |PHASE_END )
98- e3 :SetOperation (s . damop )
99- Duel .RegisterEffect (e3 ,tp )
47+ -- You take damage equal to the gained ATK during the End Phase
48+ local e3 = Effect .CreateEffect (e :GetHandler ())
49+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
50+ e3 :SetCode (EVENT_PHASE + PHASE_END )
51+ e3 :SetCountLimit (1 )
52+ e3 :SetLabel (tc :GetBaseAttack ())
53+ e3 :SetReset (RESET_PHASE |PHASE_END )
54+ e3 :SetOperation (function ( e , tp ) Duel . Hint ( HINT_CARD , tp , id ) Duel . Damage ( tp , e : GetLabel (), REASON_EFFECT ) end )
55+ Duel .RegisterEffect (e3 ,tp )
10056 end
10157end
102- function s .damop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
103- Duel .Damage (tp ,e :GetLabel (),REASON_EFFECT )
104- end
58+ function s .flipop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
59+ Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(1 << 32 ))
60+ Duel .Hint (HINT_CARD ,tp ,id )
61+ local params = {fusfilter = aux .FilterBoolFunction (Card .IsRace ,RACE_MACHINE ),extrafil = s .fextra (c ),stage2 = s .stage2 }
62+ -- You can only apply this effect once per turn
63+ Duel .RegisterFlagEffect (tp ,id ,0 ,0 ,0 )
64+ -- Discard 1 card
65+ s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,1 )
66+ -- Fusion Summon 1 Machine Fusion monster, using monsters from your hand or field as material
67+ Fusion .SummonEffTG (params )(e ,tp ,eg ,ep ,ev ,re ,r ,rp ,1 )
68+ Fusion .SummonEffOP (params )(e ,tp ,eg ,ep ,ev ,re ,r ,rp )
69+ end
0 commit comments