品质可用性判定未使用 ItemTypes.txt 标志(戒指/护身符可掉出 Cracked/Superior) #127

Closed
opened 2026-09-19 09:53:33 +00:00 by troytt · 1 comment
Owner

问题描述 (Issue A2)

  • src/game/drop-pipeline.ts 中 canHaveQuality 使用硬编码白名单 (weapon, armor, rin, amu, jew, cm1..3),且调用 rollItemQuality 时未传入 ItemTypes.txt 的 normal、magic、rare 标志。
  • 在 Diablo II 1.13c 中(D2Game!6FC2FC40 + ItemTypes.txt):
    1. normal === true 的类型(如药水、卷轴、符文、宝石、箭矢等)只能为 normal 品质。
    2. magic === true 的类型(如 ring, amul, char/scha/mcha/lcha, jewl 等)最低品质就是 Magic,绝不会 roll 出 superior、normal 或 low(即不可能存在 Cracked Ring 或 Superior Amulet)。
    3. rare === false 的类型(如护身符 char)在 rollItemQuality 中 allowRare 应为 false(或在降级时跳过 rare)。
    4. 职业专属物品(ItemTypes.txt 的 class 列非空,或 isA 继承自职业专属类型)在 rollItemQuality 时应传入 classSpecific: 1 以匹配 ItemRatio.txt 的 Class Specific 行。

解决方案

  1. 在 src/game/drop-pipeline.ts 新增辅助函数 resolveItemTypeFlags(base, itemTypes, isA),通过 ItemTypes.txt(含 equiv1/equiv2 父类型继承)解析 { isNormalOnly, isAlwaysMagic, canBeRare, isClassSpecific }。
  2. 在 executeDropPipeline 中用 resolveItemTypeFlags 驱动 rollItemQuality 参数(allowRare, allowSuperior, classSpecific),并对 isAlwaysMagic 类型在 rollItemQuality 返回 'normal' | 'low' | 'superior' 时兜底提升为 'magic'。
  3. 在 tests/parity-1.13c.test.ts 新增回归测试,验证戒指、项链、护身符、珠宝在大样本及低 ilvl/0 MF 下永远不会产出 normal / superior / low 品质,且职业专属装备正确命中 classSpecific: 1。
## 问题描述 (Issue A2) - `src/game/drop-pipeline.ts` 中 `canHaveQuality` 使用硬编码白名单 (`weapon`, `armor`, `rin`, `amu`, `jew`, `cm1..3`),且调用 `rollItemQuality` 时未传入 `ItemTypes.txt` 的 `normal`、`magic`、`rare` 标志。 - 在 Diablo II 1.13c 中(`D2Game!6FC2FC40` + `ItemTypes.txt`): 1. `normal === true` 的类型(如药水、卷轴、符文、宝石、箭矢等)只能为 `normal` 品质。 2. `magic === true` 的类型(如 `ring`, `amul`, `char`/`scha`/`mcha`/`lcha`, `jewl` 等)**最低品质就是 Magic**,绝不会 roll 出 `superior`、`normal` 或 `low`(即不可能存在 `Cracked Ring` 或 `Superior Amulet`)。 3. `rare === false` 的类型(如护身符 `char`)在 `rollItemQuality` 中 `allowRare` 应为 `false`(或在降级时跳过 `rare`)。 4. 职业专属物品(`ItemTypes.txt` 的 `class` 列非空,或 `isA` 继承自职业专属类型)在 `rollItemQuality` 时应传入 `classSpecific: 1` 以匹配 `ItemRatio.txt` 的 `Class Specific` 行。 ## 解决方案 1. 在 `src/game/drop-pipeline.ts` 新增辅助函数 `resolveItemTypeFlags(base, itemTypes, isA)`,通过 `ItemTypes.txt`(含 `equiv1`/`equiv2` 父类型继承)解析 `{ isNormalOnly, isAlwaysMagic, canBeRare, isClassSpecific }`。 2. 在 `executeDropPipeline` 中用 `resolveItemTypeFlags` 驱动 `rollItemQuality` 参数(`allowRare`, `allowSuperior`, `classSpecific`),并对 `isAlwaysMagic` 类型在 `rollItemQuality` 返回 `'normal' | 'low' | 'superior'` 时兜底提升为 `'magic'`。 3. 在 `tests/parity-1.13c.test.ts` 新增回归测试,验证戒指、项链、护身符、珠宝在大样本及低 ilvl/0 MF 下永远不会产出 `normal` / `superior` / `low` 品质,且职业专属装备正确命中 `classSpecific: 1`。
Author
Owner

Fixed in commit a618ed7 (merged into main). Verified with tests/parity-1.13c.test.ts (8 passed) and tests/drop-pipeline.test.ts (19 passed).

Fixed in commit a618ed7 (merged into main). Verified with tests/parity-1.13c.test.ts (8 passed) and tests/drop-pipeline.test.ts (19 passed).
Sign in to join this conversation.
No Label
No Milestone
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#127
No description provided.