From 2be00fb3b09bef28b1dd50ef9ddeb761685b4b6b Mon Sep 17 00:00:00 2001 From: xxyheaven <1433191064@qq.com> Date: Fri, 19 Apr 2024 20:51:18 +0800 Subject: [PATCH] fix (#343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正从牌堆底获取牌的顺序问题 --- lua/server/room.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/server/room.lua b/lua/server/room.lua index 0166b724..f2f8c802 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -437,14 +437,14 @@ function Room:getNCards(num, from) end end + local i, j = 1, num + if from == "bottom" then + i = #self.draw_pile + 1 - num + j = #self.draw_pile + end local cardIds = {} - while num > 0 do - - local index = from == "top" and 1 or #self.draw_pile - table.insert(cardIds, self.draw_pile[index]) - table.remove(self.draw_pile, index) - - num = num - 1 + for index = i, j, 1 do + table.insert(cardIds, table.remove(self.draw_pile, i)) end self:doBroadcastNotify("UpdateDrawPile", #self.draw_pile) @@ -1991,7 +1991,7 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit, customNotif for i = #top, 1, -1 do table.insert(self.draw_pile, 1, top[i]) end - for i = #bottom, 1, -1 do + for i = 1, #bottom, -1 do table.insert(self.draw_pile, bottom[i]) end