1+ -- スパークハーツ・ハット
2+ -- Sparkhearts Hat
3+ local s ,id = GetID ()
4+ function s .initial_effect (c )
5+ local e1 = Effect .CreateEffect (c )
6+ e1 :SetDescription (aux .Stringid (id ,0 ))
7+ e1 :SetCategory (CATEGORY_TOGRAVE + CATEGORY_TOHAND )
8+ e1 :SetType (EFFECT_TYPE_IGNITION )
9+ e1 :SetRange (LOCATION_MZONE )
10+ e1 :SetCountLimit (1 )
11+ e1 :SetCondition (s .condition )
12+ e1 :SetTarget (s .target )
13+ e1 :SetOperation (s .operation )
14+ c :RegisterEffect (e1 )
15+ end
16+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
17+ return e :GetHandler ():IsStatus (STATUS_SUMMON_TURN )
18+ end
19+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
20+ if chk == 0 then return Duel .IsExistingMatchingCard (Card .IsAbleToGrave ,tp ,LOCATION_HAND |LOCATION_ONFIELD ,0 ,1 ,e :GetHandler ()) end
21+ Duel .SetOperationInfo (0 ,CATEGORY_TOGRAVE ,nil ,1 ,tp ,LOCATION_HAND |LOCATION_ONFIELD )
22+ end
23+ function s .thfilter (c )
24+ return c :IsMonster () and c :IsRace (RACE_SPELLCASTER ) and c :IsAttribute (ATTRIBUTE_FIRE ) and not c :IsAttack (600 ) and c :IsAbleToHand ()
25+ end
26+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
27+ local c = e :GetHandler ()
28+ -- Effect
29+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TOGRAVE )
30+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToGrave ,tp ,LOCATION_HAND |LOCATION_ONFIELD ,0 ,1 ,1 ,c )
31+ if Duel .SendtoGrave (g ,REASON_EFFECT )== 0 then return end
32+ if Duel .IsExistingMatchingCard (aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,nil ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
33+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
34+ local g = Duel .SelectMatchingCard (tp ,aux .NecroValleyFilter (s .thfilter ),tp ,LOCATION_GRAVE ,0 ,1 ,1 ,nil )
35+ if # g > 0 then
36+ Duel .BreakEffect ()
37+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
38+ Duel .ConfirmCards (1 - tp ,g )
39+ end
40+ end
41+ local e1 = Effect .CreateEffect (c )
42+ e1 :SetDescription (aux .Stringid (id ,1 ))
43+ e1 :SetType (EFFECT_TYPE_FIELD )
44+ e1 :SetCode (EFFECT_CANNOT_ACTIVATE )
45+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
46+ e1 :SetTargetRange (1 ,0 )
47+ e1 :SetValue (s .aclimit )
48+ e1 :SetReset (RESET_PHASE |PHASE_END )
49+ Duel .RegisterEffect (e1 ,tp )
50+ end
51+ function s .aclimit (e ,re ,tp )
52+ return re :GetHandler ():IsCode (id )
53+ end
0 commit comments