feat(tooltip/stats): 武器与防具基础属性增强显示(支持ED%/需求增减及原始底模对照展示) #123
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/boss.ts与src/game/item-tooltip.ts)中:One-Hand Damage/Two-Hand Damage)仅直接读取装备底模基准值(base.mindam/base.maxdam),未根据词缀中的增强伤害百分比(dmg%/ Enhanced Damage)及额外最小/最大伤害(dmg-min,dmg-max)动态计算武器的真实面板物理伤害。Defense)未根据增强防御百分比(ac%/ Enhanced Defense)与附加平面防御(ac)计算实际防御力。Required Strength/Required Dexterity)未考虑需求减免词缀(如ease/Requirements -X%,如镶嵌 15 号 Hel 符文或带有 of Simplicity 词缀);需求等级未综合底模与词缀的levelreq进行正确取大计算。暗黑2 1.13c 原版规范 (Ground Truth)
在暗黑2 1.13c 官方引擎规范(
D2Common.dll)中:baseMin,baseMaxtotalEd = sum(dmg%)flatMin = sum(dmg-min),flatMax = sum(dmg-max)finalMin = Math.floor(baseMin * (1 + totalEd / 100)) + flatMinfinalMax = Math.floor(baseMax * (1 + totalEd / 100)) + flatMax(若finalMin >= finalMax,则finalMax = finalMin + 1)Two-Hand Damage: 36 to 48 (18 to 24)。ac%(Enhanced Defense),底模防御基准值取base.maxac + 1。finalDef = Math.floor(baseDef * (1 + totalAcPct / 100)) + flatAc。Defense: 260 (130)。finalReqStr = Math.max(0, Math.floor(base.reqstr * (1 - easePct / 100)))。finalReqDex = Math.max(0, Math.floor(base.reqdex * (1 - easePct / 100)))。Required Strength: 125 (156)。待实现功能清单 (TODOs)
src/game/item-tooltip.ts中实现computeItemEnhancedStats(item: Item),解析统计dmg%,dmg-min,dmg-max,ac%,ac,ease。FormattedItemTooltip结构,携带isEnhanced、增强后数值与原始底模数值。src/boss.ts的renderSingleItemCard中支持增强属性与原始属性的并列显示(如Two-Hand Damage: 36 to 48 (18 to 24),其中增强数值用暗黑原版魔法高亮色展示)。修复完成并验证通过 (Commit
f68b1de)finalMin = Math.floor(baseMin * (100 + totalEdPct) / 100) + flatMin,finalMax = Math.floor(baseMax * (100 + totalEdPct) / 100) + flatMax,展示为Two-Hand Damage: 36 to 48 (18 to 24)。finalDef = Math.floor(baseDef * (100 + totalAcPct) / 100) + flatAc,展示为Defense: 260 (130)。finalReq = Math.max(0, Math.floor(baseReq * (100 + easeSigned) / 100)),展示为Required Strength: 124 (156)。dur/dur%增强对照,展示为Durability: 258 of 258 (86)。tests/item-tooltip-123-125.test.ts与生产构建验证通过。