1+ -- コクーン・キング・ビートル
2+ -- Cocoon King Beetle
3+ -- Scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Draw
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_DRAW |CATEGORY_TOHAND )
10+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
11+ e1 :SetType (EFFECT_TYPE_IGNITION )
12+ e1 :SetRange (LOCATION_MZONE )
13+ e1 :SetCountLimit (1 )
14+ e1 :SetCondition (s .condition )
15+ e1 :SetCost (s .cost )
16+ e1 :SetTarget (s .target )
17+ e1 :SetOperation (s .operation )
18+ c :RegisterEffect (e1 )
19+ end
20+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
21+ return Duel .GetFieldGroupCount (tp ,LOCATION_DECK ,0 )>= 10
22+ end
23+ function s .cfilter (c )
24+ return c :IsMonster () and c :IsRace (RACE_INSECT ) and c :IsAttribute (ATTRIBUTE_DARK ) and c :IsAbleToGraveAsCost ()
25+ end
26+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
27+ if chk == 0 then return Duel .IsExistingMatchingCard (s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,nil ) end
28+ end
29+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
30+ if chk == 0 then return Duel .IsPlayerCanDraw (tp ,1 ) end
31+ Duel .SetTargetPlayer (tp )
32+ Duel .SetTargetParam (1 )
33+ Duel .SetOperationInfo (0 ,CATEGORY_DRAW ,nil ,0 ,tp ,1 )
34+ end
35+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
36+ -- Requirement
37+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
38+ local g = Duel .SelectMatchingCard (tp ,s .cfilter ,tp ,LOCATION_HAND ,0 ,1 ,1 ,nil )
39+ if Duel .SendtoGrave (g ,REASON_COST )< 1 then return end
40+ -- Effect
41+ local p ,d = Duel .GetChainInfo (0 ,CHAININFO_TARGET_PLAYER ,CHAININFO_TARGET_PARAM )
42+ if Duel .Draw (p ,d ,REASON_EFFECT )> 0 and Duel .IsPlayerCanDiscardDeck (tp ,3 )
43+ and Duel .IsExistingMatchingCard (Card .IsAttribute ,tp ,LOCATION_GRAVE ,0 ,2 ,nil ,ATTRIBUTE_DARK )
44+ and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
45+ Duel .BreakEffect ()
46+ Duel .DiscardDeck (tp ,3 ,REASON_EFFECT )
47+ end
48+ end
0 commit comments