修改13烂以及其他

master
mxj 2026-05-08 17:34:23 +08:00
parent ad6bba88d6
commit 4dbda00716
88 changed files with 113 additions and 69 deletions

View File

@ -1,8 +1,8 @@
local CS_Win_Type = {
"点炮",
"自摸",
"副烂",
"正烂",
"副烂",
"碰碰胡",
"七小对",
"天胡",

View File

@ -272,59 +272,95 @@ function M:checkQidui()
end
function M:checkLanPai()
local cardList = membe_clone(self.cardList)
local narr = self:removeRepeat(cardList)
if #narr > #cardList or #narr < #cardList then
return false
end
-- 克隆手牌列表
local cardList = membe_clone(self.cardList)
-- 获取赖子的数量
local laiziCount = self.zhong_count
-- 特殊情况处理:全赖子
if #cardList == 0 then
return laiziCount >= 0
end
-- 牌型分类
local ziCards = {} -- 字牌 (ID >= 400)
local wanVals = {} -- 万子点数
local tongVals = {} -- 筒子点数
local tiaoVals = {} -- 条子点数
-- 整理成了四个独立的列表
for _, card in ipairs(cardList) do
if card >= 400 then
table.insert(ziCards, card)
elseif card > 100 and card < 200 then
table.insert(wanVals, card % 100)
elseif card > 200 and card < 300 then
table.insert(tongVals, card % 100)
elseif card > 300 and card < 400 then
table.insert(tiaoVals, card % 100)
end
end
local zf = 0
local wz = 0 --万字
local wzcard = 0
local bz = 0 --筒子
local bzcard = 0
local tz = 0 --条
local tzcard = 0
-- 1. 检查字牌是否有重复
local ziUnique = {}
for _, c in ipairs(ziCards) do
if ziUnique[c] then
return false -- 发现重复字牌
end
ziUnique[c] = true
end
-- 检查是否属于固定的 1-4-7, 2-5-8, 3-6-9 组
local function checkFixedGroup(vals)
if #vals == 0 then return true end -- 没牌肯定合法
-- 去重并排序
local uniqueVals = {}
local seen = {}
for _, v in ipairs(vals) do
if not seen[v] then
table.insert(uniqueVals, v)
seen[v] = true
end
end
table.sort(uniqueVals)
-- 如果超过3张牌或者存在重复牌虽然上面去重了但逻辑上13烂不能对子直接失败
if #uniqueVals ~= #vals then return false end
-- 任意两张牌的差值必须是3的倍数。
for i = 2, #uniqueVals do
if (uniqueVals[i] - uniqueVals[1]) % 3 ~= 0 then
return false -- 不属于同一组(例如 1 和 2差值1不是3的倍数
end
end
return true
end
--检查万、筒、条是否符合固定组规则
if not checkFixedGroup(wanVals) then return false end
if not checkFixedGroup(tongVals) then return false end
if not checkFixedGroup(tiaoVals) then return false end
-- 计算可用槽位 (用于赖子填充)
local function countFixedSlots(vals)
if #vals == 0 then
return 3 -- 没牌时可以任选一组最多3个位置
end
return 3 - #vals
end
for k, v in pairs(cardList) do
if v>=400 then
zf = zf+1
end
if v > 100 and v<200 then
wz = wz+1
if wzcard==0 then
wzcard = v
else
if v ~= wzcard+3 and v~= wzcard+6 then
return false
end
end
end
if v > 200 and v<300 then
bz = bz+1
if bzcard==0 then
bzcard = v
else
if v ~= bzcard+3 and v~= bzcard+6 then
return false
end
end
end
if v > 300 and v<400 then
tz = tz+1
if tzcard==0 then
tzcard = v
else
if v ~= tzcard+3 and v ~= tzcard+6 then
return false
end
end
end
end
if zf>=5 and wz<4 and bz<4 and tz<4 then
return true
end
return false
local ziAvailable = 7 - #ziCards
local wanAvailable = countFixedSlots(wanVals)
local tongAvailable = countFixedSlots(tongVals)
local tiaoAvailable = countFixedSlots(tiaoVals)
local totalAvailable = ziAvailable + wanAvailable + tongAvailable + tiaoAvailable
-- 如果手中的赖子数量 <= 总可用槽位,说明赖子可以全部填入合法位置
if laiziCount <= totalAvailable then
return true
end
return false
end
function M:removeRepeat(a)
@ -384,9 +420,11 @@ local function init(self,cardInhand,addCard,isZhong,qidui,eightLaizi)
self.qidui = qidui
self.eight_laizi = eightLaizi
self.cardList[#self.cardList+1] = addCard
--是否启用“红中/赖子”玩法
if (isZhong) then
--将赖子的数量保存到 self.zhong_count 变量中
self.zhong_count = cardNum(zhongid, self.cardList)
--从 self.cardList 中移除所有刚才统计到的赖子牌。
removeCard(self.cardList, zhongid, self.zhong_count)
end
table.sort(self.cardList)
@ -395,14 +433,8 @@ local function init(self,cardInhand,addCard,isZhong,qidui,eightLaizi)
return self:checkLanPai() or self:checkQidui() or self:tryWin()
end
local specialCardList={401,402,403,404,504,502,503}
local specialCardList={401,402,403,404,502,503,501}
function M.tingPai(cardInhand,isZhong,qidui,eightLaizi)
printlog("isZhong",isZhong)
printlog("qidui",qidui)
printlog("eightLaizi",eightLaizi)
pt(cardInhand)
local self = setmetatable({}, {__index = M})
local tingList = {}
if not cardInhand or #cardInhand == 0 then
@ -418,8 +450,7 @@ function M.tingPai(cardInhand,isZhong,qidui,eightLaizi)
end
end
end
printlog("ddddtt")
pt(tingList)
for j=1,#specialCardList do
local tem = specialCardList[j]

View File

@ -1,16 +1,25 @@
{
"objectStatus": {
"n85_l2u4": {
"n117_kmwu": {
"collapsed": true
},
"n90_8sat": {
"locked": true
},
"n108_go7q": {
"hidden": true
},
"n59_v38k": {
"collapsed": true
},
"n85_l2u4": {
"collapsed": true
},
"n107_go7q": {
"hidden": true
},
"n90_8sat": {
"locked": true
},
"n123_dzuu": {
"collapsed": true
}
}
}

View File

@ -6,6 +6,8 @@
"ui://m7iejg46m16m7igb",
"ui://v0j9abjygq7med",
"ui://v0j9abjygq7m8f",
"ui://v0j9abjygq7men",
"ui://v0j9abjygq7m8u",
"ui://v0j9abjygq7m8k",
"ui://v0j9abjygq7m8i",
"ui://4skil1l6r6qo1kc",
@ -21,7 +23,7 @@
"test.device": "iPhone XR",
"canvasColor": 10066329,
"auxline2": true,
"doc.activeDoc": "ui://v0j9abjygq7m8k",
"doc.activeDoc": "ui://v0j9abjygq7men",
"libview.twoColumn": false,
"libview.expandedNodes": [
"hrxsdiix",
@ -35,6 +37,8 @@
"v0j9abjy",
"/",
"v0j9abjy",
"/Main_style_2/",
"v0j9abjy",
"/images/",
"v0j9abjy",
"/images/cards/",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

@ -184,8 +184,8 @@
<component id="la4e50" name="别人胡.xml" path="/component/eff/" exported="true"/>
<component id="la4e51" name="自己胡牌.xml" path="/component/eff/" exported="true"/>
<image id="la4e52" name="he10.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e53" name="he3.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e54" name="he4.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e53" name="he4.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e54" name="he3.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e55" name="he5.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e56" name="he6.png" path="/component/hu_effect/image/" exported="true"/>
<image id="la4e57" name="he7.png" path="/component/hu_effect/image/" exported="true"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 KiB

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 878 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 966 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 KiB

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 KiB

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 KiB

After

Width:  |  Height:  |  Size: 497 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 KiB

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 KiB

After

Width:  |  Height:  |  Size: 782 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 KiB

After

Width:  |  Height:  |  Size: 839 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 KiB

After

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 33 KiB