yunque9/lua_probject/extend_project/extend/zipai/fulushou/main/CardCheck.lua

1112 lines
26 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 checkCard1(eventCard, cardList, num)
if num == nil then
num = 1
end
local result = 0
for k,v in pairs(cardList) do
if k==eventCard then
result = v
if result==num then
return true
end
end
end
return false
end
local function GetCheckCardNum(eventCard, cardList)
local result = 0
for k,v in pairs(cardList) do
if k==eventCard then
result = v
return v
end
end
return result
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 = {
cardList = nil,
stack = nil,
stackHuxi = nil,
cbCardMap=nil,
ting_pai = true
}
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:tryWin(player,room)
return self:checkWinOpList(player,player.fz_list,room)
end
function M:checkWinOpList(player,opcardList,room)
local isHu=self:AnalyseChiHuCard(opcardList,room.room_config.config)
return isHu
end
function M:AnalyseChiHuCard(opcardList,roomConfig)
return self:AnalyseChiHuCardEx(opcardList,roomConfig)
end
function M:AnalyseChiHuCardEx(opcardList,roomConfig)
local tempCardList=membe_deep_clone(self.cbCardMap)
--//变量定义
-- List<TagAnalyseItem> tagAnalyseItemList = new ArrayList<TagAnalyseItem>();
-- List<Integer> wChiHuKind = new ArrayList<Integer>();
local tagAnalyseItemList={}
local wChiHuKind={}
self:AnalyseCard(tempCardList,opcardList,tagAnalyseItemList,roomConfig)
local huxi=0
for i=1,#tagAnalyseItemList do
huxi=huxi+tagAnalyseItemList[i].huxi
end
printlog("胡息数为=>>>",huxi)
pt(tagAnalyseItemList)
if huxi >=11 then
return true
else
return false
end
end
function M:AnalyseCard(tempCardList,opCards,tagAnalyseItemList,config)
local cbCardCount=0
for k,v in pairs(tempCardList) do
cbCardCount=cbCardCount+v
end
if cbCardCount<1 or cbCardCount>19 then return false end
--List<TagKindItem> tagKindList = new ArrayList<TagKindItem>();
local tagKindList={}
--while false do
repeat
local cbLessKindItem = math.floor((cbCardCount - 1) / 3)
if cbLessKindItem+#opCards ~=6 then
break
end
--//单吊判断
if cbLessKindItem==0 then
if not ((cbCardCount==1) and #opCards==6) then
return false
end
for k,v in pairs(tempCardList) do
if v==1 then
return AnalyseCardFuLuShou(cbLessKindItem,nil,k,opCards,tagAnalyseItemList,config)
end
end
return false
end
--//拆分分析
if cbCardCount>=3 then
for k,v in pairs(tempCardList) do
if v>=2 and checkCard1( math.floor(k/100)*100+4,tempCardList,1) then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Peng
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k
kindItem.cbCardList[3] = math.floor(k / 100) * 100 + 4
table.insert(tagKindList,kindItem)
end
if v>=3 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Peng
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k
kindItem.cbCardList[3] = k
table.insert(tagKindList,kindItem)
end
--//连牌判断
if k%100>=1 and k%100<4 and v>0 then
for i=1,v do
if cardNum(k+1,self.cardList)>=i and cardNum(k+2,self.cardList)>=i and (k+1)%100~=4 and (k+2)%100~=4 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k+1
kindItem.cbCardList[3] = k +2
table.insert(tagKindList,kindItem)
end
if cardNum(k+1,self.cardList)>=i and (k+1)%100~=4 and cardNum( math.floor(k/100)*100+4,self.cardList)>=i then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k+1
kindItem.cbCardList[3] = math.floor(k/100) * 100 + 4
table.insert(tagKindList,kindItem)
end
if cardNum(k+2,self.cardList)>=i and (k+2)%100~=4 and cardNum( math.floor(k/100)*100+4,self.cardList)>=i then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k+1
kindItem.cbCardList[3] = math.floor(k/100) * 100 + 4
table.insert(tagKindList,kindItem)
end
end
end
end
end
--//组合分析
if #tagKindList>=cbLessKindItem then
local cbIndex={}
for i=1,6 do
table.insert(cbIndex,i)
end
--TagKindItem[] pKindItem = new TagKindItem[6];
local pKindItem={}
--local count = 0
repeat
--while true do
local cbCardMap_temp=membe_deep_clone(tempCardList)
for i=1,cbLessKindItem do
pKindItem[i]=tagKindList[i]
end
--//数量判断
local bEnoughCard = true
for i=1,cbLessKindItem * 3 do
local num1=math.floor((i-1)/3)+1
local num2=i % 3
if num==0 then
num2=3
end
local cbCardIndex=pKindItem[num1].cbCardList[num2]
if GetCheckCardNum(cbCardIndex,cbCardMap_temp)<=0 then
bEnoughCard = false
break
else
if cbCardMap_temp[cbCardIndex] then
cbCardMap_temp[cbCardIndex]=cbCardMap_temp[cbCardIndex]-1
end
end
end
--//胡牌判断
if bEnoughCard==true then
local cbCardEye = 0
for k,v in pairs(cbCardMap_temp) do
if v==1 then
cbCardEye=k
break
end
end
if cbCardEye ~= 0 then
local result = AnalyseCardFuLuShou(cbLessKindItem, pKindItem, cbCardEye, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
end
--//设置索引
if cbIndex[cbLessKindItem]==#tagKindList then
local tempi=cbLessKindItem
for i=cbLessKindItem,2,-1 do
tempi=i-1
if (cbIndex[i-1]+1)~=cbIndex[i] then
local cbNewIndex = cbIndex[i - 1]
for j=i-1,cbLessKindItem do
cbIndex[j]=cbNewIndex+j-i+2
end
break
end
end
if tempi==1 then break end
else
cbIndex[cbLessKindItem]=cbIndex[cbLessKindItem]+1
end
until(false)
--end
----
end
if #tagAnalyseItemList>0 then break end
--end
until(true)
tagKindList={}
repeat
--while false do
local cbLessKindItem = math.floor((cbCardCount - 4) / 3)
if cbLessKindItem+#opCards ~=5 then
break
end
--//单吊判断
if cbLessKindItem==0 then
if not ((cbCardCount==4) and #opCards==5 )then
return false
end
--//牌眼判断
-- ArrayList<ITArray> eyeList = new ArrayList<ITArray>();
-- ArrayList<Integer> eyeCardList = new ArrayList<Integer>();
local eyeList={}
local eyeCardList={}
for k,v in pairs(tempCardList) do
if v>0 then
for i=1,v do
table.insert(eyeCardList,k)
end
end
end
if #eyeCardList~=4 then return false end
if math.floor(eyeCardList[1]/100)== math.floor(eyeCardList[2]/100) and math.floor(eyeCardList[3]/100)== math.floor(eyeCardList[4]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[2]
local card3=eyeCardList[3]
local card4=eyeCardList[4]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if math.floor(eyeCardList[1]/100)== math.floor(eyeCardList[3]/100) and math.floor(eyeCardList[2]/100)== math.floor(eyeCardList[4]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[3]
local card3=eyeCardList[2]
local card4=eyeCardList[4]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if math.floor(eyeCardList[1]/100)== math.floor(eyeCardList[4]/100) and math.floor(eyeCardList[2]/100)== math.floor(eyeCardList[3]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[4]
local card3=eyeCardList[3]
local card4=eyeCardList[2]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if #tagAnalyseItemList>0 then
return true
else
return false
end
end
--//拆分分析
if cbCardCount >= 3 then
for k,v in pairs(tempCardList) do
if v>=2 and cardNum( math.floor(k / 100) * 100 + 4,self.cardList)==1 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Peng
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k
kindItem.cbCardList[3] = math.floor(k / 100) * 100 + 4
table.insert(tagKindList,kindItem)
end
if v>=3 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Peng
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k
kindItem.cbCardList[3] = k
table.insert(tagKindList,kindItem)
end
--//连牌判断
if k%100>=1 and k%100<=4 and v>0 then
for i=1,v do
if cardNum(k+1,self.cardList)>=i and cardNum(k+2,self.cardList)>=i and (k+1)%100~=4 and (k+2)%100~=4 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k+1
kindItem.cbCardList[3] = k+2
table.insert(tagKindList,kindItem)
end
if cardNum(k+1,self.cardList)>=i and cardNum(math.floor(k/100)*100+4,self.cardList)>=i and (k+1)%100~=4 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = k+1
kindItem.cbCardList[3] = math.floor(k/100)*100+4
table.insert(tagKindList,kindItem)
end
if cardNum(k+2,self.cardList)>=i and cardNum(math.floor(k/100)*100+4,self.cardList)>=i and (k+2)%100~=4 then
local kindItem={}
kindItem.type=RB_FZTypeFLS.Chi
kindItem.card = k
kindItem.cbCardList={}
kindItem.cbCardList[1] = k
kindItem.cbCardList[2] = math.floor(k/100)*100+4
kindItem.cbCardList[3] = k+2
table.insert(tagKindList,kindItem)
end
end
end
end
end
--//组合分析
if #tagKindList>=cbLessKindItem then
local cbIndex={}
for i=1,5 do
table.insert(cbIndex,i-1)
end
--TagKindItem[] pKindItem = new TagKindItem[6];
local pKindItem={}
repeat
--while true do
local cbCardMap_temp=membe_deep_clone(tempCardList)
for i=1,cbLessKindItem do
pKindItem[i]=tagKindList[i]
end
--//数量判断
local bEnoughCard = true
for i=1,cbLessKindItem * 3 do
local num1=math.floor((i-1)/3)+1
local num2=i % 3
if num==0 then
num2=3
end
local cbCardIndex=pKindItem[num1].cbCardList[num2]
if GetCheckCardNum(cbCardIndex,cbCardMap_temp)<=0 then
bEnoughCard = false
break
else
if cbCardMap_temp[cbCardIndex] then
cbCardMap_temp[cbCardIndex]=cbCardMap_temp[cbCardIndex]-1
end
end
end
--//胡牌判断
if bEnoughCard==true then
--//牌眼判断
-- ArrayList<ITArray> eyeList = new ArrayList<ITArray>();
-- ArrayList<Integer> eyeCardList = new ArrayList<Integer>();
local eyeList={}
local eyeCardList={}
for k,v in pairs(tempCardList) do
if v>0 then
for i=1,v do
table.insert(eyeCardList,k)
end
end
end
if #eyeCardList~=4 then return false end
if math.floor(eyeCardList[1]/100)==math.floor(eyeCardList[2]/100) and math.floor(eyeCardList[3]/100)==math.floor(eyeCardList[4]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[2]
local card3=eyeCardList[3]
local card4=eyeCardList[4]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if math.floor(eyeCardList[1]/100)==math.floor(eyeCardList[3]/100) and math.floor(eyeCardList[2]/100)==math.floor(eyeCardList[4]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[3]
local card3=eyeCardList[2]
local card4=eyeCardList[4]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if math.floor(eyeCardList[1]/100)==math.floor(eyeCardList[4]/100) and math.floor(eyeCardList[2]/100)==math.floor(eyeCardList[3]/100) then
local card1=eyeCardList[1]
local card2=eyeCardList[4]
local card3=eyeCardList[3]
local card4=eyeCardList[2]
local result=AnalyseCardFuLuShouJiang(cbLessKindItem, nil, card1, card2, card3, card4, opCards, tagAnalyseItemList, config)
if result then
return true
end
end
if #tagAnalyseItemList>0 then
return true
else
return false
end
end
--//设置索引
if cbIndex[cbLessKindItem]==#tagKindList then
local tempi=cbLessKindItem
for i=cbLessKindItem,2,-1 do
tempi=i-1
if (cbIndex[i-1]+1)~=cbIndex[i] then
local cbNewIndex = cbIndex[i - 1]
for j=i-1,cbLessKindItem do
cbIndex[j]=cbNewIndex+j-i+2
end
break
end
end
if tempi==1 then break end
else
cbIndex[cbLessKindItem]=cbIndex[cbLessKindItem]+1
end
until(false)
--end
--
end
if #tagAnalyseItemList>0 then break end
--end
until(true)
if #tagAnalyseItemList>0 then return true end
return false
end
function M:AnalyseCardFuLuShou(cbLessKindItem,pKindItem,eyeCard,opCards,tagAnalyseItemList,config)
printlog("AnalyseCardFuLuShou===>>>")
local AnalyseItem={}
AnalyseItem.huxi=0
AnalyseItem.cbCardEye = 0
AnalyseItem.cbOpCard={}
AnalyseItem.cbCardEyeList={}
--//设置结果
for i=1,#opCards do
local src_card=opCards[i]
local op_card={}
op_card.type=src_card.type
op_card.card=src_card.card
table.insert(AnalyseItem.cbOpCard,src_card)
if src_card.type==RB_FZTypeFLS.Chi then
if IsShangDaRenFuLuShou(src_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4
end
elseif src_card.type==RB_FZTypeFLS.Peng then
if IsShangFu(src_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+3*4
else
AnalyseItem.huxi=AnalyseItem.huxi+2
end
else
if IsShangFu(src_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4*4
else
if config["gang_zhao_liu_xi"] then
AnalyseItem.huxi=AnalyseItem.huxi+6
else
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
end
end
--//设置牌型
if pKindItem then
for i=1,cbLessKindItem do
local op_card={}
op_card.type=pKindItem[i].type
op_card.card=pKindItem[i].card
table.insert(AnalyseItem.cbOpCard,op_card)
if op_card.type==RB_FZTypeFLS.Chi then
if IsShangDaRenFuLuShou(op_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4
end
elseif op_card.type==RB_FZTypeFLS.Peng then
if IsShangFu(op_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+3*4
else
AnalyseItem.huxi=AnalyseItem.huxi+3
end
else
if IsShangFu(op_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4*4
else
if config["gang_zhao_liu_xi"] then
AnalyseItem.huxi=AnalyseItem.huxi+6
else
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
end
end
end
if eyeCard>0 then
AnalyseItem.cbCardEye = eyeCard
if IsShangFu(eyeCard) then
AnalyseItem.huxi=AnalyseItem.huxi+8
elseif IsDaRenLuShou(eyeCard) then
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif eyeCard==104 or eyeCard==804 then
AnalyseItem.huxi=AnalyseItem.huxi+8
end
end
--//插入结果
table.insert(tagAnalyseItemList,AnalyseItem)
pt(tagAnalyseItemList)
printlog("胡息---》》》",AnalyseItem.huxi)
if AnalyseItem.huxi >= 11 then
return true
end
return false
end
function M:AnalyseCardFuLuShouJiang(cbLessKindItem,pKindItem,card1,card2,card3,card4,opCards,tagAnalyseItemList,config)
printlog("AnalyseCardFuLuShouJiang===>>>")
local AnalyseItem={}
AnalyseItem.huxi=0
AnalyseItem.cbCardEye = 0
AnalyseItem.cbOpCard={}
AnalyseItem.cbCardEyeList={}
--//设置结果
local diJin = false
local shangDaRenFuLuShou = false
local ban_shangDaRenFuLuShou = false
local hasKan = false
for i=1,#opCards do
local src_card=opCards[i]
local op_card={}
op_card.type=src_card.type
op_card.card=src_card.card
table.insert(AnalyseItem.cbOpCard,src_card)
if src_card.type==RB_FZTypeFLS.Chi then
if IsShangDaRenFuLuShou(src_card.card) then
shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
elseif src_card.type==RB_FZTypeFLS.Peng then
if IsShangFu(src_card.card) then
hasKan = true
AnalyseItem.huxi=AnalyseItem.huxi+3*4
else
AnalyseItem.huxi=AnalyseItem.huxi+2
end
else
hasKan = true
if IsShangFu(src_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4*4
else
if config["gang_zhao_liu_xi"] then
AnalyseItem.huxi=AnalyseItem.huxi+6
else
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
end
end
--//设置牌型
if pKindItem then
for i=1,cbLessKindItem do
local op_card={}
op_card.type=pKindItem[i].type
op_card.card=pKindItem[i].card
table.insert(AnalyseItem.cbOpCard,op_card)
if op_card.type==RB_FZTypeFLS.Chi then
if IsShangDaRenFuLuShou(op_card.card) then
shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
elseif op_card.type==RB_FZTypeFLS.Peng then
hasKan = true
if IsShangFu(op_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+3*4
else
AnalyseItem.huxi=AnalyseItem.huxi+3
end
else
hasKan = true
if IsShangFu(op_card.card) then
AnalyseItem.huxi=AnalyseItem.huxi+4*4
else
if config["gang_zhao_liu_xi"] then
AnalyseItem.huxi=AnalyseItem.huxi+6
else
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
end
end
end
local eyeCard1={}
table.insert(eyeCard1,card1)
table.insert(eyeCard1,card2)
table.insert(AnalyseItem.cbCardEyeList,eyeCard1)
local eyeCard1={}
table.insert(eyeCard1,card3)
table.insert(eyeCard1,card4)
table.insert(AnalyseItem.cbCardEyeList,eyeCard2)
--//一对上、福,就可以胡了
if card1 == card2 and IsShangFu(card1) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif card1 == card2 and (card1 == 104 or card1 == 804) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif (card1 == 101 and card2 == 104 or card2 == 101 and card1 == 104) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif (card1 == 801 and card2 == 804 or card2 == 801 and card1 == 804) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif ((card1 == 101 or card2 == 101 ) and card1 ~= card2) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card1 == 104 or card2 == 104 ) and card1 ~= card2) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card1 == 801 or card2 == 801 ) and card1 ~= card2) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card1 == 804 or card2 == 804 ) and card1 ~= card2) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
if (card3 == card4 and IsShangFu(card3)) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif (card3 == card4 and (card3 == 104 or card3 == 804)) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif (card3 == 101 and card4 == 104 or card4 == 101 and card3 == 104) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif (card3 == 801 and card4 == 804 or card4 == 801 and card3 == 804) then
AnalyseItem.huxi=AnalyseItem.huxi+12
elseif ((card3 == 101 or card4 == 101) and card3 ~= card4) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card3 == 104 or card4 == 104) and card3 ~= card4) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card3 == 801 or card4 == 801) and card3 ~= card4) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
elseif ((card3 == 804 or card4 == 804) and card3 ~= card4) then
ban_shangDaRenFuLuShou = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
if shangDaRenFuLuShou or ban_shangDaRenFuLuShou or hasKan then
if (card1 ~= card2 and IsDaRen(card1) and IsDaRen(card2) or card3 ~= card4 and IsDaRen(card3) and IsDaRen(card4)) then
if not diJin then
diJin = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
if (card1 ~= card2 and IsLuShou(card1) and IsLuShou(card2) or card3 ~= card4 and IsLuShou(card3) and IsLuShou(card4)) then
if not diJin then
diJin = true
AnalyseItem.huxi=AnalyseItem.huxi+4
end
end
if ((card1 == card2 and not IsShangFu(card1) and card1 ~= 104 and card1 ~= 804) or
(card3 == card4 and not IsShangFu(card3) and card3 ~= 104 and card3 ~= 804)) then
if not diJin then
diJin = true
AnalyseItem.huxi=AnalyseItem.huxi+3
end
elseif ((card1 ~= card2 and (( math.floor(card1 / 100) ~= 1 and math.floor(card1 / 100) ~= 8 and card1 % 100 == 4) or ( math.floor(card2 / 100) ~= 1 and math.floor(card2 / 100) ~= 8 and card2 % 100 == 4)) and not IsShangFu(card1)) or
(card3 ~= card4 and (( math.floor(card3 / 100) ~= 1 and math.floor(card3 / 100) ~= 8 and card3 % 100 == 4) or ( math.floor(card4 / 100) ~= 1 and math.floor(card4 / 100) ~= 8 and card4 % 100 == 4)) and not IsShangFu(card3))) then
if not diJin then
diJin = true
AnalyseItem.huxi=AnalyseItem.huxi+3
end
end
end
--//插入结果
table.insert(tagAnalyseItemList,AnalyseItem)
pt(tagAnalyseItemList)
printlog("胡息---》》》",AnalyseItem.huxi)
if AnalyseItem.huxi >= 11 then
return true
end
return false
end
function M:IsShangFu(card)
if card==101 or card==801 then
return true
end
return false
end
function M:IsDaRen(card)
if card==102 or card==103 then
return true
end
return false
end
function M:IsLuShou(card)
if card==802 or card==803 then
return true
end
return false
end
function M:IsDaRenLuShou(card)
if card==102 or card==103 or card==802 or card==803 then
return true
end
return false
end
function M:IsShangDaRen(card)
if math.floor(card/100)==1 then
return true
end
return false
end
function M:IsFuLuShou(card)
if math.floor(card/100)==8 then
return true
end
return false
end
function M:IsShangDaRenFuLuShou(card)
if math.floor(card/100)==1 or math.floor(card/100)==8 then
return true
end
return false
end
local function init(self, player, cardInhand, addCard,room)
self.stack = {}
self.stackHuxi = {}
self.cardList = membe_deep_clone(cardInhand)
if addCard then
self.cardList[#self.cardList + 1] = addCard
end
table.sort(self.cardList)
self.cbCardMap={}
for i=1,#self.cardList do
if self.cbCardMap[self.cardList[i]]==nil then
self.cbCardMap[self.cardList[i]]=1
end
local num=cardNum(self.cardList[i],self.cardList)
if num>1 then
self.cbCardMap[self.cardList[i]]=num
end
end
--printlog("cbCardMap")
--pt(self.cbCardMap)
return self:tryWin(player,room)
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
for k = 100, 800, 100 do
for i = 1, 4 do
local tem = k + i
printlog("听牌查询=======>>>",tem)
local result = init(self, player, cardInhand, tem,room)
if result then
printlog("胡牌值为==>>>",tem)
table.insert(tingList,tem)
end
end
end
return tingList
end
function M:getHuxi(room)
if room.game_id == 77 then
return 11
end
if room.game_id == 301 then
return 8
end
if room.game_id == 13 or room.game_id == 14 or room.game_id == 23 then
return 15
elseif room.game_id == 26 then
return 10
elseif room.game_id == 29 then
if room.room_config.maxPlayers == 3 then
return 15
else
return 9
end
end
end
function M:GetFzData(tem, ctype)
local huxi
if ctype == 2 then
if tem > 200 then
huxi = 6
else
huxi = 5
end
elseif ctype == 3 then
huxi = 3
elseif ctype == 4 then
huxi = 3
elseif ctype == 5 then
huxi = 3
end
return huxi
end
return M