Credibility pass: comments say what the code can't, and the seams are gone
Engine: pit-rim exits live in one helper (pitRimExits) shared by the resolver and the automaton; chargeReach names the six-stride cap; dust sight is inDust + dustAtEnd; PushPending is exported once; the force-field counter builds its events in one list; drawUnderSlowDeath says what it draws under. Test groups are named for the rule they pin, not the revision that introduced it. Client: one smoothstep; one edgeScar per battle-scarred edge; one board-zone rule (which also seats the caption strip on phones); the compass names live in SIDE_NAMES; net.flash() is the one toast; MediaQuery replaces two hand-rolled matchMedia listeners; sprites carry their sizes as plain numbers and their CSS in one rule each; canvas helpers are formatted like the rest of the tree. Comments that told how a cel or a fallback used to look now say what it draws. The actions-over notice no longer blames a pickup when slime ended the turn. Server and ops: dataRoot() is the one data directory; headlineOf builds its deeds without a cast; the rollup and skills read the same way the code behaves. 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
85690f0e23
commit
6e49fc9020
@@ -8,7 +8,7 @@ import {
|
||||
} from "../src/game";
|
||||
import { cellKey, edgeKey } from "../src/board";
|
||||
import { sightedCellsFor, viewFor } from "../src/view";
|
||||
import { automatonCommand, automatonFallback, drawUnderCurses, pathToward, type AutomatonStyle, type AutomatonTier } from "../src/automaton";
|
||||
import { automatonCommand, automatonFallback, drawUnderSlowDeath, pathToward, type AutomatonStyle, type AutomatonTier } from "../src/automaton";
|
||||
import { pushSustained } from "./helpers";
|
||||
|
||||
/** Whose input does the maze want right now? */
|
||||
@@ -1129,14 +1129,14 @@ describe("the clockwork under a curse, and before a pit", () => {
|
||||
const state = botsTurn();
|
||||
const bot = state.players.find((p) => p.id === "bot")!;
|
||||
const plain = viewFor(state, "bot");
|
||||
expect(drawUnderCurses(plain, 2)).toBe(2);
|
||||
expect(drawUnderSlowDeath(plain, 2)).toBe(2);
|
||||
pushSustained(state, { id: "sd", cardId: "slow-death", casterId: "human", targetId: "bot", remainingTurns: 1e9 });
|
||||
bot.life = 7;
|
||||
expect(drawUnderCurses(viewFor(state, "bot"), 2)).toBe(2);
|
||||
expect(drawUnderSlowDeath(viewFor(state, "bot"), 2)).toBe(2);
|
||||
bot.life = 5;
|
||||
expect(drawUnderCurses(viewFor(state, "bot"), 2)).toBe(1);
|
||||
expect(drawUnderSlowDeath(viewFor(state, "bot"), 2)).toBe(1);
|
||||
bot.life = 4;
|
||||
expect(drawUnderCurses(viewFor(state, "bot"), 2)).toBe(0);
|
||||
expect(drawUnderSlowDeath(viewFor(state, "bot"), 2)).toBe(0);
|
||||
});
|
||||
|
||||
it("raises no SHADOW while bleeding, nor with little blood to spare", () => {
|
||||
@@ -1152,7 +1152,7 @@ describe("the clockwork under a curse, and before a pit", () => {
|
||||
for (let guard = 0; guard < 30 && actingSeat(state) === "bot"; guard++) {
|
||||
const view = viewFor(state, "bot");
|
||||
const cmd = automatonCommand(view, "berserker", "archmage") ?? automatonFallback(view, "archmage");
|
||||
expect(JSON.stringify(cmd)).not.toContain("shadow#T");
|
||||
expect(cmd.type === "cast" && cmd.instanceId === "shadow#T").toBe(false);
|
||||
const r = applyCommand(state, "bot", cmd);
|
||||
if (!r.ok) break;
|
||||
state = r.state;
|
||||
|
||||
@@ -396,7 +396,7 @@ describe("big man", () => {
|
||||
/** From a giant's square: a step into a square whose exits (all sides but
|
||||
* the way back) number exactly `want` — a corner (1, not straight) or a
|
||||
* fork (2+). Returns the giant's start, the pushee's square, and the exits. */
|
||||
function pushSite(state: GameState, want: "corner" | "fork") {
|
||||
function pushSite(state: GameState, want: "corner" | "fork" | "straight-fork") {
|
||||
const view = boardView(state);
|
||||
for (const key of Object.keys(view.cells)) {
|
||||
const [x, y] = key.split(",").map(Number) as [number, number];
|
||||
@@ -407,6 +407,7 @@ describe("big man", () => {
|
||||
const exits = SIDES.filter((d) => d !== opposite(side) && stepTarget(view, t1.to, d).kind === "step");
|
||||
if (want === "corner" && exits.length === 1 && exits[0] !== side) return { at: { x, y }, side, mid: t1.to, exits };
|
||||
if (want === "fork" && exits.length >= 2) return { at: { x, y }, side, mid: t1.to, exits };
|
||||
if (want === "straight-fork" && exits.length >= 2 && exits.includes(side)) return { at: { x, y }, side, mid: t1.to, exits };
|
||||
}
|
||||
}
|
||||
throw new Error(`no ${want} on this board`);
|
||||
@@ -453,15 +454,15 @@ describe("big man", () => {
|
||||
expect(state.turn.movementUsed).toBe(used + 1);
|
||||
});
|
||||
|
||||
it("an older game shoves straight ahead when it can, and now rounds a corner when it cannot", () => {
|
||||
it("a pre-rev-15 game shoves straight ahead when it can and rounds a corner when it cannot", () => {
|
||||
let { state } = createGame({ playerIds: ["alice", "bob"], seed: 42, sets: ["basic", "expansion1"], deckRev: 14 });
|
||||
state = toRound2(state);
|
||||
const giant = activePlayer(state);
|
||||
state.sustained.push({ id: "fx-big", cardId: "big-man", casterId: giant.id, targetId: giant.id, remainingTurns: 9, data: {} });
|
||||
const victim = state.players.find((p) => p.id !== giant.id)!;
|
||||
// A fork where straight ahead is open: no window, straight it is.
|
||||
const fork = pushSite(state, "fork");
|
||||
if (fork.exits.includes(fork.side)) {
|
||||
const fork = pushSite(state, "straight-fork");
|
||||
{
|
||||
giant.position = { ...fork.at };
|
||||
victim.position = { ...fork.mid };
|
||||
const r = applyCommand(state, giant.id, { type: "move", direction: fork.side });
|
||||
|
||||
@@ -813,7 +813,7 @@ describe("the goat charges on legs, not wings (rev 10)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("butt-head's charge reaches as far as its legs (K4T3)", () => {
|
||||
describe("butt-head's charge reaches as far as its legs (rev 16)", () => {
|
||||
/** Two empty cells seven or eight corridor steps apart on the seed-42 board. */
|
||||
function longRun(state: GameState): { from: Cell; to: Cell; steps: number } {
|
||||
const view = boardView(state);
|
||||
|
||||
@@ -561,7 +561,7 @@ describe("the boobytrap keeps its secret", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("a pit on the board's rim (M4Q7)", () => {
|
||||
describe("a pit on the board's rim (rev 17)", () => {
|
||||
/** A square on the outer rim with a warp mouth on one side, entered from
|
||||
* the square opposite the mouth; its other neighbouring squares listed. */
|
||||
function rimPitSite(state: GameState) {
|
||||
@@ -637,7 +637,7 @@ describe("a pit on the board's rim (M4Q7)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("a wave names its victims before it pushes (LK97)", () => {
|
||||
describe("a wave names its victims before it pushes (rev 20)", () => {
|
||||
/** A wall between two squares, a wizard on its near side with one open
|
||||
* square behind them and a wall beyond it, and a caster's square beside. */
|
||||
function site(state: GameState) {
|
||||
@@ -692,7 +692,6 @@ describe("spells cast at a slime wait in the gel", () => {
|
||||
expect(cast.state.slimeTraps[cellKey(spot.cell)]?.length).toBe(1);
|
||||
// Nobody is hurt yet; the victim walks in on their own turn.
|
||||
state = must(cast.state, caster.id, { type: "endTurn", draw: 2 });
|
||||
victim.position = { ...caster.position };
|
||||
const v = state.players.find((p) => p.id === victim.id)!;
|
||||
v.position = { ...caster.position };
|
||||
const walk = applyCommand(state, victim.id, { type: "move", direction: spot.side });
|
||||
|
||||
Reference in New Issue
Block a user