二七王:报无主后立即为全体三人刷新主牌统计

design §9:「一旦有玩家的主牌全部打空,系统就为全体三人显示另外
两家各自的主牌数量、以及这些主牌里有多少对子」。

原实现只在出牌者自己出牌时更新自己那一格 seatlist[seat][4],所以
A 打空主牌报无主的那一刻,B、C 的主牌数/对子数仍是初始 [-1,-1],
要等各自轮到出牌才补上,界面最多滞后两次出牌才完整。

改为:出牌后先判定出牌者主牌是否出空,一旦 have_baofu() 成立,就
按各家实际手牌为三个座位统一重算 [剩余主牌数, 剩余主对数] 及主花
色标志。重算幂等——主牌一旦出空不会再有,[4][0] 恒为 0。

test_rpc 的 mkChupai 原先只把 seatlist[1][4][0] 置 0 伪造报无主,
而不真的清空 seat1 的主牌;新逻辑按实际手牌重算会把这个假状态纠
正回去,导致 baozhu 断言失败。这是新实现更严格的正确表现,故改测
试造真状态(把 seat1 的主牌标为已出),不是放宽断言。

test_input 新增 6 项:报无主前三家均为 [-1,-1];打空瞬间三家统计
与主花色标志同时刷新到实际值。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 04:20:03 +08:00
co-authored by Claude Opus 5
parent 84774fa525
commit 4276d38267
3 changed files with 45 additions and 16 deletions
+22 -16
View File
@@ -558,23 +558,29 @@ var cls_youle_erqiwang_paiju = cls_youle_erqiwang_paiju || {
//进入出牌阶段
o_paiju.step = 5;
//是否报副处理
if (o_paiju.seatlist[o_paiju.playproc.currseat][4][0] != 0){
var _zhu = cls_youle_erqiwang_paiju.get_seat_zhucards(o_paiju, o_paiju.playproc.currseat);
if (_zhu.length == 0){
o_paiju.seatlist[o_paiju.playproc.currseat][4][0] = 0;
o_paiju.seatlist[o_paiju.playproc.currseat][4][1] = 0;
}
if (o_paiju.method.have_baofu()){
var _parilist = cls_youle_erqiwang_arith.get_pairlist(o_paiju.flower, _zhu);
o_paiju.seatlist[o_paiju.playproc.currseat][4][0] = _zhu.length;
o_paiju.seatlist[o_paiju.playproc.currseat][4][1] = _parilist.length;
//报无主处理(design §9)
//先看出牌者自己的主牌是否已出空(出空即"报无主");
//一旦全场有人报无主,立即为【全体三人】刷新剩余主牌数/主对子数——design §9 要求
//"一旦有玩家的主牌全部打空,系统就为全体三人显示另外两家各自的主牌数量与对子数",
//而不是等另外两家各自轮到出牌时才逐个补上。
var _self = o_paiju.playproc.currseat;
if (cls_youle_erqiwang_paiju.get_seat_zhucards(o_paiju, _self).length == 0){
o_paiju.seatlist[_self][4][0] = 0;
o_paiju.seatlist[_self][4][1] = 0;
}
if (o_paiju.method.have_baofu()){
for (var _s = 0; _s < 3; _s++){
var _zhu = cls_youle_erqiwang_paiju.get_seat_zhucards(o_paiju, _s);
var _zhupair = cls_youle_erqiwang_arith.get_pairlist(o_paiju.flower, _zhu);
o_paiju.seatlist[_s][4][0] = _zhu.length;
o_paiju.seatlist[_s][4][1] = _zhupair.length;
if (o_paiju.seatlist[o_paiju.playproc.currseat][4][0] == 0){
o_paiju.seatlist[o_paiju.playproc.currseat][o_paiju.flower - 1][0] = 1;
o_paiju.seatlist[o_paiju.playproc.currseat][o_paiju.flower - 1][1] = 1;
} else if (o_paiju.seatlist[o_paiju.playproc.currseat][4][1] == 0){
o_paiju.seatlist[o_paiju.playproc.currseat][o_paiju.flower - 1][1] = 1;
if (_zhu.length == 0){
//主牌出空,等同于主花色也没有了、也没有主花色的对子
o_paiju.seatlist[_s][o_paiju.flower - 1][0] = 1;
o_paiju.seatlist[_s][o_paiju.flower - 1][1] = 1;
} else if (_zhupair.length == 0){
o_paiju.seatlist[_s][o_paiju.flower - 1][1] = 1;
}
}
}