Show who can act and expose Gatherer power bar stock in team cards
This commit is contained in:
parent
2db30cb8e4
commit
5227fcbb3e
4 changed files with 56 additions and 15 deletions
|
|
@ -712,7 +712,7 @@ export function stripSecret(s: State, seat?: number): View {
|
|||
});
|
||||
return { ...publicState, deckCount: deck.length };
|
||||
}
|
||||
export function activePlayers(s: State): number[] {
|
||||
export function activePlayers(s: State | View): number[] {
|
||||
if (s.outcome) return [];
|
||||
if (s.pending) return s.pending.players;
|
||||
const injured = s.players.flatMap((p, i) => (p.pendingInjuries ? [i] : []));
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
CHARACTER_COLORS,
|
||||
hasSkill,
|
||||
activeDice,
|
||||
activePlayers,
|
||||
type EquipmentId,
|
||||
type View,
|
||||
} from "fuji-engine";
|
||||
|
|
@ -28,6 +29,7 @@
|
|||
import Die from "./lib/Die.svelte";
|
||||
let { store }: { store: Store } = $props();
|
||||
const s = $derived(store.state);
|
||||
const actingSeats = $derived(s ? activePlayers(s) : []);
|
||||
const seat = $derived(store.seat);
|
||||
const me = $derived(seat === undefined ? undefined : s?.players[seat]);
|
||||
let inspected = $state("");
|
||||
|
|
@ -250,36 +252,51 @@
|
|||
<button
|
||||
class="teammate"
|
||||
class:own={seat === i}
|
||||
class:can-act={actingSeats.includes(i)}
|
||||
style:--player-color={CHARACTER_COLORS[p.character]}
|
||||
onclick={() => {
|
||||
if (store.local) store.selectSeat(i);
|
||||
}}
|
||||
disabled={!store.local}
|
||||
aria-label={`${p.name}${seat === i ? ", you" : ""}. ${EXHAUSTION - p.stamina} stamina remaining${store.local ? ". Switch to this player." : ""}`}
|
||||
aria-label={`${p.name}${seat === i ? ", you" : ""}${actingSeats.includes(i) ? ", can act now" : ""}. ${EXHAUSTION - p.stamina} stamina remaining${store.local ? ". Switch to this player." : ""}`}
|
||||
>
|
||||
<img src={art("character", p.character + 1)} alt="" class="portrait" />
|
||||
<div class="teammate-info">
|
||||
<span class="teammate-name"
|
||||
>{p.name}{#if seat === i}<small>YOU</small>{/if}</span
|
||||
><span class="role-name">{SKILLS[p.skill].name}</span><span class="stamina-track" aria-hidden="true"
|
||||
><span class="role-name"
|
||||
>{SKILLS[p.skill].name}{#if p.skill === "gatherer"}<span class="public-bars">
|
||||
· {p.powerBars} power bar{p.powerBars === 1 ? "" : "s"}</span
|
||||
>{/if}</span
|
||||
><span class="stamina-track" aria-hidden="true"
|
||||
><i style:width={`${(1 - p.stamina / EXHAUSTION) * 100}%`}></i></span
|
||||
>
|
||||
</div>
|
||||
<div class="teammate-status">
|
||||
<span title="Remaining stamina. At zero, the whole expedition loses."
|
||||
>{EXHAUSTION - p.stamina}<small> / {EXHAUSTION} stamina</small></span
|
||||
><span class="ready-label"
|
||||
>{p.pendingInjuries
|
||||
? "Injured"
|
||||
: p.ready || (p.setupDone && s.phase === "setup")
|
||||
? "Ready ✓"
|
||||
: p.resolved && s.phase === "movement"
|
||||
? "Moved"
|
||||
: s.phase === "setup"
|
||||
? "Packing"
|
||||
: p.injuries.length
|
||||
? `${p.injuries.length} injury`
|
||||
: ""}</span
|
||||
><span class="ready-label" class:active-label={actingSeats.includes(i)}
|
||||
>{actingSeats.includes(i)
|
||||
? s.pending
|
||||
? "Respond"
|
||||
: p.pendingInjuries
|
||||
? "Choose injury"
|
||||
: s.phase === "movement" && s.activeResolution !== null
|
||||
? s.activeResolution === i
|
||||
? "Resolving"
|
||||
: "Can help"
|
||||
: "Can act"
|
||||
: p.pendingInjuries
|
||||
? "Injured"
|
||||
: p.ready || (p.setupDone && s.phase === "setup")
|
||||
? "Ready ✓"
|
||||
: p.resolved && s.phase === "movement"
|
||||
? "Moved"
|
||||
: s.phase === "setup"
|
||||
? "Packing"
|
||||
: p.injuries.length
|
||||
? `${p.injuries.length} injury`
|
||||
: ""}</span
|
||||
>
|
||||
</div>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1308,3 +1308,21 @@ h3 {
|
|||
.comparison .comparison-dice .die-caption {
|
||||
font-size: 6px;
|
||||
}
|
||||
|
||||
.ready-label.active-label {
|
||||
color: #dfedc4;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.active-label::before {
|
||||
content: "";
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #bcdfa4;
|
||||
flex: none;
|
||||
}
|
||||
.public-bars {
|
||||
color: var(--gold);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,8 +87,14 @@ import path from "node:path";
|
|||
if (s.players[0].cards.some((c) => c.id === "machete")) throw Error("Machete was not consumed");
|
||||
s.phase = "movement";
|
||||
s.activeResolution = 0;
|
||||
s.players[1].powerBars = 2;
|
||||
await page.evaluate((v) => window.bridge.emit("state", v), stripSecret(s, 0));
|
||||
await page.getByRole("button", { name: "Confirm result" }).waitFor();
|
||||
if ((await page.locator(".teammate.can-act").count()) !== 2) throw Error("Resolver and Gatherer should be active");
|
||||
if (!(await page.locator(".public-bars").innerText()).includes("2 power bars"))
|
||||
throw Error("Public power bars missing");
|
||||
if (!(await page.getByText("Can help", { exact: true }).isVisible()))
|
||||
throw Error("Gatherer help availability missing");
|
||||
if ((await page.locator(".comparison-player").count()) !== 3) throw Error("Comparison must show every participant");
|
||||
if (await page.locator(".comparison-dice .die.aside").count()) throw Error("Set-aside dice must not count");
|
||||
const countedBeforeHover = await page.locator(".comparison").innerText();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue