[P0][D05] 删除 rollDrop 合成掉落死代码路径 #414

Closed
opened 2026-09-24 03:25:57 +00:00 by troytt · 1 comment
Owner

现状

src/game/engine.ts:896-914 保留了一条 else if (this.opts.itemBases && this.opts.itemBases.length > 0)
分支,调用 items.ts 的合成掉落 rollDrop(...),参数是编造的
{ level: player.level + 2, dropChance: 0.8, goldChance: 0.3, goldRange: [5, 40] }。

这些数字与 1.13c 毫无关系。M10 的 #107 已经宣告「用 TC 树替换 rollDrop」,但旧路径并未删除。

验收标准

  • 删除 engine.ts 中的 rollDrop 分支。
  • 删除 src/game/items.ts 中的 rollDrop 及其仅服务于它的 demo 类型 / 常量。
  • 清理 EngineOptions 中随之失效的 itemBases / prefixAffixes / suffixAffixes(若无其他消费者)。
  • 更新所有引用该路径的测试为真实 TC 管线。
  • npx tsc --noEmit + npm test + npm run build 零错误;确认产物体积下降。
## 现状 `src/game/engine.ts:896-914` 保留了一条 `else if (this.opts.itemBases && this.opts.itemBases.length > 0)` 分支,调用 `items.ts` 的合成掉落 `rollDrop(...)`,参数是编造的 `{ level: player.level + 2, dropChance: 0.8, goldChance: 0.3, goldRange: [5, 40] }`。 这些数字与 1.13c 毫无关系。M10 的 #107 已经宣告「用 TC 树替换 rollDrop」,但旧路径并未删除。 ## 验收标准 - [ ] 删除 `engine.ts` 中的 `rollDrop` 分支。 - [ ] 删除 `src/game/items.ts` 中的 `rollDrop` 及其仅服务于它的 demo 类型 / 常量。 - [ ] 清理 `EngineOptions` 中随之失效的 `itemBases` / `prefixAffixes` / `suffixAffixes`(若无其他消费者)。 - [ ] 更新所有引用该路径的测试为真实 TC 管线。 - [ ] `npx tsc --noEmit` + `npm test` + `npm run build` 零错误;确认产物体积下降。
troytt added this to the [M18] 打怪掉落物品:怪物死亡掉落全链路 1.13c 还原 milestone 2026-09-24 03:25:57 +00:00
Author
Owner

Resolution Summary (Issue #414 — Commit 9022579)

  • Deleted legacy synthetic rollDrop, DropOptions, and DropResult from src/game/items.ts and src/game/engine.ts.\n- Migrated tests/items.test.ts, tests/m5.test.ts, and scripts/verify-m5.ts to canonical item creation.

  • Verification: npx tsc --noEmit (0 errors), full Vitest drop/combat/item/E2E parity suites (100% pass), and scripts/verify-m5.ts / scripts/verify-net.ts (0 problems).

### Resolution Summary (Issue #414 — Commit `9022579`) - Deleted legacy synthetic `rollDrop`, `DropOptions`, and `DropResult` from `src/game/items.ts` and `src/game/engine.ts`.\n- Migrated `tests/items.test.ts`, `tests/m5.test.ts`, and `scripts/verify-m5.ts` to canonical item creation. - **Verification**: `npx tsc --noEmit` (0 errors), full Vitest drop/combat/item/E2E parity suites (100% pass), and `scripts/verify-m5.ts` / `scripts/verify-net.ts` (0 problems).
Sign in to join this conversation.
No Label
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: troytt/diablo2-web#414
No description provided.