1+ -- 湧軍機海炎
2+ -- Kaien the Molten Martial Machine
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Special summon procedure
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetType (EFFECT_TYPE_FIELD )
9+ e1 :SetCode (EFFECT_SPSUMMON_PROC )
10+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE )
11+ e1 :SetRange (LOCATION_HAND )
12+ e1 :SetCondition (s .spcon )
13+ e1 :SetTarget (s .sptg )
14+ e1 :SetOperation (s .spop )
15+ c :RegisterEffect (e1 )
16+ -- Special Summon from the hand or GY
17+ local e2 = Effect .CreateEffect (c )
18+ e2 :SetDescription (aux .Stringid (id ,0 ))
19+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON )
20+ e2 :SetType (EFFECT_TYPE_IGNITION )
21+ e2 :SetRange (LOCATION_MZONE )
22+ e2 :SetCountLimit (1 )
23+ e2 :SetCondition (s .condition )
24+ e2 :SetCost (s .cost )
25+ e2 :SetTarget (s .target )
26+ e2 :SetOperation (s .operation )
27+ c :RegisterEffect (e2 )
28+ end
29+ function s .spcfilter (c )
30+ return c :IsMonster () and c :IsRace (RACE_MACHINE ) and c :IsAttribute (ATTRIBUTE_FIRE ) and not c :IsLevel (7 ) and not c :IsPublic ()
31+ end
32+ function s .spcon (e ,c )
33+ if c == nil then return true end
34+ local tp = c :GetControler ()
35+ local rg = Duel .GetMatchingGroup (s .spcfilter ,tp ,LOCATION_HAND ,0 ,e :GetHandler ())
36+ return # rg > 0 and aux .SelectUnselectGroup (rg ,e ,tp ,1 ,1 ,aux .ChkfMMZ (1 ),0 )
37+ end
38+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
39+ local rg = Duel .GetMatchingGroup (s .spcfilter ,tp ,LOCATION_HAND ,0 ,e :GetHandler ())
40+ local g = aux .SelectUnselectGroup (rg ,e ,tp ,1 ,1 ,aux .ChkfMMZ (1 ),1 ,tp ,HINTMSG_CONFIRM ,nil ,nil ,true )
41+ if # g > 0 then
42+ g :KeepAlive ()
43+ e :SetLabelObject (g )
44+ return true
45+ end
46+ return false
47+ end
48+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,c )
49+ local g = e :GetLabelObject ()
50+ if not g then return end
51+ Duel .ConfirmCards (1 - tp ,g )
52+ Duel .ShuffleHand (tp )
53+ g :DeleteGroup ()
54+ end
55+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
56+ return Duel .GetFieldGroupCount (tp ,LOCATION_DECK ,0 )>= 10
57+ end
58+ function s .cfilter (c )
59+ return c :IsFaceup () and c :IsAbleToDeckOrExtraAsCost ()
60+ end
61+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
62+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_MZONE ,0 ,1 ,nil ) end
63+ end
64+ function s .filter (c ,e ,tp )
65+ return c :IsRace (RACE_MACHINE ) and c :IsAttribute (ATTRIBUTE_FIRE ) and c :IsLevel (9 ) and c :IsType (TYPE_EFFECT ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEUP_DEFENSE )
66+ end
67+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
68+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
69+ and Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_GRAVE |LOCATION_HAND ,0 ,1 ,nil ,e ,tp )
70+ end
71+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,nil ,0 ,tp ,LOCATION_GRAVE |LOCATION_HAND )
72+ end
73+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
74+ -- Requirement
75+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
76+ local g = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_MZONE ,0 ,1 ,1 ,nil )
77+ if Duel .SendtoDeck (g ,nil ,SEQ_DECKBOTTOM ,REASON_COST )< 1 then return end
78+ -- Effect
79+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
80+ local g = Duel .SelectMatchingCard (tp ,s .filter ,tp ,LOCATION_GRAVE |LOCATION_HAND ,0 ,1 ,1 ,nil ,e ,tp )
81+ Duel .SpecialSummon (g ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
82+ end
0 commit comments