@@ -11,7 +11,6 @@ const model = {
1111 privateHand : { } ,
1212 publicHands : { } ,
1313 busy : false ,
14- confirmStart : false ,
1514 revealedCardId : null ,
1615 claimPicker : false ,
1716 claimSelection : null ,
@@ -151,7 +150,6 @@ function leaveLocalRoom() {
151150 room : null ,
152151 privateHand : { } ,
153152 publicHands : { } ,
154- confirmStart : false ,
155153 revealedCardId : null ,
156154 claimPicker : false ,
157155 claimSelection : null
@@ -164,7 +162,7 @@ function subscribeToHandVisibility() {
164162 cleanupHandSubscription ( ) ;
165163 return ;
166164 }
167- const visibility = model . room . settings ?. handVisibility || "private " ;
165+ const visibility = model . room . settings ?. handVisibility || "public " ;
168166 if ( subscribedHandMode === visibility ) return ;
169167 cleanupHandSubscription ( ) ;
170168 subscribedHandMode = visibility ;
@@ -309,51 +307,24 @@ function visibilitySelector(settings) {
309307 const isPublic = settings . handVisibility === "public" ;
310308 return `<fieldset class="visibility-fieldset">
311309 <legend>Visibilidad de las cartas</legend>
312- <label class="choice-card ${ ! isPublic ? "selected" : "" } ">
313- <input type="radio" name="handVisibility" value="private" ${ ! isPublic ? "checked" : "" } >
314- <span class="choice-dot"></span>
315- <span><strong>Cartas privadas</strong><small>Cada jugador ve solamente su mano.</small></span>
316- </label>
317310 <label class="choice-card ${ isPublic ? "selected" : "" } ">
318311 <input type="radio" name="handVisibility" value="public" ${ isPublic ? "checked" : "" } >
319312 <span class="choice-dot"></span>
320- <span><strong>Visibles para todos</strong><small>Todas las manos permanecen a la vista.</small></span>
313+ <span><strong>Cartas visibles</strong><small>Todas las manos permanecen a la vista.</small></span>
314+ </label>
315+ <label class="choice-card ${ ! isPublic ? "selected" : "" } ">
316+ <input type="radio" name="handVisibility" value="private" ${ ! isPublic ? "checked" : "" } >
317+ <span class="choice-dot"></span>
318+ <span><strong>Cartas abajo</strong><small>Cada jugador mantiene su mano oculta en su teléfono.</small></span>
321319 </label>
322320 </fieldset>` ;
323321}
324322
325323function settingsReadOnly ( settings ) {
326324 const isPublic = settings . handVisibility === "public" ;
327325 return `<div class="readonly-settings">
328- <span><small>Visibilidad</small><strong>${ isPublic ? "Visibles para todos " : "Cartas privadas " } </strong></span>
326+ <span><small>Visibilidad</small><strong>${ isPublic ? "Cartas visibles " : "Cartas abajo " } </strong></span>
329327 <span><small>Cartas</small><strong>${ settings . cardsPerPlayer } por jugador</strong></span>
330- <span><small>Multiplicadores</small><strong>${ ( settings . floorMultipliers || [ 1 , 2 , 4 , 8 , 16 ] ) . map ( value => `×${ value } ` ) . join ( ", " ) } </strong></span>
331- </div>` ;
332- }
333-
334- function startSummary ( settings ) {
335- const visibility = settings . handVisibility === "public" ? "Visibles para todos" : "Cartas privadas" ;
336- return `<dl class="start-summary">
337- <div><dt>Modo</dt><dd>Clásico</dd></div>
338- <div><dt>Jugadores</dt><dd>${ players ( ) . length } </dd></div>
339- <div><dt>Cartas por jugador</dt><dd>${ settings . cardsPerPlayer } </dd></div>
340- <div><dt>Visibilidad</dt><dd>${ visibility } </dd></div>
341- <div><dt>Multiplicadores</dt><dd>${ settings . floorMultipliers . map ( value => `×${ value } ` ) . join ( ", " ) } </dd></div>
342- </dl>` ;
343- }
344-
345- function startConfirmation ( settings ) {
346- if ( ! model . confirmStart ) return "" ;
347- return `<div class="modal-layer" role="presentation">
348- <section class="modal panel" role="dialog" aria-modal="true" aria-labelledby="confirm-title">
349- <span class="eyebrow">Revisa la mesa</span>
350- <h2 id="confirm-title">¿Todo listo?</h2>
351- ${ startSummary ( settings ) }
352- <div class="modal-actions">
353- <button class="btn ghost" data-action="cancel-start">Volver</button>
354- <button class="btn primary" data-action="confirm-start" ${ model . busy ? "disabled" : "" } >Confirmar e iniciar</button>
355- </div>
356- </section>
357328 </div>` ;
358329}
359330
@@ -384,19 +355,14 @@ function renderLobby() {
384355 ${ [ 3 , 4 , 5 , 6 ] . map ( value => `<option value="${ value } " ${ settings . cardsPerPlayer === value ? "selected" : "" } >${ value } </option>` ) . join ( "" ) }
385356 </select>
386357 </label>
387- <div class="multiplier-setting">
388- <span><strong>Multiplicadores por piso</strong><small>Define la carga de cada nivel.</small></span>
389- <div class="multiplier-inputs">${ ( settings . floorMultipliers || [ 1 , 2 , 4 , 8 , 16 ] ) . map ( ( value , index ) => `<label><small>${ index + 1 } </small><input type="number" name="floorMultiplier${ index } " min="1" max="99" value="${ value } "></label>` ) . join ( "" ) } </div>
390- </div>
391358 <button type="button" class="btn ghost full" data-action="close-room">Cerrar sala para todos</button>
392359 </form>` : settingsReadOnly ( settings ) }
393360 </section>
394361 </div>
395362
396- ${ isHost ( ) ? `<button class="btn primary start-room" data-action="review- start" ${ players ( ) . length < 2 || model . busy ? "disabled" : "" } >
397- ${ players ( ) . length < 2 ? "Esperando al menos 2 jugadores" : "Revisar e iniciar " } <span>→</span>
363+ ${ isHost ( ) ? `<button class="btn primary start-room" data-action="start-room " ${ players ( ) . length < 2 || model . busy ? "disabled" : "" } >
364+ ${ players ( ) . length < 2 ? "Esperando al menos 2 jugadores" : "Iniciar partida " } <span>→</span>
398365 </button>` : `<div class="waiting-host"><i></i> Esperando al anfitrión…</div>` }
399- ${ startConfirmation ( settings ) }
400366 </section>` ;
401367}
402368
@@ -442,13 +408,14 @@ function activeClaimMarkup() {
442408 const claimant = model . room . players [ claim . claimantUid ] ;
443409 const target = model . room . players [ claim . targetUid ] ;
444410 const isTarget = claim . targetUid === model . user . uid ;
411+ const canChallenge = model . room . settings . handVisibility === "private" ;
445412 return `<section class="claim-banner panel">
446413 <span class="eyebrow">Declaración pendiente</span>
447414 <h3>${ escapeHTML ( claimant ?. name ) } declara ${ escapeHTML ( claim . claimedValue ) } </h3>
448415 <p>Le entrega una carga ×${ claim . multiplier } a <strong>${ escapeHTML ( target ?. name ) } </strong>.</p>
449416 ${ isTarget ? `<div class="claim-actions">
450417 <button class="btn secondary" data-action="resolve-claim" data-decision="accept">Aceptar carga</button>
451- <button class="btn danger" data-action="resolve-claim" data-decision="challenge">Desafiar</button>
418+ ${ canChallenge ? ` <button class="btn danger" data-action="resolve-claim" data-decision="challenge">Desafiar</button>` : "" }
452419 </div>` : `<small>Esperando la decisión de ${ escapeHTML ( target ?. name ) } …</small>` }
453420 </section>` ;
454421}
@@ -610,7 +577,7 @@ function settingsFromForm(form) {
610577 scoringEnabled : true ,
611578 maxPlayers : 8 ,
612579 multiplierType : "double" ,
613- floorMultipliers : [ 0 , 1 , 2 , 3 , 4 ] . map ( index => Number ( form . elements [ `floorMultiplier ${ index } ` ] . value ) )
580+ floorMultipliers : [ 1 , 2 , 4 , 8 , 16 ]
614581 } ;
615582}
616583
@@ -675,16 +642,7 @@ root.addEventListener("click", event => {
675642 leaveLocalRoom ( ) ;
676643 } ) ;
677644 }
678- if ( action === "review-start" ) {
679- model . confirmStart = true ;
680- render ( ) ;
681- }
682- if ( action === "cancel-start" ) {
683- model . confirmStart = false ;
684- render ( ) ;
685- }
686- if ( action === "confirm-start" ) {
687- model . confirmStart = false ;
645+ if ( action === "start-room" ) {
688646 run ( ( ) => api . startOnlineGame ( { code : model . roomCode } ) ) ;
689647 }
690648 if ( action === "reveal-card" ) {
@@ -782,7 +740,7 @@ function demoRoom(mode) {
782740 code : "VACILA" ,
783741 hostUid : "demo-host" ,
784742 status : "lobby" ,
785- settings : { mode : "classic" , handVisibility : "private " , bluffEnabled : true , powersEnabled : false , scoringEnabled : true , cardsPerPlayer : 4 , maxPlayers : 8 , floorMultipliers : [ 1 , 2 , 4 , 8 , 16 ] } ,
743+ settings : { mode : "classic" , handVisibility : "public " , bluffEnabled : false , powersEnabled : false , scoringEnabled : true , cardsPerPlayer : 4 , maxPlayers : 8 , floorMultipliers : [ 1 , 2 , 4 , 8 , 16 ] } ,
786744 players : demoPlayers
787745 } ;
788746 }
0 commit comments