refactor(starpuff): W3 前置債務車——enemyUpdates 依品種家族分檔(1188→201 行) - #929
Merged
Conversation
- 空 commit 活性錨:enemyUpdates.ts 拆分(1172 → ≤850 行)開工 - 純結構重構,行為零改變 測試:無(空 commit 活性錨) Co-authored-by: Cursor <cursoragent@cursor.com>
- enemyUpdates.ts 逼近 1200 行硬閘(1172 行):依品種家族機械式複製出四模組—— groundEnemies(地面走動/定點據點:shelly/drilly/spora/boomy/bubbla/splatta/chompy)、 flyerEnemies(飛行漂浮:glowy/gusty/twinkla/cometa/zappy)、 fieldEnemies(場域機制:magno/mirri——W3 鏡界/引力小怪落點)、 enemyWindupRing(windup 預警圈共用件) - 本段舊路徑仍在(enemyUpdates.ts 未動),下一段切 wiring——git 史可驗兩段式 - 新模組 characterization 測試 36 案:真 FSM 時序驅動,鎖復速方向、telegraph 定身、hazards 生成原點/節拍、半入地壓扁、預警圈生命週期;禁硬編色碼 測試:pnpm --filter @app/starpuff typecheck 通過;vitest run 新增 4 檔 36 案全綠 Co-authored-by: Cursor <cursoragent@cursor.com>
- enemyUpdates.ts 1172 → 207 行:移除已搬移的 per-kind update 本體與常數, 保留 EnemyUpdateContext 契約、§16 基礎品種內聯(jelly/floaty/spiky/puffy) 與 updateEnemyKind 單一分派點(never 窮舉不變) - zappy 內聯 case 改呼叫 flyerEnemies.updateZappy(機械式抽出) - enemies.ts import 重接:CHOMPY_BITE_MS/SHELLY_* 常數改自 groundEnemies 取得 - 行為零改變:既有測試零修改全綠;windup ring 共用件歸 enemyWindupRing.ts 測試:pnpm --filter @app/starpuff typecheck 通過;pnpm --filter @app/starpuff test 89 檔 1205 案全綠(既有 1169 案零修改+新模組 36 案) Co-authored-by: Cursor <cursoragent@cursor.com>
- 002 單一聚合條目 reward-starpuff-w3prep-enemyupdates-split:檔頭 +1(累計 +329→+330) - changeset:patch(純結構重構,玩家零可感知差異) - 三重證據:--color-moved 1001 行搬移/57 行僅 import 與簽名;1205 案全綠 (既有 1169 案零修改);L21/L23 audit ×7 靜態軸全等、clearRate 兩側 7/7 測試:node scripts/verify-002-log.mjs 通過;pnpm --filter @app/starpuff test 全綠 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
- 依 wc -l 實測訂正:base 1188(原誤植 1172)、HEAD 201(原誤植 207), 1200 閘餘裕 28→12 行;檔頭記分不動(純內文精確性修正路徑) - 雙席審查(Sonnet 98/97、Grok 98/96)唯一共同 LOW 收斂項 測試:node scripts/verify-002-log.mjs 通過(檔頭未動+零新增條目走內文修正路徑) Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
W3 前置債務車:
enemyUpdates.ts1188 行逼近max-lines1200 硬閘(餘裕僅 12 行),W3 落地 L26 Reflector(鏡界館長)/L28 Gravion(引力侯爵)新小怪 update 邏輯必撞閘。本 PR 行為零改變地把 per-kind update 本體依品種家族機械式分檔,主檔 1188 → 201 行(要求 ≤850,對 1200 閘餘裕 999 行)。沿用 #807(GameScene 2121→1196)與 #906(GameScene 1180→875)兩次成功先例的方法:機械搬移+新模組單元測試+既有回歸套件不變三重證據鏈,並依 AGENTS.md v5.7 採兩段式 commit(①新模組+測試、舊路徑仍在 → ②切 wiring),git 史可證。
拆分前後行數對照
enemyUpdates.tsgroundEnemies.tsflyerEnemies.tsfieldEnemies.tsenemyWindupRing.tsenemies.ts模組清單與職責
enemyUpdates.ts:EnemyUpdateContext契約(對外 import 路徑不變)+updateEnemyKind單一分派點(never窮舉不變)+§16 基礎品種內聯(jelly/floaty/spiky/puffy)。groundEnemies.ts:地面走動/定點據點系——shelly、drilly、spora、boomy、bubbla、splatta、chompy。flyerEnemies.ts:飛行漂浮系——glowy、gusty、twinkla、cometa、zappy(自分派器內聯 case 機械抽出)。fieldEnemies.ts:場域機制系——magno(磁場)、mirri(鏡面);W3 鏡界(L26)/引力(L28)家族小怪 update 的預定落點。enemyWindupRing.ts:windup 預警圈共用件(WindupRingSpec/updateWindupRing/clearWindupRing);ring spec 常數隨消費者模組持有。切點與派工建議的差異說明
派工建議四組(走動/飛行/水潮/特殊機制);實際落地三組+共用件:水/潮系現役僅 bubbla(foamy/manta/frosty 已在
finaleEnemies.ts),單獨成檔過度碎片化——bubbla 與 spora 同屬「定點據點怪」語彙,併入地面系;W4 若擴水系再析出。#914的enemyFacing.ts完全未動——家族模組僅 import 其三個 helper,DIRECTIONAL 分類與表驅動守門原樣生效;enemies.spawn單一重建點契約不變(生成/傷害/回收/池衛生全數留在enemies.ts)。三重證據
① 機械搬移 diff 逐字可驗(最高權重)
git diff --color-moved=plain --color-moved-ws=allow-indentation-change 022db08b7..HEAD(5 個 source 檔,不含測試):export function簽名(對應舊function簽名在刪除側)、zappy 分派呼叫;零邏輯行enemyUpdates.ts未動;commit ②(2bcf75a1)僅切 wiring(-1007/+22)② 既有測試零修改全綠
git diff 022db08b7..HEAD -- '**/*.test.ts':僅新增 4 檔(+839 行),既有測試檔 0 修改 0 放寬pnpm --filter @app/starpuff test:89 檔 1205 案全綠(既有 1169 案+新模組 characterization 36 案)pnpm typecheck(全 workspace)、prettier --check、eslint(含max-lines1200 閘)、pnpm --filter @app/starpuff build全數通過enemies.ts)、禁 emoji、禁硬編 854、座標經 rotation.pointerToLocal(本 diff 不涉指標處理)③ level-audit 抽驗(走動關 ×2:L21 星港集散地/L23 冰晶潮灣)
L21 混編 drilly/chompy/boomy/glowy(搬移品種)+cargo/ticketa/scanna;L23 混編 spora/bubbla/chompy(搬移品種)+frosty/foamy/manta——兩關合計覆蓋三個新家族模組。
檔案層前提:
git diff 022db08b7..HEAD -- apps/starpuff/src/game/logic/為空(靜態軸輸入零改動)。實測(mid bot、serialized ×7 輪、兩側同協定):
靜態軸兩側全等;clearRate 為 bot 觀測值(僅觀測不作裁決真值,AGENTS.md v5.7)。
002 與 changeset
reward-starpuff-w3prep-enemyupdates-split,檔頭 +1 → 累計 +330