跑得快同步出牌检测
parent
552d248de1
commit
6a4d4b574e
|
|
@ -34,7 +34,7 @@ function M:initFlag()
|
||||||
self.planelack = config.planelack == 1
|
self.planelack = config.planelack == 1
|
||||||
self.threelack = config.threelack == 1
|
self.threelack = config.threelack == 1
|
||||||
self.fourDaiThree = config.fourDaiThree
|
self.fourDaiThree = config.fourDaiThree
|
||||||
self.fristCard = true
|
self._flag_fristCard = true
|
||||||
print("==============================lingmengcheckinitFlag")
|
print("==============================lingmengcheckinitFlag")
|
||||||
pt(config)
|
pt(config)
|
||||||
pt(self)
|
pt(self)
|
||||||
|
|
@ -42,9 +42,9 @@ function M:initFlag()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:initLastCard(cardList)
|
function M:initLastCard(cardList)
|
||||||
self.fristCard = false
|
self._flag_fristCard = false
|
||||||
if #cardList == 0 then
|
if #cardList == 0 then
|
||||||
self.fristCard = true
|
self._flag_fristCard = true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.lastCardNum = #cardList
|
self.lastCardNum = #cardList
|
||||||
|
|
@ -53,6 +53,7 @@ function M:initLastCard(cardList)
|
||||||
local temp_long = 0
|
local temp_long = 0
|
||||||
self:Clear()
|
self:Clear()
|
||||||
self._flag_allCards = false
|
self._flag_allCards = false
|
||||||
|
self._flag_checkLst = true
|
||||||
for i = 1, #cardList do
|
for i = 1, #cardList do
|
||||||
local number = math.floor(cardList[i] / 10)
|
local number = math.floor(cardList[i] / 10)
|
||||||
if self.cardList[number] then
|
if self.cardList[number] then
|
||||||
|
|
@ -66,7 +67,7 @@ function M:initLastCard(cardList)
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
temp_long = 1
|
temp_long = 1
|
||||||
elseif temp_long == i - 1 then
|
elseif temp_long == i - 1 then
|
||||||
if math.abs(math.floor(cardList[i - 1].card_code_number / 10) - number) == 1 then
|
if math.abs(math.floor(cardList[i - 1] / 10) - number) == 1 then
|
||||||
temp_long = i
|
temp_long = i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -174,22 +175,20 @@ function M:CheckCards()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CheckAloneOrLong(falg_check)
|
function M:CheckAloneOrLong()
|
||||||
falg_check = falg_check or false
|
if self.cardNum == 1 and M:CheckType(cardType.one) then
|
||||||
if self.cardNum == 1 then
|
|
||||||
return cardType.one
|
return cardType.one
|
||||||
end
|
end
|
||||||
if self.long then
|
if self.long and M:CheckType(cardType.long) then
|
||||||
return cardType.long
|
return cardType.long
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CheckDuiZi(falg_check)
|
function M:CheckDuiZi()
|
||||||
falg_check = falg_check or false
|
if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(cardType.dui) then
|
||||||
if self.cardNum == 2 and self.cardSize == 1 then
|
|
||||||
return cardType.dui
|
return cardType.dui
|
||||||
end
|
end
|
||||||
if self.cardNum % 2 == 0 then
|
if self.cardNum % 2 == 0 and M:CheckType(cardType.dui) then
|
||||||
local last_k
|
local last_k
|
||||||
for i = 1, self.cardSize do
|
for i = 1, self.cardSize do
|
||||||
local k = self.cardListSord[i]
|
local k = self.cardListSord[i]
|
||||||
|
|
@ -211,18 +210,17 @@ function M:CheckDuiZi(falg_check)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CheckSanDai(falg_check)
|
function M:CheckSanDai()
|
||||||
falg_check = falg_check or false
|
|
||||||
--三张
|
--三张
|
||||||
if self.cardNum == 5 and self.cardSize < 4 then
|
if self.cardNum == 5 and self.cardSize < 4 and M:CheckType(cardType.threeAndTwo) then
|
||||||
return cardType.threeAndTwo
|
return cardType.threeAndTwo
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards then
|
if self.threelack and self.cardNum == 4 and self.cardSize == 2 and self._flag_allCards and M:CheckType(cardType.threeAndTwo) then
|
||||||
return cardType.threeAndTwo
|
return cardType.threeAndTwo
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 then
|
if self.threeNoBelt and self.cardNum == 3 and self.cardSize == 1 and M:CheckType(cardType.onlyThree) then
|
||||||
return cardType.onlyThree
|
return cardType.onlyThree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -233,7 +231,7 @@ function M:CheckSanDai(falg_check)
|
||||||
temp_normol_feiji = self.cardNum / 5
|
temp_normol_feiji = self.cardNum / 5
|
||||||
end
|
end
|
||||||
|
|
||||||
if temp_normol_feiji then
|
if temp_normol_feiji and M:CheckType(cardType.normolPlant) then
|
||||||
local last_k
|
local last_k
|
||||||
local num_san = 0
|
local num_san = 0
|
||||||
for i = 1, self.cardSize do
|
for i = 1, self.cardSize do
|
||||||
|
|
@ -260,7 +258,7 @@ function M:CheckSanDai(falg_check)
|
||||||
|
|
||||||
print("liengmengCheckthreelack", self.threelack, self._flag_allCards)
|
print("liengmengCheckthreelack", self.threelack, self._flag_allCards)
|
||||||
|
|
||||||
if self.threelack and self._flag_allCards then
|
if self.threelack and self._flag_allCards and M:CheckType(cardType.normolPlant) then
|
||||||
local last_k
|
local last_k
|
||||||
local num_san = 0
|
local num_san = 0
|
||||||
for k, v in pairs(self.cardList) do
|
for k, v in pairs(self.cardList) do
|
||||||
|
|
@ -289,7 +287,7 @@ function M:CheckSanDai(falg_check)
|
||||||
|
|
||||||
print("liengmengCheckplaneNoBelt", self.planeNoBelt, self.cardNum % 3)
|
print("liengmengCheckplaneNoBelt", self.planeNoBelt, self.cardNum % 3)
|
||||||
|
|
||||||
if self.planeNoBelt and self.cardNum % 3 == 0 then
|
if self.planeNoBelt and self.cardNum % 3 == 0 and M:CheckType(cardType.onlyPlant) then
|
||||||
local last_k
|
local last_k
|
||||||
for i = 1, self.cardSize do
|
for i = 1, self.cardSize do
|
||||||
local k = self.cardListSord[i]
|
local k = self.cardListSord[i]
|
||||||
|
|
@ -311,13 +309,12 @@ function M:CheckSanDai(falg_check)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:CheckZha(falg_check)
|
function M:CheckZha()
|
||||||
falg_check = falg_check or false
|
|
||||||
if self.cardNum == 4 and self.cardSize == 1 then
|
if self.cardNum == 4 and self.cardSize == 1 then
|
||||||
return cardType.zha
|
return cardType.zha
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.fourDaiThree and self.cardNum == 7 then
|
if self.fourDaiThree and self.cardNum == 7 and M:CheckType(cardType.zhaAndThreee) then
|
||||||
local flag_four
|
local flag_four
|
||||||
for i = 1, self.cardSize do
|
for i = 1, self.cardSize do
|
||||||
local k = self.cardListSord[i]
|
local k = self.cardListSord[i]
|
||||||
|
|
@ -330,12 +327,17 @@ function M:CheckZha(falg_check)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:CheckType(type)
|
||||||
|
return self._flag_checkLst or self._flag_fristCard or type == self.type
|
||||||
|
end
|
||||||
|
|
||||||
function M:Clear()
|
function M:Clear()
|
||||||
self.cardList = {}
|
self.cardList = {}
|
||||||
self.cardListSord = {}
|
self.cardListSord = {}
|
||||||
self.cardNum = 0
|
self.cardNum = 0
|
||||||
self.cardSize = 0
|
self.cardSize = 0
|
||||||
self.long = false
|
self.long = false
|
||||||
|
self._flag_checkLst = false
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue