| 1 | import { MATERIAL_TIER_ORDER, tierMinSkillLevel } from "../definitions/materialTiers.js"; |
| 2 | |
| 3 | /** Universal Chebyshev range for ranged weapons and magic (players and mobs). */ |
| 4 | export const COMBAT_RANGE_TILES = 15; |
| 5 | |
| 6 | export const RANGED_PROJECTILE_MS = 300; |
| 7 | export const SPELL_PROJECTILE_MS = 500; |
| 8 | export const SPELL_COOLDOWN_MS = 2000; |
| 9 | export const MAX_FAVORITE_SPELLS = 6; |
| 10 | |
| 11 | /** Torch blocks use 8 tiles; spell lights are slightly dimmer. */ |
| 12 | export const SPELL_LIGHT_RANGE_TILES = 6; |
| 13 | export const SPELL_LIGHT_INTENSITY = 0.88; |
| 14 | /** Dark spell dims local light by this intensity at the centre. */ |
| 15 | export const SPELL_DARK_INTENSITY = 0.88; |
| 16 | |
| 17 | export const LIGHT_DURATION_MS_PER_MIND = 5000; |
| 18 | export const LIGHT_MAX_DURATION_MS = 3 * 60 * 1000; |
| 19 | export const LIGHT_FADE_MS = 3000; |
| 20 | export const LIGHT_OWNER_DISTANCE_CAP_MS = 5000; |
| 21 | |
| 22 | export 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 | */ |
| 29 | export 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. */ |
| 37 | export function castFlashRadiusTiles (tier) |
| 38 | { |
| 39 | return Math.max(0.5, (Number(tier) || 1) / 2); |
| 40 | } |