BlueGit

timfa questward

Rename spell projectiles to spell-<element>-<tier>-<name>.

Sorts by element then tier in the asset folder and matches each spell more clearly.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
dd12203d75626d23118f686e1fce708353e2583a
Parent
b20000c6
54 files changed +43 −39
client/assets/fx/projectile/spell-airbolt.png client/assets/fx/projectile/spell-air-2-sprite-bolt-air.png renamed +0 −0
client/assets/fx/projectile/spell-blaze.png client/assets/fx/projectile/spell-air-3-airbolt.png renamed +0 −0
client/assets/fx/projectile/spell-blight.png client/assets/fx/projectile/spell-air-4-gale.png renamed +0 −0
client/assets/fx/projectile/spell-boulder.png client/assets/fx/projectile/spell-air-5-cyclone.png renamed +0 −0
client/assets/fx/projectile/spell-cataclysm.png client/assets/fx/projectile/spell-air-6-tempest.png renamed +0 −0
client/assets/fx/projectile/spell-cyclone.png client/assets/fx/projectile/spell-air-7-hurricane.png renamed +0 −0
client/assets/fx/projectile/spell-dark.png client/assets/fx/projectile/spell-dark-2-dark.png renamed +0 −0
client/assets/fx/projectile/spell-darkbolt.png client/assets/fx/projectile/spell-dark-2-sprite-bolt-dark.png renamed +0 −0
client/assets/fx/projectile/spell-deluge.png client/assets/fx/projectile/spell-dark-3-darkbolt.png renamed +0 −0
client/assets/fx/projectile/spell-drain.png client/assets/fx/projectile/spell-dark-4-drain.png renamed +0 −0
client/assets/fx/projectile/spell-earthbolt.png client/assets/fx/projectile/spell-dark-4-gloom.png renamed +0 −0
client/assets/fx/projectile/spell-eclipse.png client/assets/fx/projectile/spell-dark-5-voidlance.png renamed +0 −0
client/assets/fx/projectile/spell-fireball.png client/assets/fx/projectile/spell-dark-6-eclipse.png renamed +0 −0
client/assets/fx/projectile/spell-firebolt.png client/assets/fx/projectile/spell-dark-6-shade.png renamed +0 −0
client/assets/fx/projectile/spell-flare.png client/assets/fx/projectile/spell-dark-7-oblivion.png renamed +0 −0
client/assets/fx/projectile/spell-gale.png client/assets/fx/projectile/spell-earth-2-sprite-bolt-earth.png renamed +0 −0
client/assets/fx/projectile/spell-gloom.png client/assets/fx/projectile/spell-earth-3-earthbolt.png renamed +0 −0
client/assets/fx/projectile/spell-hellfire.png client/assets/fx/projectile/spell-earth-3-poison.png renamed +0 −0
client/assets/fx/projectile/spell-hurricane.png client/assets/fx/projectile/spell-earth-4-boulder.png renamed +0 −0
client/assets/fx/projectile/spell-inferno.png client/assets/fx/projectile/spell-earth-5-quake.png renamed +0 −0
client/assets/fx/projectile/spell-judgment.png client/assets/fx/projectile/spell-earth-6-landslide.png renamed +0 −0
client/assets/fx/projectile/spell-landslide.png client/assets/fx/projectile/spell-earth-7-cataclysm.png renamed +0 −0
client/assets/fx/projectile/spell-light.png client/assets/fx/projectile/spell-fire-2-sprite-bolt-fire.png renamed +0 −0
client/assets/fx/projectile/spell-lightbolt.png client/assets/fx/projectile/spell-fire-3-firebolt.png renamed +0 −0
client/assets/fx/projectile/spell-maelstrom.png client/assets/fx/projectile/spell-fire-3-tinders.png renamed +0 −0
client/assets/fx/projectile/spell-magic-missile.png client/assets/fx/projectile/spell-fire-4-fireball.png renamed +0 −0
client/assets/fx/projectile/spell-mana-bullet.png client/assets/fx/projectile/spell-fire-5-blaze.png renamed +0 −0
client/assets/fx/projectile/spell-oblivion.png client/assets/fx/projectile/spell-fire-6-inferno.png renamed +0 −0
client/assets/fx/projectile/spell-plague.png client/assets/fx/projectile/spell-fire-7-hellfire.png renamed +0 −0
client/assets/fx/projectile/spell-poison.png client/assets/fx/projectile/spell-holy-5-revitalize.png renamed +0 −0
client/assets/fx/projectile/spell-poisonbolt.png client/assets/fx/projectile/spell-light-2-sprite-bolt-light.png renamed +0 −0
client/assets/fx/projectile/spell-quake.png client/assets/fx/projectile/spell-light-3-lightbolt.png renamed +0 −0
client/assets/fx/projectile/spell-radiance.png client/assets/fx/projectile/spell-light-4-radiance.png renamed +0 −0
client/assets/fx/projectile/spell-revitalize.png client/assets/fx/projectile/spell-light-5-flare.png renamed +0 −0
client/assets/fx/projectile/spell-shade.png client/assets/fx/projectile/spell-light-6-sunbeam.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-air.png client/assets/fx/projectile/spell-light-7-judgment.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-dark.png client/assets/fx/projectile/spell-none-1-light.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-earth.png client/assets/fx/projectile/spell-none-1-mana-bullet.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-fire.png client/assets/fx/projectile/spell-none-2-magic-missile.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-light.png client/assets/fx/projectile/spell-poison-2-sprite-bolt-poison.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-poison.png client/assets/fx/projectile/spell-poison-3-poisonbolt.png renamed +0 −0
client/assets/fx/projectile/spell-sprite-bolt-water.png client/assets/fx/projectile/spell-poison-4-toxinburst.png renamed +0 −0
client/assets/fx/projectile/spell-sunbeam.png client/assets/fx/projectile/spell-poison-5-venomcloud.png renamed +0 −0
client/assets/fx/projectile/spell-tempest.png client/assets/fx/projectile/spell-poison-6-plague.png renamed +0 −0
client/assets/fx/projectile/spell-tinders.png client/assets/fx/projectile/spell-poison-7-blight.png renamed +0 −0
client/assets/fx/projectile/spell-torrent.png client/assets/fx/projectile/spell-water-2-sprite-bolt-water.png renamed +0 −0
client/assets/fx/projectile/spell-toxinburst.png client/assets/fx/projectile/spell-water-3-waterbolt.png renamed +0 −0
client/assets/fx/projectile/spell-venomcloud.png client/assets/fx/projectile/spell-water-4-waterspout.png renamed +0 −0
client/assets/fx/projectile/spell-voidlance.png client/assets/fx/projectile/spell-water-5-torrent.png renamed +0 −0
client/assets/fx/projectile/spell-waterbolt.png client/assets/fx/projectile/spell-water-6-deluge.png renamed +0 −0
client/assets/fx/projectile/spell-waterspout.png client/assets/fx/projectile/spell-water-7-maelstrom.png renamed +0 −0
client/scripts/write-spell-projectile-template.mjs +18 −23
@@ -1,7 +1,7 @@
1 1 #!/usr/bin/env node
2 2 /**
3 3 * Magenta placeholder projectile art: one PNG per spell under
4 * client/assets/fx/projectile/spell-<spellId>.png
4 * client/assets/fx/projectile/spell-<element>-<tier>-<spellId>.png
5 5 *
6 6 * Canvas is 16×16. Facing: the RIGHT side (+X) is the front/tip — the same
7 7 * convention as arrow.png. Runtime rotates with atan2(dy, dx) so 0° = flying east.
@@ -11,11 +11,11 @@
11 11 *
12 12 * node client/scripts/write-spell-projectile-template.mjs
13 13 */
14 import { unlinkSync, existsSync } from "node:fs";
14 import { unlinkSync, readdirSync } from "node:fs";
15 15 import { join, dirname } from "node:path";
16 16 import { fileURLToPath } from "node:url";
17 17 import { writeRgbaPng, makeRgba, fillRect } from "../../server/src/assets/placeholderPng.js";
18 import { SPELL_DEFINITIONS } from "../../shared/definitions/spells.js";
18 import { SPELL_DEFINITIONS, spellProjectileStem } from "../../shared/definitions/spells.js";
19 19
20 20 const SIZE = 16;
21 21 /** Offset so the original 8×8 diamond sits centred on the 16×16 canvas. */
@@ -27,39 +27,34 @@ const OUT_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "assets", "f
27 27 const MAGENTA = [220, 0, 220, 255];
28 28 const MAGENTA_HI = [255, 120, 255, 255];
29 29
30 const legacy = [
31 "spell-light-0.png",
32 "spell-light-1.png",
33 "spell-light-2.png",
34 "spell-spark-0.png",
35 "spell-spark-1.png",
36 "spell-spark-2.png"
37 ];
38 for (const name of legacy)
39 {
40 const path = join(OUT_DIR, name);
41 if (existsSync(path))
42 {
43 unlinkSync(path);
44 console.log(`Removed legacy ${name}`);
45 }
46 }
30 const keep = new Set(["arrow.png", "arrow-tipped.png"]);
31 const wanted = new Set();
47 32
48 33 let wrote = 0;
49 34 for (const def of Object.values(SPELL_DEFINITIONS))
50 35 {
51 const file = join(OUT_DIR, `spell-${def.spellId}.png`);
36 const stem = spellProjectileStem(def.element, def.tier, def.spellId);
37 wanted.add(`${stem}.png`);
38 const file = join(OUT_DIR, `${stem}.png`);
52 39 const image = makeRgba(SIZE, SIZE, [0, 0, 0, 0]);
53 // Diamond body (same pixels as the old 8×8 art, centred)
54 40 fillRect(image, OX + 3, OY + 1, 2, 1, MAGENTA);
55 41 fillRect(image, OX + 2, OY + 2, 4, 1, MAGENTA);
56 42 fillRect(image, OX + 1, OY + 3, 6, 2, MAGENTA);
57 43 fillRect(image, OX + 2, OY + 5, 4, 1, MAGENTA);
58 44 fillRect(image, OX + 3, OY + 6, 2, 1, MAGENTA);
59 // Center highlight
60 45 fillRect(image, OX + 3, OY + 3, 2, 2, MAGENTA_HI);
61 46 writeRgbaPng(file, SIZE, SIZE, image.pixels);
62 47 wrote += 1;
63 48 }
64 49
50 for (const name of readdirSync(OUT_DIR))
51 {
52 if (!name.startsWith("spell-") || !name.endsWith(".png"))
53 { continue; }
54 if (wanted.has(name) || keep.has(name))
55 { continue; }
56 unlinkSync(join(OUT_DIR, name));
57 console.log(`Removed obsolete ${name}`);
58 }
59
65 60 console.log(`Wrote ${wrote} magenta spell projectile placeholders (${SIZE}×${SIZE}) in ${OUT_DIR}`);
@@ -1,7 +1,7 @@
1#!/usr/bin/env node
1#!/usr/bin/env node
2/**
2/**
3 * Magenta placeholder projectile art: one PNG per spell under
3 * Magenta placeholder projectile art: one PNG per spell under
4 * client/assets/fx/projectile/spell-<spellId>.png
4 * client/assets/fx/projectile/spell-<element>-<tier>-<spellId>.png
5 *
5 *
6 * Canvas is 16×16. Facing: the RIGHT side (+X) is the front/tip — the same
6 * Canvas is 16×16. Facing: the RIGHT side (+X) is the front/tip — the same
7 * convention as arrow.png. Runtime rotates with atan2(dy, dx) so 0° = flying east.
7 * convention as arrow.png. Runtime rotates with atan2(dy, dx) so 0° = flying east.
@@ -11,11 +11,11 @@
11 *
11 *
12 * node client/scripts/write-spell-projectile-template.mjs
12 * node client/scripts/write-spell-projectile-template.mjs
13 */
13 */
14import { unlinkSync, existsSync } from "node:fs";
14import { unlinkSync, readdirSync } from "node:fs";
15import { join, dirname } from "node:path";
15import { join, dirname } from "node:path";
16import { fileURLToPath } from "node:url";
16import { fileURLToPath } from "node:url";
17import { writeRgbaPng, makeRgba, fillRect } from "../../server/src/assets/placeholderPng.js";
17import { writeRgbaPng, makeRgba, fillRect } from "../../server/src/assets/placeholderPng.js";
18import { SPELL_DEFINITIONS } from "../../shared/definitions/spells.js";
18import { SPELL_DEFINITIONS, spellProjectileStem } from "../../shared/definitions/spells.js";
19
19
20const SIZE = 16;
20const SIZE = 16;
21/** Offset so the original 8×8 diamond sits centred on the 16×16 canvas. */
21/** Offset so the original 8×8 diamond sits centred on the 16×16 canvas. */
@@ -27,39 +27,34 @@ const OUT_DIR = join(dirname(fileURLToPath(import.meta.url)), "..", "assets", "f
27const MAGENTA = [220, 0, 220, 255];
27const MAGENTA = [220, 0, 220, 255];
28const MAGENTA_HI = [255, 120, 255, 255];
28const MAGENTA_HI = [255, 120, 255, 255];
29
29
30const legacy = [
30const keep = new Set(["arrow.png", "arrow-tipped.png"]);
31 "spell-light-0.png",
31const wanted = new Set();
32 "spell-light-1.png",
33 "spell-light-2.png",
34 "spell-spark-0.png",
35 "spell-spark-1.png",
36 "spell-spark-2.png"
37];
38for (const name of legacy)
39{
40 const path = join(OUT_DIR, name);
41 if (existsSync(path))
42 {
43 unlinkSync(path);
44 console.log(`Removed legacy ${name}`);
45 }
46}
47
32
48let wrote = 0;
33let wrote = 0;
49for (const def of Object.values(SPELL_DEFINITIONS))
34for (const def of Object.values(SPELL_DEFINITIONS))
50{
35{
51 const file = join(OUT_DIR, `spell-${def.spellId}.png`);
36 const stem = spellProjectileStem(def.element, def.tier, def.spellId);
37 wanted.add(`${stem}.png`);
38 const file = join(OUT_DIR, `${stem}.png`);
52 const image = makeRgba(SIZE, SIZE, [0, 0, 0, 0]);
39 const image = makeRgba(SIZE, SIZE, [0, 0, 0, 0]);
53 // Diamond body (same pixels as the old 8×8 art, centred)
54 fillRect(image, OX + 3, OY + 1, 2, 1, MAGENTA);
40 fillRect(image, OX + 3, OY + 1, 2, 1, MAGENTA);
55 fillRect(image, OX + 2, OY + 2, 4, 1, MAGENTA);
41 fillRect(image, OX + 2, OY + 2, 4, 1, MAGENTA);
56 fillRect(image, OX + 1, OY + 3, 6, 2, MAGENTA);
42 fillRect(image, OX + 1, OY + 3, 6, 2, MAGENTA);
57 fillRect(image, OX + 2, OY + 5, 4, 1, MAGENTA);
43 fillRect(image, OX + 2, OY + 5, 4, 1, MAGENTA);
58 fillRect(image, OX + 3, OY + 6, 2, 1, MAGENTA);
44 fillRect(image, OX + 3, OY + 6, 2, 1, MAGENTA);
59 // Center highlight
60 fillRect(image, OX + 3, OY + 3, 2, 2, MAGENTA_HI);
45 fillRect(image, OX + 3, OY + 3, 2, 2, MAGENTA_HI);
61 writeRgbaPng(file, SIZE, SIZE, image.pixels);
46 writeRgbaPng(file, SIZE, SIZE, image.pixels);
62 wrote += 1;
47 wrote += 1;
63}
48}
64
49
50for (const name of readdirSync(OUT_DIR))
51{
52 if (!name.startsWith("spell-") || !name.endsWith(".png"))
53 { continue; }
54 if (wanted.has(name) || keep.has(name))
55 { continue; }
56 unlinkSync(join(OUT_DIR, name));
57 console.log(`Removed obsolete ${name}`);
58}
59
65console.log(`Wrote ${wrote} magenta spell projectile placeholders (${SIZE}×${SIZE}) in ${OUT_DIR}`);
60console.log(`Wrote ${wrote} magenta spell projectile placeholders (${SIZE}×${SIZE}) in ${OUT_DIR}`);
client/src/render/worldView.js +1 −1
@@ -1653,7 +1653,7 @@ export class WorldView
1653 1653 const def = spellId != null ? spellDefinition(spellId) : null;
1654 1654 const spriteName = payload.sprite
1655 1655 ?? def?.projectileSprite
1656 ?? "fx:projectile:spell-mana-bullet";
1656 ?? "fx:projectile:spell-none-1-mana-bullet";
1657 1657 const image = this.game.images[spriteName];
1658 1658 if (!image)
1659 1659 { return; }
@@ -1653,7 +1653,7 @@ export class WorldView
1653 const def = spellId != null ? spellDefinition(spellId) : null;
1653 const def = spellId != null ? spellDefinition(spellId) : null;
1654 const spriteName = payload.sprite
1654 const spriteName = payload.sprite
1655 ?? def?.projectileSprite
1655 ?? def?.projectileSprite
1656 ?? "fx:projectile:spell-mana-bullet";
1656 ?? "fx:projectile:spell-none-1-mana-bullet";
1657 const image = this.game.images[spriteName];
1657 const image = this.game.images[spriteName];
1658 if (!image)
1658 if (!image)
1659 { return; }
1659 { return; }
shared/definitions/spells.js +24 −15
@@ -12,17 +12,25 @@ import { MagicElement, MAGIC_ELEMENT_TINT, magicElementTint } from "./attackType
12 12 * @property {boolean} [autoRepeat] Auto-cast repeats while target stays in range
13 13 * @property {number} [minMagicLevel] Minimum Magic level to cast / favourite
14 14 * @property {string} description In-world spell description
15 * @property {string} [projectileSprite] fx:projectile:spell-<spellId> magenta art
15 * @property {string} [projectileSprite] fx:projectile:spell-<element>-<tier>-<spellId>
16 16 * @property {string} [effect] Server impact kind (defaults to spellId)
17 17 * @property {boolean} [starter] Known by default; no spellbook required
18 18 * @property {boolean} [mobOnly] Not offered on player spellbooks
19 19 * @property {boolean} [damageTree] Part of an elemental damage progression
20 20 */
21 21
22 /** File stem: `spell-<element>-<tier>-<spellId>` (sorts by element, then tier). */
23 export function spellProjectileStem (element, tier, spellId)
24 {
25 const el = String(element || "none");
26 const t = Math.max(1, Math.floor(Number(tier) || 1));
27 return `spell-${el}-${t}-${spellId}`;
28 }
29
22 30 /** Catalog image name for a spell's unique magenta projectile art. */
23 export function spellProjectileSprite (spellId)
31 export function spellProjectileSprite (element, tier, spellId)
24 32 {
25 return `fx:projectile:spell-${spellId}`;
33 return `fx:projectile:${spellProjectileStem(element, tier, spellId)}`;
26 34 }
27 35
28 36 /** Runtime tint for magenta projectile art (element colour, or white for none/holy). */
@@ -357,7 +365,7 @@ function buildDamageTreeDefinitions ()
357 365 target: "entity",
358 366 autoRepeat: true,
359 367 minMagicLevel: spellMinMagicLevelFromTier(tier),
360 projectileSprite: spellProjectileSprite(entry.id),
368 projectileSprite: spellProjectileSprite(tree.element, tier, entry.id),
361 369 effect: "damage",
362 370 damageTree: true,
363 371 description: entry.description
@@ -378,7 +386,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
378 386 autoRepeat: false,
379 387 minMagicLevel: spellMinMagicLevelFromTier(1),
380 388 starter: true,
381 projectileSprite: spellProjectileSprite(SpellId.light),
389 projectileSprite: spellProjectileSprite("none", 1, SpellId.light),
382 390 effect: "light",
383 391 description: "A whisper of radiance that settles on stone or grass, holding back the dark for a while."
384 392 }),
@@ -390,7 +398,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
390 398 target: "entity",
391 399 autoRepeat: true,
392 400 minMagicLevel: spellMinMagicLevelFromTier(1),
393 projectileSprite: spellProjectileSprite(SpellId.manaBullet),
401 projectileSprite: spellProjectileSprite("none", 1, SpellId.manaBullet),
394 402 effect: "damage",
395 403 description: "A small shot of raw mana, swift and simple, for those just learning to strike."
396 404 }),
@@ -402,7 +410,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
402 410 target: "tile",
403 411 autoRepeat: false,
404 412 minMagicLevel: spellMinMagicLevelFromTier(2),
405 projectileSprite: spellProjectileSprite(SpellId.dark),
413 projectileSprite: spellProjectileSprite(MagicElement.dark, 2, SpellId.dark),
406 414 effect: "dark",
407 415 description: "A pool of shadow that drinks the light from a place, leaving the air thick and dim."
408 416 }),
@@ -414,7 +422,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
414 422 target: "entity",
415 423 autoRepeat: true,
416 424 minMagicLevel: spellMinMagicLevelFromTier(2),
417 projectileSprite: spellProjectileSprite(SpellId.magicMissile),
425 projectileSprite: spellProjectileSprite("none", 2, SpellId.magicMissile),
418 426 effect: "damage",
419 427 description: "A plain dart of force that flies true and strikes without favour of the elements."
420 428 }),
@@ -427,7 +435,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
427 435 target: "entity",
428 436 autoRepeat: true,
429 437 minMagicLevel: spellMinMagicLevelFromTier(3),
430 projectileSprite: spellProjectileSprite(SpellId.poison),
438 projectileSprite: spellProjectileSprite(MagicElement.earth, 3, SpellId.poison),
431 439 effect: "poison",
432 440 description: "A venomous curse that sinks in without a wound, then eats at the body over time."
433 441 }),
@@ -439,7 +447,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
439 447 target: "entity",
440 448 autoRepeat: true,
441 449 minMagicLevel: spellMinMagicLevelFromTier(4),
442 projectileSprite: spellProjectileSprite(SpellId.drain),
450 projectileSprite: spellProjectileSprite(MagicElement.dark, 4, SpellId.drain),
443 451 effect: "drain",
444 452 description: "A hunger that saps a foe's wind, leaving them gasping and slow to recover."
445 453 }),
@@ -451,7 +459,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
451 459 target: "tile",
452 460 autoRepeat: true,
453 461 minMagicLevel: spellMinMagicLevelFromTier(3),
454 projectileSprite: spellProjectileSprite(SpellId.tinders),
462 projectileSprite: spellProjectileSprite(MagicElement.fire, 3, SpellId.tinders),
455 463 effect: "tinders",
456 464 description: "Sparks of will that can coax logs into flame or sear raw meat as a cookfire would."
457 465 }),
@@ -463,7 +471,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
463 471 target: "tile",
464 472 autoRepeat: false,
465 473 minMagicLevel: spellMinMagicLevelFromTier(6),
466 projectileSprite: spellProjectileSprite(SpellId.shade),
474 projectileSprite: spellProjectileSprite(MagicElement.dark, 6, SpellId.shade),
467 475 effect: "shade",
468 476 description: "A summoned shadow that fights beside you until the magic frays."
469 477 }),
@@ -475,7 +483,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
475 483 target: "entity",
476 484 autoRepeat: false,
477 485 minMagicLevel: spellMinMagicLevelFromTier(5),
478 projectileSprite: spellProjectileSprite(SpellId.revitalize),
486 projectileSprite: spellProjectileSprite("holy", 5, SpellId.revitalize),
479 487 effect: "revitalize",
480 488 description: "A gentle current of life that mends wounds one breath at a time."
481 489 }),
@@ -490,15 +498,16 @@ export const SPELL_DEFINITIONS = Object.freeze({
490 498
491 499 function spriteBoltDef (spellId, displayName, element)
492 500 {
501 const tier = 2;
493 502 return Object.freeze({
494 503 spellId,
495 504 displayName,
496 tier: 2,
505 tier,
497 506 element,
498 507 target: "entity",
499 508 autoRepeat: true,
500 509 minMagicLevel: 1,
501 projectileSprite: spellProjectileSprite(spellId),
510 projectileSprite: spellProjectileSprite(element, tier, spellId),
502 511 effect: "damage",
503 512 mobOnly: true,
504 513 description: `A flickering ${element} mote cast by a sprite.`
@@ -12,17 +12,25 @@ import { MagicElement, MAGIC_ELEMENT_TINT, magicElementTint } from "./attackType
12 * @property {boolean} [autoRepeat] Auto-cast repeats while target stays in range
12 * @property {boolean} [autoRepeat] Auto-cast repeats while target stays in range
13 * @property {number} [minMagicLevel] Minimum Magic level to cast / favourite
13 * @property {number} [minMagicLevel] Minimum Magic level to cast / favourite
14 * @property {string} description In-world spell description
14 * @property {string} description In-world spell description
15 * @property {string} [projectileSprite] fx:projectile:spell-<spellId> magenta art
15 * @property {string} [projectileSprite] fx:projectile:spell-<element>-<tier>-<spellId>
16 * @property {string} [effect] Server impact kind (defaults to spellId)
16 * @property {string} [effect] Server impact kind (defaults to spellId)
17 * @property {boolean} [starter] Known by default; no spellbook required
17 * @property {boolean} [starter] Known by default; no spellbook required
18 * @property {boolean} [mobOnly] Not offered on player spellbooks
18 * @property {boolean} [mobOnly] Not offered on player spellbooks
19 * @property {boolean} [damageTree] Part of an elemental damage progression
19 * @property {boolean} [damageTree] Part of an elemental damage progression
20 */
20 */
21
21
22/** File stem: `spell-<element>-<tier>-<spellId>` (sorts by element, then tier). */
23export function spellProjectileStem (element, tier, spellId)
24{
25 const el = String(element || "none");
26 const t = Math.max(1, Math.floor(Number(tier) || 1));
27 return `spell-${el}-${t}-${spellId}`;
28}
29
22/** Catalog image name for a spell's unique magenta projectile art. */
30/** Catalog image name for a spell's unique magenta projectile art. */
23export function spellProjectileSprite (spellId)
31export function spellProjectileSprite (element, tier, spellId)
24{
32{
25 return `fx:projectile:spell-${spellId}`;
33 return `fx:projectile:${spellProjectileStem(element, tier, spellId)}`;
26}
34}
27
35
28/** Runtime tint for magenta projectile art (element colour, or white for none/holy). */
36/** Runtime tint for magenta projectile art (element colour, or white for none/holy). */
@@ -357,7 +365,7 @@ function buildDamageTreeDefinitions ()
357 target: "entity",
365 target: "entity",
358 autoRepeat: true,
366 autoRepeat: true,
359 minMagicLevel: spellMinMagicLevelFromTier(tier),
367 minMagicLevel: spellMinMagicLevelFromTier(tier),
360 projectileSprite: spellProjectileSprite(entry.id),
368 projectileSprite: spellProjectileSprite(tree.element, tier, entry.id),
361 effect: "damage",
369 effect: "damage",
362 damageTree: true,
370 damageTree: true,
363 description: entry.description
371 description: entry.description
@@ -378,7 +386,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
378 autoRepeat: false,
386 autoRepeat: false,
379 minMagicLevel: spellMinMagicLevelFromTier(1),
387 minMagicLevel: spellMinMagicLevelFromTier(1),
380 starter: true,
388 starter: true,
381 projectileSprite: spellProjectileSprite(SpellId.light),
389 projectileSprite: spellProjectileSprite("none", 1, SpellId.light),
382 effect: "light",
390 effect: "light",
383 description: "A whisper of radiance that settles on stone or grass, holding back the dark for a while."
391 description: "A whisper of radiance that settles on stone or grass, holding back the dark for a while."
384 }),
392 }),
@@ -390,7 +398,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
390 target: "entity",
398 target: "entity",
391 autoRepeat: true,
399 autoRepeat: true,
392 minMagicLevel: spellMinMagicLevelFromTier(1),
400 minMagicLevel: spellMinMagicLevelFromTier(1),
393 projectileSprite: spellProjectileSprite(SpellId.manaBullet),
401 projectileSprite: spellProjectileSprite("none", 1, SpellId.manaBullet),
394 effect: "damage",
402 effect: "damage",
395 description: "A small shot of raw mana, swift and simple, for those just learning to strike."
403 description: "A small shot of raw mana, swift and simple, for those just learning to strike."
396 }),
404 }),
@@ -402,7 +410,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
402 target: "tile",
410 target: "tile",
403 autoRepeat: false,
411 autoRepeat: false,
404 minMagicLevel: spellMinMagicLevelFromTier(2),
412 minMagicLevel: spellMinMagicLevelFromTier(2),
405 projectileSprite: spellProjectileSprite(SpellId.dark),
413 projectileSprite: spellProjectileSprite(MagicElement.dark, 2, SpellId.dark),
406 effect: "dark",
414 effect: "dark",
407 description: "A pool of shadow that drinks the light from a place, leaving the air thick and dim."
415 description: "A pool of shadow that drinks the light from a place, leaving the air thick and dim."
408 }),
416 }),
@@ -414,7 +422,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
414 target: "entity",
422 target: "entity",
415 autoRepeat: true,
423 autoRepeat: true,
416 minMagicLevel: spellMinMagicLevelFromTier(2),
424 minMagicLevel: spellMinMagicLevelFromTier(2),
417 projectileSprite: spellProjectileSprite(SpellId.magicMissile),
425 projectileSprite: spellProjectileSprite("none", 2, SpellId.magicMissile),
418 effect: "damage",
426 effect: "damage",
419 description: "A plain dart of force that flies true and strikes without favour of the elements."
427 description: "A plain dart of force that flies true and strikes without favour of the elements."
420 }),
428 }),
@@ -427,7 +435,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
427 target: "entity",
435 target: "entity",
428 autoRepeat: true,
436 autoRepeat: true,
429 minMagicLevel: spellMinMagicLevelFromTier(3),
437 minMagicLevel: spellMinMagicLevelFromTier(3),
430 projectileSprite: spellProjectileSprite(SpellId.poison),
438 projectileSprite: spellProjectileSprite(MagicElement.earth, 3, SpellId.poison),
431 effect: "poison",
439 effect: "poison",
432 description: "A venomous curse that sinks in without a wound, then eats at the body over time."
440 description: "A venomous curse that sinks in without a wound, then eats at the body over time."
433 }),
441 }),
@@ -439,7 +447,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
439 target: "entity",
447 target: "entity",
440 autoRepeat: true,
448 autoRepeat: true,
441 minMagicLevel: spellMinMagicLevelFromTier(4),
449 minMagicLevel: spellMinMagicLevelFromTier(4),
442 projectileSprite: spellProjectileSprite(SpellId.drain),
450 projectileSprite: spellProjectileSprite(MagicElement.dark, 4, SpellId.drain),
443 effect: "drain",
451 effect: "drain",
444 description: "A hunger that saps a foe's wind, leaving them gasping and slow to recover."
452 description: "A hunger that saps a foe's wind, leaving them gasping and slow to recover."
445 }),
453 }),
@@ -451,7 +459,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
451 target: "tile",
459 target: "tile",
452 autoRepeat: true,
460 autoRepeat: true,
453 minMagicLevel: spellMinMagicLevelFromTier(3),
461 minMagicLevel: spellMinMagicLevelFromTier(3),
454 projectileSprite: spellProjectileSprite(SpellId.tinders),
462 projectileSprite: spellProjectileSprite(MagicElement.fire, 3, SpellId.tinders),
455 effect: "tinders",
463 effect: "tinders",
456 description: "Sparks of will that can coax logs into flame or sear raw meat as a cookfire would."
464 description: "Sparks of will that can coax logs into flame or sear raw meat as a cookfire would."
457 }),
465 }),
@@ -463,7 +471,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
463 target: "tile",
471 target: "tile",
464 autoRepeat: false,
472 autoRepeat: false,
465 minMagicLevel: spellMinMagicLevelFromTier(6),
473 minMagicLevel: spellMinMagicLevelFromTier(6),
466 projectileSprite: spellProjectileSprite(SpellId.shade),
474 projectileSprite: spellProjectileSprite(MagicElement.dark, 6, SpellId.shade),
467 effect: "shade",
475 effect: "shade",
468 description: "A summoned shadow that fights beside you until the magic frays."
476 description: "A summoned shadow that fights beside you until the magic frays."
469 }),
477 }),
@@ -475,7 +483,7 @@ export const SPELL_DEFINITIONS = Object.freeze({
475 target: "entity",
483 target: "entity",
476 autoRepeat: false,
484 autoRepeat: false,
477 minMagicLevel: spellMinMagicLevelFromTier(5),
485 minMagicLevel: spellMinMagicLevelFromTier(5),
478 projectileSprite: spellProjectileSprite(SpellId.revitalize),
486 projectileSprite: spellProjectileSprite("holy", 5, SpellId.revitalize),
479 effect: "revitalize",
487 effect: "revitalize",
480 description: "A gentle current of life that mends wounds one breath at a time."
488 description: "A gentle current of life that mends wounds one breath at a time."
481 }),
489 }),
@@ -490,15 +498,16 @@ export const SPELL_DEFINITIONS = Object.freeze({
490
498
491function spriteBoltDef (spellId, displayName, element)
499function spriteBoltDef (spellId, displayName, element)
492{
500{
501 const tier = 2;
493 return Object.freeze({
502 return Object.freeze({
494 spellId,
503 spellId,
495 displayName,
504 displayName,
496 tier: 2,
505 tier,
497 element,
506 element,
498 target: "entity",
507 target: "entity",
499 autoRepeat: true,
508 autoRepeat: true,
500 minMagicLevel: 1,
509 minMagicLevel: 1,
501 projectileSprite: spellProjectileSprite(spellId),
510 projectileSprite: spellProjectileSprite(element, tier, spellId),
502 effect: "damage",
511 effect: "damage",
503 mobOnly: true,
512 mobOnly: true,
504 description: `A flickering ${element} mote cast by a sprite.`
513 description: `A flickering ${element} mote cast by a sprite.`