Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ import { describe, expect, it } from 'vitest';
import { MONSTER_TEMPLATES_REDUX } from './monsterTemplatesRedux';

describe('MONSTER_TEMPLATES_REDUX', () => {
it('renders Giant Spider with the spider template instead of the crystal elemental art', () => {
it('renders Giant Spider with GLB model and canvas fallback', () => {
const giantSpider = MONSTER_TEMPLATES_REDUX.find((template) => template.name === 'Giant Spider');

expect(giantSpider).toBeDefined();
expect(giantSpider?.draw.name).toBe('drawPhaseSpiderRedux');
expect(giantSpider?.dynamic).toBe(true);
expect(giantSpider?.draw.name).toBe('drawGLBCreature');
});

it('uses dedicated dark cave monster art instead of stand-in templates', () => {
const expectations = new Map([
['Skeleton', 'drawSkeletonRedux'],
['Goblin Shaman', 'drawGoblinShamanRedux'],
// GLB-backed creatures use makeGLBDrawFn wrapper (dynamic: true)
const glbCreatures = ['Skeleton', 'Goblin Shaman', 'Bugbear'];
for (const name of glbCreatures) {
const template = MONSTER_TEMPLATES_REDUX.find((entry) => entry.name === name);
expect(template, `${name} template should exist`).toBeDefined();
expect(template?.dynamic, `${name} should be dynamic (GLB)`).toBe(true);
}

// Canvas-only creatures use direct draw functions
const canvasCreatures = new Map([
['Gelatinous Ooze', 'drawGelatinousOozeRedux'],
['Bugbear', 'drawBugbearRedux'],
['Carrion Crawler', 'drawCarrionCrawlerRedux'],
]);

for (const [monsterName, drawName] of expectations) {
for (const [monsterName, drawName] of canvasCreatures) {
const template = MONSTER_TEMPLATES_REDUX.find((entry) => entry.name === monsterName);

expect(template, `${monsterName} template should exist`).toBeDefined();
expect(template?.draw.name).toBe(drawName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,8 @@ export const MONSTER_TEMPLATES_REDUX: MonsterTemplate[] = [
draw: makeGLBDrawFn('/models/creatures/kobold.glb', 7, 7, drawKoboldRedux) },
{ id: 'redux-goblin', name: 'Goblin', gridWidth: 7, gridHeight: 7, dynamic: true, monsterClass: 0, level: 3, atmosphere: { r: 96, g: 120, b: 48, intensity: 0.16 },
draw: makeGLBDrawFn('/models/creatures/goblin.glb', 7, 7, drawGoblinRedux) },
{ id: 'redux-giant-spider', name: 'Giant Spider', gridWidth: 10, gridHeight: 12, monsterClass: 2, level: 4, atmosphere: { r: 72, g: 164, b: 226, intensity: 0.22 }, draw: drawPhaseSpiderRedux },
{ id: 'redux-giant-spider', name: 'Giant Spider', gridWidth: 10, gridHeight: 12, dynamic: true, monsterClass: 2, level: 4, atmosphere: { r: 72, g: 164, b: 226, intensity: 0.22 },
draw: makeGLBDrawFn('/models/creatures/giant-spider.glb', 10, 12, drawPhaseSpiderRedux) },
{ id: 'redux-skeleton', name: 'Skeleton', gridWidth: 7, gridHeight: 7, dynamic: true, monsterClass: 0, level: 5, atmosphere: { r: 96, g: 156, b: 70, intensity: 0.18 },
draw: makeGLBDrawFn('/models/creatures/skeleton.glb', 7, 7, drawSkeletonRedux) },
{ id: 'redux-goblin-shaman', name: 'Goblin Shaman', gridWidth: 7, gridHeight: 7, dynamic: true, monsterClass: 1, level: 6, atmosphere: { r: 106, g: 70, b: 164, intensity: 0.18 },
Expand Down
Loading