sans remise
This commit is contained in:
parent
c00a3ce3b1
commit
0a4ebc4500
2 changed files with 23 additions and 3 deletions
|
|
@ -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)}`;
|
||||
|
|
|
|||
|
|
@ -1420,9 +1420,17 @@ io.on('connection', (socket) => {
|
|||
const removed = hand.splice(idx,1)[0];
|
||||
room.hands[senderId] = hand;
|
||||
room.discard = room.discard || [];
|
||||
// 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){
|
||||
|
|
|
|||
Loading…
Reference in a new issue