From 886624f1165f412749389baa78230947fa2ae39a Mon Sep 17 00:00:00 2001 From: Didictateur Date: Tue, 25 Nov 2025 22:21:20 +0100 Subject: [PATCH] hidden card --- public/game.html | 8 +++++++- server.js | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/public/game.html b/public/game.html index 7df2144..b161c26 100644 --- a/public/game.html +++ b/public/game.html @@ -320,7 +320,13 @@ const title = (cardObj && (cardObj.title || cardObj.cardId)) || (played && played.card && (played.card.title || played.card.cardId)) || 'Carte'; // show player's color instead of their id; fallback to generic label const actor = (owner === myPlayerId) ? 'Vous' : (playerColors[owner] ? playerColors[owner] : 'Adversaire'); - appendActivity(`${actor} : a joué la carte "${title}"`); + // If the played card is marked hidden, do not reveal the title to other players + const isHidden = (cardObj && cardObj.hidden) || (played && played.card && played.card.hidden); + if(isHidden && owner !== myPlayerId){ + appendActivity(`${actor} : a joué une carte`); + } else { + appendActivity(`${actor} : a joué la carte "${title}"`); + } }catch(_){ } }catch(e){ console.warn('card:played handler error', e); } }); diff --git a/server.js b/server.js index 14717c6..466644b 100644 --- a/server.js +++ b/server.js @@ -305,7 +305,9 @@ function buildDefaultDeck(){ const cardId = ascii.replace(/[^a-z0-9]+/gi,'_').toLowerCase(); // Use deterministic id equal to the slug so clients and server agree on identifiers across requests const id = cardId; - return { id, cardId, title: cap(normalized), description: desc }; + // mark some cards as hidden so their play isn't revealed publicly (mines, totems, immunities) + const hidden = /mine|totem|immun/i.test(cardId); + return { id, cardId, title: cap(normalized), description: desc, hidden: !!hidden }; }); }