1+ -- 継承の魔戦士
2+ -- Magical Warrior of Heritage
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Special Summon
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetCategory (CATEGORY_SPECIAL_SUMMON )
9+ e1 :SetType (EFFECT_TYPE_IGNITION )
10+ e1 :SetRange (LOCATION_MZONE )
11+ e1 :SetCountLimit (1 )
12+ e1 :SetCost (s .cost )
13+ e1 :SetTarget (s .target )
14+ e1 :SetOperation (s .operation )
15+ c :RegisterEffect (e1 )
16+ end
17+ function s .tdfilter (c )
18+ return c :IsMonster () and c :IsAbleToDeckOrExtraAsCost ()
19+ end
20+ function s .cfilter (c ,tp ,code )
21+ return c :IsRace (RACE_SPELLCASTER |RACE_WARRIOR ) and (c :IsAttack (2600 ) or c :IsDefense (2600 )) and not c :IsCode (code )
22+ and Duel .IsExistingMatchingCard (s .tdfilter ,tp ,LOCATION_GRAVE ,0 ,2 ,c )
23+ end
24+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
25+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,tp ,e :GetHandler ():GetCode ()) end
26+ end
27+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
28+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,tp ,e :GetHandler ():GetCode ()) end
29+ end
30+ function s .cfilter2 (c ,code )
31+ return c :IsRace (RACE_SPELLCASTER |RACE_WARRIOR ) and (c :IsAttack (2600 ) or c :IsDefense (2600 )) and not c :IsCode (code )
32+ end
33+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
34+ local c = e :GetHandler ()
35+ -- Requirement
36+ local g = Duel .GetMatchingGroup (s .tdfilter ,tp ,LOCATION_GRAVE ,0 ,nil ,tp )
37+ local td = aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .rescon ,1 ,tp ,HINTMSG_SELECT )
38+ Duel .HintSelection (td )
39+ if Duel .SendtoDeck (td ,nil ,SEQ_DECKSHUFFLE ,REASON_COST )< 1 then return end
40+ -- Effect
41+ if Duel .GetLocationCount (tp ,LOCATION_MZONE )<= 0 then return end
42+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_CODE )
43+ local g = Duel .SelectMatchingCard (tp ,s .cfilter2 ,tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil ,e :GetHandler ():GetCode ())
44+ if # g > 0 then
45+ Duel .HintSelection (g )
46+ local e1 = Effect .CreateEffect (c )
47+ e1 :SetType (EFFECT_TYPE_SINGLE )
48+ e1 :SetCode (EFFECT_CHANGE_CODE )
49+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
50+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
51+ e1 :SetValue (g :GetFirst ():GetCode ())
52+ c :RegisterEffect (e1 )
53+ end
54+ end
55+ function s .rescon (sg ,e ,tp ,mg )
56+ return Duel .IsExistingMatchingCard (s .cfilter2 ,tp ,LOCATION_GRAVE ,0 ,1 ,sg ,e :GetHandler ():GetCode ())
57+ end
0 commit comments