共享会话
🛠️ 遊戲規則與動畫修復
分享于 2026年8月23日 11:57
QuanAI以下修改只涉及:
- 「規則說明」中的中英文靜態文案。
- 下載 SVG 動畫的棋子數量顯示時間。
不修改 validateTurnOnState()、actionCheck()、applySearchTurnToState()、AI、仲裁、棋譜導入導出或正式棋局狀態,因此不會影響當前正確的遊戲流程。
一、更新中文「落子規則」
修改位置
搜尋以下原代碼:
html
<p>先手方首回合將把他的一個棋子放至棋盤中心,此後每一方的回合中,他所放的每一個棋子都要滿足以下條件:</p>替換為:
html
<p>
先手方首回合將把他的一個棋子放至棋盤中心,此後每一方需要放兩個棋子的回合中,他所放的每一個棋子都要滿足以下條件:
</p>這樣只限制後面的規則描述適用於「需要放兩個棋子的回合」,不會把後手方最後只放一子的回合錯誤包含進去。
在中文「落子規則」末尾增加新規則
找到中文落子規則最後的第 6 條:
html
<p>
6,當兩手棋落下之後,其中一個棋子跟場上已有棋子或者這兩個棋子形成了可計分的頂鑫結構,則允許這兩手棋不落在同一個「對方棋子」上。
</p>
<h2 style="color: #7289da">計分規則</h2>替換為:
html
<p>
6,當兩手棋落下之後,其中一個棋子跟場上已有棋子或者這兩個棋子形成了可計分的頂鑫結構,則允許這兩手棋不落在同一個「對方棋子」上。
</p>
<p>先手方的最後一個回合也要保證後手方的最後一手棋能合規落下。</p>
<h2 style="color: #7289da">計分規則</h2>二、相應更新英文「Placement Rules」
修改英文適用回合的描述
搜尋以下原代碼:
html
<p>
The first player places their first piece at the center of the board. On all subsequent turns, every piece
placed by a player must satisfy the following conditions:
</p>替換為:
html
<p>
The first player places their first piece at the center of the board. On all subsequent turns in which a player
is required to place two pieces, every piece placed by that player must satisfy the following conditions:
</p>這與中文的「此後每一方需要放兩個棋子的回合中」相對應。
在英文「Placement Rules」末尾增加相應規則
找到英文落子規則最後一段:
html
<p>
Exception: After both pieces have been placed, if either piece forms a scoring Bracing TriGolden Structure
with existing pieces on the board or with the two newly placed pieces themselves, the two pieces are
permitted to align with different opponent pieces.
</p>
<h2>Scoring Rules</h2>替換為:
html
<p>
Exception: After both pieces have been placed, if either piece forms a scoring Bracing TriGolden Structure
with existing pieces on the board or with the two newly placed pieces themselves, the two pieces are
permitted to align with different opponent pieces.
</p>
<p>
On the first player's final turn, they must also ensure that the second player's final piece can be placed
legally.
</p>
<h2>Scoring Rules</h2>這裡使用 final piece 對應中文的「最後一手棋」,避免誤解為後手方的整個最後回合。
三、更改下載功能「動畫」中的棋子數量觸發時間
現有問題
在函數:
javascript
function appendDownloadRollingTextGroup({ status, id, x, fontSize, history, events, direction })中,分數和棋子數量目前共用以下時間:
javascript
begin: `bt${event.turn}.begin+1s`因此棋子數量會在 bt(n).begin 後一秒才開始變化。
要求是:
- 棋子數量:在
bt(n).begin時開始變化。 - 分數:保持目前的
bt(n).begin+1s。 - 不更改棋子出現、計分、環路、鏡頭或回合分組的時間。
精確替換代碼
在 appendDownloadRollingTextGroup() 中找到:
javascript
events.forEach(event => {
const moveY = direction === 'score' ? 60 * event.m : -60 * event.m;
const animation = createDownloadSvgElement('animateTransform', {
attributeName: 'transform',
attributeType: 'XML',
type: 'translate',
to: `0,${moveY}`,
dur: '1s',
fill: 'freeze',
begin: `bt${event.turn}.begin+1s`
});
group.appendChild(animation);
});完整替換為:
javascript
events.forEach(event => {
const moveY = direction === 'score' ? 60 * event.m : -60 * event.m;
/*
* 棋子數量在該回合 bt(n).begin 時開始滾動;
* 分數仍在回合中段 bt(n).begin+1s 時更新。
*/
const animationBegin =
direction === 'count' ? `bt${event.turn}.begin` : `bt${event.turn}.begin+1s`;
const animation = createDownloadSvgElement('animateTransform', {
attributeName: 'transform',
attributeType: 'XML',
type: 'translate',
to: `0,${moveY}`,
dur: '1s',
fill: 'freeze',
begin: animationBegin
});
group.appendChild(animation);
});也可以做最小化修改,只把:
javascript
begin: `bt${event.turn}.begin+1s`替換成:
javascript
begin: direction === 'count' ? `bt${event.turn}.begin` : `bt${event.turn}.begin+1s`但完整版本更容易維護,也明確保證分數動畫時間不變。
修改後的動畫時序
| 動畫內容 | 修改前 | 修改後 |
|---|---|---|
| 棋子開始出現 | bt(n).begin | 不變 |
| 棋子數量開始滾動 | bt(n).begin+1s | bt(n).begin |
| 分數開始滾動 | bt(n).begin+1s | 不變 |
| 頂鑫環顯示 | bt(n).begin+1s | 不變 |
| 白點移動 | 原有時間 | 不變 |
| 鏡頭移動及縮放 | 原有時間 | 不變 |
以上修改不需要變更 buildDownloadAnimationTimeline() 中的 countEvents 或 scoreEvents,也不要移動正式遊戲內扣除 piecesCount 的位置;否則才可能影響棋局流程。