1+ -- 最強の戦旗
2+ -- Ultimate Flag
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Set
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_DESTROY )
10+ e1 :SetType (EFFECT_TYPE_IGNITION )
11+ e1 :SetRange (LOCATION_MZONE )
12+ e1 :SetCountLimit (1 )
13+ e1 :SetCost (s .cost )
14+ e1 :SetTarget (s .target )
15+ e1 :SetOperation (s .operation )
16+ c :RegisterEffect (e1 )
17+ end
18+ s .listed_names = {160023052 ,160411001 }
19+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
20+ if chk == 0 then return e :GetHandler ():IsAbleToGraveAsCost () end
21+ end
22+ function s .monsterfilter (c )
23+ return c :IsMonster () and c :IsRace (RACE_MACHINE ) and c :IsAttribute (ATTRIBUTE_LIGHT ) and c :IsAttack (2500 ) and c :IsDefense (1600 )
24+ end
25+ function s .thfilter (c )
26+ return (c :IsCode (160023052 ) or s .monsterfilter (c )) and c :IsAbleToHand ()
27+ end
28+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
29+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ) end
30+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_GRAVE )
31+ end
32+ function s .spfilter (c ,e ,tp )
33+ return c :IsCode (160411001 ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false )
34+ end
35+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
36+ -- Requirement
37+ local c = e :GetHandler ()
38+ if Duel .SendtoGrave (c ,REASON_COST )< 1 then return end
39+ -- Effect
40+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
41+ local sg = Duel .GetMatchingGroup (s .thfilter ,tp ,LOCATION_GRAVE ,0 ,nil )
42+ local tg = aux .SelectUnselectGroup (sg ,1 ,tp ,1 ,2 ,s .rescon ,1 ,tp )
43+ local ct = Duel .SendtoHand (tg ,nil ,REASON_EFFECT )
44+ Duel .ConfirmCards (1 - tp ,tg )
45+ local sg = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_HAND ,0 ,nil ,e ,tp )
46+ if Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0 and # sg > 0 and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
47+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
48+ local sc = Group .Select (sg ,tp ,1 ,1 ,nil )
49+ if # sc == 0 then return end
50+ Duel .BreakEffect ()
51+ Duel .SpecialSummon (sc ,0 ,tp ,tp ,false ,false ,POS_FACEUP )
52+ end
53+ end
54+ function s .rescon (sg ,e ,tp ,mg )
55+ return sg :FilterCount (Card .IsCode ,nil ,160023052 )< 2 and sg :FilterCount (s .monsterfilter ,nil )< 2
56+ end
0 commit comments