fix: preserve rpg custom world detail profiles

This commit is contained in:
kdletters
2026-05-22 03:14:11 +08:00
parent a9d23a8a44
commit d74457faa2
19 changed files with 2726 additions and 109 deletions

View File

@@ -7,7 +7,10 @@ import {
type Encounter,
type SceneHostileNpc,
} from '../../types';
import { GameCanvasEntityLayer } from './GameCanvasEntityLayer';
import {
GameCanvasEntityLayer,
getCombatFloatingNumberPresentation,
} from './GameCanvasEntityLayer';
import {
CHARACTER_COMBAT_HP_TOP_PX,
ENTITY_CONTAINER_REM,
@@ -125,6 +128,21 @@ function renderEntityLayer(effectNpcId: string | null) {
}
describe('GameCanvasEntityLayer', () => {
it('keeps combat floating numbers readable on dark noisy battle backgrounds', () => {
const damage = getCombatFloatingNumberPresentation(false);
const healing = getCombatFloatingNumberPresentation(true);
expect(damage.toneClass).toContain('bg-rose-950/72');
expect(damage.toneClass).toContain('text-rose-50');
expect(damage.textStyle.WebkitTextStroke).toContain('rgba(127, 29, 29');
expect(damage.textStyle.textShadow).toContain('rgba(0, 0, 0');
expect(healing.toneClass).toContain('bg-emerald-950/70');
expect(healing.toneClass).toContain('text-emerald-50');
expect(healing.textStyle.WebkitTextStroke).toContain('rgba(6, 78, 59');
expect(healing.textStyle.textShadow).toContain('rgba(0, 0, 0');
});
it('uses mirrored stage anchors for player and opponent containers', () => {
expect(getMirroredStageEntityLeft('15%', 'player')).toBe('15%');
expect(getMirroredStageEntityLeft('15%', 'opponent')).toBe(`calc(100% - 15% - ${ENTITY_CONTAINER_REM}rem)`);