1+ -- 号令のナリキング・レックス
2+ -- Commanding Ritzy King Rex
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Name becomes "Ritzy King Rex" in the Graveyard
7+ local e0 = Effect .CreateEffect (c )
8+ e0 :SetType (EFFECT_TYPE_SINGLE )
9+ e0 :SetCode (EFFECT_CHANGE_CODE )
10+ e0 :SetProperty (EFFECT_FLAG_SINGLE_RANGE )
11+ e0 :SetRange (LOCATION_GRAVE )
12+ e0 :SetValue (160203010 )
13+ c :RegisterEffect (e0 )
14+ -- Destroy 1 face up monster
15+ local e1 = Effect .CreateEffect (c )
16+ e1 :SetDescription (aux .Stringid (id ,0 ))
17+ e1 :SetType (EFFECT_TYPE_IGNITION )
18+ e1 :SetCategory (CATEGORY_DESTROY |CATEGORY_DRAW )
19+ e1 :SetRange (LOCATION_MZONE )
20+ e1 :SetCountLimit (1 )
21+ e1 :SetCondition (s .condition )
22+ e1 :SetTarget (s .target )
23+ e1 :SetOperation (s .operation )
24+ c :RegisterEffect (e1 )
25+ end
26+ s .listed_names = {CARD_UPSTART_GOBLIN }
27+ function s .filter (c )
28+ return c :IsMonster () and not c :IsRace (RACE_DINOSAUR )
29+ end
30+ function s .cfilter (c )
31+ return (c :IsMonster () and c :IsLegend ()) or c :IsCode (CARD_UPSTART_GOBLIN )
32+ end
33+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
34+ return Duel .IsExistingMatchingCard (Card .IsMonster ,tp ,LOCATION_GRAVE ,0 ,1 ,nil )
35+ and not Duel .IsExistingMatchingCard (s .filter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil )
36+ and Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_GRAVE ,0 ,1 ,nil )
37+ end
38+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
39+ local dg = Duel .GetMatchingGroup (Card .IsNotMaximumModeSide ,tp ,0 ,LOCATION_MZONE ,nil )
40+ if chk == 0 then return # dg > 0 end
41+ end
42+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
43+ -- Effect
44+ local dg = Duel .GetMatchingGroup (Card .IsNotMaximumModeSide ,tp ,0 ,LOCATION_MZONE ,nil )
45+ if # dg > 0 then
46+ local sg = dg :Select (tp ,1 ,1 ,nil )
47+ local sg2 = sg :AddMaximumCheck ()
48+ Duel .HintSelection (sg2 )
49+ if Duel .Destroy (sg ,REASON_EFFECT )> 0
50+ and Duel .IsPlayerCanDraw (tp ,1 )
51+ and Duel .IsExistingMatchingCard (Card .IsCode ,tp ,LOCATION_GRAVE ,0 ,1 ,nil ,CARD_UPSTART_GOBLIN )
52+ and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
53+ Duel .BreakEffect ()
54+ Duel .Draw (tp ,1 ,REASON_EFFECT )
55+ end
56+ end
57+ end
0 commit comments