1+ -- ダークリボー
2+ -- Darkuriboh
3+ -- scripted by pyrQ
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Apply effects to 1 of your Fiend or Fusion Monsters
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetType (EFFECT_TYPE_QUICK_O )
10+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
11+ e1 :SetCode (EVENT_BECOME_TARGET )
12+ e1 :SetRange (LOCATION_HAND )
13+ e1 :SetCountLimit (1 ,id )
14+ e1 :SetCondition (s .effcon )
15+ e1 :SetCost (Cost .SelfDiscard )
16+ e1 :SetTarget (s .efftg )
17+ e1 :SetOperation (s .effop )
18+ c :RegisterEffect (e1 )
19+ local e2 = e1 :Clone ()
20+ e2 :SetCode (EVENT_BE_BATTLE_TARGET )
21+ c :RegisterEffect (e2 )
22+ -- Add 1 "Polymerization" from your Deck or GY to your hand
23+ local e3 = Effect .CreateEffect (c )
24+ e3 :SetDescription (aux .Stringid (id ,1 ))
25+ e3 :SetCategory (CATEGORY_TOHAND + CATEGORY_SEARCH )
26+ e3 :SetType (EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O )
27+ e3 :SetProperty (EFFECT_FLAG_DELAY )
28+ e3 :SetCode (EVENT_TO_GRAVE )
29+ e3 :SetCountLimit (1 ,{id ,1 })
30+ e3 :SetCondition (s .thcon )
31+ e3 :SetTarget (s .thtg )
32+ e3 :SetOperation (s .thop )
33+ c :RegisterEffect (e3 )
34+ end
35+ s .listed_names = {CARD_POLYMERIZATION }
36+ function s .effconfilter (c ,tp )
37+ return (c :IsRace (RACE_FIEND ) or c :IsType (TYPE_FUSION )) and c :IsControler (tp ) and c :IsLocation (LOCATION_MZONE ) and c :IsFaceup ()
38+ end
39+ function s .effcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
40+ return eg :IsExists (s .effconfilter ,1 ,nil ,tp )
41+ end
42+ function s .efftg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
43+ local g = eg :Filter (s .effconfilter ,nil ,tp ):Match (Card .IsCanBeEffectTarget ,nil ,e )
44+ if chk == 0 then return # g > 0 end
45+ local tg = nil
46+ if # g > 1 then
47+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TARGET )
48+ tg = g :Select (tp ,1 ,1 ,nil )
49+ else
50+ tg = g
51+ end
52+ Duel .SetTargetCard (tg )
53+ end
54+ function s .effop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
55+ local tc = Duel .GetFirstTarget ()
56+ if tc :IsRelateToEffect (e ) and tc :IsMonster () then
57+ local c = e :GetHandler ()
58+ tc :RegisterFlagEffect (id ,RESET_EVENT |RESET_TURN_SET |RESET_TOFIELD |RESET_PHASE |PHASE_END ,0 ,1 )
59+ -- It cannot be destroyed by battle or card effects until the end of this turn
60+ local e1 = Effect .CreateEffect (c )
61+ e1 :SetDescription (aux .Stringid (id ,2 ))
62+ e1 :SetType (EFFECT_TYPE_SINGLE )
63+ e1 :SetProperty (EFFECT_FLAG_CLIENT_HINT )
64+ e1 :SetCode (EFFECT_INDESTRUCTABLE_BATTLE )
65+ e1 :SetValue (1 )
66+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
67+ tc :RegisterEffect (e1 )
68+ local e2 = e1 :Clone ()
69+ e2 :SetCode (EFFECT_INDESTRUCTABLE_EFFECT )
70+ tc :RegisterEffect (e2 )
71+ -- Its effects activated on the field cannot be negated until the end of this turn
72+ local e3 = Effect .CreateEffect (c )
73+ e3 :SetType (EFFECT_TYPE_FIELD )
74+ e3 :SetProperty (EFFECT_FLAG_PLAYER_TARGET )
75+ e3 :SetCode (EFFECT_CANNOT_DISEFFECT )
76+ e3 :SetTargetRange (1 ,1 )
77+ e3 :SetValue (s .effectfilter )
78+ e3 :SetReset (RESET_PHASE |PHASE_END )
79+ Duel .RegisterEffect (e3 ,tp )
80+ end
81+ end
82+ function s .effectfilter (e ,ct )
83+ local eff ,loc = Duel .GetChainInfo (ct ,CHAININFO_TRIGGERING_EFFECT ,CHAININFO_TRIGGERING_LOCATION )
84+ return eff :GetHandler ():HasFlagEffect (id ) and (loc &LOCATION_ONFIELD )> 0
85+ end
86+ function s .thcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
87+ local c = e :GetHandler ()
88+ return c :IsPreviousLocation (LOCATION_HAND ) and c :IsReason (REASON_EFFECT )
89+ end
90+ function s .thfilter (c )
91+ return c :IsCode (CARD_POLYMERIZATION ) and c :IsAbleToHand ()
92+ end
93+ function s .thtg (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
94+ if chk == 0 then return Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK |LOCATION_GRAVE ,0 ,1 ,nil ) end
95+ Duel .SetOperationInfo (0 ,CATEGORY_TOHAND ,nil ,1 ,tp ,LOCATION_DECK |LOCATION_GRAVE )
96+ end
97+ function s .thop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
98+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
99+ local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK |LOCATION_GRAVE ,0 ,1 ,1 ,nil )
100+ if # g > 0 then
101+ Duel .SendtoHand (g ,nil ,REASON_EFFECT )
102+ Duel .ConfirmCards (1 - tp ,g )
103+ end
104+ end
0 commit comments