mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-17 14:21:25 +02:00
A browser-based roguelike synchronized with crypto block timing. A run is a race against the next block: reach the exit before the block lands, or the house wins. The same codebase runs the solo dungeon, the social Tavern, and operator-selected PvP and race rulesets, with separate free and paid leaderboards. Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md for the design, and docs/DEPLOY.md to operate an instance.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const vm = require('vm');
|
|
|
|
function loadCharSprites() {
|
|
const context = {
|
|
console,
|
|
window: { console }
|
|
};
|
|
context.window.window = context.window;
|
|
vm.runInNewContext(
|
|
fs.readFileSync(path.join(__dirname, '../html/js/render/charSprites.js'), 'utf8'),
|
|
context
|
|
);
|
|
return context.window.RK;
|
|
}
|
|
|
|
describe('roguelike character sprites', () => {
|
|
test('equipment stays fixed color unless an asset explicitly opts into tinting', () => {
|
|
const RK = loadCharSprites();
|
|
const parts = RK.charOverlayParts({
|
|
avatar: 'char-wizard',
|
|
tint: 'gold',
|
|
colors: { base: 'gold', body: 'moss', head: 'teal' },
|
|
equipment: { body: 'mail', head: 'helm', shield: 'round', weapon: 'sword' }
|
|
});
|
|
|
|
expect(parts).toEqual(expect.arrayContaining([
|
|
expect.objectContaining({ slot: 'body', id: 'mail', tint: 'none', colorable: false }),
|
|
expect.objectContaining({ slot: 'head', id: 'helm', tint: 'none', colorable: false }),
|
|
expect.objectContaining({ slot: 'shield', id: 'round', tint: 'none', colorable: false }),
|
|
expect.objectContaining({ slot: 'weapon', id: 'sword', tint: 'none', colorable: false })
|
|
]));
|
|
});
|
|
});
|