Game over unmasks the mystery machines
Hands already go face-up when the maze is won; now the roster does too — a secret automaton's row reads 'archmage berserker (was a mystery)' once the game finishes, broadcast with the final command from either a human or the bot pump. Mid-game, the mood stays its own business. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
This commit is contained in:
co-authored by
Claude Fable 5
parent
5243a173a8
commit
55c76cf20e
@@ -180,7 +180,14 @@ function roomInfo(room: Room) {
|
|||||||
started: room.state !== null,
|
started: room.state !== null,
|
||||||
colors: Object.fromEntries(room.colorChoices),
|
colors: Object.fromEntries(room.colorChoices),
|
||||||
bots: Object.fromEntries(
|
bots: Object.fromEntries(
|
||||||
[...room.bots].map(([name, b]) => [name, `${b.tier} ${b.secret ? "mystery" : b.style}`]),
|
// A mystery machine keeps its mood only while the game lives: once it
|
||||||
|
// ends, the hands go face-up and so does the temperament.
|
||||||
|
[...room.bots].map(([name, b]) => [
|
||||||
|
name,
|
||||||
|
room.state?.phase === "finished"
|
||||||
|
? `${b.tier} ${b.style}${b.secret ? " (was a mystery)" : ""}`
|
||||||
|
: `${b.tier} ${b.secret ? "mystery" : b.style}`,
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -254,6 +261,8 @@ function runBots(room: Room): void {
|
|||||||
}
|
}
|
||||||
broadcast(room, (playerId) => ({ type: "events", events: redactFor(step.events, playerId) }));
|
broadcast(room, (playerId) => ({ type: "events", events: redactFor(step.events, playerId) }));
|
||||||
broadcast(room, (playerId) => ({ type: "state", view: viewForPlayer(room, playerId), seq: room.log.length }));
|
broadcast(room, (playerId) => ({ type: "state", view: viewForPlayer(room, playerId), seq: room.log.length }));
|
||||||
|
// The game's end unmasks the mystery machines in the roster.
|
||||||
|
if (room.state?.phase === "finished") broadcast(room, () => roomInfo(room));
|
||||||
botRemark(room, step.seat, step.events as { type: string }[]);
|
botRemark(room, step.seat, step.events as { type: string }[]);
|
||||||
setTimeout(tick, BOT_STEP_MS);
|
setTimeout(tick, BOT_STEP_MS);
|
||||||
};
|
};
|
||||||
@@ -368,6 +377,7 @@ wss.on("connection", (socket) => {
|
|||||||
if ("error" in result) return send(socket, { type: "error", message: result.error });
|
if ("error" in result) return send(socket, { type: "error", message: result.error });
|
||||||
broadcast(room, (playerId) => ({ type: "events", events: redactFor(result.events, playerId) }));
|
broadcast(room, (playerId) => ({ type: "events", events: redactFor(result.events, playerId) }));
|
||||||
broadcast(room, (playerId) => ({ type: "state", view: viewForPlayer(room, playerId), seq: room.log.length }));
|
broadcast(room, (playerId) => ({ type: "state", view: viewForPlayer(room, playerId), seq: room.log.length }));
|
||||||
|
if (room.state?.phase === "finished") broadcast(room, () => roomInfo(room));
|
||||||
botRemark(room, session.playerId, result.events as { type: string }[]);
|
botRemark(room, session.playerId, result.events as { type: string }[]);
|
||||||
runBots(room);
|
runBots(room);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user