import { hpBarClass } from '../lib/format'; // A health bar with temporary hit points on it. Temp HP sits on top of real // HP, so it is drawn as its own blue segment after the HP fill, and the bar // stretches to fit when the two together come to more than the maximum (full // health plus a buffer). The fill's colour still reflects real HP only: temp // HP doesn't make a bloodied character look healthy. export function HpBar({ current, max, temp = 0, height, className = 'mt-sm' }: { current: number; max: number; temp?: number; height?: number; className?: string; }) { const hp = Math.max(0, Math.min(current, max)); const buffer = Math.max(0, temp); const scale = Math.max(max, hp + buffer, 1); return (
{buffer > 0 &&
}
); }