二七王:发牌与叫分 handler
fapai 是一局起点,先 reset 清上局残留(保留 mySeat 与 options)。
叫分里 0(不叫)与 null(还没叫)严格区分。上庄的 bottomcards/cards 只有庄家有,
缺字段时保持原值、不抹掉闲家已有手牌——GameState 的「缺字段不兜底」在此体现。
新增 GameState._apply 助手:按 {目标键:源键} 映射写入,源键不存在就不写。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,5 +98,15 @@ var EQW_GameState = EQW_GameState || {
|
||||
out[g] = JSON.parse(JSON.stringify(this[g]));
|
||||
}
|
||||
return out;
|
||||
},
|
||||
|
||||
//把包里的字段写进目标分组。map = { 目标键: 源键 }。
|
||||
//【缺字段不兜底】源键在包里不存在就不写,保持原值——不填默认值掩盖漏发。
|
||||
_apply: function (target, src, map) {
|
||||
for (var dst in map) {
|
||||
if (!map.hasOwnProperty(dst)) { continue; }
|
||||
var srcKey = map[dst];
|
||||
if (src.hasOwnProperty(srcKey)) { target[dst] = src[srcKey]; }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user