Make the broken mirror easier: wider margins, extra moves from balanced companions, hover outline on hard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bbfb08676f
commit
734a3b6a8b
13 changed files with 82 additions and 52 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : plateau du Miroir brisé : les morceaux de l'image mélangée envoyée par le serveur, la sélection, les cases permises
|
||||
// (même rangée ou même colonne), le contour vert, le bon coup montré et l'animation des échanges.
|
||||
// (même rangée ou même colonne), le contour vert (au survol en Difficile), le bon coup montré et l'animation des échanges.
|
||||
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
||||
import { fillTemplate } from "./dailyShare.js";
|
||||
import { sameLine } from "./mirrorFormat.js";
|
||||
|
|
@ -58,7 +58,7 @@ export function MirrorBoard({ game, src, modelSrc, tiles, peeking, disabled, con
|
|||
const lit = (cell) => !game.freeSwap && selected === null && hovered !== null && (cell === hovered || sameLine(cols, hovered, cell));
|
||||
|
||||
return <div className="nebula-mirror-frame" data-format={rows === cols ? "square" : "portrait"} data-state={game.status} data-peek={peeking || undefined}>
|
||||
<div ref={boardRef} className="nebula-mirror-board" style={{ "--mirror-cols": cols, "--mirror-rows": rows }} data-picking={selected !== null || undefined} data-aiming={aiming || undefined} role="group" aria-label={content.boardLabel}>
|
||||
<div ref={boardRef} className="nebula-mirror-board" style={{ "--mirror-cols": cols, "--mirror-rows": rows }} data-picking={selected !== null || undefined} data-placed-hover={game.placedOnHover || undefined} data-aiming={aiming || undefined} role="group" aria-label={content.boardLabel}>
|
||||
{tiles.map((piece, cell) => <button key={piece} ref={(element) => refs.current.set(piece, element)} type="button" className="nebula-mirror-piece"
|
||||
style={{ gridRow: Math.floor(cell / cols) + 1, gridColumn: (cell % cols) + 1, backgroundImage: src ? `url(${src})` : undefined, backgroundSize: `${cols * 100}% ${rows * 100}%`, backgroundPosition: `${((piece % cols) / (cols - 1)) * 100}% ${(Math.floor(piece / cols) / (rows - 1)) * 100}%` }}
|
||||
aria-label={fillTemplate(content.pieceLabel, { row: Math.floor(cell / cols) + 1, col: (cell % cols) + 1 })} aria-pressed={selected === cell}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ export function MirrorPanel({ catalog, runMutation, busy, content, teamContent }
|
|||
}
|
||||
}
|
||||
|
||||
// Coup de main : l'Orientation attend d'abord le morceau visé ; l'Équilibré montre le modèle quelques secondes.
|
||||
// Coup de main : l'Orientation attend d'abord le morceau visé.
|
||||
async function help(cardId, helpId, cell = null) {
|
||||
// Orientation : sur le morceau déjà choisi, sinon le prochain clic sur le plateau le désigne ; un second clic l'annule sans la dépenser.
|
||||
if (helpId === "orientation" && cell === null) {
|
||||
|
|
@ -242,12 +242,7 @@ export function MirrorPanel({ catalog, runMutation, busy, content, teamContent }
|
|||
setAiming(null);
|
||||
// La sélection reste pour le Mouvement libre (il suffit de cliquer la case voulue), pas pour les autres coups de main.
|
||||
if (helpId !== "bravoure") setSelected(null);
|
||||
const next = await act(() => applyMirrorHelp(mirror.day, activeMode, cardId, helpId, game.moves, cell));
|
||||
const after = next?.games[activeMode];
|
||||
if (helpId === "balanced" && after?.peekUntil) {
|
||||
await peek(true);
|
||||
window.setTimeout(() => setPeeking(false), Math.max(0, after.peekUntil - Date.now()));
|
||||
}
|
||||
await act(() => applyMirrorHelp(mirror.day, activeMode, cardId, helpId, game.moves, cell));
|
||||
}
|
||||
|
||||
// Ouvre un miroir : sa partie si elle existe, sinon elle commence.
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
.nebula-mirror-piece:disabled { cursor: default; }
|
||||
.nebula-mirror-frame[data-state="won"] .nebula-mirror-piece { border-radius: 0; }
|
||||
.nebula-mirror-board .nebula-mirror-piece[data-placed] { box-shadow: inset 0 0 0 2px var(--color-success); }
|
||||
// Difficile : le contour vert ne se voit qu'au survol du morceau.
|
||||
.nebula-mirror-board[data-placed-hover] .nebula-mirror-piece[data-placed]:not(:hover) { box-shadow: none; }
|
||||
.nebula-mirror-board .nebula-mirror-piece[aria-pressed="true"] { z-index: 2; box-shadow: inset 0 0 0 3px var(--color-accent-cyan), 0 0 0 2px var(--color-accent-cyan); filter: brightness(1.2); }
|
||||
.nebula-mirror-board[data-picking] .nebula-mirror-piece[data-off] { filter: brightness(0.38) saturate(0.6); }
|
||||
.nebula-mirror-board .nebula-mirror-piece[data-legal]:hover { box-shadow: inset 0 0 0 3px var(--color-accent-gold); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue