2025-04-29 19:34:41 +08:00
|
|
|
local CardCheck = {
|
|
|
|
|
|
|
|
|
|
cardList = {},
|
2025-04-30 10:53:04 +08:00
|
|
|
cardListSord = {},
|
2025-04-29 19:34:41 +08:00
|
|
|
cardNum = 0,
|
|
|
|
|
cardSize = 0,
|
|
|
|
|
long = false,
|
|
|
|
|
planeNoBelt = false,
|
|
|
|
|
threeNoBelt = false,
|
|
|
|
|
planelack = false,
|
|
|
|
|
threelack = false,
|
2025-05-08 12:41:42 +08:00
|
|
|
fourDaiThree = false,
|
2025-05-10 15:38:54 +08:00
|
|
|
fristCard = true,
|
|
|
|
|
tipCardList = {},
|
|
|
|
|
touchCardSet = {},
|
|
|
|
|
touchCardMao = {}
|
2025-05-08 12:41:42 +08:00
|
|
|
}
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
local CardType = {
|
2025-05-08 12:41:42 +08:00
|
|
|
one = 1,
|
|
|
|
|
long = 2,
|
|
|
|
|
dui = 3,
|
|
|
|
|
threeAndTwo = 4,
|
|
|
|
|
normolPlant = 5,
|
|
|
|
|
zha = 6,
|
|
|
|
|
onlyThree = 7,
|
|
|
|
|
onlyPlant = 8,
|
|
|
|
|
zhaAndThreee = 9
|
2025-04-29 19:34:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
local M = CardCheck
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
function M:InitFlag()
|
2025-04-29 19:34:41 +08:00
|
|
|
local config = DataManager.CurrenRoom.room_config.config
|
|
|
|
|
self.planeNoBelt = config.planeNoBelt == 1
|
|
|
|
|
self.threeNoBelt = config.threeNoBelt == 1
|
|
|
|
|
self.planelack = config.planelack == 1
|
|
|
|
|
self.threelack = config.threelack == 1
|
|
|
|
|
self.fourDaiThree = config.fourDaiThree
|
2025-05-08 14:57:15 +08:00
|
|
|
self._flag_fristCard = true
|
2025-04-29 19:34:41 +08:00
|
|
|
print("==============================lingmengcheckinitFlag")
|
|
|
|
|
pt(config)
|
|
|
|
|
pt(self)
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
function M:InitLastCard(cardList)
|
2025-05-08 14:57:15 +08:00
|
|
|
self._flag_fristCard = false
|
2025-05-08 12:41:42 +08:00
|
|
|
if #cardList == 0 then
|
2025-05-08 14:57:15 +08:00
|
|
|
self._flag_fristCard = true
|
2025-05-08 12:41:42 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
self.lastCardNum = #cardList
|
|
|
|
|
table.sort(cardList)
|
|
|
|
|
pt(cardList)
|
2025-05-10 15:38:54 +08:00
|
|
|
self.lastMinCard = math.floor(cardList[1] / 10)
|
2025-05-08 14:23:48 +08:00
|
|
|
local temp_long = 0
|
|
|
|
|
self:Clear()
|
|
|
|
|
self._flag_allCards = false
|
2025-05-08 14:57:15 +08:00
|
|
|
self._flag_checkLst = true
|
2025-05-08 14:23:48 +08:00
|
|
|
for i = 1, #cardList do
|
|
|
|
|
local number = math.floor(cardList[i] / 10)
|
|
|
|
|
if self.cardList[number] then
|
|
|
|
|
self.cardList[number] = self.cardList[number] + 1
|
|
|
|
|
else
|
|
|
|
|
self.cardList[number] = 1
|
|
|
|
|
self.cardSize = self.cardSize + 1
|
|
|
|
|
table.insert(self.cardListSord, number)
|
|
|
|
|
end
|
|
|
|
|
self.cardNum = self.cardNum + 1
|
|
|
|
|
if i == 1 then
|
|
|
|
|
temp_long = 1
|
|
|
|
|
elseif temp_long == i - 1 then
|
2025-05-08 14:57:15 +08:00
|
|
|
if math.abs(math.floor(cardList[i - 1] / 10) - number) == 1 then
|
2025-05-08 14:23:48 +08:00
|
|
|
temp_long = i
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-08 16:02:39 +08:00
|
|
|
self.long = temp_long == self.cardNum and self.cardNum >= 5
|
2025-05-08 14:23:48 +08:00
|
|
|
self.type = -1
|
|
|
|
|
print("lingmengCheckAloneOrLong2")
|
|
|
|
|
if self:CheckAloneOrLong() then
|
|
|
|
|
self.type = self:CheckAloneOrLong()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
print("lingmengCheckDuiZi2")
|
|
|
|
|
if self:CheckDuiZi() then
|
|
|
|
|
self.type = self:CheckDuiZi()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
print("lingmengCheckSanDai2")
|
|
|
|
|
|
|
|
|
|
if self:CheckSanDai() then
|
|
|
|
|
self.type = self:CheckSanDai()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
print("lingmengCheckZha2")
|
|
|
|
|
|
|
|
|
|
if self:CheckZha() then
|
|
|
|
|
self.type = self:CheckZha()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if self.type == -1 then
|
|
|
|
|
ViewUtil.ErrorTip(-1, "上一份牌型判断错误")
|
|
|
|
|
end
|
2025-05-08 12:41:42 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:23:48 +08:00
|
|
|
function M:initCards(cardList, flag, flag_allCards)
|
2025-04-30 10:53:04 +08:00
|
|
|
print("lingmenginitCards")
|
|
|
|
|
pt(cardList)
|
2025-04-29 19:34:41 +08:00
|
|
|
local temp_long = 0
|
|
|
|
|
self:Clear()
|
2025-05-07 11:58:53 +08:00
|
|
|
self._flag_allCards = flag_allCards or false
|
2025-04-29 19:34:41 +08:00
|
|
|
if flag then
|
|
|
|
|
for i = 1, #cardList do
|
|
|
|
|
local number = math.floor(cardList[i][1].card_code_number / 10)
|
|
|
|
|
if self.cardList[number] then
|
|
|
|
|
self.cardList[number] = self.cardList[number] + 1
|
|
|
|
|
else
|
|
|
|
|
self.cardList[number] = 1
|
|
|
|
|
self.cardSize = self.cardSize + 1
|
2025-04-30 10:53:04 +08:00
|
|
|
table.insert(self.cardListSord, number)
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
self.cardNum = self.cardNum + 1
|
|
|
|
|
if i == 1 then
|
|
|
|
|
temp_long = 1
|
|
|
|
|
elseif temp_long == i - 1 then
|
|
|
|
|
if math.abs(math.floor(cardList[i - 1][1].card_code_number / 10) - number) == 1 then
|
|
|
|
|
temp_long = i
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
for i = 1, #cardList do
|
|
|
|
|
local number = math.floor(cardList[i].card_code_number / 10)
|
|
|
|
|
if self.cardList[number] then
|
|
|
|
|
self.cardList[number] = self.cardList[number] + 1
|
|
|
|
|
else
|
|
|
|
|
self.cardList[number] = 1
|
|
|
|
|
self.cardSize = self.cardSize + 1
|
2025-04-30 10:53:04 +08:00
|
|
|
table.insert(self.cardListSord, number)
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
self.cardNum = self.cardNum + 1
|
|
|
|
|
if i == 1 then
|
|
|
|
|
temp_long = 1
|
|
|
|
|
elseif temp_long == i - 1 then
|
|
|
|
|
if math.abs(math.floor(cardList[i - 1].card_code_number / 10) - number) == 1 then
|
|
|
|
|
temp_long = i
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-04-29 19:48:08 +08:00
|
|
|
|
2025-04-29 19:34:41 +08:00
|
|
|
print(self.cardNum, self.cardSize, temp_long)
|
|
|
|
|
pt(self.cardList)
|
2025-04-30 10:53:04 +08:00
|
|
|
self.long = temp_long == self.cardNum and self.cardNum >= 5
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckCards()
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.cardNum ~= 4 and self.cardNum ~= self.lastCardNum and not self._flag_fristCard then
|
2025-05-09 16:56:59 +08:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-07 15:38:38 +08:00
|
|
|
print("lingmengCheckAloneOrLong")
|
2025-04-29 19:34:41 +08:00
|
|
|
if self:CheckAloneOrLong() then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
print("lingmengCheckDuiZi")
|
2025-04-29 19:34:41 +08:00
|
|
|
|
|
|
|
|
if self:CheckDuiZi() then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
print("lingmengCheckSanDai")
|
2025-04-29 19:34:41 +08:00
|
|
|
|
|
|
|
|
if self:CheckSanDai() then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
print("lingmengCheckZha")
|
2025-04-29 19:34:41 +08:00
|
|
|
|
|
|
|
|
if self:CheckZha() then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
function M:CheckOutCard(cardList)
|
|
|
|
|
self.tipCardList = {}
|
|
|
|
|
self.touchCardSet = {}
|
|
|
|
|
self.touchCardMao = {}
|
|
|
|
|
|
|
|
|
|
local cardMap = {}
|
|
|
|
|
local cardSet = {}
|
|
|
|
|
local cardType,only,longLength = self:CheckOutCardGetType()
|
|
|
|
|
|
|
|
|
|
if cardType == 0 then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = 1, #cardList do
|
|
|
|
|
local number = math.floor(cardList[i].card_code_number / 10)
|
|
|
|
|
if cardMap[number] then
|
|
|
|
|
cardMap[number].value = cardMap[number].value + 1
|
|
|
|
|
table.insert(cardMap[number].cardList, cardList[i])
|
|
|
|
|
else
|
|
|
|
|
cardMap[number] = {}
|
|
|
|
|
cardMap[number].value = 1
|
|
|
|
|
cardMap[number].cardList = {}
|
|
|
|
|
table.insert(cardMap[number].cardList, cardList[i])
|
|
|
|
|
table.insert(cardSet, number)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(cardSet)
|
|
|
|
|
|
|
|
|
|
local tipCardSet = self:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
|
|
|
|
|
|
|
|
|
|
self:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckOutCardGetType()
|
|
|
|
|
local cardType = 0
|
|
|
|
|
local only = 0
|
|
|
|
|
local longLength = 1
|
|
|
|
|
if self.type == CardType.one or self.type == CardType.long then
|
|
|
|
|
cardType = 1
|
|
|
|
|
if self.type == CardType.long then
|
|
|
|
|
longLength = self.lastCardNum
|
|
|
|
|
end
|
|
|
|
|
elseif self.type == CardType.dui then
|
|
|
|
|
cardType = 2
|
|
|
|
|
if self.lastCardNum > 2 then
|
|
|
|
|
longLength = self.lastCardNum/2
|
|
|
|
|
end
|
|
|
|
|
elseif self.type == CardType.threeAndTwo or self.type == CardType.onlyThree or self.type == CardType.normolPlant or self.type == CardType.onlyPlant then
|
|
|
|
|
cardType = 3
|
|
|
|
|
if self.type == CardType.onlyThree or self.type == CardType.onlyPlant then
|
|
|
|
|
only = 1
|
|
|
|
|
if self.type == CardType.onlyPlant then
|
|
|
|
|
longLength = self.lastCardNum/3
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if self.type == CardType.normolPlant then
|
|
|
|
|
longLength = self.lastCardNum/5
|
|
|
|
|
end
|
|
|
|
|
elseif self.type == CardType.zha or self.type == CardType.zhaAndThreee then
|
|
|
|
|
cardType = 4
|
|
|
|
|
if self.type == CardType.zha then
|
|
|
|
|
only = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return cardType,only,longLength
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckOutCardGetTouchSet(cardSet,cardMap,cardType,longLength)
|
|
|
|
|
print("lingmengCheckOutCardGetTouchSet",cardType,longLength,self.lastMinCard)
|
|
|
|
|
pt(cardSet)
|
|
|
|
|
pt(cardMap)
|
|
|
|
|
local tempLong = 0
|
|
|
|
|
local lastCard = 0
|
|
|
|
|
local tempCardSet = {}
|
|
|
|
|
local tipCardSet = {}
|
|
|
|
|
for i = 1, #cardSet do
|
|
|
|
|
local card = cardSet[i]
|
|
|
|
|
if (cardMap[card].value >= cardType or cardMap[card].value == 4) and card > self.lastMinCard then
|
|
|
|
|
if tempLong == 0 then
|
|
|
|
|
tempLong = 1
|
|
|
|
|
else
|
|
|
|
|
if lastCard - card == -1 then
|
|
|
|
|
tempLong = tempLong + 1
|
|
|
|
|
else
|
|
|
|
|
if tempLong >= longLength then
|
|
|
|
|
for j = 1,tempLong do
|
|
|
|
|
table.insert(self.touchCardSet,tempCardSet[j])
|
|
|
|
|
self.touchCardMao[tempCardSet[j]] = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(tipCardSet,tempCardSet)
|
|
|
|
|
tempLong = 1
|
|
|
|
|
tempCardSet = {}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(tempCardSet,card)
|
|
|
|
|
lastCard = card
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if tempLong >= longLength then
|
|
|
|
|
for j = 1,tempLong do
|
|
|
|
|
table.insert(self.touchCardSet,tempCardSet[j])
|
|
|
|
|
self.touchCardMao[tempCardSet[j]] = 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(tipCardSet,tempCardSet)
|
|
|
|
|
return tipCardSet
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:CheckOutCardSetTipList(tipCardSet,longLength,cardMap,cardType)
|
|
|
|
|
print("lingmengCheckOutCardSetTipList",longLength,cardMap,cardType)
|
|
|
|
|
pt(tipCardSet)
|
|
|
|
|
for i = 1, #tipCardSet do
|
|
|
|
|
local tipCardSetLen = #tipCardSet[i]
|
|
|
|
|
if tipCardSetLen == longLength then
|
|
|
|
|
local tempList = {}
|
|
|
|
|
for j = 1, tipCardSetLen do
|
|
|
|
|
local card = tipCardSet[i][j]
|
|
|
|
|
local minNum = Mathf.Min(cardMap[card].value,cardType)
|
|
|
|
|
for k = 1 , minNum do
|
|
|
|
|
table.insert(tempList,cardMap[card].cardList[k])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(self.tipCardList,tempList)
|
|
|
|
|
else
|
|
|
|
|
for j = 1, tipCardSetLen do
|
|
|
|
|
if j + longLength <= tipCardSetLen then
|
|
|
|
|
local tempList = {}
|
|
|
|
|
for k = j,j + longLength do
|
|
|
|
|
local card = tipCardSet[i][k]
|
|
|
|
|
local minNum = Mathf.Min(cardMap[card].value,cardType)
|
|
|
|
|
for l = 1 , minNum do
|
|
|
|
|
table.insert(tempList,cardMap[card].cardList[l])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.insert(self.tipCardList,tempList)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:57:15 +08:00
|
|
|
function M:CheckAloneOrLong()
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.cardNum == 1 and M:CheckType(CardType.one) then
|
|
|
|
|
return CardType.one
|
2025-05-08 12:41:42 +08:00
|
|
|
end
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.long and M:CheckType(CardType.long) then
|
|
|
|
|
return CardType.long
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:57:15 +08:00
|
|
|
function M:CheckDuiZi()
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(CardType.dui) then
|
|
|
|
|
return CardType.dui
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.cardNum % 2 == 0 and M:CheckType(CardType.dui) then
|
2025-04-29 19:34:41 +08:00
|
|
|
local last_k
|
2025-04-30 10:53:04 +08:00
|
|
|
for i = 1, self.cardSize do
|
|
|
|
|
local k = self.cardListSord[i]
|
|
|
|
|
local v = self.cardList[k]
|
2025-04-29 19:34:41 +08:00
|
|
|
if v == 2 then
|
|
|
|
|
if not last_k then
|
|
|
|
|
last_k = k
|
|
|
|
|
else
|
|
|
|
|
if math.abs(last_k - k) ~= 1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-04-30 10:53:04 +08:00
|
|
|
last_k = k
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.dui
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:57:15 +08:00
|
|
|
function M:CheckSanDai()
|
2025-04-29 19:34:41 +08:00
|
|
|
--三张
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.cardNum == 5 and M:CheckType(CardType.threeAndTwo) then
|
2025-05-09 16:56:59 +08:00
|
|
|
for i = 1, self.cardSize do
|
|
|
|
|
local k = self.cardListSord[i]
|
|
|
|
|
local v = self.cardList[k]
|
|
|
|
|
if v >= 3 then
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.threeAndTwo
|
2025-05-09 16:56:59 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards and M:CheckType(CardType.threeAndTwo) then
|
|
|
|
|
return CardType.threeAndTwo
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 and M:CheckType(CardType.onlyThree) then
|
|
|
|
|
return CardType.onlyThree
|
2025-05-07 11:58:53 +08:00
|
|
|
end
|
2025-04-29 19:34:41 +08:00
|
|
|
|
2025-05-07 15:38:38 +08:00
|
|
|
|
2025-04-29 19:34:41 +08:00
|
|
|
--飞机
|
|
|
|
|
local temp_normol_feiji
|
|
|
|
|
if self.cardNum % 5 == 0 then
|
|
|
|
|
temp_normol_feiji = self.cardNum / 5
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if temp_normol_feiji and M:CheckType(CardType.normolPlant) then
|
2025-04-29 19:34:41 +08:00
|
|
|
local last_k
|
|
|
|
|
local num_san = 0
|
2025-04-30 10:53:04 +08:00
|
|
|
for i = 1, self.cardSize do
|
|
|
|
|
local k = self.cardListSord[i]
|
|
|
|
|
local v = self.cardList[k]
|
2025-04-29 19:34:41 +08:00
|
|
|
if v >= 3 then
|
|
|
|
|
num_san = num_san + 1
|
|
|
|
|
if not last_k then
|
|
|
|
|
last_k = k
|
|
|
|
|
else
|
|
|
|
|
if math.abs(last_k - k) ~= 1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-04-30 10:53:04 +08:00
|
|
|
last_k = k
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-04-30 10:53:04 +08:00
|
|
|
if num_san >= temp_normol_feiji then
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.normolPlant
|
2025-04-29 19:34:41 +08:00
|
|
|
else
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-07 15:38:38 +08:00
|
|
|
print("liengmengCheckthreelack", self.threelack, self._flag_allCards)
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.threelack and self._flag_allCards and M:CheckType(CardType.normolPlant) then
|
2025-04-29 19:34:41 +08:00
|
|
|
local last_k
|
2025-05-07 15:38:38 +08:00
|
|
|
local num_san = 0
|
|
|
|
|
for k, v in pairs(self.cardList) do
|
|
|
|
|
if v >= 3 then
|
|
|
|
|
num_san = num_san + 1
|
|
|
|
|
print("liengmengCheckthreelack2", last_k, k)
|
|
|
|
|
|
2025-04-29 19:34:41 +08:00
|
|
|
if not last_k then
|
|
|
|
|
last_k = k
|
|
|
|
|
else
|
|
|
|
|
if math.abs(last_k - k) ~= 1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-04-30 10:53:04 +08:00
|
|
|
last_k = k
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
print("liengmengCheckthreelack4", num_san, self.cardNum - num_san * 3 < num_san * 2)
|
|
|
|
|
|
|
|
|
|
if self.cardNum - num_san * 3 < num_san * 2 then
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.normolPlant
|
2025-05-07 15:38:38 +08:00
|
|
|
else
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-07 15:38:38 +08:00
|
|
|
print("liengmengCheckplaneNoBelt", self.planeNoBelt, self.cardNum % 3)
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.planeNoBelt and self.cardNum % 3 == 0 and M:CheckType(CardType.onlyPlant) then
|
2025-05-07 11:58:53 +08:00
|
|
|
local last_k
|
2025-05-07 15:38:38 +08:00
|
|
|
for i = 1, self.cardSize do
|
|
|
|
|
local k = self.cardListSord[i]
|
|
|
|
|
local v = self.cardList[k]
|
|
|
|
|
if v == 3 then
|
2025-05-07 11:58:53 +08:00
|
|
|
if not last_k then
|
|
|
|
|
last_k = k
|
|
|
|
|
else
|
|
|
|
|
if math.abs(last_k - k) ~= 1 then
|
|
|
|
|
return
|
|
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
last_k = k
|
2025-05-07 11:58:53 +08:00
|
|
|
end
|
2025-05-07 15:38:38 +08:00
|
|
|
else
|
|
|
|
|
return
|
2025-05-07 11:58:53 +08:00
|
|
|
end
|
|
|
|
|
end
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.onlyPlant
|
2025-05-07 11:58:53 +08:00
|
|
|
end
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:57:15 +08:00
|
|
|
function M:CheckZha()
|
2025-04-29 19:34:41 +08:00
|
|
|
if self.cardNum == 4 and self.cardSize == 1 then
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.zha
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
if self.fourDaiThree and self.cardNum == 7 and M:CheckType(CardType.zhaAndThreee) then
|
2025-04-29 19:34:41 +08:00
|
|
|
local flag_four
|
2025-04-30 10:53:04 +08:00
|
|
|
for i = 1, self.cardSize do
|
|
|
|
|
local k = self.cardListSord[i]
|
|
|
|
|
local v = self.cardList[k]
|
2025-04-29 19:34:41 +08:00
|
|
|
if v == 4 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-10 15:38:54 +08:00
|
|
|
return CardType.zhaAndThreee
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-08 14:57:15 +08:00
|
|
|
function M:CheckType(type)
|
|
|
|
|
return self._flag_checkLst or self._flag_fristCard or type == self.type
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-10 15:38:54 +08:00
|
|
|
function M:GetTipsList()
|
|
|
|
|
return self.tipCardList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetTouchSet()
|
|
|
|
|
return self.touchCardSet
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:GetTouchCardMap()
|
|
|
|
|
return self.touchCardMao
|
|
|
|
|
end
|
|
|
|
|
|
2025-04-29 19:34:41 +08:00
|
|
|
function M:Clear()
|
|
|
|
|
self.cardList = {}
|
2025-04-30 10:53:04 +08:00
|
|
|
self.cardListSord = {}
|
2025-04-29 19:34:41 +08:00
|
|
|
self.cardNum = 0
|
|
|
|
|
self.cardSize = 0
|
|
|
|
|
self.long = false
|
2025-05-08 14:57:15 +08:00
|
|
|
self._flag_checkLst = false
|
2025-04-29 19:34:41 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|