diff --git a/packages/viewer/src/App.svelte b/packages/viewer/src/App.svelte
index 0c835d7..6876229 100644
--- a/packages/viewer/src/App.svelte
+++ b/packages/viewer/src/App.svelte
@@ -171,7 +171,7 @@
const diceTerrain = $derived(s?.phase === "planning" ? focusTerrain : destination);
const rule = $derived(diceTerrain?.requirement);
const diceConflicts = $derived.by(() => {
- if (!s || !me || seat === undefined || !["reroll", "equipment"].includes(s.phase)) return {};
+ if (!s || !me || seat === undefined || !["planning", "reroll", "equipment"].includes(s.phase)) return {};
// Only our visible dice and the public destinations of comparison neighbors.
return Object.fromEntries(
me.dice.map((d) => [
@@ -180,6 +180,7 @@
? []
: neighbors(s, seat).flatMap((i) => {
const player = s.players[i]!;
+ if (s.phase === "planning" && player.path.length <= 1 && !player.ready) return [];
const destination = terrain(cell(s, player.path.at(-1) ?? player.position).terrain);
return matches(face(d), destination.requirement)
? [
@@ -188,6 +189,7 @@
name: player.name,
color: CHARACTER_COLORS[player.character]!,
location: destination.name,
+ provisional: s.phase === "planning" && !player.ready,
},
]
: [];
@@ -436,7 +438,17 @@
? "Preparation"
: s.phase}
- Level {s.difficulty}
+ Level {s.difficulty} ⓘ
+
+ Difficulty level {s.difficulty} of 4
+
+
{#if store.chat.enabled}Chat{store.chat.unread ? ` · ${store.chat.unread}` : ""} {localTotal}Matching dice total {diceTerrain.name}
{/if}
- {#if ["reroll", "equipment"].includes(s.phase)}
+ {#if ["planning", "reroll", "equipment"].includes(s.phase)}
Player numbers mark dice that also count against that teammate’s destination.
+ {#if s.phase === "planning"}Dashed markers are provisional; solid markers are confirmed.{/if}
{/if}
{#if s.phase === "reroll"}
{#if me.ready}✓ Your dice are kept. Waiting for the team.
store.dispatch({ action: "unready" })}
disabled={store.waiting || !canReopenChoice(s, seat!)}>Change my dice choices
@@ -1018,7 +1032,7 @@
disabled={store.waiting || !!reserved[currentRoute.at(-1)!]}
onclick={confirmTravel}>Ready to travel → {:else}✓ Your route is set. Waiting for the team.
- store.dispatch({ action: "plan", path: me.path })}
+ store.dispatch({ action: "plan", path: me.path })}
>Change my route {/if}
{:else if s.phase === "reroll"}
@@ -1033,7 +1047,7 @@
disabled={store.waiting}>Ready to reveal → {:else}✓ Ready. Waiting for the team.
store.dispatch({ action: "unready" })}
disabled={store.waiting || !canReopenChoice(s, seat!)}>Change my choice {/if}
diff --git a/packages/viewer/src/lib/Die.svelte b/packages/viewer/src/lib/Die.svelte
index 728a0b8..fa3fd35 100644
--- a/packages/viewer/src/lib/Die.svelte
+++ b/packages/viewer/src/lib/Die.svelte
@@ -13,13 +13,18 @@
colorblind?: boolean;
selected?: boolean;
relevant?: boolean;
- conflicts?: { seat: number; name: string; color: string; location: string }[];
+ conflicts?: { seat: number; name: string; color: string; location: string; provisional?: boolean }[];
disabled?: boolean;
onclick?: () => void;
} = $props();
const f = $derived(face(die));
const conflictHelp = $derived(
- conflicts.map((p) => `Adds ${die.face} to the total ${p.name} must beat at ${p.location}`).join(". ")
+ conflicts
+ .map(
+ (p) =>
+ `Adds ${die.face} to the total ${p.name} must beat at ${p.location}${p.provisional ? " (provisional destination)" : ""}`
+ )
+ .join(". ")
);
const layouts: Record = {
1: [4],
@@ -55,7 +60,9 @@
>{#each Array(9) as _, i} {/each}{#if colorblind}{f.color} {/if}{:else}? {/if}
{#if conflicts.length && die.face && !die.aside}
- {#each conflicts as player}{player.seat + 1} {/each}
+ {#each conflicts as player}{player.seat + 1} {/each}
{/if}
@@ -133,6 +140,9 @@
font-weight: 700;
box-shadow: 0 2px 4px #0005;
}
+ .conflict-badges > span.provisional {
+ border-style: dashed;
+ }
.die.aside {
opacity: 0.5;
transform: scale(0.85);
diff --git a/packages/viewer/src/lib/Landscape.svelte b/packages/viewer/src/lib/Landscape.svelte
index b19ce2d..c5268a8 100644
--- a/packages/viewer/src/lib/Landscape.svelte
+++ b/packages/viewer/src/lib/Landscape.svelte
@@ -2,6 +2,7 @@
import {
terrain,
total,
+ neighbors,
cell,
distance,
threatened,
@@ -24,6 +25,7 @@
selectionReasons,
reachable = [],
previewTotals = false,
+ previewImpacts = false,
onclick,
oninspect,
}: {
@@ -37,9 +39,18 @@
selectionReasons?: Record;
reachable?: string[];
previewTotals?: boolean;
+ previewImpacts?: boolean;
onclick: (id: string) => void;
oninspect: (id: string) => void;
} = $props();
+ const impactPlayers = $derived(
+ previewImpacts && seat !== undefined
+ ? neighbors(state, seat).filter((i) => {
+ const p = state.players[i]!;
+ return p.path.length > 1 || p.ready;
+ })
+ : []
+ );
const opposite = $derived(state.players.length === 4 && seat !== undefined ? (seat + 2) % 4 : -1);
const danger = $derived(threatened(state));
const mapWidth = $derived(116 + Math.max(...state.board.map((c) => c.x)) * 100);
@@ -109,6 +120,7 @@
class:burnt={a.lava || b.lava}
/>{/each}
{#each state.board as c (c.id)}
+ {@const peers = impactPlayers.filter((i) => state.players[i]!.path.at(-1) === c.id)}
{@const data = terrain(c.terrain)}
{/if}
- {#if previewTotals && seat !== undefined && reachable.includes(c.id) && !reserved[c.id] && !c.lava}
+
+ {#if seat !== undefined && peers.length && !c.lava}
+ {#each peers as playerIndex, index}
+ {@const player = state.players[playerIndex]!}
+ {@const value = total(state.players[seat]!, c.terrain)}
+ {@const cx = x(c.id) + (index - (peers.length - 1) / 2) * 43}
+
+
+ {value}
+
+ {/each}
+ {:else if previewTotals && seat !== undefined && reachable.includes(c.id) && !reserved[c.id] && !c.lava}
{@const value = total(state.players[seat]!, c.terrain) + state.players[seat]!.bonus}
Your current matching dice total, including bonuses. Rerolls may change it.
@@ -333,6 +363,16 @@
font-weight: 700;
text-anchor: middle;
}
+ .impact-preview rect {
+ stroke: var(--impact-color);
+ stroke-width: 2;
+ }
+ .impact-preview text {
+ fill: var(--impact-color);
+ }
+ .impact-preview.provisional rect {
+ stroke-dasharray: 4 3;
+ }
@media (max-width: 650px), (pointer: coarse) {
.dice-preview {
display: block;
diff --git a/packages/viewer/src/lib/StaminaGuide.svelte b/packages/viewer/src/lib/StaminaGuide.svelte
index b12d1a7..4a00081 100644
--- a/packages/viewer/src/lib/StaminaGuide.svelte
+++ b/packages/viewer/src/lib/StaminaGuide.svelte
@@ -1,12 +1,17 @@
-
+
ⓘ Stamina cost
Lead = your total − the highest neighbouring total.
diff --git a/packages/viewer/src/lib/theme.css b/packages/viewer/src/lib/theme.css
index 7da27c4..0b67132 100644
--- a/packages/viewer/src/lib/theme.css
+++ b/packages/viewer/src/lib/theme.css
@@ -222,11 +222,7 @@ h3 {
min-width: 0;
}
.journey {
- position: sticky;
- top: 12px;
- max-height: calc(100dvh - 24px);
- overflow-y: auto;
- scrollbar-width: thin;
+ position: static;
border-left: 1px solid #c9d4b620;
padding-left: 28px;
min-width: 0;
@@ -1810,3 +1806,47 @@ button.equipment-chip {
padding-left: 9px;
white-space: nowrap;
}
+
+button.difficulty-label {
+ background: transparent;
+ border: 0;
+ border-left: 1px solid #597367;
+ padding: 0 0 0 9px;
+ font: inherit;
+ cursor: help;
+}
+button.difficulty-label:hover,
+button.difficulty-label:focus-visible {
+ color: #f1d584;
+}
+.difficulty-preview {
+ text-transform: none;
+ letter-spacing: normal;
+}
+
+.revise-choice {
+ display: block;
+ width: 100%;
+ margin: 10px 0;
+ padding: 12px 16px;
+ border: 1px solid #d9c581;
+ border-radius: 5px;
+ background: #d9c58118;
+ color: #f1dba0;
+ font: inherit;
+ font-size: 15px;
+ font-weight: 600;
+ cursor: pointer;
+ text-align: center;
+}
+.revise-choice:hover:not(:disabled) {
+ background: #d9c58130;
+}
+.revise-choice:focus-visible {
+ outline: 2px solid #f1dba0;
+ outline-offset: 3px;
+}
+.revise-choice:disabled {
+ opacity: 0.45;
+ cursor: default;
+}
diff --git a/tests/planning-impacts-smoke.mjs b/tests/planning-impacts-smoke.mjs
new file mode 100644
index 0000000..ae6b9f0
--- /dev/null
+++ b/tests/planning-impacts-smoke.mjs
@@ -0,0 +1,59 @@
+import { chromium } from "playwright";
+import { initGame, stripSecret, total, paths, terrain } from "../packages/engine/dist/index.js";
+import assert from "node:assert/strict";
+const root = process.cwd();
+const browser = await chromium.launch({ headless: true, executablePath: process.env.FUJI_CHROMIUM_EXECUTABLE });
+for (const ready of [false, true]) {
+ const s = initGame(4, { skillAssignment: "fixed" }, "impacts");
+ s.phase = "planning";
+ s.players.forEach((p) => {
+ p.setupDone = true;
+ p.ready = false;
+ p.dice.forEach((d) => (d.face = 3));
+ });
+ s.players[0].bonus = 3;
+ const reach = paths(s, 0);
+ const far = s.board.find((c) => !c.lava && terrain(c.terrain).kind === "land" && !reach[c.id]);
+ const near = s.board.find((c) => c.id !== s.players[0].position && reach[c.id]);
+ for (const [i, c] of [
+ [1, far],
+ [2, near],
+ [3, near],
+ ]) {
+ s.players[i].path = [s.players[i].position, c.id];
+ s.players[i].ready = ready;
+ }
+ const p = await browser.newPage({ viewport: { width: 390, height: 840 } });
+ const errors = [];
+ p.on("pageerror", (e) => errors.push(e.message));
+ await p.setContent('
');
+ await p.addStyleTag({ path: root + "/packages/viewer/dist/fuji-viewer.css" });
+ await p.addScriptTag({ path: root + "/packages/viewer/dist/fuji-viewer.iife.js" });
+ await p.evaluate(
+ (s) => {
+ window.e = fuji.launch("#app");
+ e.emit("player", { index: 0 });
+ e.emit("state", s);
+ },
+ stripSecret(s, 0)
+ );
+ await p.locator(".impact-preview").first().waitFor();
+ assert.equal(await p.locator(".impact-preview").count(), 2);
+ assert.equal(await p.locator('.impact-preview[data-player="2"]').count(), 0);
+ assert.equal(
+ await p.locator('.impact-preview[data-player="1"] text').textContent(),
+ String(total(s.players[0], far.terrain))
+ );
+ assert.equal(await p.locator(".impact-preview.provisional").count(), ready ? 0 : 2);
+ assert.equal(await p.locator('.impact-preview[data-player="3"]').count(), 1);
+ assert.equal(await p.locator(`.dice-preview:not(.impact-preview)[data-location="${near.id}"]`).count(), 0);
+ const markers = await p.locator(".conflict-badges > span").count();
+ assert(markers > 0);
+ assert.equal(await p.locator(".conflict-badges > span.provisional").count(), ready ? 0 : markers);
+ assert.deepEqual(errors, []);
+ await p.close();
+}
+await browser.close();
+console.log(
+ "Planning previews: unreachable/reachable destinations, neighbour filtering, own dice totals, provisional/confirmed borders passed."
+);