import test from "node:test"; import assert from "node:assert/strict"; import { skullValue, skullTintColor, decayKillCounter, SKULL_PURE_RED_VALUE, SKULL_DARK_RED_VALUE, SKULL_KILL_BONUS } from "../../shared/combat/skull.js"; test("skull value is bounty plus kill counter", () => { assert.equal(skullValue(100, 400), 500); assert.equal(skullValue(0, 0), 0); assert.equal(SKULL_KILL_BONUS, 500); }); test("kill counter decays one point per second", () => { assert.deepEqual(decayKillCounter(10, 3500), { killCounter: 7, consumedMs: 3000 }); assert.deepEqual(decayKillCounter(2, 10_000), { killCounter: 0, consumedMs: 2000 }); }); test("skull tint: invisible, white, red, dark red", () => { assert.equal(skullTintColor(0), null); assert.deepEqual(skullTintColor(1), { r: 1, g: 1, b: 1 }); assert.deepEqual(skullTintColor(SKULL_PURE_RED_VALUE), { r: 1, g: 0, b: 0 }); const dark = skullTintColor(SKULL_DARK_RED_VALUE); assert.ok(Math.abs(dark.r - 128 / 255) < 1e-9); assert.equal(dark.g, 0); assert.equal(dark.b, 0); });