1+ -- 紋章獣スタット・ホエール
2+ -- Heraldic Beast Stat Whale
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Add 2 "Heraldry" Spells/Traps from your Deck to your hand.
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
10+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
11+ e1 :SetProperty (EFFECT_FLAG_DELAY )
12+ e1 :SetCode (EVENT_SUMMON_SUCCESS )
13+ e1 :SetCountLimit (1 ,id )
14+ e1 :SetCost (aux .DiscardCost ())
15+ e1 :SetTarget (s .thtg )
16+ e1 :SetOperation (s .thop )
17+ c :RegisterEffect (e1 )
18+ local e2 = e1 :Clone ()
19+ e2 :SetCode (EVENT_SPSUMMON_SUCCESS )
20+ c :RegisterEffect (e2 )
21+ -- Special Summon in Defense Position 2 "Heraldic Beast" monsters with the same name from your GY
22+ local e3 = Effect .CreateEffect (c )
23+ e3 :SetDescription (aux .Stringid (id ,1 ))
24+ e3 :SetCategory (CATEGORY_SPECIAL_SUMMON )
25+ e3 :SetType (EFFECT_TYPE_IGNITION )
26+ e3 :SetProperty (EFFECT_FLAG_CARD_TARGET )
27+ e3 :SetRange (LOCATION_GRAVE )
28+ e3 :SetCountLimit (1 ,{id ,1 })
29+ e3 :SetCost (aux .SelfBanishCost )
30+ e3 :SetTarget (s .sptg )
31+ e3 :SetOperation (s .spop )
32+ c :RegisterEffect (e3 )
33+ end
34+ s .listed_series = {SET_HERALDRY ,SET_HERALDIC_BEAST }
35+ function s .thfilter (c )
36+ return c :IsSetCard (SET_HERALDRY ) and c :IsSpellTrap () and c :IsAbleToHand ()
37+ end
38+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
39+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,2 ,nil ) end
40+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,2 ,tp ,LOCATION_DECK )
41+ end
42+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
43+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
44+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,2 ,2 ,nil )
45+ if # g == 2 then
46+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
47+ Duel .ConfirmCards (1 - tp ,g )
48+ end
49+ end
50+ function s .spfilter (c ,e ,tp )
51+ return c :IsSetCard (SET_HERALDIC_BEAST ) and c :IsCanBeEffectTarget (e ) and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ,POS_FACEUP_DEFENSE )
52+ end
53+ function s .spcheck (sg ,e ,tp ,mg )
54+ return sg :GetClassCount (Card .GetCode )== 1
55+ end
56+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
57+ local g = Duel .GetMatchingGroup (s .spfilter ,tp ,LOCATION_GRAVE ,0 ,e :GetHandler (),e ,tp )
58+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )>= 2
59+ and not Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT )
60+ and aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .spcheck ,0 ) end
61+ local tg = aux .SelectUnselectGroup (g ,e ,tp ,2 ,2 ,s .spcheck ,1 ,tp ,HINTMSG_SPSUMMON )
62+ Duel .SetTargetCard (tg )
63+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,tg ,2 ,tp ,0 )
64+ end
65+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
66+ local tg = Duel .GetTargetCards (e )
67+ local ft = Duel .GetLocationCount (tp ,LOCATION_MZONE )
68+ if # tg > 0 and ft > 0 and not Duel .IsPlayerAffectedByEffect (tp ,CARD_BLUEEYES_SPIRIT ) then
69+ if ft == 1 then
70+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SPSUMMON )
71+ tg = tg :FilterSelect (tp ,Card .IsCanBeSpecialSummoned ,1 ,1 ,nil ,e ,0 ,tp ,false ,false ,POS_FACEUP_DEFENSE )
72+ end
73+ Duel .SpecialSummon (tg ,0 ,tp ,tp ,false ,false ,POS_FACEUP_DEFENSE )
74+ end
75+ local c = e :GetHandler ()
76+ -- Cannot Special Summon from the Extra Deck for the rest of this turn, except by Xyz Summon
77+ local e1 = Effect .CreateEffect (c )
78+ e1 :SetDescription (aux .Stringid (id ,2 ))
79+ e1 :SetType (EFFECT_TYPE_FIELD )
80+ e1 :SetProperty (EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_CLIENT_HINT )
81+ e1 :SetCode (EFFECT_CANNOT_SPECIAL_SUMMON )
82+ e1 :SetTargetRange (1 ,0 )
83+ e1 :SetTarget (function (e ,c ,sump ,sumtype ) return c :IsLocation (LOCATION_EXTRA ) and (sumtype &SUMMON_TYPE_XYZ )~= SUMMON_TYPE_XYZ end )
84+ e1 :SetReset (RESET_PHASE |PHASE_END )
85+ Duel .RegisterEffect (e1 ,tp )
86+ -- Can only use monsters with "Heraldic Beast" and/or "Number" in their original names as material for an Xyz Summon this turn
87+ local e2 = Effect .CreateEffect (c )
88+ e2 :SetType (EFFECT_TYPE_FIELD )
89+ e2 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE )
90+ e2 :SetCode (EFFECT_CANNOT_BE_XYZ_MATERIAL )
91+ e2 :SetTargetRange (LOCATION_ALL ,LOCATION_ALL )
92+ e2 :SetTarget (function (e ,c ) return not c :IsOriginalSetCard ({SET_HERALDIC_BEAST ,SET_NUMBER }) end )
93+ e2 :SetValue (function (e ,c ) return c and c :IsControler (e :GetHandlerPlayer ()) end )
94+ e2 :SetReset (RESET_PHASE |PHASE_END )
95+ Duel .RegisterEffect (e2 ,tp )
96+ end
0 commit comments