The step light is for a first game's first turn, then by choice
It lit every turn of the first game. Now a browser's first game lights its first turn on its own, and the preference is an explicit switch that keeps it on every turn for anyone who wants it. The old preference key retires with it, so nobody is left lit by accident. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
53b6b01582
commit
65e88df523
@@ -1433,8 +1433,6 @@
|
||||
const room = net.roomId;
|
||||
if (!room || finishedRoom === room) return;
|
||||
finishedRoom = room;
|
||||
// The step light is for a first game; the second is played by sight.
|
||||
if (prefs.finishedGames === 0) setPref("stepLight", false);
|
||||
setPref("finishedGames", prefs.finishedGames + 1);
|
||||
if (!prefs.tierChosen && prefs.botTier === "apprentice") setPref("botTier", "adept");
|
||||
});
|
||||
@@ -1511,8 +1509,10 @@
|
||||
|
||||
/** The step light: with no card in hand, your square and the squares a
|
||||
* stride reaches are lit and the rest of the maze falls into shadow. */
|
||||
/** A first game's first turn lights itself; after that only by choice. */
|
||||
const firstTurnEver = $derived(!!view && prefs.finishedGames === 0 && view.turn.round === 1);
|
||||
const stepLight = $derived(
|
||||
!!view && !!me && prefs.stepLight && isYourTurn && !view.turn.actionsEnded && !selectedCard &&
|
||||
!!view && !!me && (prefs.stepLightAlways || firstTurnEver) && isYourTurn && !view.turn.actionsEnded && !selectedCard &&
|
||||
!net.spectating && !youMustRespond && view.turn.movementAllowance - view.turn.movementUsed > 0,
|
||||
);
|
||||
const stepCells = $derived.by(() => {
|
||||
@@ -1895,9 +1895,9 @@
|
||||
<span>Hand at the left: your cards stand in a column beside the board (wide screens)</span>
|
||||
</label>
|
||||
<label class="pref-row pref-check">
|
||||
<input type="checkbox" checked={prefs.stepLight}
|
||||
onchange={(e) => setPref("stepLight", e.currentTarget.checked)} />
|
||||
<span>Step light: on your turn, the squares you can walk to glow and the rest of the maze dims (on for a first game)</span>
|
||||
<input type="checkbox" checked={prefs.stepLightAlways}
|
||||
onchange={(e) => setPref("stepLightAlways", e.currentTarget.checked)} />
|
||||
<span>Step light on every turn: the squares you can walk to glow and the rest of the maze dims (a first game lights its first turn on its own)</span>
|
||||
</label>
|
||||
<label class="pref-row pref-check">
|
||||
<input type="checkbox" checked={prefs.cautions}
|
||||
@@ -2750,7 +2750,7 @@
|
||||
{:else if isYourTurn}
|
||||
<div class="slip yours">
|
||||
Your turn — round {view.turn.round}.
|
||||
{#if prefs.stepLight && view.turn.round <= 2}
|
||||
{#if prefs.finishedGames === 0 && view.turn.round <= 2}
|
||||
<div class="goal">Win by carrying two treasures that aren't yours to your home, or by being the last wizard standing.</div>
|
||||
{/if}
|
||||
{#if view.turn.actionsEnded}
|
||||
|
||||
@@ -31,10 +31,10 @@ export interface Prefs {
|
||||
tierChosen: boolean;
|
||||
/** Games this browser has seen through to a winner. */
|
||||
finishedGames: number;
|
||||
/** The step light: on your turn, the squares a stride can reach glow
|
||||
* and the rest of the maze falls into shadow. On for a browser's first
|
||||
* game, off once that game is won, and yours to switch on again. */
|
||||
stepLight: boolean;
|
||||
/** Keep the step light on every turn: your square and the squares a
|
||||
* stride reaches glow, the rest of the maze in shadow. A browser's
|
||||
* first game lights its first turn on its own. */
|
||||
stepLightAlways: boolean;
|
||||
}
|
||||
|
||||
const KEY = "wizwar-prefs";
|
||||
@@ -43,7 +43,7 @@ function load(): Prefs {
|
||||
const fallback: Prefs = {
|
||||
art: "photo", autoGrab: false, flourishes: true, wizardName: "", color: null,
|
||||
cautions: true, botTier: "apprentice", instantReplay: true, liveFp: false, handLeft: false,
|
||||
coached: false, tierChosen: false, finishedGames: 0, stepLight: true,
|
||||
coached: false, tierChosen: false, finishedGames: 0, stepLightAlways: false,
|
||||
};
|
||||
try {
|
||||
const raw = localStorage.getItem(KEY);
|
||||
@@ -65,9 +65,7 @@ function load(): Prefs {
|
||||
coached: p.coached === true,
|
||||
tierChosen: p.tierChosen === true,
|
||||
finishedGames: typeof p.finishedGames === "number" ? p.finishedGames : 0,
|
||||
// A browser that has already won a game meets the step light switched
|
||||
// off; a fresh one has it on for its first.
|
||||
stepLight: typeof p.stepLight === "boolean" ? p.stepLight : !(typeof p.finishedGames === "number" && p.finishedGames > 0),
|
||||
stepLightAlways: p.stepLightAlways === true,
|
||||
};
|
||||
} catch {
|
||||
return fallback;
|
||||
|
||||
Reference in New Issue
Block a user