Improve mobile map, action panels and expedition details
This commit is contained in:
parent
d46c69fd0e
commit
f6846f447a
11 changed files with 959 additions and 112 deletions
|
|
@ -68,7 +68,8 @@
|
|||
let keep = $state<string[]>([]);
|
||||
let drop = $state("");
|
||||
let help = $state(false);
|
||||
let journal = $state(true);
|
||||
let journal = $state(false);
|
||||
let teamExpanded = $state(false);
|
||||
let socialTab = $state("chat");
|
||||
let fullscreen = $state(false);
|
||||
onMount(() => {
|
||||
|
|
@ -325,7 +326,7 @@
|
|||
return;
|
||||
}
|
||||
if (s.phase === "reroll") {
|
||||
document.querySelector(".reroll-actions")?.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
store.dispatch({ action: me.ready ? "unready" : "finishRerolls" });
|
||||
return;
|
||||
}
|
||||
if (s.phase === "equipment") {
|
||||
|
|
@ -351,7 +352,9 @@
|
|||
? "Change route"
|
||||
: "Ready to travel"
|
||||
: s.phase === "reroll"
|
||||
? "Dice actions"
|
||||
? me.ready
|
||||
? "Change dice"
|
||||
: "Keep dice"
|
||||
: s.phase === "equipment"
|
||||
? me.ready
|
||||
? "Change equipment"
|
||||
|
|
@ -447,7 +450,7 @@
|
|||
{#if s}
|
||||
<VictoryPetals won={s.outcome === "won"} animating={store.animating} />
|
||||
<main class="expedition">
|
||||
<header class="game-tools">
|
||||
<header class="game-tools" class:details-open={teamExpanded}>
|
||||
<div class="game-brand" translate="no" title="Fuji · Wolfgang Warsch · Feuerland Spiele">
|
||||
<svg class="fuji-mark" viewBox="0 0 44 36" fill="none" aria-hidden="true"
|
||||
><circle cx="33" cy="8" r="5" fill="currentColor" opacity=".45" /><path
|
||||
|
|
@ -501,6 +504,13 @@
|
|||
</span>
|
||||
</div>
|
||||
<nav class="game-utilities" aria-label="Game options">
|
||||
<button
|
||||
class="utility-button team-toggle"
|
||||
aria-label="Your expedition"
|
||||
title="Your expedition"
|
||||
aria-expanded={teamExpanded}
|
||||
onclick={() => (teamExpanded = !teamExpanded)}>☷</button
|
||||
>
|
||||
{#if store.chatAvailable}<button
|
||||
class="utility-button"
|
||||
onclick={openChat}
|
||||
|
|
@ -619,16 +629,16 @@
|
|||
>{s.phase === "planning"
|
||||
? `${destination?.name ?? ""} · ${destination ? total(me, destination.id) : 0}`
|
||||
: s.phase === "reroll"
|
||||
? `${me.rerolls} rerolls remaining`
|
||||
? `${localTotal} · ${hasSkill(me, "gatherer") && me.rerolls && me.powerBars < 3 ? `+${Math.min(me.rerolls, 3 - me.powerBars)} ${Math.min(me.rerolls, 3 - me.powerBars) === 1 ? "bar" : "bars"} if kept` : (destination?.name ?? "")}`
|
||||
: me.name}</strong
|
||||
>
|
||||
</div>
|
||||
<button
|
||||
data-tutorial={s.phase === "movement" ? "resolve" : "confirm"}
|
||||
data-tutorial={s.phase === "movement" ? "resolve" : s.phase === "reroll" ? "finish-rerolls" : "confirm"}
|
||||
onclick={mobileAction}
|
||||
disabled={store.waiting ||
|
||||
(s.phase === "planning" && !me.ready && !!reserved[currentRoute.at(-1)!]) ||
|
||||
(s.phase === "reroll" && me.ready) ||
|
||||
(s.phase === "reroll" && me.ready && !canReopenChoice(s, seat!)) ||
|
||||
(s.phase === "equipment" && me.ready && !canReopenChoice(s, seat!)) ||
|
||||
(s.phase === "eruption" && seat !== 0)}>{mobileLabel} →</button
|
||||
>
|
||||
|
|
@ -636,7 +646,7 @@
|
|||
>Chat{store.chatState.unreadIds.length ? ` · ${store.chatState.unreadIds.length}` : ""}</button
|
||||
>{/if}
|
||||
</div>{/if}
|
||||
<section class="team" aria-label="Your expedition">
|
||||
<section class="team" class:expanded={teamExpanded} aria-label="Your expedition">
|
||||
{#each s.players as p, i}
|
||||
<article
|
||||
class="teammate"
|
||||
|
|
@ -812,23 +822,30 @@
|
|||
<strong>{localTotal}</strong><span>Matching dice total<br />{diceTerrain.name}</span>
|
||||
</div>{/if}
|
||||
</div>
|
||||
{#if ["planning", "reroll", "equipment"].includes(s.phase)}<p class="dice-conflict-guide">
|
||||
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}
|
||||
</p>{/if}
|
||||
{#if ["planning", "reroll", "equipment"].includes(s.phase)}<details class="dice-conflict-guide">
|
||||
<summary aria-label="Your dice" title="Your dice"
|
||||
><span class="dice-guide-label">Your dice</span><span class="dice-guide-icon" aria-hidden="true"
|
||||
>ⓘ</span
|
||||
></summary
|
||||
>
|
||||
<p>
|
||||
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}
|
||||
</p>
|
||||
</details>{/if}
|
||||
{#if s.phase === "reroll"}<section class="reroll-actions" aria-label="Dice actions">
|
||||
{#if me.ready}<p class="confirmed">✓ Your dice are kept. Waiting for the team.</p>
|
||||
<button
|
||||
class="revise-choice"
|
||||
class="revise-choice desktop-phase-confirm"
|
||||
onclick={() => store.dispatch({ action: "unready" })}
|
||||
disabled={store.waiting || !canReopenChoice(s, seat!)}>Change my dice choices</button
|
||||
>
|
||||
{:else}
|
||||
<div class="reroll-choice">
|
||||
<div class="reroll-choice normal-reroll">
|
||||
<strong
|
||||
>{me.rerolls === 1 ? `${me.rerolls} reroll remaining` : `${me.rerolls} rerolls remaining`}</strong
|
||||
>
|
||||
{#if me.rerolls}<p>Select any dice, then reroll them together.</p>
|
||||
{#if me.rerolls}<p class="reroll-hint">Select any dice, then reroll them together.</p>
|
||||
<button
|
||||
class="primary"
|
||||
disabled={!dice.length || store.waiting}
|
||||
|
|
@ -844,18 +861,20 @@
|
|||
</p>{/if}
|
||||
</div>
|
||||
{#if hasSkill(me, "buddy")}<div class="reroll-choice buddy-choice">
|
||||
<strong>Buddy · optional</strong>
|
||||
{#if me.buddyUsed}<p>Die set aside: visible to everyone, excluded from comparisons this round.</p>
|
||||
{:else}<p>
|
||||
Set one die aside without spending a reroll. It becomes public and does not count this round.
|
||||
<details class="buddy-help">
|
||||
<summary>Buddy <span aria-hidden="true">ⓘ</span></summary>
|
||||
<p>
|
||||
Optionally set one die aside without spending a reroll. It becomes public and does not count
|
||||
in comparisons this round.
|
||||
</p>
|
||||
<button
|
||||
</details>
|
||||
{#if me.buddyUsed}<span class="buddy-status">✓ Die set aside</span>
|
||||
{:else}<button
|
||||
class="secondary"
|
||||
disabled={dice.length !== 1 || store.waiting}
|
||||
onclick={() => store.dispatch({ action: "buddy", ids: dice })}>Set selected die aside</button
|
||||
>
|
||||
{#if dice.length !== 1}<span class="muted small">Select exactly one die above.</span>{/if}
|
||||
{/if}
|
||||
onclick={() => store.dispatch({ action: "buddy", ids: dice })}
|
||||
>{dice.length === 1 ? "Set die aside · free" : "Select 1 die to set aside"}</button
|
||||
>{/if}
|
||||
</div>{/if}
|
||||
<button
|
||||
class="primary finish-dice"
|
||||
|
|
@ -863,7 +882,7 @@
|
|||
data-tutorial="finish-rerolls"
|
||||
onclick={() => store.dispatch({ action: "finishRerolls" })}
|
||||
>Done with my dice{hasSkill(me, "gatherer") && me.rerolls
|
||||
? ` · gain ${Math.min(me.rerolls, 3 - me.powerBars)} bars`
|
||||
? ` · gain ${Math.min(me.rerolls, 3 - me.powerBars)} ${Math.min(me.rerolls, 3 - me.powerBars) === 1 ? "bar" : "bars"}`
|
||||
: ""}<span aria-hidden="true">→</span></button
|
||||
>
|
||||
{/if}
|
||||
|
|
@ -887,7 +906,7 @@
|
|||
<div class:desktop-journal={store.chatAvailable}>{@render journalPanel("desktop")}</div>
|
||||
</div>
|
||||
<aside class="journey">
|
||||
<div class="social-panel" data-tab={socialTab}>
|
||||
<div class="social-panel" class:empty-social={!store.chatAvailable} data-tab={socialTab}>
|
||||
{#if store.chatAvailable}<nav class="social-tabs" aria-label="Chat and journal">
|
||||
<button
|
||||
class:active={socialTab === "chat"}
|
||||
|
|
@ -1054,16 +1073,20 @@
|
|||
? "Choose exactly one die to reroll."
|
||||
: "Select any dice to reroll. You may also stop."}
|
||||
</p>
|
||||
<button
|
||||
class="primary"
|
||||
disabled={store.waiting ||
|
||||
(s.pending.required && dice.length !== 1) ||
|
||||
(s.pending.kind === "lend" && dice.length !== 1)}
|
||||
onclick={() => store.dispatch({ action: "respond", ids: dice })}
|
||||
>{s.pending.kind === "lend" ? "Lend selected die" : "Reroll selected dice"}</button
|
||||
>{#if !s.pending.required}<button class="secondary" onclick={() => store.dispatch({ action: "decline" })}
|
||||
>{s.pending.kind === "lend" ? "Decline" : "Finish rerolls"}</button
|
||||
>{/if}
|
||||
<div class="response-actions">
|
||||
<button
|
||||
class="primary"
|
||||
disabled={store.waiting ||
|
||||
(s.pending.required && dice.length !== 1) ||
|
||||
(s.pending.kind === "lend" && dice.length !== 1)}
|
||||
onclick={() => store.dispatch({ action: "respond", ids: dice })}
|
||||
>{s.pending.kind === "lend" ? "Lend selected die" : "Reroll selected dice"}</button
|
||||
>{#if !s.pending.required}<button
|
||||
class="secondary"
|
||||
onclick={() => store.dispatch({ action: "decline" })}
|
||||
>{s.pending.kind === "lend" ? "Decline" : "Finish rerolls"}</button
|
||||
>{/if}
|
||||
</div>
|
||||
{:else}<p class="instruction">
|
||||
Waiting for {s.pending.players.map((i) => s.players[i]!.name).join(", ")} to resolve an equipment effect.
|
||||
</p>{/if}
|
||||
|
|
@ -1086,6 +1109,13 @@
|
|||
<div>
|
||||
<span class="eyebrow">YOUR DESTINATION</span>
|
||||
<h3>{destination.name}</h3>
|
||||
{#if destination.reroll}<span>↻ +1 reroll when chosen as your destination.</span>{/if}
|
||||
{#if cell(s, currentRoute.at(-1)!).equipment}<span
|
||||
>Equipment: finish your move here to draw a card, usable next round.</span
|
||||
>{/if}
|
||||
{#if destination.kind === "village"}<span
|
||||
>Village: any house-marked location counts toward the team’s escape.</span
|
||||
>{/if}
|
||||
<RequirementDisplay requirement={destination.requirement} colorblind={store.colorblind} />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1104,28 +1134,31 @@
|
|||
{reserved[currentRoute.at(-1)!]} has reserved this destination. Choose another location.
|
||||
</p>{/if}
|
||||
{#if !me.ready}<button
|
||||
class="primary"
|
||||
class="primary desktop-travel-confirm"
|
||||
disabled={store.waiting || !!reserved[currentRoute.at(-1)!]}
|
||||
data-tutorial="confirm"
|
||||
onclick={confirmTravel}>Ready to travel <span>→</span></button
|
||||
>{:else}<p class="confirmed">✓ Your route is set. Waiting for the team.</p>
|
||||
<button class="revise-choice" onclick={() => store.dispatch({ action: "plan", path: me.path })}
|
||||
>Change my route</button
|
||||
<button
|
||||
class="revise-choice desktop-phase-confirm"
|
||||
onclick={() => store.dispatch({ action: "plan", path: me.path })}>Change my route</button
|
||||
>{/if}
|
||||
{:else if s.phase === "reroll"}
|
||||
<p class="instruction">Reroll in silence. Your dice actions are below the map.</p>
|
||||
<p class="instruction desktop-reroll-instruction">
|
||||
Reroll in silence. Your dice actions are below the map.
|
||||
</p>
|
||||
{:else if s.phase === "equipment"}
|
||||
<p class="instruction">
|
||||
Discuss equipment with your teammates. Your dice are still private and your destination is locked.
|
||||
</p>
|
||||
{#if !me.ready}<button
|
||||
class="primary"
|
||||
class="primary desktop-phase-confirm"
|
||||
data-tutorial="confirm"
|
||||
onclick={() => store.dispatch({ action: "ready" })}
|
||||
disabled={store.waiting}>Ready to reveal <span>→</span></button
|
||||
>{:else}<p class="confirmed">✓ Ready. Waiting for the team.</p>
|
||||
<button
|
||||
class="revise-choice"
|
||||
class="revise-choice desktop-phase-confirm"
|
||||
onclick={() => store.dispatch({ action: "unready" })}
|
||||
disabled={store.waiting || !canReopenChoice(s, seat!)}>Change my choice</button
|
||||
>{/if}
|
||||
|
|
@ -1141,7 +1174,7 @@
|
|||
</p>
|
||||
{#if !me.resolved}<button
|
||||
data-tutorial="resolve"
|
||||
class="primary"
|
||||
class="primary desktop-phase-confirm"
|
||||
onclick={() => store.dispatch({ action: "beginMovement" })}>Resolve my journey <span>→</span></button
|
||||
>{:else}<p class="confirmed">✓ Your journey is resolved.</p>{/if}
|
||||
{:else if resolvingPlayer && result}{@const criterion = terrain(
|
||||
|
|
@ -1217,7 +1250,7 @@
|
|||
<div class="eruption-count"><strong>{danger.length}</strong><span>locations threatened</span></div>
|
||||
<button
|
||||
data-tutorial="erupt"
|
||||
class="primary ember"
|
||||
class="primary ember desktop-phase-confirm"
|
||||
disabled={seat !== 0}
|
||||
onclick={() => store.dispatch({ action: "erupt" })}
|
||||
>{seat === 0 ? "Let the lava advance" : "Waiting for the expedition leader"} <span>→</span></button
|
||||
|
|
@ -1265,7 +1298,6 @@
|
|||
(c) => c.id === tool
|
||||
)!}{@const info = EQUIPMENT.find((e) => e.id === tool)!}
|
||||
<div class="tool-form">
|
||||
{#if tool !== "knife"}<p>{info.description}</p>{/if}
|
||||
{#if tool === "knife"}<fieldset class="visible-choices equipment-copy">
|
||||
<legend>Copy equipment</legend>
|
||||
{#each copyOptions as option}<button
|
||||
|
|
@ -1317,6 +1349,12 @@
|
|||
: actionTool === "torch"
|
||||
? "one or more dice to reroll"
|
||||
: "the dice"} below the map. {dice.length} selected.
|
||||
<button
|
||||
class="text-button"
|
||||
onclick={() =>
|
||||
document.querySelector(".personal")?.scrollIntoView({ behavior: "smooth", block: "center" })}
|
||||
>Select dice ↑</button
|
||||
>
|
||||
</p>{/if}
|
||||
{#if actionTool === "shovel" && shovelDie}<fieldset class="visible-choices">
|
||||
<legend>New value</legend>
|
||||
|
|
@ -1338,7 +1376,12 @@
|
|||
? `: ${tilePicks.map((id) => terrain(cell(s, id).terrain).name).join(" + ")}`
|
||||
: ""}.</span
|
||||
>
|
||||
{#if actionTool === "binoculars" && tileHint}<span role="status">{tileHint}</span>{/if}
|
||||
{#if actionTool === "binoculars" && tileHint}<span role="status">{tileHint}</span>{/if}<button
|
||||
class="text-button"
|
||||
onclick={() =>
|
||||
document.querySelector(".landscape")?.scrollIntoView({ behavior: "smooth", block: "start" })}
|
||||
>Choose on map ↑</button
|
||||
>
|
||||
</p>{/if}
|
||||
<button
|
||||
class="secondary"
|
||||
|
|
@ -1384,16 +1427,19 @@
|
|||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
{#if focusTerrain && s.phase !== "setup"}<div class="location-detail">
|
||||
{#if s.phase !== "setup" && reserved[focusId]}<p class="instruction">
|
||||
Reserved by {reserved[focusId]}. Choose another destination; you may still pass through.
|
||||
</p>{/if}
|
||||
{#if focusTerrain && s.phase !== "setup" && !(s.phase === "planning" && destination && focusId === currentRoute.at(-1))}<div
|
||||
class="location-detail"
|
||||
>
|
||||
<span class="eyebrow">INSPECTING THE TRAIL</span><strong>{focusTerrain.name}</strong>
|
||||
<img
|
||||
class="inspected-art"
|
||||
src={art("land", focusTerrain.id)}
|
||||
alt={focusTerrain.name}
|
||||
/><RequirementDisplay requirement={focusTerrain.requirement} colorblind={store.colorblind} />
|
||||
{#if reserved[focusId]}<span
|
||||
>Reserved by {reserved[focusId]}. Choose another destination; you may still pass through.</span
|
||||
>{/if}
|
||||
|
||||
{#if focus?.lava}<span>Lava: cannot enter or cross.</span>
|
||||
{:else}
|
||||
{#if focusTerrain.reroll}<span>↻ +1 reroll when chosen as your destination.</span>{/if}
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@
|
|||
.chat-messages {
|
||||
height: clamp(140px, 22vh, 250px);
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
overscroll-behavior: auto;
|
||||
overflow-anchor: none;
|
||||
margin: 14px 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { tick } from "svelte";
|
||||
let overview = $state(false);
|
||||
let mapScroll: HTMLDivElement;
|
||||
import {
|
||||
terrain,
|
||||
total,
|
||||
|
|
@ -15,7 +18,7 @@
|
|||
import RequirementSymbols from "./RequirementSymbols.svelte";
|
||||
import { art } from "./assets";
|
||||
let {
|
||||
state,
|
||||
state: game,
|
||||
avatars = [],
|
||||
colorblind = false,
|
||||
seat,
|
||||
|
|
@ -45,47 +48,57 @@
|
|||
} = $props();
|
||||
const impactPlayers = $derived(
|
||||
previewImpacts && seat !== undefined
|
||||
? neighbors(state, seat).filter((i) => {
|
||||
const p = state.players[i]!;
|
||||
return state.phase !== "planning" || p.path.length > 1 || p.ready;
|
||||
? neighbors(game, seat).filter((i) => {
|
||||
const p = game.players[i]!;
|
||||
return game.phase !== "planning" || 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);
|
||||
const opposite = $derived(game.players.length === 4 && seat !== undefined ? (seat + 2) % 4 : -1);
|
||||
const danger = $derived(threatened(game));
|
||||
const mapWidth = $derived(116 + Math.max(...game.board.map((c) => c.x)) * 100);
|
||||
// Empty rectangles in the seven production layouts, including four-player tiles.
|
||||
const layout = $derived(
|
||||
(
|
||||
{
|
||||
1: { guide: [14, 519, 385], counter: [state.players.length === 4 ? 714 : 614, 108] },
|
||||
2: { guide: [14, 603, 485], counter: [714, state.players.length === 4 ? 184 : 268] },
|
||||
1: { guide: [14, 519, 385], counter: [game.players.length === 4 ? 714 : 614, 108] },
|
||||
2: { guide: [14, 603, 485], counter: [714, game.players.length === 4 ? 184 : 268] },
|
||||
3: { guide: [14, 519, 485], counter: [614, 435] },
|
||||
4: { guide: [514, 435, 185], counter: [714, 16] },
|
||||
5: { guide: [414, 519, 185], counter: [14, 184] },
|
||||
6: { guide: [14, 351, 285], counter: [14, 519] },
|
||||
7: { guide: [214, 267, 285], counter: [14, 268] },
|
||||
} as Record<number, { guide: number[]; counter: number[] }>
|
||||
)[state.scenario ?? 1]!
|
||||
)[game.scenario ?? 1]!
|
||||
);
|
||||
const guideX = $derived(layout.guide[0]!);
|
||||
const guideY = $derived(layout.guide[1]!);
|
||||
const guideWidth = $derived(layout.guide[2]!);
|
||||
const guideHeight = $derived(guideWidth < 200 ? 184 : guideWidth < 300 ? 148 : state.difficulty >= 3 ? 106 : 86);
|
||||
const mapHeight = $derived(Math.max(100 + Math.max(...state.board.map((c) => c.y)) * 84, guideY + guideHeight + 5));
|
||||
const x = (id: string) => 58 + cell(state, id).x * 100;
|
||||
const y = (id: string) => 54 + cell(state, id).y * 84;
|
||||
const guideHeight = $derived(guideWidth < 200 ? 184 : guideWidth < 300 ? 148 : game.difficulty >= 3 ? 106 : 86);
|
||||
const mapHeight = $derived(Math.max(100 + Math.max(...game.board.map((c) => c.y)) * 84, guideY + guideHeight + 5));
|
||||
const x = (id: string) => 58 + cell(game, id).x * 100;
|
||||
const y = (id: string) => 54 + cell(game, id).y * 84;
|
||||
const edges = $derived(
|
||||
state.board.flatMap((a) =>
|
||||
state.board.filter((b) => distance(a, b) === 1 && (b.x > a.x || b.y > a.y)).map((b) => ({ a, b }))
|
||||
game.board.flatMap((a) =>
|
||||
game.board.filter((b) => distance(a, b) === 1 && (b.x > a.x || b.y > a.y)).map((b) => ({ a, b }))
|
||||
)
|
||||
);
|
||||
const ownColor = $derived(seat === undefined ? "#f1d584" : CHARACTER_COLORS[state.players[seat]!.character]);
|
||||
$effect(() => {
|
||||
const position = seat === undefined ? undefined : game.players[seat]?.position;
|
||||
const compact = overview;
|
||||
if (position)
|
||||
void tick().then(() => {
|
||||
if (!mapScroll || compact) return;
|
||||
const svg = mapScroll.querySelector("svg");
|
||||
if (svg) mapScroll.scrollLeft = (x(position) * svg.clientWidth) / mapWidth - mapScroll.clientWidth / 2;
|
||||
});
|
||||
});
|
||||
const ownColor = $derived(seat === undefined ? "#f1d584" : CHARACTER_COLORS[game.players[seat]!.character]);
|
||||
// Stable parallel lanes keep shared segments visible, including opposite directions.
|
||||
const destinationMarker = (id: string, player: number) => {
|
||||
const c = cell(state, id);
|
||||
const c = cell(game, id);
|
||||
const data = terrain(c.terrain);
|
||||
const targets = state.players.flatMap((p, i) =>
|
||||
const targets = game.players.flatMap((p, i) =>
|
||||
!p.resolved && (p.path.length > 1 || p.ready) && p.path.at(-1) === id ? [i] : []
|
||||
);
|
||||
const obstacles = [
|
||||
|
|
@ -110,7 +123,7 @@
|
|||
return `translate(${x(id) + offset[0]!},${y(id) + offset[1]!})`;
|
||||
};
|
||||
const routePoints = (path: string[], player: number) => {
|
||||
const offset = (player - (state.players.length - 1) / 2) * 8;
|
||||
const offset = (player - (game.players.length - 1) / 2) * 8;
|
||||
return path.map((id) => `${x(id) + offset},${y(id) + offset}`).join(" ");
|
||||
};
|
||||
</script>
|
||||
|
|
@ -121,11 +134,18 @@
|
|||
style:--route-color={ownColor}
|
||||
style:--landscape-art={`url(${art("land", 21)})`}
|
||||
>
|
||||
<div class="map-scroll">
|
||||
<button
|
||||
class="map-zoom"
|
||||
aria-label={overview ? "Zoom in on the map" : "Show the whole map"}
|
||||
title={overview ? "Zoom in on the map" : "Show the whole map"}
|
||||
aria-pressed={overview}
|
||||
onclick={() => (overview = !overview)}>{overview ? "+" : "−"}</button
|
||||
>
|
||||
<div class="map-scroll" class:overview bind:this={mapScroll}>
|
||||
<svg
|
||||
viewBox={`0 0 ${mapWidth} ${mapHeight}`}
|
||||
class="map"
|
||||
aria-label={`Scenario ${state.scenario ?? 1}, difficulty ${state.difficulty}. Choose a location to inspect or plan a journey.`}
|
||||
aria-label={`Scenario ${game.scenario ?? 1}, difficulty ${game.difficulty}. Choose a location to inspect or plan a journey.`}
|
||||
>
|
||||
<defs>
|
||||
<radialGradient id="feather"
|
||||
|
|
@ -151,13 +171,13 @@
|
|||
class="trail"
|
||||
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)}
|
||||
{#each game.board as c (c.id)}
|
||||
{@const peers = impactPlayers.filter((i) => game.players[i]!.path.at(-1) === c.id)}
|
||||
{@const data = terrain(c.terrain)}
|
||||
<g
|
||||
class="location"
|
||||
data-tutorial={`tile:${c.id}`}
|
||||
class:inactive={state.phase === "setup"}
|
||||
class:inactive={game.phase === "setup"}
|
||||
class:reserved={!!reserved[c.id]}
|
||||
class:reachable={reachable.includes(c.id)}
|
||||
class:out-of-range={selectionReasons
|
||||
|
|
@ -167,8 +187,8 @@
|
|||
class:lava={c.lava}
|
||||
class:village={data.kind === "village"}
|
||||
role="button"
|
||||
aria-disabled={state.phase === "setup"}
|
||||
tabindex={state.phase === "setup" ? -1 : 0}
|
||||
aria-disabled={game.phase === "setup"}
|
||||
tabindex={game.phase === "setup" ? -1 : 0}
|
||||
aria-label={`${data.name}${!selectionReasons && reserved[c.id] ? `, reserved by ${reserved[c.id]}: choose another destination` : ""}${selectionReasons ? `, ${selectionReasons[c.id] || "available to swap, any distance"}` : reachable.length ? (reachable.includes(c.id) ? ", within movement range" : ", outside movement range") : ""}${data.kind === "village" ? ", village destination" : ""}, ${requirementLabel(data.requirement)}${c.lava ? ", covered in lava" : ""}${c.equipment && !c.lava ? ", equipment: finish here to draw a card usable next round" : ""}${c.eruption && !c.lava ? `, crossing or entering triggers ${c.eruption} extra eruption(s)` : ""}${danger.includes(c.id) ? ", threatened by the next eruption" : ""}`}
|
||||
onclick={() => onclick(c.id)}
|
||||
onkeydown={(e) => {
|
||||
|
|
@ -178,10 +198,10 @@
|
|||
}
|
||||
}}
|
||||
onmouseenter={() => {
|
||||
if (state.phase !== "setup") oninspect(c.id);
|
||||
if (game.phase !== "setup") oninspect(c.id);
|
||||
}}
|
||||
onfocus={() => {
|
||||
if (state.phase !== "setup") oninspect(c.id);
|
||||
if (game.phase !== "setup") oninspect(c.id);
|
||||
}}
|
||||
onmouseleave={() => oninspect("")}
|
||||
onblur={() => oninspect("")}
|
||||
|
|
@ -255,23 +275,23 @@
|
|||
|
||||
{#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 player = game.players[playerIndex]!}
|
||||
{@const value = total(game.players[seat]!, c.terrain)}
|
||||
{@const cx = x(c.id) + (index - (peers.length - 1) / 2) * 43}
|
||||
<g
|
||||
class="dice-preview impact-preview"
|
||||
class:provisional={state.phase === "planning" && !player.ready}
|
||||
class:provisional={game.phase === "planning" && !player.ready}
|
||||
data-location={c.id}
|
||||
data-player={playerIndex}
|
||||
style:--impact-color={CHARACTER_COLORS[player.character]}
|
||||
aria-label={`Your dice total against ${player.name}: ${value}. ${state.phase !== "planning" || player.ready ? "Confirmed" : "Provisional"} destination.`}
|
||||
aria-label={`Your dice total against ${player.name}: ${value}. ${game.phase !== "planning" || player.ready ? "Confirmed" : "Provisional"} destination.`}
|
||||
>
|
||||
<rect x={cx - 20} y={y(c.id) - 13} width="40" height="26" rx="6" />
|
||||
<text x={cx} y={y(c.id) + 6}>{value}</text>
|
||||
</g>
|
||||
{/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}
|
||||
{@const value = total(game.players[seat]!, c.terrain) + game.players[seat]!.bonus}
|
||||
<g class="dice-preview" data-location={c.id} aria-label={`Your current dice total: ${value}`}>
|
||||
<title>Your current matching dice total, including bonuses. Rerolls may change it.</title>
|
||||
<rect x={x(c.id) - 20} y={y(c.id) - 13} width="40" height="26" rx="6" />
|
||||
|
|
@ -283,22 +303,22 @@
|
|||
>{/if}
|
||||
</g>
|
||||
{/each}
|
||||
{#if ["planning", "reroll", "equipment", "movement"].includes(state.phase)}
|
||||
{#each state.players as p, i}
|
||||
{#if ["planning", "reroll", "equipment", "movement"].includes(game.phase)}
|
||||
{#each game.players as p, i}
|
||||
{#if !p.resolved && (p.path.length > 1 || p.ready)}
|
||||
{@const destination = p.path.at(-1)!}
|
||||
<g
|
||||
class="teammate-route"
|
||||
class:opposite={i === opposite}
|
||||
data-player={i}
|
||||
aria-label={`${p.name}: ${terrain(cell(state, destination).terrain).name}${p.ready ? ", ready" : ", planned"}`}
|
||||
aria-label={`${p.name}: ${terrain(cell(game, destination).terrain).name}${p.ready ? ", ready" : ", planned"}`}
|
||||
>
|
||||
{#if p.path.length > 1}
|
||||
<polyline points={routePoints(p.path, i)} class="route-shadow" />
|
||||
<polyline
|
||||
points={routePoints(p.path, i)}
|
||||
class="shared-route-line"
|
||||
class:provisional={state.phase === "planning" && !p.ready}
|
||||
class:provisional={game.phase === "planning" && !p.ready}
|
||||
stroke={CHARACTER_COLORS[p.character]}
|
||||
/>
|
||||
{/if}
|
||||
|
|
@ -309,8 +329,8 @@
|
|||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#each state.players as p, i (i)}
|
||||
{#if i === seat && p.ready && state.phase === "planning" && p.path.length}
|
||||
{#each game.players as p, i (i)}
|
||||
{#if i === seat && p.ready && game.phase === "planning" && p.path.length}
|
||||
<circle
|
||||
cx={x(p.path.at(-1)!)}
|
||||
cy={y(p.path.at(-1)!)}
|
||||
|
|
@ -321,7 +341,7 @@
|
|||
stroke-dasharray="3 5"
|
||||
/>
|
||||
{/if}
|
||||
{@const occupants = state.players.map((q, j) => (q.position === p.position ? j : -1)).filter((j) => j >= 0)}
|
||||
{@const occupants = game.players.map((q, j) => (q.position === p.position ? j : -1)).filter((j) => j >= 0)}
|
||||
{@const offset = (occupants.indexOf(i) - (occupants.length - 1) / 2) * 27}
|
||||
<g
|
||||
class="traveler"
|
||||
|
|
@ -352,8 +372,8 @@
|
|||
<div
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
class="legend-end"
|
||||
title={`Scenario ${String(state.scenario ?? 1).padStart(2, "0")} · Level ${state.difficulty}. Everyone must reach a house-marked location.`}
|
||||
aria-label={`${state.players.filter((p) => terrain(cell(state, p.position).terrain).kind === "village").length} of ${state.players.length} players in the village`}
|
||||
title={`Scenario ${String(game.scenario ?? 1).padStart(2, "0")} · Level ${game.difficulty}. Everyone must reach a house-marked location.`}
|
||||
aria-label={`${game.players.filter((p) => terrain(cell(game, p.position).terrain).kind === "village").length} of ${game.players.length} players in the village`}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
|
|
@ -364,8 +384,8 @@
|
|||
stroke-width="1.7"
|
||||
aria-hidden="true"><path d="m2 11 10-9 10 9M5 9v12h14V9M10 21v-7h4v7" /></svg
|
||||
>
|
||||
{state.players.filter((p) => terrain(cell(state, p.position).terrain).kind === "village").length}/{state
|
||||
.players.length}
|
||||
{game.players.filter((p) => terrain(cell(game, p.position).terrain).kind === "village").length}/{game.players
|
||||
.length}
|
||||
</div>
|
||||
</foreignObject>
|
||||
<foreignObject x={guideX} y={guideY} width={guideWidth} height={guideHeight} class="map-guides">
|
||||
|
|
@ -373,7 +393,7 @@
|
|||
<div class="scene-legend">
|
||||
<span><i class="legend-line"></i>Route</span><span><i class="legend-danger"></i>Next eruption</span>
|
||||
</div>
|
||||
<TravelGuide difficulty={state.difficulty} embedded />
|
||||
<TravelGuide difficulty={game.difficulty} embedded />
|
||||
</div>
|
||||
</foreignObject>
|
||||
</svg>
|
||||
|
|
@ -381,6 +401,9 @@
|
|||
</div>
|
||||
|
||||
<style>
|
||||
.map-zoom {
|
||||
display: none;
|
||||
}
|
||||
.dice-preview {
|
||||
display: block;
|
||||
pointer-events: none;
|
||||
|
|
@ -648,11 +671,28 @@
|
|||
}
|
||||
}
|
||||
@media (max-width: 650px) {
|
||||
.map-zoom {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 6px;
|
||||
z-index: 2;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #ddc985;
|
||||
background: #163b32;
|
||||
color: #ffe6a1;
|
||||
font-size: 24px;
|
||||
}
|
||||
.map-scroll.overview .map {
|
||||
min-width: 0;
|
||||
}
|
||||
.map-scroll {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.map {
|
||||
min-width: 610px;
|
||||
min-width: 640px;
|
||||
height: auto;
|
||||
}
|
||||
.scene-legend {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
.player-choices {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 14px 0;
|
||||
margin: 8px 0;
|
||||
min-width: 0;
|
||||
}
|
||||
legend {
|
||||
|
|
@ -54,15 +54,17 @@
|
|||
margin-bottom: 8px;
|
||||
}
|
||||
.choices {
|
||||
display: grid;
|
||||
gap: 7px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 48px;
|
||||
gap: 6px;
|
||||
flex: 1 1 130px;
|
||||
min-width: 0;
|
||||
min-height: 44px;
|
||||
padding: 6px 10px;
|
||||
text-align: left;
|
||||
background: #102b25;
|
||||
|
|
@ -80,8 +82,8 @@
|
|||
background: #29483a;
|
||||
}
|
||||
img {
|
||||
width: 28px;
|
||||
height: 36px;
|
||||
width: 22px;
|
||||
height: 28px;
|
||||
object-fit: cover;
|
||||
}
|
||||
span {
|
||||
|
|
|
|||
|
|
@ -1427,7 +1427,7 @@ h3 {
|
|||
max-height: 300px;
|
||||
margin: 0;
|
||||
padding: 0 18px 18px;
|
||||
overscroll-behavior: contain;
|
||||
overscroll-behavior: auto;
|
||||
}
|
||||
|
||||
.auto-teammates {
|
||||
|
|
@ -2019,3 +2019,699 @@ button.difficulty-label:focus-visible {
|
|||
gap: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.mobile-sections {
|
||||
display: none;
|
||||
}
|
||||
.dice-conflict-guide summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
@media (max-width: 850px) {
|
||||
.team {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
gap: 8px;
|
||||
padding-bottom: 8px;
|
||||
scroll-snap-type: x proximity;
|
||||
}
|
||||
.teammate {
|
||||
flex: 0 0 180px;
|
||||
min-width: 0;
|
||||
padding: 8px;
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
.world-column {
|
||||
display: contents;
|
||||
}
|
||||
.game-layout {
|
||||
gap: 10px;
|
||||
}
|
||||
.personal {
|
||||
grid-row: 1;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
.landscape {
|
||||
grid-row: 2;
|
||||
min-width: 0;
|
||||
scroll-margin-top: 70px;
|
||||
}
|
||||
.journey-actions {
|
||||
grid-row: 3;
|
||||
scroll-margin-top: 70px;
|
||||
}
|
||||
.journey > .social-panel {
|
||||
grid-row: 4;
|
||||
}
|
||||
.personal {
|
||||
scroll-margin-top: 70px;
|
||||
}
|
||||
.personal-title h2 {
|
||||
font-size: 16px;
|
||||
margin: 2px 0;
|
||||
}
|
||||
.personal-title .eyebrow {
|
||||
display: none;
|
||||
}
|
||||
.dice-row {
|
||||
padding: 8px 0;
|
||||
gap: 6px;
|
||||
}
|
||||
.dice-total {
|
||||
padding: 0;
|
||||
}
|
||||
.dice-conflict-guide {
|
||||
margin: 4px 0;
|
||||
}
|
||||
.skill-line {
|
||||
padding-top: 6px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.inspected-art {
|
||||
max-height: 140px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.mobile-sections {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
.mobile-sections button {
|
||||
flex: 1;
|
||||
min-height: 40px;
|
||||
border: 1px solid var(--line);
|
||||
background: #193329;
|
||||
color: var(--text);
|
||||
border-radius: 5px;
|
||||
}
|
||||
.social-panel {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.teammate {
|
||||
gap: 5px;
|
||||
}
|
||||
.teammate-status {
|
||||
gap: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.teammate .portrait {
|
||||
width: 26px;
|
||||
height: 34px;
|
||||
}
|
||||
.dice-total {
|
||||
margin-top: 0;
|
||||
}
|
||||
.dice-total strong {
|
||||
font-size: 22px;
|
||||
}
|
||||
.journey-actions {
|
||||
padding-top: 6px;
|
||||
}
|
||||
.phase-track {
|
||||
margin-bottom: 10px;
|
||||
padding-top: 6px;
|
||||
}
|
||||
.journey-actions .instruction {
|
||||
margin: 8px 0;
|
||||
}
|
||||
.journey-stats {
|
||||
margin: 10px 0;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.destination {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.destination img {
|
||||
width: 44px;
|
||||
height: 50px;
|
||||
}
|
||||
.destination h3 {
|
||||
margin: 3px 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile: the map is the workspace; details remain available without stacked navigation. */
|
||||
.team-toggle {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 850px) {
|
||||
.expedition {
|
||||
padding-bottom: 85px;
|
||||
}
|
||||
.game-tools {
|
||||
gap: 6px;
|
||||
flex-wrap: nowrap;
|
||||
min-height: 44px;
|
||||
}
|
||||
.game-brand p,
|
||||
.game-brand .fuji-mark {
|
||||
display: none;
|
||||
}
|
||||
.game-brand h1 {
|
||||
font-size: 20px;
|
||||
}
|
||||
.game-tools .round-status {
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.game-tools:not(.details-open) .difficulty-label {
|
||||
display: none;
|
||||
}
|
||||
.team-toggle {
|
||||
display: inline-flex;
|
||||
}
|
||||
.game-utilities {
|
||||
gap: 2px;
|
||||
}
|
||||
.game-tools .utility-button {
|
||||
width: 32px;
|
||||
height: 40px;
|
||||
min-width: 32px;
|
||||
}
|
||||
.team {
|
||||
margin: 4px 0 8px;
|
||||
padding: 0 0 4px;
|
||||
gap: 6px;
|
||||
}
|
||||
.team:not(.expanded) .teammate {
|
||||
flex: 1 0 125px;
|
||||
display: grid;
|
||||
grid-template-columns: 22px 1fr;
|
||||
gap: 2px 5px;
|
||||
padding: 5px 7px;
|
||||
}
|
||||
.team:not(.expanded) .portrait {
|
||||
width: 22px;
|
||||
height: 28px;
|
||||
grid-row: 1 / 3;
|
||||
}
|
||||
.team:not(.expanded) .teammate-info {
|
||||
min-width: 0;
|
||||
}
|
||||
.team:not(.expanded) .teammate-name {
|
||||
font-size: 11px;
|
||||
}
|
||||
.team:not(.expanded) .role-details,
|
||||
.team:not(.expanded) .teammate-equipment,
|
||||
.team:not(.expanded) .stamina-track {
|
||||
display: none;
|
||||
}
|
||||
.team:not(.expanded) .role-name {
|
||||
margin: 0;
|
||||
}
|
||||
.team:not(.expanded) .teammate-status {
|
||||
display: flex;
|
||||
grid-column: 2;
|
||||
width: auto;
|
||||
gap: 6px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.team:not(.expanded) .teammate-status small {
|
||||
display: none;
|
||||
}
|
||||
.mobile-dock {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 6px 10px max(6px, env(safe-area-inset-bottom));
|
||||
}
|
||||
.mobile-dock > div {
|
||||
gap: 2px;
|
||||
}
|
||||
.landscape {
|
||||
grid-row: 1;
|
||||
scroll-margin-top: 8px;
|
||||
}
|
||||
.personal {
|
||||
grid-row: 2;
|
||||
margin-top: 0;
|
||||
padding: 7px 9px;
|
||||
scroll-margin-top: 8px;
|
||||
}
|
||||
.personal-title {
|
||||
justify-content: flex-start;
|
||||
padding: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
.personal-title > div {
|
||||
display: none;
|
||||
}
|
||||
.privacy-tag {
|
||||
font-size: 10px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.personal .skill-line {
|
||||
display: none;
|
||||
}
|
||||
.personal .dice-row {
|
||||
gap: 4px;
|
||||
padding: 6px 0 3px;
|
||||
}
|
||||
.personal .dice-row .die {
|
||||
width: 42px;
|
||||
height: 46px;
|
||||
padding: 3px;
|
||||
}
|
||||
.personal .dice-total {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.personal .dice-total strong {
|
||||
font-size: 22px;
|
||||
}
|
||||
.personal .dice-total span {
|
||||
font-size: 10px;
|
||||
}
|
||||
.personal .dice-conflict-guide {
|
||||
font-size: 11px;
|
||||
margin: 2px 0 0;
|
||||
}
|
||||
.phase-track {
|
||||
display: none;
|
||||
}
|
||||
.journey-actions {
|
||||
scroll-margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.team:not(.expanded) .teammate {
|
||||
grid-template-columns: 20px 1fr;
|
||||
grid-template-rows: auto auto;
|
||||
align-content: center;
|
||||
min-height: 54px;
|
||||
}
|
||||
.team:not(.expanded) .portrait {
|
||||
grid-row: 1;
|
||||
width: 20px;
|
||||
height: 24px;
|
||||
}
|
||||
.team:not(.expanded) .teammate-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
.team:not(.expanded) .teammate-status {
|
||||
grid-column: 1 / -1;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.team:not(.expanded) .teammate-status > span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.personal .privacy-tag {
|
||||
max-width: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.personal .dice-total {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.personal .dice-total br {
|
||||
display: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.dice-guide-icon {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 850px) {
|
||||
.personal {
|
||||
position: relative;
|
||||
}
|
||||
.personal .dice-total {
|
||||
display: none;
|
||||
} /* Destination total stays in the persistent action bar. */
|
||||
.dice-guide-label {
|
||||
display: none;
|
||||
}
|
||||
.dice-guide-icon {
|
||||
display: inline;
|
||||
}
|
||||
.personal .dice-conflict-guide {
|
||||
margin: 0;
|
||||
}
|
||||
.personal .dice-conflict-guide summary {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 4px;
|
||||
width: 30px;
|
||||
min-height: 26px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 17px;
|
||||
list-style: none;
|
||||
}
|
||||
.personal .dice-conflict-guide summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.personal .dice-row {
|
||||
min-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.desktop-travel-confirm {
|
||||
display: none;
|
||||
}
|
||||
.destination > div > span:not(.eyebrow) {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep planning information together without dashboard-sized counters on phones. */
|
||||
@media (max-width: 850px) {
|
||||
.location-detail {
|
||||
display: none;
|
||||
}
|
||||
.journey-actions .instruction {
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
margin: 4px 0 8px;
|
||||
}
|
||||
.destination {
|
||||
margin-top: 6px;
|
||||
gap: 9px;
|
||||
}
|
||||
.destination .eyebrow {
|
||||
display: none;
|
||||
}
|
||||
.destination h3 {
|
||||
font-size: 18px;
|
||||
margin: 0 0 3px;
|
||||
}
|
||||
.journey-stats {
|
||||
justify-content: flex-start;
|
||||
gap: 18px;
|
||||
border: 0;
|
||||
margin: 6px 0 8px;
|
||||
padding: 0;
|
||||
}
|
||||
.journey-stats div {
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
gap: 4px;
|
||||
}
|
||||
.journey-stats strong {
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
font-size: 14px;
|
||||
}
|
||||
.journey-stats span {
|
||||
font-size: 12px;
|
||||
}
|
||||
.journey-stats div:last-child {
|
||||
display: none;
|
||||
}
|
||||
.equipment-section {
|
||||
margin-top: 10px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.equipment-section .section-title h3 {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
.equipment-list {
|
||||
margin-top: 6px;
|
||||
gap: 5px;
|
||||
}
|
||||
.equipment-list > button {
|
||||
padding: 6px 8px;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
}
|
||||
.equipment-list img {
|
||||
width: 30px;
|
||||
height: 36px;
|
||||
}
|
||||
.equipment-list .equipment-description {
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
margin: 2px 0;
|
||||
}
|
||||
.equipment-list small {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.social-panel .journal {
|
||||
margin-top: 8px;
|
||||
padding-top: 0;
|
||||
}
|
||||
.journal-header {
|
||||
padding: 4px 10px;
|
||||
min-height: 44px;
|
||||
}
|
||||
.journal-header h2 {
|
||||
font-size: 15px;
|
||||
}
|
||||
.journal-header button {
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.social-panel.empty-social {
|
||||
display: none;
|
||||
}
|
||||
.inline-journal,
|
||||
.social-panel .inline-journal {
|
||||
margin-top: 0;
|
||||
}
|
||||
.journal-header {
|
||||
min-height: 44px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.journal-header button {
|
||||
box-sizing: border-box;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
}
|
||||
.expedition {
|
||||
padding-bottom: calc(64px + env(safe-area-inset-bottom));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 850px) {
|
||||
.reroll-actions {
|
||||
margin-top: 6px;
|
||||
padding-top: 6px;
|
||||
gap: 8px;
|
||||
}
|
||||
.reroll-actions .normal-reroll {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
gap: 4px 8px;
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.normal-reroll strong {
|
||||
font-size: 12px;
|
||||
}
|
||||
.normal-reroll .reroll-hint {
|
||||
display: none;
|
||||
}
|
||||
.normal-reroll p {
|
||||
grid-column: 1 / -1;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.normal-reroll .primary {
|
||||
min-height: 44px;
|
||||
padding: 8px 10px;
|
||||
width: auto;
|
||||
font-size: 12px;
|
||||
}
|
||||
.finish-dice,
|
||||
.desktop-reroll-instruction {
|
||||
display: none;
|
||||
}
|
||||
.reroll-actions .buddy-choice {
|
||||
gap: 4px;
|
||||
}
|
||||
.buddy-choice p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shared dice controls: keep the action beside its remaining-use count. */
|
||||
.desktop-reroll-instruction {
|
||||
display: none;
|
||||
}
|
||||
@media (min-width: 851px) {
|
||||
.reroll-actions {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
gap: 12px;
|
||||
}
|
||||
.reroll-actions .normal-reroll {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: center;
|
||||
gap: 4px 12px;
|
||||
}
|
||||
.normal-reroll > strong {
|
||||
grid-column: 1;
|
||||
}
|
||||
.normal-reroll > p {
|
||||
grid-column: 1;
|
||||
margin: 0;
|
||||
}
|
||||
.normal-reroll > button {
|
||||
grid-column: 2;
|
||||
grid-row: 1 / 3;
|
||||
min-height: 44px;
|
||||
width: auto;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
.finish-dice {
|
||||
margin-top: 0;
|
||||
min-height: 44px;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.reroll-actions .buddy-choice {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 4px 8px;
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.buddy-help {
|
||||
display: contents;
|
||||
}
|
||||
.buddy-help summary {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
cursor: pointer;
|
||||
color: var(--gold);
|
||||
font-size: 13px;
|
||||
padding: 12px 0;
|
||||
list-style: none;
|
||||
}
|
||||
.buddy-help summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
.buddy-help summary span {
|
||||
margin-left: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
.buddy-help p {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
margin: 0;
|
||||
}
|
||||
.buddy-choice > button,
|
||||
.buddy-choice > .buddy-status {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
.buddy-choice > button {
|
||||
width: auto;
|
||||
min-height: 44px;
|
||||
padding: 8px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.buddy-status {
|
||||
font-size: 12px;
|
||||
color: #bfd0bb;
|
||||
}
|
||||
|
||||
.response-actions,
|
||||
.powerbar-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.response-actions > button,
|
||||
.powerbar-options > button {
|
||||
flex: 1 1 130px;
|
||||
width: auto;
|
||||
min-height: 44px;
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.tool-form {
|
||||
margin-top: 8px;
|
||||
padding: 10px;
|
||||
}
|
||||
.tool-form > p {
|
||||
margin: 6px 0;
|
||||
}
|
||||
.equipment-transfer {
|
||||
margin-top: 10px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.equipment-transfer summary {
|
||||
min-height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
@media (max-width: 850px) {
|
||||
.desktop-phase-confirm {
|
||||
display: none;
|
||||
}
|
||||
.skill-choices,
|
||||
.injury-options {
|
||||
gap: 6px;
|
||||
}
|
||||
.skill-choices button,
|
||||
.injury-options button {
|
||||
padding: 8px 10px;
|
||||
gap: 4px;
|
||||
}
|
||||
.skill-choices span,
|
||||
.injury-options span {
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.starting-dice-options {
|
||||
gap: 6px;
|
||||
}
|
||||
.starting-dice-options button {
|
||||
padding: 6px 8px;
|
||||
}
|
||||
.starting-dice p {
|
||||
font-size: 12px;
|
||||
margin: 6px 0;
|
||||
}
|
||||
.visible-choices {
|
||||
margin: 8px 0;
|
||||
padding: 8px;
|
||||
}
|
||||
.comparison > .comparison-player {
|
||||
gap: 4px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
.comparison-dice {
|
||||
gap: 4px;
|
||||
}
|
||||
.eruption-count {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
.eruption-count strong {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,10 +97,11 @@
|
|||
}
|
||||
.tutorial-session [data-tutorial] {
|
||||
scroll-margin-top: calc(var(--tutorial-height) + 75px);
|
||||
scroll-margin-bottom: 20px;
|
||||
scroll-margin-bottom: 80px;
|
||||
}
|
||||
.tutorial-session .mobile-dock {
|
||||
top: var(--tutorial-height);
|
||||
top: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
@media (max-width: 850px) {
|
||||
.tutorial-guide-host {
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ import path from "node:path";
|
|||
throw Error("Reroll matching badges must stay tied to the chosen destination");
|
||||
await page.screenshot({ path: "work/browser/fuji-matching-dice.png", fullPage: true });
|
||||
await page.locator(".personal .die").first().click();
|
||||
const aside = page.getByRole("button", { name: "Set selected die aside" });
|
||||
const aside = page.getByRole("button", { name: "Set die aside · free" });
|
||||
if (!(await aside.isEnabled())) throw Error("Buddy must be usable with zero rerolls");
|
||||
await aside.click();
|
||||
if ((await page.evaluate(() => window.captured.findLast((e) => e.name === "move")?.payload.action)) !== "buddy")
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ for (const width of [390, 1400]) {
|
|||
assert.equal(await p.locator("article script").count(), 0);
|
||||
assert.equal(await p.getByText(/Waiting for Full Name to choose an injury/).count(), 1);
|
||||
assert.equal(await p.getByText(/Gatherer.*decide/).count(), 0);
|
||||
if (width === 390) await p.getByRole("button", { name: "Your expedition", exact: true }).click();
|
||||
assert.equal(await p.locator('.difficulty-label[title="Scenario 7"]').isVisible(), true);
|
||||
assert.equal(await p.getByRole("button", { name: "Difficulty level 2: stamina costs" }).isVisible(), true);
|
||||
await p.evaluate(() =>
|
||||
|
|
|
|||
57
tests/mobile-layout-smoke.mjs
Normal file
57
tests/mobile-layout-smoke.mjs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { chromium } from "playwright";
|
||||
import assert from "node:assert/strict";
|
||||
const root = process.cwd() + "/";
|
||||
const { initGame, applyMove, stripSecret, total, cell } = await import(root + "packages/engine/dist/index.js");
|
||||
let state = initGame(3, { skillAssignment: "fixed" }, "mobile-readiness");
|
||||
for (let i = 0; i < 3; i++)
|
||||
if (!state.players[i].setupDone)
|
||||
state = applyMove(
|
||||
state,
|
||||
{ action: "setup", keep: state.players[i].cards.slice(0, i === 2 ? 2 : 1).map((c) => c.id) },
|
||||
i
|
||||
);
|
||||
const browser = await chromium.launch({ executablePath: process.env.FUJI_CHROMIUM_EXECUTABLE, headless: true });
|
||||
const page = await browser.newPage({ viewport: { width: 390, height: 740 }, isMobile: true, hasTouch: true });
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.setContent('<meta name="viewport" content="width=device-width, initial-scale=1"><div id="app"></div>');
|
||||
await page.addStyleTag({ path: root + "packages/viewer/dist/fuji-viewer.css" });
|
||||
await page.addScriptTag({ path: root + "packages/viewer/dist/fuji-viewer.iife.js" });
|
||||
await page.evaluate(
|
||||
(s) => {
|
||||
window.events = [];
|
||||
window.bridge = fuji.launch("#app");
|
||||
bridge.on("player:clicked", (p) => events.push(["player", p]));
|
||||
bridge.on("move", (p) => events.push(["move", p]));
|
||||
bridge.emit("player", { index: 0 });
|
||||
bridge.emit("state", s);
|
||||
},
|
||||
stripSecret(state, 0)
|
||||
);
|
||||
for (const width of [320, 390, 430, 768]) {
|
||||
await page.setViewportSize({ width, height: 740 });
|
||||
await page.evaluate(() => scrollTo(0, 0));
|
||||
assert.ok(
|
||||
await page.locator(".landscape").evaluate((el) => el.getBoundingClientRect().top < 170),
|
||||
"The map is visible immediately on mobile"
|
||||
);
|
||||
assert.ok(
|
||||
await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1),
|
||||
"No horizontal page overflow"
|
||||
);
|
||||
const team = page.locator(".team");
|
||||
assert.equal(
|
||||
await team.evaluate((el) => getComputedStyle(el).flexWrap),
|
||||
"nowrap",
|
||||
"Teammates form a horizontal rail"
|
||||
);
|
||||
assert.equal(await page.locator(".mobile-sections").count(), 0, "No redundant shortcut bar");
|
||||
await page.locator(".team-toggle").click();
|
||||
assert.ok(await page.locator(".team.expanded .role-details").first().isVisible());
|
||||
await page.locator(".team-toggle").click();
|
||||
const dock = await page.locator(".mobile-dock").boundingBox();
|
||||
assert.ok(dock.y + dock.height >= 739, "Confirmation stays at the bottom");
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
console.log("Fuji mobile: central map, expandable teammate rail, bottom confirmation and no horizontal page overflow.");
|
||||
await browser.close();
|
||||
|
|
@ -39,6 +39,7 @@ await page.locator(".teammate-status").first().click();
|
|||
assert.deepEqual(await page.evaluate(() => events), []);
|
||||
await page.locator(".teammate-name").first().click();
|
||||
assert.equal((await page.evaluate(() => events))[0][0], "player");
|
||||
await page.locator(".team-toggle").click();
|
||||
for (const index of [0, 2]) {
|
||||
await page.locator(".teammate").nth(index).locator(".equipment-chip").first().click();
|
||||
const rect = await page.locator(".equipment-preview:popover-open").boundingBox();
|
||||
|
|
@ -48,7 +49,7 @@ for (const index of [0, 2]) {
|
|||
}
|
||||
await page.evaluate(() => scrollTo(0, 600));
|
||||
const rect = await page.locator(".mobile-dock").boundingBox();
|
||||
assert(rect && rect.y >= -1 && rect.y < 5);
|
||||
assert(rect && rect.y > 600 && rect.y + rect.height <= 741);
|
||||
|
||||
await page.locator(".mobile-dock button").first().click();
|
||||
assert.equal((await page.evaluate(() => events)).at(-1)[1].action, "ready");
|
||||
|
|
|
|||
|
|
@ -103,11 +103,12 @@ try {
|
|||
assert.match(await guide.innerText(), /pink 5/);
|
||||
await guide.getByRole("button", { name: "Show area", exact: true }).click();
|
||||
await page.locator(".personal .die.bgs-tutorial-highlight").click();
|
||||
await page.getByRole("button", { name: "Set selected die aside", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Set die aside · free", exact: true }).click();
|
||||
await step(7);
|
||||
await page.locator('[data-tutorial="confirm"]:visible').first().click();
|
||||
await step(8);
|
||||
assert.equal(await page.locator("details.revealed-log").count(), 0);
|
||||
await page.getByRole("button", { name: "Expand journal", exact: true }).first().click();
|
||||
assert.ok((await page.locator(".revealed-log .die").count()) > 0);
|
||||
await finishRound(page);
|
||||
await page.waitForFunction(
|
||||
|
|
@ -202,6 +203,8 @@ try {
|
|||
"Each wave appears before completion"
|
||||
);
|
||||
}
|
||||
const expandJournal = page.getByRole("button", { name: "Expand journal", exact: true }).first();
|
||||
if (await expandJournal.isVisible()) await expandJournal.click();
|
||||
assert.match(await page.locator('[data-tutorial="journal"]').innerText(), /Mika was caught by the lava/);
|
||||
}
|
||||
await guide.getByText("Chapter complete", { exact: true }).waitFor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue