Rework the Broken Mirror screens and the Guild quest board
The mirror page opens on two illustrated cards, Normal and Hard, painted with Codex, with three small rule reminders; a card opens or starts its game. The five companions of the daily team show as tiles: one click uses a help, two per game, with no selection step. Helps are renamed after what they do (swap anywhere, show a piece's place, double the rewards, undo the last move, see the model again), use the shared tooltip and keep the same height. Selecting a piece no longer waits for the server, and showing a place aims at the selected piece. Under 960 px of dashboard, like the section menu, the board goes on top and the moves panel keeps only the count. Stardust is always written in full. The Guild board shows four tiles per row on full screen, aligned with subgrids, solo quests first. Status lines give way to a wooden "Fait" sign on finished quests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ddb3b81278
commit
8c0771f06f
20 changed files with 337 additions and 236 deletions
|
|
@ -284,66 +284,68 @@ test("a game without swaps left is lost and pays nothing", (t) => {
|
|||
assert.equal(mirror.view(player.id).hardLock, null);
|
||||
});
|
||||
|
||||
test("helpers come from a ready daily team, are chosen before the first move and help once each", (t) => {
|
||||
test("any companion of a ready daily team can help, once each and twice per game", (t) => {
|
||||
const context = game(t, { team: true });
|
||||
const { mirror, player, db, clock, service } = context;
|
||||
mirror.start(player.id, { day: DAY, mode: "normal" });
|
||||
assert.deepEqual(mirror.view(player.id).team, []);
|
||||
refuses("MIRROR_HELPER_INVALID", () => mirror.chooseHelpers(player.id, { day: DAY, mode: "normal", cardIds: ["starvoid-dragon"] }));
|
||||
const team = readyTeam(context);
|
||||
const helpers = mirror.view(player.id).team;
|
||||
assert.equal(helpers.length, team.companions.length);
|
||||
refuses("MIRROR_INVALID", () => mirror.chooseHelpers(player.id, { day: DAY, mode: "normal", cardIds: helpers.slice(0, 3).map((helper) => helper.cardId) }));
|
||||
assert.equal(mirror.view(player.id).games.normal.helpsLeft, 2);
|
||||
// Le modèle se voit jusqu'au premier mouvement.
|
||||
assert.equal(mirror.view(player.id).games.normal.modelOpen, true);
|
||||
assert.deepEqual(mirror.image(player.id, "normal", { model: true }).at, Array.from({ length: 16 }, (_, piece) => piece));
|
||||
|
||||
// Coups de main forcés pour l'essai : un compagnon de chaque sorte.
|
||||
const chosen = helpers.slice(0, 2).map((helper) => helper.cardId);
|
||||
mirror.chooseHelpers(player.id, { day: DAY, mode: "normal", cardIds: chosen });
|
||||
const force = (helps) => {
|
||||
// Coups de main forcés pour l'essai : l'équipe affichée donne les compagnons ; leurs coups de main sont remplacés ici.
|
||||
const ids = helpers.map((helper) => helper.cardId);
|
||||
const withHelps = (list) => { mirror.teamHelpers = () => list.map((helps, index) => ({ cardId: ids[index], helps })); };
|
||||
const reset = () => {
|
||||
const state = stored(db, player.id, "normal");
|
||||
state.helpers = chosen.map((cardId, index) => ({ cardId, helps: helps[index] }));
|
||||
state.used = {};
|
||||
db.prepare("UPDATE mirror_games SET state_json = ? WHERE player_id = ? AND mode = 'normal'").run(JSON.stringify(state), player.id);
|
||||
};
|
||||
const moves = () => mirror.view(player.id).games.normal.moves;
|
||||
const use = (cardId, help, cell) => mirror.useHelp(player.id, { day: DAY, mode: "normal", cardId, help, moves: moves(), cell }).mirror.games.normal;
|
||||
const swapNormal = (from, to) => mirror.swap(player.id, { day: DAY, mode: "normal", from, to, moves: moves() }).mirror.games.normal;
|
||||
refuses("MIRROR_HELPER_INVALID", () => use("starvoid-dragon-unknown", "bravoure"));
|
||||
|
||||
// Bravoure : le prochain mouvement se fait n'importe où, une seule fois.
|
||||
force([["bravoure"], ["endurance"]]);
|
||||
assert.equal(use(chosen[0], "bravoure").freeSwap, true);
|
||||
refuses("MIRROR_HELP_USED", () => use(chosen[0], "bravoure"));
|
||||
refuses("MIRROR_HELPER_INVALID", () => use(chosen[1], "fortune"));
|
||||
// Bravoure : le prochain mouvement se fait n'importe où, une seule fois. Deux coups de main au plus par partie.
|
||||
withHelps([["bravoure"], ["endurance"], ["fortune"]]);
|
||||
assert.equal(use(ids[0], "bravoure").freeSwap, true);
|
||||
refuses("MIRROR_HELP_USED", () => use(ids[0], "bravoure"));
|
||||
refuses("MIRROR_HELPER_INVALID", () => use(ids[1], "fortune"));
|
||||
const free = swapNormal(0, 5);
|
||||
assert.equal(free.freeSwap, false);
|
||||
refuses("MIRROR_SWAP_INVALID", () => swapNormal(0, 5));
|
||||
refuses("MIRROR_HELPERS_LOCKED", () => mirror.chooseHelpers(player.id, { day: DAY, mode: "normal", cardIds: chosen }));
|
||||
// Après le premier mouvement, le modèle ne sort plus du serveur.
|
||||
assert.equal(free.modelOpen, false);
|
||||
refuses("MIRROR_MODEL_HIDDEN", () => mirror.image(player.id, "normal", { model: true }));
|
||||
|
||||
// Endurance : reprend le dernier mouvement, remet les morceaux et le rend.
|
||||
const before = stored(db, player.id, "normal").pos;
|
||||
const undone = use(chosen[1], "endurance");
|
||||
const undone = use(ids[1], "endurance");
|
||||
assert.equal(undone.swaps, free.swaps - 1);
|
||||
assert.deepEqual(undone.lastMove, [0, 5]);
|
||||
assert.deepEqual(stored(db, player.id, "normal").pos, swapCells(before, 0, 5));
|
||||
assert.equal(undone.helpsLeft, 0);
|
||||
refuses("MIRROR_HELPS_EXHAUSTED", () => use(ids[2], "fortune"));
|
||||
|
||||
// Orientation : la vraie case du morceau choisi ; Équilibré : le modèle pendant 5 secondes.
|
||||
force([["orientation"], ["balanced"]]);
|
||||
refuses("MIRROR_INVALID", () => use(chosen[0], "orientation"));
|
||||
reset();
|
||||
withHelps([["orientation"], ["balanced"]]);
|
||||
refuses("MIRROR_INVALID", () => use(ids[0], "orientation"));
|
||||
const { pos } = stored(db, player.id, "normal");
|
||||
assert.deepEqual(use(chosen[0], "orientation", 6).hint, [6, pieceAt(pos)[6]]);
|
||||
assert.ok(use(chosen[1], "balanced").peekUntil > clock.now);
|
||||
assert.deepEqual(use(ids[0], "orientation", 6).hint, [6, pieceAt(pos)[6]]);
|
||||
assert.ok(use(ids[1], "balanced").peekUntil > clock.now);
|
||||
assert.ok(mirror.image(player.id, "normal", { model: true }));
|
||||
clock.now += 10_000;
|
||||
refuses("MIRROR_MODEL_HIDDEN", () => mirror.image(player.id, "normal", { model: true }));
|
||||
|
||||
// Fortune : le Trésor double le gain d'une image reconstituée.
|
||||
force([["fortune"], ["endurance"]]);
|
||||
assert.equal(use(chosen[0], "fortune").treasure, true);
|
||||
reset();
|
||||
withHelps([["fortune"]]);
|
||||
assert.equal(use(ids[0], "fortune").treasure, true);
|
||||
const before2 = service.getState(player.id).wallet.stardust;
|
||||
const won = play(context, "normal");
|
||||
assert.equal(won.status, "won");
|
||||
|
|
@ -383,7 +385,7 @@ test("only the development server resets the mirror games", (t) => {
|
|||
test("the mirror API requires a session", async (t) => {
|
||||
const handler = createCardsApiHandler({ projectRoot: resolve("."), enabled: true, devAuth: true, databasePath: ":memory:", env: { NODE_ENV: "test" }, random: () => 0 });
|
||||
t.after(() => handler.close?.());
|
||||
for (const [method, path] of [["GET", ""], ["GET", "/image?mode=normal"], ["POST", "/start"], ["POST", "/swap"], ["POST", "/helpers"], ["POST", "/help"]]) {
|
||||
for (const [method, path] of [["GET", ""], ["GET", "/image?mode=normal"], ["POST", "/start"], ["POST", "/swap"], ["POST", "/help"]]) {
|
||||
const req = Readable.from(method === "POST" ? [Buffer.from("{}")] : []);
|
||||
Object.assign(req, { method, url: `/api/cards/mirror${path}`, headers: { host: "localhost", origin: "http://localhost", "content-type": "application/json" }, socket: { remoteAddress: "127.0.0.1" } });
|
||||
let status = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue