1+ -- 冥跡のカーディ
2+ -- Qadi of the Monumenthes
3+ -- scripted by YoshiDuels
4+ local s ,id = GetID ()
5+ function s .initial_effect (c )
6+ -- special summon
7+ local e1 = Effect .CreateEffect (c )
8+ e1 :SetType (EFFECT_TYPE_FIELD )
9+ e1 :SetCode (EFFECT_SPSUMMON_PROC )
10+ e1 :SetProperty (EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_SPSUM_PARAM )
11+ e1 :SetRange (LOCATION_HAND )
12+ e1 :SetTargetRange (POS_FACEUP_DEFENSE ,0 )
13+ e1 :SetCondition (s .spcon )
14+ c :RegisterEffect (e1 )
15+ -- Attack restriction
16+ local e2 = Effect .CreateEffect (c )
17+ e2 :SetDescription (aux .Stringid (id ,1 ))
18+ e2 :SetCategory (CATEGORY_ATKCHANGE )
19+ e2 :SetType (EFFECT_TYPE_IGNITION )
20+ e2 :SetRange (LOCATION_MZONE )
21+ e2 :SetCountLimit (1 )
22+ e2 :SetCondition (s .condition )
23+ e2 :SetCost (s .cost )
24+ e2 :SetOperation (s .operation )
25+ c :RegisterEffect (e2 )
26+ end
27+ function s .filter (c )
28+ return c :IsFaceup () and c :IsCode (160448004 ,160024008 )
29+ end
30+ function s .spcon (e ,c )
31+ if c == nil then return true end
32+ return Duel .GetLocationCount (c :GetControler (),LOCATION_MZONE )> 0
33+ and Duel .IsExistingMatchingCard (s .filter ,c :GetControler (),LOCATION_MZONE ,0 ,1 ,nil )
34+ end
35+ function s .condition (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
36+ local c = e :GetHandler ()
37+ return c :IsSummonPhaseMain () and c :IsStatus (STATUS_SUMMON_TURN + STATUS_SPSUMMON_TURN )
38+ end
39+ function s .cost (e ,tp ,eg ,ep ,ev ,re ,r ,rp ,chk )
40+ if chk == 0 then return Duel .IsPlayerCanDiscardDeckAsCost (tp ,1 ) end
41+ end
42+ function s .tdfilter (c )
43+ return c :IsAbleToDeck () and c :IsMonster () and c :IsRace (RACE_BEASTWARRIOR )
44+ end
45+ function s .operation (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
46+ -- Requirement
47+ if Duel .DiscardDeck (tp ,1 ,REASON_COST )< 1 then return end
48+ -- Effect
49+ local c = e :GetHandler ()
50+ -- can only attack twice
51+ local e1 = Effect .CreateEffect (e :GetHandler ())
52+ e1 :SetDescription (aux .Stringid (id ,2 ))
53+ e1 :SetType (EFFECT_TYPE_FIELD )
54+ e1 :SetProperty (EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_CLIENT_HINT )
55+ e1 :SetCode (EFFECT_CANNOT_ATTACK_ANNOUNCE )
56+ e1 :SetTargetRange (0 ,LOCATION_MZONE )
57+ e1 :SetCondition (s .atkcon )
58+ e1 :SetReset (RESET_PHASE |PHASE_END ,2 )
59+ Duel .RegisterEffect (e1 ,tp )
60+ local e2 = Effect .CreateEffect (e :GetHandler ())
61+ e2 :SetType (EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS )
62+ e2 :SetProperty (EFFECT_FLAG_CANNOT_DISABLE )
63+ e2 :SetCode (EVENT_ATTACK_ANNOUNCE )
64+ e2 :SetOperation (s .checkop )
65+ e2 :SetReset (RESET_PHASE |PHASE_END ,2 )
66+ e2 :SetLabelObject (e1 )
67+ Duel .RegisterEffect (e2 ,tp )
68+ if Duel .IsExistingMatchingCard (s .tdfilter ,tp ,LOCATION_GRAVE ,0 ,3 ,nil ) and Duel .SelectYesNo (tp ,aux .Stringid (id ,1 )) then
69+ Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_TODECK )
70+ local tg = Duel .SelectMatchingCard (tp ,s .tdfilter ,tp ,LOCATION_GRAVE ,0 ,3 ,3 ,nil )
71+ Duel .HintSelection (tg )
72+ Duel .SendtoDeck (tg ,nil ,SEQ_DECKSHUFFLE ,REASON_EFFECT )
73+ end
74+ end
75+ function s .atkcon (e )
76+ return e :GetLabel ()== 2
77+ end
78+ function s .checkop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
79+ if Duel .IsTurnPlayer (1 - e :GetHandlerPlayer ()) then
80+ e :GetLabelObject ():SetLabel (e :GetLabelObject ():GetLabel ()+ 1 )
81+ end
82+ end
0 commit comments