1+ -- 星辰爪竜アルザリオン
2+ -- Dragontail Altharion
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ c :EnableReviveLimit ()
7+ -- Fusion Materials: 1 "Dragontail" monster + 1+ monsters in the hand
8+ Fusion .AddProcMixRep (c ,true ,true ,aux .FilterBoolFunctionEx (Card .IsLocation ,LOCATION_HAND ),1 ,99 ,aux .FilterBoolFunctionEx (Card .IsSetCard ,SET_DRAGONTAIL ))
9+ -- Register how many materials are used from the hand
10+ local e0 = Effect .CreateEffect (c )
11+ e0 :SetType (EFFECT_TYPE_SINGLE )
12+ e0 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
13+ e0 :SetCode (EFFECT_MATERIAL_CHECK )
14+ e0 :SetValue (function (e ,c ) e :SetLabel (c :GetMaterial ():FilterCount (Card .IsLocation ,nil ,LOCATION_HAND )) end )
15+ c :RegisterEffect (e0 )
16+ -- Return monsters on the field and/or in any GY(s) to the hand, up to the number of monsters used as material from the hand
17+ local e1 = Effect .CreateEffect (c )
18+ e1 :SetDescription (aux .Stringid (id ,0 ))
19+ e1 :SetCategory (CATEGORY_TOHAND )
20+ e1 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
21+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DELAY )
22+ e1 :SetCode (EVENT_SPSUMMON_SUCCESS )
23+ e1 :SetCountLimit (1 ,id )
24+ e1 :SetCondition (function (e ) return e :GetHandler ():IsFusionSummoned () and e :GetLabelObject ():GetLabel ()> 0 end )
25+ e1 :SetTarget (s .thtg )
26+ e1 :SetOperation (s .thop )
27+ e1 :SetLabelObject (e0 )
28+ c :RegisterEffect (e1 )
29+ -- Special Summon this card from the GY, but banish it when it leaves the field
30+ local e2 = Effect .CreateEffect (c )
31+ e2 :SetDescription (aux .Stringid (id ,1 ))
32+ e2 :SetCategory (CATEGORY_SPECIAL_SUMMON + CATEGORY_REMOVE )
33+ e2 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
34+ e2 :SetProperty (EFFECT_FLAG_DELAY ,EFFECT_FLAG2_CHECK_SIMULTANEOUS )
35+ e2 :SetCode (EVENT_CUSTOM + id )
36+ e2 :SetRange (LOCATION_GRAVE )
37+ e2 :SetCountLimit (1 ,{id ,1 })
38+ e2 :SetTarget (s .sptg )
39+ e2 :SetOperation (s .spop )
40+ c :RegisterEffect (e2 )
41+ -- Keep track of monsters being sent to the GY at the same time
42+ local e3 = Effect .CreateEffect (c )
43+ e3 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
44+ e3 :SetCode (EVENT_TO_GRAVE )
45+ e3 :SetRange (LOCATION_GRAVE )
46+ e3 :SetCondition (function () return not Duel .IsPhase (PHASE_DAMAGE ) end )
47+ e3 :SetOperation (s .regop )
48+ c :RegisterEffect (e3 )
49+ local e4 = e3 :Clone ()
50+ e4 :SetCode (EVENT_CHAINING )
51+ e4 :SetOperation (function (e ) e :GetHandler ():ResetFlagEffect (id + 100 ) end )
52+ c :RegisterEffect (e4 )
53+ local e5 = e4 :Clone ()
54+ e5 :SetCode (EVENT_CHAIN_SOLVED )
55+ c :RegisterEffect (e5 )
56+ local e6 = e4 :Clone ()
57+ e6 :SetCode (EVENT_BREAK_EFFECT )
58+ c :RegisterEffect (e6 )
59+ end
60+ s .listed_series = {SET_DRAGONTAIL }
61+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
62+ if chkc then return chkc :IsLocation (LOCATION_MZONE |LOCATION_GRAVE ) and chkc :IsMonster () and chkc :IsAbleToHand () end
63+ if chk == 0 then return Duel .IsExistingTarget (aux .AND (Card .IsMonster ,Card .IsAbleToHand ),tp ,LOCATION_MZONE |LOCATION_GRAVE ,LOCATION_MZONE |LOCATION_GRAVE ,1 ,nil ) end
64+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_RTOHAND )
65+ local ct = e :GetLabelObject ():GetLabel ()
66+ local g = Duel .SelectTarget (tp ,aux .AND (Card .IsMonster ,Card .IsAbleToHand ),tp ,LOCATION_MZONE |LOCATION_GRAVE ,LOCATION_MZONE |LOCATION_GRAVE ,1 ,ct ,nil )
67+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,g ,# g ,tp ,0 )
68+ end
69+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
70+ local tg = Duel .GetTargetCards (e )
71+ if # tg > 0 then
72+ Duel .SendtoHand (tg ,nil ,REASON_EFFECT )
73+ end
74+ end
75+ function s .regop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
76+ local c = e :GetHandler ()
77+ local ct = eg :FilterCount (Card .IsMonster ,nil )
78+ if ct == 0 or eg :IsContains (c ) then return end
79+ if ct >= 2 or c :HasFlagEffect (id + 100 ) then
80+ Duel .RaiseSingleEvent (c ,EVENT_CUSTOM + id ,re ,r ,rp ,ep ,ev )
81+ end
82+ local eff = Duel .GetChainInfo (0 ,CHAININFO_TRIGGERING_EFFECT )
83+ if eff then
84+ c :RegisterFlagEffect (id + 100 ,RESET_EVENT |RESETS_STANDARD |RESET_CHAIN ,0 ,1 )
85+ end
86+ end
87+ function s .sptg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
88+ local c = e :GetHandler ()
89+ if chk == 0 then return Duel .GetLocationCount (tp ,LOCATION_MZONE )> 0
90+ and c :IsCanBeSpecialSummoned (e ,0 ,tp ,false ,false ) end
91+ Duel .SetOperationInfo (0 ,CATEGORY_SPECIAL_SUMMON ,c ,1 ,tp ,0 )
92+ end
93+ function s .spop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
94+ local c = e :GetHandler ()
95+ if c :IsRelateToEffect (e ) and Duel .SpecialSummon (c ,0 ,tp ,tp ,false ,false ,POS_FACEUP )> 0 then
96+ -- Banish it when it leaves the field
97+ local e1 = Effect .CreateEffect (c )
98+ e1 :SetDescription (3300 )
99+ e1 :SetType (EFFECT_TYPE_SINGLE )
100+ e1 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_CLIENT_HINT )
101+ e1 :SetCode (EFFECT_LEAVE_FIELD_REDIRECT )
102+ e1 :SetValue (LOCATION_REMOVED )
103+ e1 :SetReset (RESET_EVENT |RESETS_REDIRECT )
104+ c :RegisterEffect (e1 ,true )
105+ end
106+ end
0 commit comments