diff --git a/public/waiting.html b/public/waiting.html index 272667f..c84f9c1 100644 --- a/public/waiting.html +++ b/public/waiting.html @@ -231,6 +231,18 @@ }); } + // No-remise toggle (host only) - independent from auto-draw + if(noRemiseToggleEl){ + noRemiseToggleEl.addEventListener('change', (ev)=>{ + if(!socket) return; + const enabled = !!noRemiseToggleEl.checked; + socket.emit('room:no_remise:set', { roomId, enabled }, (resp)=>{ + if(resp && resp.error){ log('no-remise error', resp); alert(resp.error); return; } + log('no-remise updated', resp); + }); + }); + } + // Copy invite link (hidden link, no display) document.getElementById('copyInviteBtn').addEventListener('click', async ()=>{ const link = `${window.location.origin}/waiting.html?roomId=${encodeURIComponent(roomId)}`; diff --git a/server.js b/server.js index dca6f11..ee5b17f 100644 --- a/server.js +++ b/server.js @@ -1420,9 +1420,17 @@ io.on('connection', (socket) => { const removed = hand.splice(idx,1)[0]; room.hands[senderId] = hand; room.discard = room.discard || []; - room.discard.push(removed); - // attach the removed card object to the played record for informational broadcast - played.card = removed; + // Respect the room.noRemise flag: when true, do NOT move the played card into the discard pile. + if(!room.noRemise){ + room.discard.push(removed); + // attach the removed card object to the played record for informational broadcast + played.card = removed; + played._discarded = true; + } else { + // still attach the card instance for informational purposes but note it wasn't discarded + played.card = removed; + played._discarded = false; + } // normalize cardId to the card's slug when the client passed an instance id cardId = (removed && removed.cardId) || cardId; }catch(e){