BlueGit

timfa questward

Files

questward / shared / spells / constants.js

constants.js

constants.js 1.4 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 = 12;
5
6export const RANGED_PROJECTILE_MS = 300;
7export const SPELL_PROJECTILE_MS = 500;
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;
23
24/**
25 * Magic contest die size from spell tier.
26 * Difficulty = unlock Magic level + 1 so cast chance is exactly 50% at the
27 * tier unlock gate (1 / 10 / 20 / 35 / 50 / 70 / 90), then rises with Magic.
28 */
29export function spellDifficultyFromTier (tier)
30{
31 const rank = Math.max(1, Math.min(MATERIAL_TIER_ORDER.length, Math.floor(Number(tier) || 1)));
32 const unlockLevel = tierMinSkillLevel(MATERIAL_TIER_ORDER[rank - 1]);
33 return Math.max(1, unlockLevel + 1);
34}
35
36/** Cast flash radius in tiles = tier / 2. */
37export function castFlashRadiusTiles (tier)
38{
39 return Math.max(0.5, (Number(tier) || 1) / 2);
40}