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?
1. 缺陷概述 (Issue Summary)
在当前网页端实现中,女巫的 闪电 (Lightning, Skill ID: 49) 与 连锁闪电 (Chain Lightning, Skill ID: 53) 投射物在视觉呈现上存在明显的表现力不足:
2. Diablo II v1.13c Ground Truth 权威数据与渲染机制分析
严格遵循暗黑破坏神 II v1.13c 官方数据表(
Skills.txt,Missiles.txt)及底层动画实现机制:2.1
Missiles.txt权威字段定义lightningbolt(ID: 98):CelFile:null(主控投射物本身逻辑上无单帧外观,而是作为轨迹发生器)Vel:30(速度 750 px/s),Range:25(最大飞行 25 帧 = 750px)pCltDoFunc:8(核心客户端运动/渲染函数)CltParam1:3(Subloops = 3,每次循环生成 3 组子片段)CltSubMissile1:lightninghit(ID: 99)(尾迹子投射物)chainlightning(ID: 93):CelFile:LightningStrikeVel:30,Range:25pCltDoFunc:8,CltParam1:3,CltSubMissile1:lightninghitlightninghit(ID: 99):CelFile:LightningStrike(32 方向 DCC 动画)Range:12(每个子片段在原地留存 12 帧,即近 0.5 秒)AnimLen:8,AnimSpeed:16,LoopAnim:1,SubLoop:1,SubStop:7Trans:1(加法半透明高亮渲染)2.2 原版长电光视觉形成原理
pCltDoFunc = 8在弹头推进路径上密集生成lightninghit(LightningStrike) 节段;3. 当前代码根因剖析 (Root Cause Analysis)
3.1 投射物数据模型仅保留单一质点
在
src/scene/act-scene.ts(第 2108–2131 行 及 2216–2230 行):(x, y),既没有轨迹历史缓冲区,也没有子投射物尾迹队列。3.2 渲染管线仅绘制单一 Sprite 切片
在
src/scene/act-scene.ts的drawMissileProjectile(第 4337–4346 行):LightningStrike纹理的一帧有效像素仅约 112×79px。(shot.x, shot.y)处绘制这单一的一张 112px 小图,随着它以 750px/s 的速度向前移动,后方没有任何残留渲染,导致玩家看到的仅仅是一个孤零零的 100px 小飞镖,而非一条长电光。4. 修复方案设计 (Proposed Architecture & Implementation Plan)
4.1 方案 A:轨迹多节段采样与长电弧渲染(推荐,高效零垃圾回收)
lightningbolt与chainlightning,根据当前弹头的行进距离(从起点(startX, startY)到当前位置(shot.x, shot.y),或维护trailSegments: Array<{x, y, age}>):LightningStrike纹理的有效跨度)沿弹道反向铺设连续节段;dccDir(32 方向之一);4.2 连锁闪电 (Chain Lightning) 跨目标完整电弧连接
4.3 验证方案 (Verification Plan)
Verification & Resolution Summary for Issue #434
1. Root Cause & 1.13c Ground Truth Parity Implementation
pCltDoFunc = 8,CltParam1 = 3): ImplementedLightningTrailManagerinsrc/render/missile-renderer.ts. For each 30px projectile step oflightningbolt(Skill #49) andchainlightning(Skill #53), 3 sub-segment slices oflightninghitare linearly interpolated along the step vector (10px spacing).CltParam2 = 16): Each slice applies random lateral jitter bounded strictly within[-8, +8]px orthogonal to the flight trajectory.Range = 12,SubLoop = 1,SubStop = 7): Slices randomize their starting frame in0..7, loop through frames1..7, and persist for 12 ticks (480ms) with additive blending (Trans = 1).LIGHTNINGBOLT_METAandLIGHTNING_METAinsrc/render/missiles-meta.ts, registered inMISSILE_METAS, and addedlightninghit(ID 99) toCANONICAL_113C_MISSILESandisHarmlessEmitterinsrc/game/skills.ts.2. Verification Results
npm run typecheck(tsc --noEmit): 0 errors.tests/skills/sor/issue-434-lightning-trail.test.ts: 14/14 tests passed.skill-049-lightning.test.ts,skill-053-chain-lightning.test.ts,issue-433-thunder-storm-visuals.test.ts: 55/55 passed (total 69/69 passed).3. Commit & Delivery
a3f5013fix(skill): restore Lightning and Chain Lightning continuous beam and arc visuals (Fixes #434)origin main.