From 15948eb8962c7fd38a90bfe902cc992258d9cc25 Mon Sep 17 00:00:00 2001 From: troytt <47798984@qq.com> Date: Wed, 23 Sep 2026 06:14:11 +0000 Subject: [PATCH] fix(skills): remove translucent solid light boxes during cast overlay animation (#386, #395) --- src/scene/act-scene.ts | 39 ++++++--------------------------- tests/cast-overlay-113c.test.ts | 2 ++ 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/src/scene/act-scene.ts b/src/scene/act-scene.ts index b820179..9aefc6a 100644 --- a/src/scene/act-scene.ts +++ b/src/scene/act-scene.ts @@ -3792,44 +3792,15 @@ export async function loadOverlayArtMap( * Render a Diablo II 1.13c character cast overlay effect: * - Uses authentic baked DCC sprite atlas with additive blending (Trans === 3) when available. * - Respects frame anchorX and anchorY offsets to align with caster's origin. - * - Projects a dynamic point light with authentic 1.13c light colors and radius. * - Falls back to procedural magic glow in test/offline environments. + * - Dynamic lighting/light mask rendering deferred to issue #395. */ export function drawCastOverlay( renderer: SpriteRenderer, overlay: ActiveOverlay, overlayArt?: LoadedOverlayArt, ): void { - // 1. Dynamic point light halo (1.13c colors & radius) - const [r255, g255, b255] = overlay.lightColor - const r = r255 / 255 - const g = g255 / 255 - const b = b255 / 255 - const radius = overlay.lightRadius > 0 ? overlay.lightRadius * 5 : 45 - const progress = Math.min(1, Math.max(0, overlay.frame / overlay.maxFrames)) - const intensity = Math.sin(progress * Math.PI) * 0.35 + 0.15 - - if (intensity > 0.01) { - renderer.drawSolid( - overlay.x - radius, - overlay.y - radius, - radius * 2, - radius * 2, - [r, g, b, intensity * 0.25], - { blendMode: 'additive' }, - ) - const coreRadius = radius * 0.5 - renderer.drawSolid( - overlay.x - coreRadius, - overlay.y - coreRadius, - coreRadius * 2, - coreRadius * 2, - [r, g, b, intensity * 0.5], - { blendMode: 'additive' }, - ) - } - - // 2. Sprite animation with additive blending + // 1. Sprite animation with additive blending if (overlayArt !== undefined) { const frameCount = Math.max(1, overlayArt.meta.framesPerDirection || overlayArt.meta.frames) const frameIndex = Math.min(Math.max(0, Math.floor(overlay.frame)), frameCount - 1) @@ -3844,7 +3815,11 @@ export function drawCastOverlay( } } - // 3. Fallback procedural representation in test/offline environments + // 2. Fallback procedural representation in test/offline environments + const [r255, g255, b255] = overlay.lightColor + const r = r255 / 255 + const g = g255 / 255 + const b = b255 / 255 const fallbackRadius = 16 renderer.drawSolid( overlay.x - fallbackRadius, diff --git a/tests/cast-overlay-113c.test.ts b/tests/cast-overlay-113c.test.ts index 7d84550..9919f35 100644 --- a/tests/cast-overlay-113c.test.ts +++ b/tests/cast-overlay-113c.test.ts @@ -522,6 +522,8 @@ describe('Issue #386 — Diablo II v1.13c Cast Overlay Parity', () => { drawCastOverlay(rendererMock as any, overlay, dummyArt) expect(draws.length).toBe(1) + // Verify no residual translucent solid boxes are drawn when overlay art is rendered + expect(solids.length).toBe(0) const drawCall = draws[0]! expect(drawCall.options.blendMode).toBe('additive')