fix: 军棋风险提示【undefined】— jq.cells[行号]误取整行数组,改取目标格子且必须我方存活子(同归于尽/进攻子被吃均不再误报)
Publish Docker image to GHCR / build-push (push) Canceled after 0s

This commit is contained in:
personal827 committed 2026-10-27 16:51:46 +08:00
1 parent 6830a0eb17
commit 08c0c17b2e
2 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -106,6 +106,6 @@ route();
</div>
</footer>
<script src="js/extras.js?v=62"></script>
<script src="js/extras.js?v=63"></script>
</body>
</html>
+5 -2
View File
@@ -218,8 +218,11 @@
const h = jq._hist[jq._hist.length - 1];
if (!h || h.type !== 'move' || !h.tr) return null;
const target = h.tr, targetC = h.tc;
const mine = jq.cells[target] ? jq.cells[target] : h.fp;
if (!mine) return null;
// 目的地必须是【你方当前存活的子】才有风险可言:
// - 同归于尽(目标格为空) → 无子可吃,不提示
// - 你方进攻子阵亡(敌方幸存占格) → 不是"你的子",不提示
const mine = jq.cells[target] && jq.cells[target][targetC];
if (!mine || mine.owner !== 'r') return null;
const myKind = mine.kind, myFace = (window.FACE || {})[myKind] || KIND_LBL[myKind] || myKind;
const threats = [];
for (let r = 0; r < jq.R; r++) for (let c = 0; c < jq.C; c++) {