709 lines
24 KiB
Lua
709 lines
24 KiB
Lua
-- 检测牌是否存在
|
|
local function checkCard(eventCard, cardList, num)
|
|
if num == nil then
|
|
num = 1
|
|
end
|
|
local result = 0
|
|
for i = 1, #cardList do
|
|
if (cardList[i] == eventCard) then
|
|
result = result + 1
|
|
if (result == num) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- 移除指定数量的牌
|
|
local function removeCard(cardList, card, count)
|
|
for i = 1, count do
|
|
list_remove(cardList, card)
|
|
end
|
|
end
|
|
|
|
local function checkCardAndRomve(eventCard, cardList, num)
|
|
if (checkCard(eventCard, cardList, num)) then
|
|
removeCard(cardList, eventCard, num)
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- 获取列表中牌数量
|
|
local function cardNum(eventCard, cardList)
|
|
local result = 0
|
|
for i = 1, #cardList do
|
|
local card = cardList[i]
|
|
if (card == eventCard) then
|
|
result = result + 1
|
|
end
|
|
end
|
|
return result
|
|
end
|
|
|
|
local M = {
|
|
pair_count = 0,
|
|
cardList = nil,
|
|
stack = nil,
|
|
stackHuxi = nil,
|
|
isManYuan = false,
|
|
isJiangTuanYuan = false,
|
|
isJiangTYCard = 0
|
|
}
|
|
|
|
function M:push(cardGroup)
|
|
self.stack[#self.stack + 1] = cardGroup
|
|
end
|
|
function M:pushhuxi(cardGroup)
|
|
self.stackHuxi[#self.stackHuxi + 1] = cardGroup
|
|
end
|
|
|
|
function M:rollBack()
|
|
local cardGroup = self.stack[#self.stack]
|
|
table.remove(self.stack, #self.stack)
|
|
for _, card in ipairs(cardGroup) do
|
|
self.cardList[#self.cardList + 1] = card
|
|
end
|
|
table.sort(self.cardList)
|
|
end
|
|
|
|
-- function M:tryShunzi1(card, player, istuanyuan)
|
|
-- if card < 300 and card % 100 > 8 then
|
|
-- return false
|
|
-- end
|
|
-- if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then
|
|
-- local _huxi = 0
|
|
-- if self:notHongZi(card) and self:notHongZi(card + 1) and self:notHongZi(card + 2) then
|
|
-- self.isManYuan = false
|
|
-- end
|
|
|
|
-- removeCard(self.cardList, card + 1, 1)
|
|
-- removeCard(self.cardList, card + 2, 1)
|
|
-- removeCard(self.cardList, card, 1)
|
|
-- local cardGroup = {card, card + 1, card + 2}
|
|
-- -- if (checkCard(card, self.cardList, 3)) then --有团圆
|
|
-- -- if not istuanyuan then
|
|
-- -- if not checkCard(card, player.handcard_list, 4) then
|
|
-- -- if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
-- -- _huxi = 4
|
|
-- -- else
|
|
-- -- _huxi = 3
|
|
-- -- end
|
|
-- -- end
|
|
-- -- end
|
|
-- -- if self:notHongZi(card) then
|
|
-- -- self.isManYuan = false
|
|
-- -- end
|
|
-- -- removeCard(self.cardList, card, 3)
|
|
-- -- cardGroup = {card, card + 1, card + 2, card, card, card}
|
|
-- -- end
|
|
-- self:push(cardGroup)
|
|
-- self:pushhuxi(_huxi)
|
|
-- return true
|
|
-- end
|
|
-- return false
|
|
-- end
|
|
function M:tryShunzi1(card, player)
|
|
if card < 300 and card % 100 > 8 then
|
|
return false
|
|
end
|
|
if (checkCard(card + 1, self.cardList) and checkCard(card + 2, self.cardList)) then
|
|
local _huxi = 0
|
|
if self:notHongZi(card) and self:notHongZi(card + 1) and self:notHongZi(card + 2) then
|
|
self.isManYuan = false
|
|
end
|
|
removeCard(self.cardList, card + 1, 1)
|
|
removeCard(self.cardList, card + 2, 1)
|
|
removeCard(self.cardList, card, 1)
|
|
local cardGroup = {card, card + 1, card + 2}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(_huxi)
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function M:tryShunzi2(card)
|
|
if card - card % 100 == 100 then
|
|
if checkCard(card + 100, self.cardList, 1) and checkCard(card, self.cardList, 2) then
|
|
removeCard(self.cardList, card, 2)
|
|
removeCard(self.cardList, card + 100, 1)
|
|
local cardGroup = {card, card, card + 100}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(0)
|
|
return true
|
|
end
|
|
if (checkCard(card + 100, self.cardList, 2)) and (checkCard(card, self.cardList, 1)) then
|
|
removeCard(self.cardList, card, 1)
|
|
removeCard(self.cardList, card + 100, 2)
|
|
local cardGroup = {card, card + 100, card + 100}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(0)
|
|
return true
|
|
end
|
|
else
|
|
if (checkCard(card - 100, self.cardList, 1)) and checkCard(card, self.cardList, 2) then
|
|
removeCard(self.cardList, card, 2)
|
|
removeCard(self.cardList, card - 100, 1)
|
|
local cardGroup = {card - 100, card, card}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(0)
|
|
return true
|
|
end
|
|
if (checkCard(card - 100, self.cardList, 2)) and checkCard(card, self.cardList, 1) then
|
|
removeCard(self.cardList, card, 1)
|
|
removeCard(self.cardList, card - 100, 2)
|
|
local cardGroup = {card, card - 100, card - 100}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(0)
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function M:notHongZi(card)
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
return false
|
|
end
|
|
return true
|
|
end
|
|
|
|
--坎
|
|
function M:tryKezi(card, player, istuanyuan)
|
|
if (checkCard(card, self.cardList, 3)) then
|
|
local _huxi = 0
|
|
if not istuanyuan then
|
|
local ishavecard = false
|
|
if self.stack ~= nil and #self.stack > 0 then
|
|
for i = 1, #self.stack do
|
|
local groupcard = self.stack[i]
|
|
if groupcard ~= nil then
|
|
for j = 1, #groupcard do
|
|
if card == groupcard[j] then
|
|
ishavecard = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local sNum = self:GetFzTYData(card, player, player.handcard_list)
|
|
if sNum > 0 then
|
|
ishavecard = false
|
|
end
|
|
if not checkCard(card, player.handcard_list, 4) then
|
|
-- print(card, ishavecard)
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
_huxi = 4
|
|
else
|
|
_huxi = 3
|
|
end
|
|
if ishavecard then
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
_huxi = 8
|
|
else
|
|
_huxi = 6
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if self:notHongZi(card) then
|
|
self.isManYuan = false
|
|
end
|
|
removeCard(self.cardList, card, 3)
|
|
local cardGroup = {card, card, card}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(_huxi)
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
--将牌
|
|
function M:tryPair(card, player, tuanyuan, addCard)
|
|
if (self.pair_count > 0) then
|
|
return false
|
|
end
|
|
local num = 0
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 2 or player.fz_list[k].type == 4 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
num = 3
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if (checkCard(card, self.cardList, 2)) and num <= 0 then
|
|
local _huxi = 0
|
|
self.isJiangTYCard = card
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then --麻雀
|
|
if not checkCard(card, player.handcard_list, 4) then
|
|
_huxi = 2
|
|
end
|
|
end
|
|
if self:notHongZi(card) then
|
|
self.isManYuan = false
|
|
end
|
|
|
|
local isLogicMaque = false
|
|
local newcardList = membe_clone(player.handcard_list)
|
|
table.sort(newcardList)
|
|
if self:isNotHandCardTuan(card, newcardList) then
|
|
if self:isMaQue(card, newcardList) then
|
|
isLogicMaque = true
|
|
end
|
|
else
|
|
local sNum = self:GetFzTYData(card, player, newcardList)
|
|
if sNum > 0 then
|
|
isLogicMaque = true
|
|
end
|
|
end
|
|
if isLogicMaque then
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
_huxi = 3
|
|
else
|
|
_huxi = 2
|
|
end
|
|
end
|
|
removeCard(self.cardList, card, 2)
|
|
local cardGroup = {card, card}
|
|
self:push(cardGroup)
|
|
self:pushhuxi(_huxi)
|
|
self.pair_count = 1
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function M:isNotHandCardTuan(card, cardLis)
|
|
-- statements
|
|
if card < 300 and card % 100 > 8 then
|
|
if card == 110 or card == 210 then
|
|
if
|
|
not checkCard(card, cardLis, 4) and not checkCard(card - 1, cardLis, 4) and
|
|
not checkCard(card - 2, cardLis, 4)
|
|
then
|
|
return true
|
|
end
|
|
else
|
|
if
|
|
not checkCard(card, cardLis, 4) and not checkCard(card - 1, cardLis, 4) and
|
|
not checkCard(card + 1, cardLis, 4)
|
|
then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
if not checkCard(card, cardLis, 4) and not checkCard(card + 1, cardLis, 4) and not checkCard(card + 2, cardLis, 4) then
|
|
return true
|
|
end
|
|
if not checkCard(card, cardLis, 4) and not checkCard(card - 1, cardLis, 4) and not checkCard(card - 2, cardLis, 4) then
|
|
return true
|
|
end
|
|
if not checkCard(card, cardLis, 4) and not checkCard(card - 1, cardLis, 4) and not checkCard(card + 1, cardLis, 4) then
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end
|
|
function M:isMaQue(card, cardLis)
|
|
if card < 300 and card % 100 > 8 then
|
|
if card == 110 or card == 210 then
|
|
if
|
|
(checkCard(card - 1, cardLis) and checkCard(card - 2, cardLis)) and
|
|
(checkCard(card, cardLis, 3) or checkCard(card - 1, cardLis, 3) or checkCard(card - 2, cardLis, 3))
|
|
then
|
|
return true
|
|
end
|
|
else
|
|
if
|
|
((checkCard(card + 1, cardLis) and checkCard(card - 1, cardLis)) or
|
|
(checkCard(card - 1, cardLis) and checkCard(card - 2, cardLis))) and
|
|
(checkCard(card, cardLis, 3) or checkCard(card + 1, cardLis, 3) or checkCard(card - 1, cardLis, 3))
|
|
then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
if
|
|
(checkCard(card + 1, cardLis) and checkCard(card + 2, cardLis)) and
|
|
(checkCard(card, cardLis, 3) or checkCard(card + 1, cardLis, 3) or --转弯麻雀
|
|
checkCard(card + 2, cardLis, 3))
|
|
then
|
|
return true
|
|
end
|
|
if
|
|
(checkCard(card - 1, cardLis) and checkCard(card - 2, cardLis)) and
|
|
(checkCard(card, cardLis, 3) or checkCard(card - 1, cardLis, 3) or --转弯麻雀
|
|
checkCard(card - 2, cardLis, 3))
|
|
then
|
|
return true
|
|
end
|
|
if
|
|
(checkCard(card - 1, cardLis) and checkCard(card + 1, cardLis)) and
|
|
(checkCard(card, cardLis, 3) or checkCard(card - 1, cardLis, 3) or --转弯麻雀
|
|
checkCard(card + 1, cardLis, 3))
|
|
then
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end
|
|
function M:tryWin(player, istuanyuan, addCard, tuanyuan)
|
|
if (#self.cardList == 0 and self.pair_count == 1) then
|
|
return true
|
|
end
|
|
if (#self.cardList == 0) then
|
|
return false
|
|
end
|
|
local activeCard = self.cardList[1]
|
|
|
|
if self:tryShunzi1(activeCard, player) then
|
|
if self:tryWin(player) then
|
|
return true
|
|
end
|
|
self:rollBack()
|
|
table.remove(self.stackHuxi, #self.stackHuxi)
|
|
end
|
|
if self:tryKezi(activeCard, player, istuanyuan) then
|
|
if self:tryWin(player) then
|
|
return true
|
|
end
|
|
self:rollBack()
|
|
table.remove(self.stackHuxi, #self.stackHuxi)
|
|
end
|
|
if self:tryPair(activeCard, player, tuanyuan, addCard) then
|
|
if self:tryWin(player) then
|
|
return true
|
|
end
|
|
self.pair_count = 0
|
|
self:rollBack()
|
|
end
|
|
return false
|
|
end
|
|
|
|
local function init(room, self, player, cardInhand, addCard, istuanyuan, tuanyuan)
|
|
self.stack = {}
|
|
self.stackHuxi = {}
|
|
self.pair_count = 0
|
|
self.kong_count = 0
|
|
self.isManYuan = true
|
|
self.isJiangTuanYuan = false
|
|
self.isJiangTYCard = 0
|
|
self.cardList = membe_clone(cardInhand)
|
|
if addCard == nil then
|
|
self.kong_count = 1
|
|
else
|
|
self.kong_count = 0
|
|
self.cardList[#self.cardList + 1] = addCard
|
|
end
|
|
table.sort(self.cardList)
|
|
if addCard ~= nil then
|
|
local fzNum = self:GetFzDataNum(addCard, player)
|
|
fzNum = fzNum + cardNum(addCard, self.cardList)
|
|
if fzNum == 5 then
|
|
return false
|
|
end
|
|
end
|
|
return self:tryWin(player, istuanyuan, addCard, tuanyuan)
|
|
end
|
|
|
|
function M.tingPai(player, room)
|
|
local self = setmetatable({}, {__index = M})
|
|
local tingList = {}
|
|
local cardInhand = player.handcard_list
|
|
if not cardInhand or #cardInhand == 0 then
|
|
return tingList
|
|
end
|
|
local tuanyuancard = {} --所有团圆牌数组
|
|
local tuanyuan = 0 --团圆
|
|
for k = 100, 200, 100 do
|
|
for i = 1, 10 do
|
|
local tem = k + i
|
|
local astuanyuan = self:GetFzTYData(tem, player, cardInhand)
|
|
tuanyuan = tuanyuan + astuanyuan
|
|
if astuanyuan > 0 then
|
|
if #tuanyuancard > 1 and tuanyuancard[#tuanyuancard] == tem then
|
|
tuanyuancard[#tuanyuancard] = tem
|
|
else
|
|
tuanyuancard[#tuanyuancard + 1] = tem
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for l = 1, #player.fz_list do
|
|
local iType = player.fz_list[l].type
|
|
if tuanyuancard ~= nil then
|
|
for is = 1, #tuanyuancard do
|
|
if tuanyuancard[is] == player.fz_list[l].opcard[1] then
|
|
if iType == 2 then
|
|
if
|
|
tuanyuancard[is] % 100 == 2 or tuanyuancard[is] % 100 == 7 or tuanyuancard[is] == 110 or
|
|
tuanyuancard[is] == 210
|
|
then
|
|
player.hu_xi = player.hu_xi - 3
|
|
else
|
|
player.hu_xi = player.hu_xi - 2
|
|
end
|
|
elseif iType == 4 then
|
|
if
|
|
tuanyuancard[is] % 100 == 2 or tuanyuancard[is] % 100 == 7 or tuanyuancard[is] == 110 or
|
|
tuanyuancard[is] == 210
|
|
then
|
|
player.hu_xi = player.hu_xi - 4
|
|
else
|
|
player.hu_xi = player.hu_xi - 3
|
|
end
|
|
end
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if player.hu_xi ~= nil and player.hu_xi < 0 then
|
|
player.hu_xi = 0
|
|
end
|
|
local datatuyuan = membe_clone(tuanyuan)
|
|
for k = 100, 200, 100 do
|
|
for i = 1, 10 do
|
|
local tem = k + i
|
|
local istuanyuan = false
|
|
if tuanyuancard ~= nil then
|
|
for a = 1, #tuanyuancard do
|
|
if tuanyuancard[a] == tem then --匹配有团圆的牌
|
|
istuanyuan = true
|
|
break
|
|
end
|
|
end
|
|
end
|
|
local result = init(room, self, player, cardInhand, tem, istuanyuan, tuanyuan)
|
|
local num = 0
|
|
for q = 1, #self.stackHuxi do
|
|
num = num + self.stackHuxi[q]
|
|
end
|
|
tuanyuan = datatuyuan
|
|
if self.isJiangTYCard > 0 and tuanyuan ~= nil and tuanyuan > 0 then
|
|
if tuanyuancard ~= nil then
|
|
for a = 1, #tuanyuancard do
|
|
if tuanyuancard[a] == self.isJiangTYCard then --匹配有团圆的牌
|
|
tuanyuan = tuanyuan - self:GetFzTYData(self.isJiangTYCard, player, cardInhand)
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if result == false or (player.hu_xi + num + tuanyuan) < 10 then
|
|
if result then
|
|
if player.fz_list ~= nil and #player.fz_list > 0 and self.isManYuan then
|
|
for x = 1, #player.fz_list do
|
|
local manCard = player.fz_list[x].card
|
|
local ischiCard = false
|
|
local isNotchiCard = false
|
|
if self:notHongZi(manCard) then
|
|
ischiCard = true
|
|
end
|
|
for y = 1, #player.fz_list[x].opcard do
|
|
local ymanCard = player.fz_list[x].opcard[y]
|
|
if self:notHongZi(ymanCard) then
|
|
isNotchiCard = true
|
|
else
|
|
isNotchiCard = false
|
|
end
|
|
end
|
|
if self.isManYuan then
|
|
if ischiCard and isNotchiCard then
|
|
self.isManYuan = false
|
|
end
|
|
else
|
|
break
|
|
end
|
|
end
|
|
end
|
|
if room ~= nil and room.room_config.wanfa == 0 then
|
|
self.isManYuan = false
|
|
end
|
|
|
|
if self.isManYuan and (player.hu_xi + num) == 2 then
|
|
tingList[#tingList + 1] = tem
|
|
end
|
|
end
|
|
--不够10胡息时
|
|
if result and (player.hu_xi + num + tuanyuan) < 10 then
|
|
local acardList = membe_clone(cardInhand)
|
|
acardList[#acardList + 1] = tem
|
|
local tynum = self:GetFzTYData(tem, player, acardList)
|
|
local fzNum, fztype = self:GetFzTYDataNum(tem, player)
|
|
if tynum > 0 and (checkCard(tem, cardInhand, 3) or fzNum == 3) then
|
|
if fztype ~= nil and fztype == 2 then
|
|
if tem % 100 == 2 or tem % 100 == 7 or tem == 110 or tem == 210 then
|
|
tynum = tynum - 3
|
|
else
|
|
tynum = tynum - 2
|
|
end
|
|
else
|
|
if tem % 100 == 2 or tem % 100 == 7 or tem == 110 or tem == 210 then
|
|
tynum = tynum - 4
|
|
else
|
|
tynum = tynum - 3
|
|
end
|
|
end
|
|
end
|
|
if (player.hu_xi + num + tynum) >= 10 then
|
|
tingList[#tingList + 1] = tem
|
|
end
|
|
end
|
|
elseif (player.hu_xi + num + tuanyuan) >= 10 then
|
|
local num1 = 0
|
|
for k = 1, #self.stackHuxi do
|
|
num1 = num1 + self.stackHuxi[k]
|
|
end
|
|
tingList[#tingList + 1] = tem
|
|
end
|
|
end
|
|
end
|
|
return tingList
|
|
end
|
|
|
|
function M:GetFzTYData(card, player, cardList)
|
|
local huxi = 0
|
|
local fzpNum = 0
|
|
local fzcNum = 0
|
|
local ctype = 0
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 2 or player.fz_list[k].type == 4 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
ctype = player.fz_list[k].type
|
|
fzpNum = 3
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 1 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
fzcNum = 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local num = fzpNum + fzcNum
|
|
if num < 4 then --团圆
|
|
if
|
|
checkCard(card, cardList, 4) or (ctype == 4 and checkCard(card, cardList, 1)) or
|
|
(num == 1 and checkCard(card, cardList, 3))
|
|
then --暗团圆
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then
|
|
huxi = huxi + 8
|
|
else
|
|
huxi = huxi + 6
|
|
end
|
|
elseif num == 3 and checkCard(card, cardList, 1) then
|
|
if card % 100 == 2 or card % 100 == 7 or card == 110 or card == 210 then --明团圆
|
|
huxi = huxi + 7
|
|
else
|
|
huxi = huxi + 5
|
|
end
|
|
end
|
|
end
|
|
return huxi
|
|
end
|
|
function M:GetFzTYDataNum(card, player)
|
|
local fzpNum = 0
|
|
local fzcNum = 0
|
|
local tpye = 0
|
|
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 2 or player.fz_list[k].type == 4 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
tpye = player.fz_list[k].type
|
|
fzpNum = 3
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 1 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
fzcNum = 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return (fzpNum + fzcNum), tpye
|
|
end
|
|
function M:GetFzDataNum(card, player)
|
|
local fzpNum = 0
|
|
local fzcNum = 0
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 2 or player.fz_list[k].type == 4 then
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
fzpNum = 3
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if player.fz_list ~= nil and #player.fz_list > 0 then
|
|
for k = 1, #player.fz_list do
|
|
local oplist = player.fz_list[k].opcard
|
|
if oplist ~= nil and #oplist > 0 and player.fz_list[k].type == 1 then
|
|
local sscard = player.fz_list[k].card
|
|
if sscard ~= nil and sscard == card then
|
|
fzcNum = fzcNum + 1
|
|
end
|
|
for j = 1, #oplist do
|
|
if oplist[j] == card then
|
|
fzcNum = fzcNum + 1
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return (fzpNum + fzcNum)
|
|
end
|
|
|
|
function M:GetFzData(tem, ctype)
|
|
local huxi
|
|
if ctype == 2 then
|
|
if tem % 100 == 2 or tem % 100 == 7 or tem == 110 or tem == 210 then
|
|
huxi = 8
|
|
else
|
|
huxi = 6
|
|
end
|
|
elseif ctype == 4 then
|
|
if tem % 100 == 2 or tem % 100 == 7 or tem == 110 or tem == 210 then
|
|
huxi = 8
|
|
else
|
|
huxi = 6
|
|
end
|
|
end
|
|
return huxi
|
|
end
|
|
|
|
return M
|