[P1][D13] 掉落落点改用 findSafeDropPosition 的网格螺旋扫描 #422

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

现状

src/game/engine.ts:889 使用 findIsometricDropPosition:基于像素偏移
(di - dj) * stepX 的欧氏散布 + 朴素 this.terrain.overlap 判定。

而 src/game/ground-items.ts 中已经存在正确实现 findSafeDropPosition,却没有被怪物掉落路径调用。

1.13c 真实行为

D2Common.dll 的 ITEM_Drop 以尸体所在 subtile 为中心做网格象限螺旋扫描,
逐格要求目标 subtile 为 COLLIDE_NONE,找到第一个空格即放置;
同一 subtile 不叠放两件物品。这与项目规则「稀疏/空白格必须完全阻挡
(COLLIDE_MASK_INVALID / COLLIDE_BLANK | COLLIDE_WALL)」一致。

验收标准

  • 怪物掉落改用 findSafeDropPosition,按 COLLIDE_WALL | COLLIDE_MASK_INVALID 判定。
  • 保证同一 subtile 不叠放;螺旋扫描顺序与 1.13c 象限顺序一致。
  • 若评估后 findIsometricDropPosition 已无消费者则删除。
  • vitest:墙角/狭窄走廊/水域边缘处一次掉 8 件,断言全部落在可行走且互不重叠的 subtile 上。
  • 无头浏览器验证:无物品卡进墙体或掉进 void。
## 现状 `src/game/engine.ts:889` 使用 `findIsometricDropPosition`:基于像素偏移 `(di - dj) * stepX` 的欧氏散布 + 朴素 `this.terrain.overlap` 判定。 而 `src/game/ground-items.ts` 中已经存在正确实现 `findSafeDropPosition`,却没有被怪物掉落路径调用。 ## 1.13c 真实行为 `D2Common.dll` 的 `ITEM_Drop` 以尸体所在 subtile 为中心做**网格象限螺旋扫描**, 逐格要求目标 subtile 为 `COLLIDE_NONE`,找到第一个空格即放置; 同一 subtile 不叠放两件物品。这与项目规则「稀疏/空白格必须完全阻挡 (`COLLIDE_MASK_INVALID` / `COLLIDE_BLANK | COLLIDE_WALL`)」一致。 ## 验收标准 - [ ] 怪物掉落改用 `findSafeDropPosition`,按 `COLLIDE_WALL | COLLIDE_MASK_INVALID` 判定。 - [ ] 保证同一 subtile 不叠放;螺旋扫描顺序与 1.13c 象限顺序一致。 - [ ] 若评估后 `findIsometricDropPosition` 已无消费者则删除。 - [ ] vitest:墙角/狭窄走廊/水域边缘处一次掉 8 件,断言全部落在可行走且互不重叠的 subtile 上。 - [ ] 无头浏览器验证:无物品卡进墙体或掉进 void。
troytt added this to the [M18] 打怪掉落物品:怪物死亡掉落全链路 1.13c 还原 milestone 2026-09-24 03:25:58 +00:00
Author
Owner

Resolution Summary (Issue #422 — Commit 9022579)

  • Upgraded findSafeDropPosition in src/game/ground-items.ts and src/game/engine.ts to scan discrete isometric collision-grid quadrant spirals grounded on walkable floor sub-tiles (COLLIDE_NONE) with anti-stacking coordinate tracking.

  • 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 #422 — Commit `9022579`) - Upgraded `findSafeDropPosition` in `src/game/ground-items.ts` and `src/game/engine.ts` to scan discrete isometric collision-grid quadrant spirals grounded on walkable floor sub-tiles (`COLLIDE_NONE`) with anti-stacking coordinate tracking. - **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#422
No description provided.