BlueGit

timfa questward

Files

questward / shared / spells / constants.js

constants.js

constants.js 1.5 KiB Download Raw
1import { MATERIAL_TIER_ORDER, tierMinSkillLevel } from "../definitions/materialTiers.js";
2
3/** Universal Chebyshev range for ranged weapons and magic (players and mobs). */
4export const COMBAT_RANGE_TILES = 15;
5
6export const RANGED_PROJECTILE_MS = 500;
7export const SPELL_PROJECTILE_MS = 1000;
8export const SPELL_COOLDOWN_MS = 2000;
9export const MAX_FAVORITE_SPELLS = 6;
10
11/** Torch blocks use 8 tiles; spell lights are slightly dimmer. */
12export const SPELL_LIGHT_RANGE_TILES = 6;
13export const SPELL_LIGHT_INTENSITY = 0.88;
14/** Dark spell dims local light by this intensity at the centre. */
15export const SPELL_DARK_INTENSITY = 0.88;
16
17export const LIGHT_DURATION_MS_PER_MIND = 5000;
18export const LIGHT_MAX_DURATION_MS = 3 * 60 * 1000;
19export const LIGHT_FADE_MS = 3000;
20export const LIGHT_OWNER_DISTANCE_CAP_MS = 5000;
21
22export const CAST_FLASH_MS = 500;
23export const SPELL_PROJECTILE_FRAME_MS = 250;
24
25/**
26 * Magic contest die size from spell tier.
27 * Difficulty = unlock Magic level + 1 so cast chance is exactly 50% at the
28 * tier unlock gate (1 / 10 / 20 / 35 / 50 / 70 / 90), then rises with Magic.
29 */
30export function spellDifficultyFromTier (tier)
31{
32 const rank = Math.max(1, Math.min(MATERIAL_TIER_ORDER.length, Math.floor(Number(tier) || 1)));
33 const unlockLevel = tierMinSkillLevel(MATERIAL_TIER_ORDER[rank - 1]);
34 return Math.max(1, unlockLevel + 1);
35}
36
37/** Cast flash radius in tiles = tier / 2. */
38export function castFlashRadiusTiles (tier)
39{
40 return Math.max(0.5, (Number(tier) || 1) / 2);
41}