/** * Combat modifiers from target tile lighting (0 = dark, 1 = fully lit). * Penalty scales quadratically: 0% lit → 50% to-hit penalty, 50% lit → 12.5%. */ /** Fraction subtracted from effective hit skill (0–0.5). */ export function toHitDarknessPenalty (light01) { const lit = Math.min(1, Math.max(0, Number(light01) || 0)); return 0.5 * (1 - lit) ** 2; } /** Effective hit skill after darkness penalty on the target tile. */ export function effectiveHitSkillInDarkness (hitSkillLevel, light01) { const penalty = toHitDarknessPenalty(light01); return Math.max(1, Math.floor((hitSkillLevel | 0) * (1 - penalty))); } /** * Multiplier applied to Chebyshev aggro distance (1 = normal, 2 = target in full dark). * Linear: 0 lit → 2×, 0.5 lit → 1.5×, 1 lit → 1×. */ export function aggroDistanceMultiplier (light01) { const lit = Math.min(1, Math.max(0, Number(light01) || 0)); return 2 - lit; }