2025-04-01 10:48:36 +08:00
|
|
|
|
-- 检测牌是否存在
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local function checkCard(eventCard, cardList, num)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
num = num == nil and 1 or num
|
|
|
|
|
|
local result = 0
|
2025-04-10 12:25:45 +08:00
|
|
|
|
for i = 1, #cardList do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (cardList[i] == eventCard) then
|
|
|
|
|
|
result = result + 1
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (result == num) then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 移除指定数量的牌
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local function removeCard(cardList, card, count)
|
|
|
|
|
|
for i = 1, count do
|
|
|
|
|
|
list_remove(cardList, card)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local function checkCardAndRomve(eventCard, cardList, num)
|
|
|
|
|
|
if (checkCard(eventCard, cardList, num)) then
|
|
|
|
|
|
removeCard(cardList, eventCard, num)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 获取列表中牌数量
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local function cardNum(eventCard, cardList)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local result = 0
|
2025-04-10 12:25:45 +08:00
|
|
|
|
for i = 1, #cardList do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local card = cardList[i]
|
|
|
|
|
|
if (card == eventCard) then
|
|
|
|
|
|
result = result + 1
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
return result
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local zhongid = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local M = {
|
|
|
|
|
|
pair_count = 0,
|
|
|
|
|
|
cardList = nil,
|
|
|
|
|
|
stack = nil,
|
|
|
|
|
|
zhong_count = 0,
|
|
|
|
|
|
qidui = false,
|
|
|
|
|
|
hongzhong_count = 0,
|
|
|
|
|
|
qidui_pari_count = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:push(cardGroup)
|
|
|
|
|
|
self.stack[#self.stack + 1] = cardGroup
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:rollBack()
|
|
|
|
|
|
local cardGroup = self.stack[#self.stack]
|
2025-04-10 12:25:45 +08:00
|
|
|
|
table.remove(self.stack, #self.stack)
|
|
|
|
|
|
for _, card in ipairs(cardGroup) do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (card == zhongid) then
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count + 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
else
|
|
|
|
|
|
self.cardList[#self.cardList + 1] = card
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
table.sort(self.cardList)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryShunzi(card)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
if card > 400 or card % 100 > 7 then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then
|
|
|
|
|
|
removeCard(self.cardList, card, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 1, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 2, 1)
|
|
|
|
|
|
local cardGroup = { card, card + 1, card + 2 }
|
|
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--特殊牌,风牌也就是东南西北的成顺逻辑,中发白逻辑在普通顺子里
|
|
|
|
|
|
function M:tryFengShunzi(card)
|
|
|
|
|
|
--只有牌里有东南风的时候才能成顺,401东风,402南方
|
|
|
|
|
|
if self._flag_zikechengshun ~= 0 then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
local canShunziFeng = { 401, 402 }
|
|
|
|
|
|
for i = 1, #canShunziFeng do
|
|
|
|
|
|
if card == canShunziFeng[i] then
|
|
|
|
|
|
local tempFengList = {}
|
|
|
|
|
|
for j = 1, 4 - i do
|
|
|
|
|
|
if checkCard(405 - j, self.cardList) then
|
|
|
|
|
|
table.insert(tempFengList, 405 - j)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if #tempFengList >= 2 then
|
|
|
|
|
|
removeCard(self.cardList, card, 1)
|
|
|
|
|
|
removeCard(self.cardList, tempFengList[1], 1)
|
|
|
|
|
|
removeCard(self.cardList, tempFengList[2], 1)
|
|
|
|
|
|
local cardGroup = { card, tempFengList[1], tempFengList[2] }
|
|
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
if card < 500 then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return false
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
removeCard(self.cardList, card, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 1, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 2, 1)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local cardGroup = { card, card + 1, card + 2 }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryKezi(card)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (checkCardAndRomve(card, self.cardList, 3)) then
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local cardGroup = { card, card, card }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryPair(card)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self.pair_count > 0) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if (checkCardAndRomve(card, self.cardList, 2)) then
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local cardGroup = { card, card }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
self.pair_count = 1
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryKezi1Zhong(card)
|
|
|
|
|
|
if (self.zhong_count >= 1 and checkCardAndRomve(card, self.cardList, 2)) then
|
|
|
|
|
|
local cardGroup = { card, card, zhongid }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
2025-04-10 12:25:45 +08:00
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
|
|
function M:tryKezi2Zhong(card)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (self.zhong_count >= 2 and checkCardAndRomve(card, self.cardList, 1)) then
|
|
|
|
|
|
local cardGroup = { card, zhongid, zhongid }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 2
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryShunzi1Zhong(card)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (card % 100 > 8) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self.zhong_count < 1) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (checkCard(card + 1, self.cardList)) then
|
|
|
|
|
|
removeCard(self.cardList, card, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 1, 1)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 1
|
|
|
|
|
|
local cardGroup = { card, card + 1, zhongid }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (checkCard(card + 2, self.cardList) and ((card + 1) % 100 ~= 0)) then
|
|
|
|
|
|
removeCard(self.cardList, card, 1)
|
|
|
|
|
|
removeCard(self.cardList, card + 2, 1)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 1
|
|
|
|
|
|
local cardGroup = { card, zhongid, card + 2 }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryPair1Zhong(card)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self.pair_count > 0) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if (self.zhong_count < 1) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
removeCard(self.cardList, card, 1)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local cardGroup = { card, zhongid }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.pair_count = 1
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryPair2Zhong()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self.pair_count > 0) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if (self.zhong_count < 2) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local cardGroup = { zhongid, zhongid }
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self:push(cardGroup)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.zhong_count = self.zhong_count - 2
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.pair_count = 1
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:tryWin()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self.zhong_count == 4 and not self.eight_laizi) or (self.zhong_count == 8 and self.eight_laizi) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
if (#self.cardList == 0 and self.pair_count == 1) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
if (#self.cardList == 0 and self.pair_count == 0) then
|
|
|
|
|
|
return self:tryPair2Zhong()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (#self.cardList == 0) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local activeCard = self.cardList[1]
|
|
|
|
|
|
if (self:tryPair(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self.pair_count = 0
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self:tryKezi(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 13:36:22 +08:00
|
|
|
|
if (self:tryShunzi(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
2025-10-09 20:27:29 +08:00
|
|
|
|
if (self:tryFengShunzi(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self:tryKezi1Zhong(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self:tryKezi2Zhong(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self:tryShunzi1Zhong(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self:tryPair1Zhong(activeCard)) then
|
|
|
|
|
|
if (self:tryWin()) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
self.pair_count = 0
|
|
|
|
|
|
self:rollBack()
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:checkQidui()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (not self.qidui) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if ((#self.cardList + self.zhong_count) ~= 14) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
local cardList = membe_clone(self.cardList)
|
|
|
|
|
|
self.qidui_pari_count = 0
|
|
|
|
|
|
self.hongzhong_count = self.zhong_count
|
|
|
|
|
|
return self:isQdPari(cardList)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M:isQdPari(cardList)
|
|
|
|
|
|
if (self.qidui_pari_count == 7) then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (#cardList == 0) then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
local card = cardList[1]
|
|
|
|
|
|
if (cardNum(card, cardList) >= 2) then
|
|
|
|
|
|
removeCard(cardList, card, 2)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.qidui_pari_count = self.qidui_pari_count + 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self:isQdPari(cardList)) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if (self.hongzhong_count > 0) then
|
|
|
|
|
|
removeCard(cardList, card, 1)
|
|
|
|
|
|
self.hongzhong_count = self.hongzhong_count - 1
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.qidui_pari_count = self.qidui_pari_count + 1
|
2025-04-01 10:48:36 +08:00
|
|
|
|
if (self:isQdPari(cardList)) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-10-09 20:27:29 +08:00
|
|
|
|
function M:checkshisanlan()
|
|
|
|
|
|
if (not self.shisanlan) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
if ((#self.cardList + self.zhong_count) ~= 14) then
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
local cardList = membe_clone(self.cardList)
|
|
|
|
|
|
self.hongzhong_count = self.zhong_count
|
|
|
|
|
|
return self:isShiSanLan(cardList, table.remove(cardList, 1))
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function M:isShiSanLan(cardList, card)
|
|
|
|
|
|
if (#cardList == 0) then
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
if card < 400 then
|
|
|
|
|
|
if not (checkCard(card, cardList) or checkCard(card + 1, cardList) or checkCard(card + 2, cardList)) then
|
|
|
|
|
|
return self:isShiSanLan(cardList, table.remove(cardList, 1))
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
if not checkCard(card, cardList) then
|
|
|
|
|
|
return self:isShiSanLan(cardList, table.remove(cardList, 1))
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
return false
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--._flag_haveLaizi, data._hu_qidui, data._data_laizi
|
|
|
|
|
|
local function init(self, cardInhand, addCard, data)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.stack = {}
|
|
|
|
|
|
self.pair_count = 0
|
|
|
|
|
|
self.cardList = membe_clone(cardInhand)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
self.qidui = data._hu_qidui
|
|
|
|
|
|
self.shisanlan = data._hu_shisanlan
|
|
|
|
|
|
self.eight_laizi = nil
|
2025-04-10 12:25:45 +08:00
|
|
|
|
self.cardList[#self.cardList + 1] = addCard
|
2025-10-09 20:27:29 +08:00
|
|
|
|
if (data._flag_haveLaizi) then
|
2025-04-01 10:48:36 +08:00
|
|
|
|
self.zhong_count = cardNum(zhongid, self.cardList)
|
|
|
|
|
|
removeCard(self.cardList, zhongid, self.zhong_count)
|
|
|
|
|
|
end
|
|
|
|
|
|
table.sort(self.cardList)
|
|
|
|
|
|
--printlog("添加排序====>>>")
|
|
|
|
|
|
--pt(self.cardList)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
return self:checkQidui() or self:checkshisanlan() or self:tryWin()
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
2025-10-09 20:27:29 +08:00
|
|
|
|
local specialCardList = { 401, 402, 403, 404, 501, 502, 503 }
|
|
|
|
|
|
function M.tingPai(cardInhand, data)
|
|
|
|
|
|
data = data or {}
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local tingList = {}
|
|
|
|
|
|
if not cardInhand or #cardInhand == 0 then
|
|
|
|
|
|
return tingList
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
for k = 100, 300, 100 do
|
|
|
|
|
|
for i = 1, 9 do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local tem = k + i
|
2025-10-09 20:27:29 +08:00
|
|
|
|
local result = init(self, cardInhand, tem, data)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
--printlog("返回结果为===>>>",result)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (result) then
|
|
|
|
|
|
tingList[#tingList + 1] = tem
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
|
|
|
|
|
|
for j = 1, #specialCardList do
|
2025-04-01 10:48:36 +08:00
|
|
|
|
local tem = specialCardList[j]
|
2025-10-09 20:27:29 +08:00
|
|
|
|
local result = init(self, cardInhand, tem, data)
|
2025-04-10 12:25:45 +08:00
|
|
|
|
if (result) then
|
|
|
|
|
|
tingList[#tingList + 1] = tem
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return tingList
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
function M.MuiltiplteCaculateTingPai(cardInhand, isZhong, qidui, eightLaizi)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
local room = DataManager.CurrenRoom
|
|
|
|
|
|
|
|
|
|
|
|
if room.laiziInfo and #room.laiziInfo > 0 then
|
|
|
|
|
|
zhongid = room.laiziInfo[1]
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local tempTingList2 = {}
|
|
|
|
|
|
local tempTingList1 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
if room.laiziInfo[2] then
|
|
|
|
|
|
zhongid = room.laiziInfo[2]
|
2025-04-10 12:25:45 +08:00
|
|
|
|
tempTingList2 = M.tingPai(cardInhand, isZhong, qidui, eightLaizi)
|
2025-10-09 20:27:29 +08:00
|
|
|
|
zhongid = room.laiziInfo[1]
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
local currentTingList = {}
|
|
|
|
|
|
if #tempTingList1 > 0 and #tempTingList2 > 0 then
|
|
|
|
|
|
currentTingList = CombineDictionaryAndRemoveSomeItem(tempTingList1, tempTingList2)
|
|
|
|
|
|
elseif #tempTingList1 > 0 then
|
|
|
|
|
|
currentTingList = tempTingList1
|
|
|
|
|
|
elseif #tempTingList2 > 0 then
|
|
|
|
|
|
currentTingList = tempTingList2
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
2025-04-10 12:25:45 +08:00
|
|
|
|
|
2025-04-01 10:48:36 +08:00
|
|
|
|
return currentTingList
|
|
|
|
|
|
else
|
2025-10-09 20:27:29 +08:00
|
|
|
|
M._flag_zikechengshun = room.room_config.config.zikechengshun or 0
|
2025-04-10 12:25:45 +08:00
|
|
|
|
zhongid = 0
|
|
|
|
|
|
return M.tingPai(cardInhand, isZhong, qidui, eightLaizi)
|
2025-04-01 10:48:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-10 12:25:45 +08:00
|
|
|
|
return M
|