#!/usr/bin/env node /** * Magenta placeholder projectile art: one PNG per spell under * client/assets/fx/projectile/spell-.png * * Magenta (R≈B, G < R) is recolored at runtime via spellProjectileTint(element). * Replace any file with hand-drawn art; keep magenta for tintable regions. * * node client/scripts/write-spell-projectile-template.mjs */ import { unlinkSync, existsSync } from "node:fs"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import { writeRgbaPng, makeRgba, fillRect } from "../../server/src/assets/placeholderPng.js"; import { SPELL_DEFINITIONS } from "../../shared/definitions/spells.js"; const SIZE = 8; const OUT_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "assets", "fx", "projectile"); /** Pure magenta mask + a lighter magenta highlight (G channel → white at runtime). */ const MAGENTA = [220, 0, 220, 255]; const MAGENTA_HI = [255, 120, 255, 255]; const legacy = [ "spell-light-0.png", "spell-light-1.png", "spell-light-2.png", "spell-spark-0.png", "spell-spark-1.png", "spell-spark-2.png" ]; for (const name of legacy) { const path = join(OUT_DIR, name); if (existsSync(path)) { unlinkSync(path); console.log(`Removed legacy ${name}`); } } let wrote = 0; for (const def of Object.values(SPELL_DEFINITIONS)) { const file = join(OUT_DIR, `spell-${def.spellId}.png`); const image = makeRgba(SIZE, SIZE, [0, 0, 0, 0]); // Diamond body fillRect(image, 3, 1, 2, 1, MAGENTA); fillRect(image, 2, 2, 4, 1, MAGENTA); fillRect(image, 1, 3, 6, 2, MAGENTA); fillRect(image, 2, 5, 4, 1, MAGENTA); fillRect(image, 3, 6, 2, 1, MAGENTA); // Center highlight fillRect(image, 3, 3, 2, 2, MAGENTA_HI); writeRgbaPng(file, SIZE, SIZE, image.pixels); wrote += 1; } console.log(`Wrote ${wrote} magenta spell projectile placeholders in ${OUT_DIR}`);