[P0][D04] 移除 engine.ts 掉落静默兜底(Act 1 H2H A / player.level + 2),改为 fail-fast #413
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: troytt/diablo2-web#413
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
现状
src/game/engine.ts在掉落入口处用魔法常量掩盖数据查找失败:两处都直接违反项目规则「禁止
if (!libraries) return true式宽容兜底,缺失参数必须 fail fast」。player.level + 2更是把怪物掉落等级替换成了玩家等级,ilvl / TC 上限双双错位。1.13c 真实行为
引擎不会在掉落循环中现编 TC 数据。合法的降级只发生在品质约束失败时
(例如 Unique 无可用条目 → 降 Rare 且 durability ×3,Set → 降 Magic 且 ×2),
这部分
drop-pipeline.ts已正确实现。参数缺失属于数据错误,不是可降级场景。验收标准
tcName = 'Act 1 H2H A'兜底;tcName无法从superUniques/monsterKinds解析时抛出带subjectId/difficulty/monsterType上下文的错误。?? (player.level + 2);event.monsterLevel缺失即抛错。kill事件契约固化:monsterLevel/subjectId/monsterType改为必填字段(类型层面强制)。subjectId不在monsterKinds中的 kill 事件,断言tick()抛错而非静默掉落。依赖
D01、D02(必须先有真实数据,否则 fail-fast 会让游戏无法运行)。
Resolution Summary (Issue #413 — Commit
9022579)Removed permissive
Act 1 H2H Aandplayer.level + 2fallbacks insrc/game/engine.ts.\n- Enforced strict fail-fast validation on missing/invalidmonsterLevel, unknown monsters, and unresolvable/unregistered TCs while preserving 0-drop handling for authentic non-dropping entities.\n- Verified intests/fail-fast-drop.test.ts.Verification:
npx tsc --noEmit(0 errors), full Vitest drop/combat/item/E2E parity suites (100% pass), andscripts/verify-m5.ts/scripts/verify-net.ts(0 problems).