1- -- Destiny Draw
1+ -- Destiny Draw (Skill)
22local s ,id = GetID ()
33function s .initial_effect (c )
4- -- skill
4+ -- Activate skill
55 aux .AddPreDrawSkillProcedure (c ,1 ,false ,s .flipcon ,s .flipop )
66 aux .GlobalCheck (s ,function ()
77 s [0 ]= nil
@@ -17,26 +17,23 @@ function s.initial_effect(c)
1717end
1818function s .checkop ()
1919 for tp = 0 ,1 do
20- if not s [tp ] then s [tp ]= Duel .GetLP (tp ) end
21- if s [tp ]> Duel .GetLP (tp ) then
22- s [2 + tp ]= s [2 + tp ]+ (s [tp ]- Duel .GetLP (tp ))
23- s [tp ]= Duel .GetLP (tp )
20+ local current_lp = Duel .GetLP (tp )
21+ if not s [tp ] then s [tp ]= current_lp end
22+ if s [tp ]> current_lp then
23+ s [2 + tp ]= s [2 + tp ]+ (s [tp ]- current_lp )
24+ s [tp ]= current_lp
25+ elseif s [tp ]< current_lp then
26+ s [tp ]= current_lp
2427 end
2528 end
2629end
2730function s .flipcon (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
28- -- condition
29- return Duel .GetCurrentChain ()== 0 and tp == Duel .GetTurnPlayer () and Duel .GetFieldGroupCount (tp ,LOCATION_DECK ,0 )> 0
30- and Duel .GetDrawCount (tp )> 0 and Duel .IsExistingMatchingCard (s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,nil )
31+ return Duel .GetCurrentChain ()== 0 and Duel .IsTurnPlayer (tp ) and Duel .GetFieldGroupCount (tp ,LOCATION_DECK ,0 )> 0
32+ and Duel .GetDrawCount (tp )> 0 and Duel .IsExistingMatchingCard (Card .IsAbleToHand ,tp ,LOCATION_DECK ,0 ,1 ,nil )
3133 and s [2 + tp ]>= 2000
3234end
33- function s .thfilter (c )
34- return c :IsAbleToHand ()
35- end
3635function s .flipop (e ,tp ,eg ,ep ,ev ,re ,r ,rp )
37- -- ask if you want to activate the skill or not
3836 if not Duel .SelectYesNo (tp ,aux .Stringid (id ,0 )) then return end
39- -- draw replace
4037 local dt = Duel .GetDrawCount (tp )
4138 if dt ~= 0 then
4239 _replace_count = 0
@@ -53,12 +50,10 @@ function s.flipop(e,tp,eg,ep,ev,re,r,rp)
5350 Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(1 << 32 ))
5451 Duel .Hint (HINT_CARD ,tp ,id )
5552 Duel .Hint (HINT_SELECTMSG ,tp ,HINTMSG_ATOHAND )
56- local g = Duel .SelectMatchingCard (tp ,s .thfilter ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
57- if # g ~= 0 then
58- if Duel .SendtoHand (g ,nil ,REASON_EFFECT )~= 0 then
59- Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(2 << 32 ))
60- s [2 + tp ]= 0
61- end
53+ local g = Duel .SelectMatchingCard (tp ,Card .IsAbleToHand ,tp ,LOCATION_DECK ,0 ,1 ,1 ,nil )
54+ if # g > 0 and Duel .SendtoHand (g ,nil ,REASON_EFFECT )> 0 then
6255 Duel .ConfirmCards (1 - tp ,g )
56+ Duel .Hint (HINT_SKILL_FLIP ,tp ,id |(2 << 32 ))
57+ s [2 + tp ]= 0
6358 end
6459end
0 commit comments