Choose when you eat between fights

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-24 14:02:24 +01:00
parent 8afcba79fc
commit bc99a1e0c5
5 changed files with 43 additions and 5 deletions

View file

@ -2180,8 +2180,12 @@ function foodPanel(p) {
const tiles = [...p.edible].sort((a, b) => item(a).heal - item(b).heal).map((f) => `<button class="doll-slot swap ${f === id ? "on" : ""}" data-food="${f}"
title="${esc(`${item(f).name}: heals ${item(f).heal}`)}">${item(f).icon}<span class="swap-qty">${fmt(p.bank[f])}</span></button>`);
const cheap = `<button class="doll-slot swap ${id ? "" : "on"}" data-food="cheapest" title="Cheapest first">${ANY_FOOD}</button>`;
const below = p.eat_below ?? C.eat_below;
const label = (x) => x === 0 ? "Never" : x === 1 ? "Always" : `${Math.round(x * 100)}%`;
const when = `<div class="swap-head muted small" title="Between fights you eat while under this much of your HP, then rest the rest of the way">Eat below</div>
<div class="eat-below">${C.eat_choices.map((x) => `<button class="btn sm ${x === below ? "on" : ""}" data-eat="${x}">${label(x)}</button>`).join("")}</div>`;
return head + (p.edible.length ? `<div class="swap-head muted small">Eat first</div><div class="swap-grid">${cheap}${tiles.join("")}</div>`
: `<div class="small warn">No food in your bank.</div>`);
: `<div class="small warn">No food in your bank.</div>`) + when;
}
// The equipment panel, the same on the character sheet and the combat page (which leaves out tools).
@ -2301,6 +2305,7 @@ document.addEventListener("click", (e) => {
if (d.mode) return act("/api/manual", { id: d.mode, on: !S.me.manual.includes(d.mode) });
if ("pull" in d) return act("/api/pull", {});
if (d.learn) return act("/api/learn", { item: d.learn });
if (d.eat !== undefined) return act("/api/eat", { below: Number(d.eat) });
if (d.aim) return d.aim === S.uid ? undefined : act("/api/target", { id: d.aim });
if (d.start) return act("/api/action", { id: d.start });
if (d.once) return act("/api/action", { id: d.once, once: true });

View file

@ -587,6 +587,8 @@ button.sheet-skill:hover { background: var(--panel-2); }
.ab-lv .gi { width: 10px; height: 10px; }
.ab.boosted .ab-press::after { content: "✦"; position: absolute; top: 1px; right: 3px; font-size: 10px; color: var(--gold); }
.unique-text { color: var(--gold); margin-top: 4px; }
.eat-below { display: flex; flex-wrap: wrap; gap: 4px; }
.eat-below .btn.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.ab.locked { opacity: .35; filter: grayscale(1); }
.ab.fired .ab-press { box-shadow: 0 0 0 2px var(--gold); }
.ab.spent { opacity: .35; }