1+ -- トラップホリック
2+ -- Trapholic
3+ -- scripted by Naim
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- Destroy 1 Spell/Trap you control, and if you do, Set 1 Normal Trap from your Deck
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetDescription (aux .Stringid (id ,0 ))
9+ e1 :SetCategory (CATEGORY_DESTROY )
10+ e1 :SetType (EFFECT_TYPE_ACTIVATE )
11+ e1 :SetProperty (EFFECT_FLAG_CARD_TARGET )
12+ e1 :SetCode (EVENT_FREE_CHAIN )
13+ e1 :SetCountLimit (1 ,id ,EFFECT_COUNT_CODE_OATH )
14+ e1 :SetHintTiming (0 ,TIMING_STANDBY_PHASE |TIMING_MAIN_END |TIMINGS_CHECK_MONSTER_E )
15+ e1 :SetTarget (s .target )
16+ e1 :SetOperation (s .activate )
17+ c :RegisterEffect (e1 )
18+ end
19+ s .listed_names = {id }
20+ function s .desfilter (c ,tp ,ft )
21+ if not c :IsSpellTrap () then return false end
22+ if c :IsLocation (LOCATION_STZONE ) then ft = ft + 1 end
23+ return Duel .IsExistingMatchingCard (s .setfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil ,ft > 0 )
24+ end
25+ function s .setfilter (c ,haszone )
26+ return c :IsNormalTrap () and c :IsSSetable (haszone ) and not c :IsCode (id )
27+ end
28+ function s .target (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk ,chkc )
29+ local c = e :GetHandler ()
30+ local ft = Duel .GetLocationCount (tp ,LOCATION_SZONE )
31+ if not c :IsLocation (LOCATION_SZONE ) and e :IsHasType (EFFECT_TYPE_ACTIVATE ) then ft = ft - 1 end
32+ if chkc then return chkc :IsOnField () and s .desfilter (chkc ,tp ,ft ) and chkc ~= c end
33+ if chk == 0 then return Duel .IsExistingTarget (s .desfilter ,tp ,LOCATION_ONFIELD ,0 ,1 ,c ,tp ,ft ) end
34+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_DESTROY )
35+ local g = Duel .SelectTarget (tp ,s .desfilter ,tp ,LOCATION_ONFIELD ,0 ,1 ,1 ,c ,tp ,ft )
36+ Duel .SetOperationInfo (0 ,CATEGORY_DESTROY ,g ,1 ,tp ,0 )
37+ end
38+ function s .activate (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
39+ local tc = Duel .GetFirstTarget ()
40+ if tc :IsRelateToEffect (e ) and Duel .Destroy (tc ,REASON_EFFECT )> 0 and Duel .GetLocationCount (tp ,LOCATION_SZONE )> 0 then
41+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_SET )
42+ local sc = Duel .SelectMatchingCard (tp ,s .setfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil ,false ):GetFirst ()
43+ if sc and Duel .SSet (tp ,sc )> 0 then
44+ -- It can be activated this turn while you have 3 or more Traps in your GY
45+ local e1 = Effect .CreateEffect (e :GetHandler ())
46+ e1 :SetDescription (aux .Stringid (id ,1 ))
47+ e1 :SetType (EFFECT_TYPE_SINGLE )
48+ e1 :SetProperty (EFFECT_FLAG_SET_AVAILABLE )
49+ e1 :SetCode (EFFECT_TRAP_ACT_IN_SET_TURN )
50+ e1 :SetCondition (function (e ) return Duel .GetMatchingGroupCount (Card .IsTrap ,tp ,LOCATION_GRAVE ,0 ,nil )>= 3 end )
51+ e1 :SetReset (RESETS_STANDARD_PHASE_END )
52+ sc :RegisterEffect (e1 )
53+ end
54+ end
55+ end
0 commit comments