import { MISSING as M } from './rules' const HOUR = 3_600_000 /** 想念累積:離開越久越想,速度隨想念累積速度參數(0–100,預設 50)調整 */ export function missingAccrual(idleMs: number, missParam = 50): number { const rate = M.perHour * (0.5 + missParam / 100) return Math.min(M.max, Math.max(0, idleMs / HOUR - M.graceH) * rate) } /** 時間感:把離開的時間說成人話 */ export function describeAbsence(idleMs: number): string { const h = idleMs / HOUR if (h < 1) return `${Math.max(1, Math.round(idleMs / 60_000))} 分鐘` if (h < 48) return `${Math.round(h)} 小時` return `${Math.round(h / 24)} 天` }