diff --git a/c22842126.lua b/c22842126.lua index 526364afe0..766c33e014 100644 --- a/c22842126.lua +++ b/c22842126.lua @@ -54,7 +54,7 @@ function c22842126.thop(e,tp,eg,ep,ev,re,r,rp) local sg=g:Select(tp,3,3,nil) Duel.ConfirmCards(1-tp,sg) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) - local tg=sg:Select(1-tp,1,1,nil) + local tg=aux.SelectPDS(sg,1-tp,1,1,nil) tg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) Duel.SendtoHand(tg,nil,REASON_EFFECT) end diff --git a/c24393683.lua b/c24393683.lua index 7c8560f226..079a23fb5f 100644 --- a/c24393683.lua +++ b/c24393683.lua @@ -56,7 +56,7 @@ function c24393683.activate(e,tp,eg,ep,ev,re,r,rp) local p=1-tp if e:GetLabel()==1 then p=tp end Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND) - local tg=sg:Select(p,1,1,nil) + local tg=aux.SelectPDS(sg,p,1,1,nil) tg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) Duel.SendtoHand(tg,nil,REASON_EFFECT) end diff --git a/c41773061.lua b/c41773061.lua index d4b70ae697..c2490453cd 100644 --- a/c41773061.lua +++ b/c41773061.lua @@ -28,7 +28,7 @@ function c41773061.activate(e,tp,eg,ep,ev,re,r,rp) local sg=g:SelectSubGroup(tp,aux.dncheck,false,2,2) Duel.ConfirmCards(1-tp,sg) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) - local tc=sg:Select(1-tp,1,1,nil):GetFirst() + local tc=aux.SelectPDS(sg,1-tp,1,1,nil):GetFirst() local code=0 if tc:IsRace(RACE_BEASTWARRIOR) then code=87778106 end if tc:IsRace(RACE_WARRIOR) then code=14166715 end diff --git a/c43618262.lua b/c43618262.lua index 82ac485f3e..e39e056872 100644 --- a/c43618262.lua +++ b/c43618262.lua @@ -20,9 +20,7 @@ function c43618262.cfop(e,tp,eg,ep,ev,re,r,rp) if g:FilterCount(Card.IsAbleToHand,nil,tp)==0 then return end Duel.ConfirmDecktop(1-p,5) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - Duel.PreserveSelectDeckSequence(true) - local tc=g:FilterSelect(tp,Card.IsAbleToHand,1,1,nil,tp):GetFirst() - Duel.PreserveSelectDeckSequence(false) + local tc=aux.FilterSelectPDS(g,tp,Card.IsAbleToHand,1,1,nil,tp):GetFirst() local num=math.floor(3000/100) local t={} for i=1,num do diff --git a/c51697825.lua b/c51697825.lua index ddd8a9d146..bb406735ca 100644 --- a/c51697825.lua +++ b/c51697825.lua @@ -25,7 +25,7 @@ function c51697825.activate(e,tp,eg,ep,ev,re,r,rp) if sg then Duel.ConfirmCards(1-tp,sg) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) - local oc=sg:Select(1-tp,1,1,nil):GetFirst() + local oc=aux.SelectPDS(sg,1-tp,1,1,nil):GetFirst() oc:SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) if Duel.SendtoHand(oc,1-tp,REASON_EFFECT)~=0 and oc:IsLocation(LOCATION_HAND) then sg:RemoveCard(oc) diff --git a/c74191942.lua b/c74191942.lua index 087acbf1f3..30fa5c4747 100644 --- a/c74191942.lua +++ b/c74191942.lua @@ -19,7 +19,7 @@ function c74191942.activate(e,tp,eg,ep,ev,re,r,rp) if g:GetCount()<5 then return end Duel.ConfirmCards(1-tp,g) Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(74191942,1)) - local sg=g:Select(1-tp,1,1,nil) + local sg=aux.SelectPDS(g,1-tp,1,1,nil) sg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) Duel.SendtoHand(sg,nil,REASON_EFFECT) g:Sub(sg) diff --git a/c94392192.lua b/c94392192.lua index 2c1168879e..264993893e 100644 --- a/c94392192.lua +++ b/c94392192.lua @@ -85,9 +85,7 @@ function c94392192.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmDecktop(1-tp,ct) local g=Duel.GetDecktopGroup(1-tp,ct) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - Duel.PreserveSelectDeckSequence(true) - local sg=g:FilterSelect(tp,c94392192.rmfilter,1,1,nil,tp) - Duel.PreserveSelectDeckSequence(false) + local sg=aux.FilterSelectPDS(g,tp,c94392192.rmfilter,1,1,nil,tp) if #sg>0 then Duel.DisableShuffleCheck(true) Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT) diff --git a/c97926515.lua b/c97926515.lua index a7408df2d0..c1dbac7a02 100644 --- a/c97926515.lua +++ b/c97926515.lua @@ -28,7 +28,7 @@ function c97926515.activate(e,tp,eg,ep,ev,re,r,rp) local sg=g:Select(tp,3,3,nil) Duel.ConfirmCards(1-tp,sg) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) - local tg=sg:Select(1-tp,1,1,nil) + local tg=aux.SelectPDS(sg,1-tp,1,1,nil) tg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) Duel.SendtoHand(tg,nil,REASON_EFFECT) end diff --git a/c98301564.lua b/c98301564.lua index 5618be144e..4832f5f9dc 100644 --- a/c98301564.lua +++ b/c98301564.lua @@ -53,7 +53,7 @@ function c98301564.regop(e,tp,eg,ep,ev,re,r,rp) local sg=g:Select(tp,3,3,nil) Duel.ConfirmCards(1-tp,sg) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) - local tg=sg:Select(1-tp,1,1,nil) + local tg=aux.SelectPDS(sg,1-tp,1,1,nil) tg:GetFirst():SetStatus(STATUS_TO_HAND_WITHOUT_CONFIRM,true) Duel.SendtoHand(tg,nil,REASON_EFFECT) end diff --git a/utility.lua b/utility.lua index ee8951acc2..5d54df71eb 100644 --- a/utility.lua +++ b/utility.lua @@ -1603,3 +1603,26 @@ end function Auxiliary.BanishRedirectCondition(e) return e:GetHandler():IsFaceup() end +-- Group.Select with Duel.PreserveSelectDeckSequence enabled +function Auxiliary.SelectPDS(g,...) + if #g==0 then return Group.CreateGroup() end + Duel.PreserveSelectDeckSequence(true) + local sg=g:Select(...) + Duel.PreserveSelectDeckSequence(false) + return sg +end +-- Group.FilterSelect with Duel.PreserveSelectDeckSequence enabled +function Auxiliary.FilterSelectPDS(g,...) + if #g==0 then return Group.CreateGroup() end + Duel.PreserveSelectDeckSequence(true) + local sg=g:FilterSelect(...) + Duel.PreserveSelectDeckSequence(false) + return sg +end +-- Duel.SelectMatchingCard with Duel.PreserveSelectDeckSequence enabled +function Auxiliary.SelectMatchingCardPDS(...) + Duel.PreserveSelectDeckSequence(true) + local sg=Duel.SelectMatchingCard(...) + Duel.PreserveSelectDeckSequence(false) + return sg +end