diff --git a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua index 38ccbeb1..935fd973 100644 --- a/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua +++ b/lua_probject/extend_project/extend/poker/runfast/CardCheck.lua @@ -34,7 +34,7 @@ function M:initFlag() self.planelack = config.planelack == 1 self.threelack = config.threelack == 1 self.fourDaiThree = config.fourDaiThree - self.fristCard = true + self._flag_fristCard = true print("==============================lingmengcheckinitFlag") pt(config) pt(self) @@ -42,9 +42,9 @@ function M:initFlag() end function M:initLastCard(cardList) - self.fristCard = false + self._flag_fristCard = false if #cardList == 0 then - self.fristCard = true + self._flag_fristCard = true return end self.lastCardNum = #cardList @@ -53,6 +53,7 @@ function M:initLastCard(cardList) local temp_long = 0 self:Clear() self._flag_allCards = false + self._flag_checkLst = true for i = 1, #cardList do local number = math.floor(cardList[i] / 10) if self.cardList[number] then @@ -66,7 +67,7 @@ function M:initLastCard(cardList) 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 + if math.abs(math.floor(cardList[i - 1] / 10) - number) == 1 then temp_long = i end end @@ -174,22 +175,20 @@ function M:CheckCards() return false end -function M:CheckAloneOrLong(falg_check) - falg_check = falg_check or false - if self.cardNum == 1 then +function M:CheckAloneOrLong() + if self.cardNum == 1 and M:CheckType(cardType.one) then return cardType.one end - if self.long then + if self.long and M:CheckType(cardType.long) then return cardType.long end end -function M:CheckDuiZi(falg_check) - falg_check = falg_check or false - if self.cardNum == 2 and self.cardSize == 1 then +function M:CheckDuiZi() + if self.cardNum == 2 and self.cardSize == 1 and M:CheckType(cardType.dui) then return cardType.dui end - if self.cardNum % 2 == 0 then + if self.cardNum % 2 == 0 and M:CheckType(cardType.dui) then local last_k for i = 1, self.cardSize do local k = self.cardListSord[i] @@ -211,18 +210,17 @@ function M:CheckDuiZi(falg_check) end end -function M:CheckSanDai(falg_check) - falg_check = falg_check or false +function M:CheckSanDai() --三张 - 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 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 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 end @@ -233,7 +231,7 @@ function M:CheckSanDai(falg_check) temp_normol_feiji = self.cardNum / 5 end - if temp_normol_feiji then + if temp_normol_feiji and M:CheckType(cardType.normolPlant) then local last_k local num_san = 0 for i = 1, self.cardSize do @@ -260,7 +258,7 @@ function M:CheckSanDai(falg_check) 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 num_san = 0 for k, v in pairs(self.cardList) do @@ -289,7 +287,7 @@ function M:CheckSanDai(falg_check) 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 for i = 1, self.cardSize do local k = self.cardListSord[i] @@ -311,13 +309,12 @@ function M:CheckSanDai(falg_check) end end -function M:CheckZha(falg_check) - falg_check = falg_check or false +function M:CheckZha() if self.cardNum == 4 and self.cardSize == 1 then return cardType.zha 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 for i = 1, self.cardSize do local k = self.cardListSord[i] @@ -330,12 +327,17 @@ function M:CheckZha(falg_check) end end +function M:CheckType(type) + return self._flag_checkLst or self._flag_fristCard or type == self.type +end + function M:Clear() self.cardList = {} self.cardListSord = {} self.cardNum = 0 self.cardSize = 0 self.long = false + self._flag_checkLst = false end return M