Add 2 files
Browse files- README.md +7 -5
- index.html +1499 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: parch
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,1499 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="es">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Parchís Royale | El juego de mesa clásico reinventado</title>
|
| 7 |
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎲</text></svg>">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
+
<style>
|
| 11 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 12 |
+
|
| 13 |
+
body {
|
| 14 |
+
font-family: 'Poppins', sans-serif;
|
| 15 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 16 |
+
min-height: 100vh;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.board-4 {
|
| 20 |
+
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600"><path d="M300,0 L600,300 L300,600 L0,300 Z" fill="%23FF5252"/><path d="M300,0 L600,300 L300,600" fill="%234CAF50"/><path d="M300,0 L0,300 L300,600" fill="%23FFC107"/><path d="M300,0 L600,300 L0,300 Z" fill="%232196F3"/><circle cx="300" cy="300" r="100" fill="white"/></svg>');
|
| 21 |
+
background-size: contain;
|
| 22 |
+
background-repeat: no-repeat;
|
| 23 |
+
background-position: center;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.board-6 {
|
| 27 |
+
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600" viewBox="0 0 600 600"><path d="M300,0 L600,300 L300,600 L0,300 Z" fill="%23FF5252"/><path d="M300,0 L520,150 L450,300 L520,450 L300,600 L80,450 L150,300 L80,150 Z" fill="%234CAF50"/><path d="M300,0 L520,150 L600,300 L520,450 L300,600" fill="%23FFC107"/><path d="M300,0 L80,150 L0,300 L80,450 L300,600" fill="%232196F3"/><path d="M300,0 L520,150 L450,300 L600,300 L520,450 L300,600" fill="%239C27B0"/><path d="M300,0 L80,150 L150,300 L0,300 L80,450 L300,600" fill="%23FF9800"/><circle cx="300" cy="300" r="100" fill="white"/></svg>');
|
| 28 |
+
background-size: contain;
|
| 29 |
+
background-repeat: no-repeat;
|
| 30 |
+
background-position: center;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.piece {
|
| 34 |
+
width: 30px;
|
| 35 |
+
height: 30px;
|
| 36 |
+
border-radius: 50%;
|
| 37 |
+
cursor: pointer;
|
| 38 |
+
transition: all 0.3s ease;
|
| 39 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 40 |
+
display: flex;
|
| 41 |
+
align-items: center;
|
| 42 |
+
justify-content: center;
|
| 43 |
+
font-weight: bold;
|
| 44 |
+
color: white;
|
| 45 |
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.piece:hover {
|
| 49 |
+
transform: scale(1.1);
|
| 50 |
+
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.dice {
|
| 54 |
+
width: 60px;
|
| 55 |
+
height: 60px;
|
| 56 |
+
border-radius: 12px;
|
| 57 |
+
display: flex;
|
| 58 |
+
align-items: center;
|
| 59 |
+
justify-content: center;
|
| 60 |
+
font-size: 24px;
|
| 61 |
+
font-weight: bold;
|
| 62 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 63 |
+
cursor: pointer;
|
| 64 |
+
transition: all 0.3s ease;
|
| 65 |
+
background: white;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.dice:hover {
|
| 69 |
+
transform: scale(1.05);
|
| 70 |
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.home-base {
|
| 74 |
+
border-radius: 50%;
|
| 75 |
+
display: flex;
|
| 76 |
+
align-items: center;
|
| 77 |
+
justify-content: center;
|
| 78 |
+
font-weight: bold;
|
| 79 |
+
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.safe-spot {
|
| 83 |
+
border: 3px dashed white;
|
| 84 |
+
box-sizing: border-box;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.modal-overlay {
|
| 88 |
+
position: fixed;
|
| 89 |
+
top: 0;
|
| 90 |
+
left: 0;
|
| 91 |
+
right: 0;
|
| 92 |
+
bottom: 0;
|
| 93 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 94 |
+
display: flex;
|
| 95 |
+
align-items: center;
|
| 96 |
+
justify-content: center;
|
| 97 |
+
z-index: 1000;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.modal-content {
|
| 101 |
+
background: white;
|
| 102 |
+
border-radius: 16px;
|
| 103 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
| 104 |
+
max-width: 90%;
|
| 105 |
+
max-height: 90%;
|
| 106 |
+
overflow-y: auto;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.player-color-selector {
|
| 110 |
+
width: 30px;
|
| 111 |
+
height: 30px;
|
| 112 |
+
border-radius: 50%;
|
| 113 |
+
cursor: pointer;
|
| 114 |
+
margin: 0 5px;
|
| 115 |
+
border: 2px solid transparent;
|
| 116 |
+
transition: all 0.2s ease;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.player-color-selector:hover, .player-color-selector.selected {
|
| 120 |
+
transform: scale(1.1);
|
| 121 |
+
border-color: white;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.glow {
|
| 125 |
+
animation: glow 1.5s infinite alternate;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
@keyframes glow {
|
| 129 |
+
from {
|
| 130 |
+
box-shadow: 0 0 5px -5px currentColor;
|
| 131 |
+
}
|
| 132 |
+
to {
|
| 133 |
+
box-shadow: 0 0 10px 5px currentColor;
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
.path-cell {
|
| 138 |
+
position: relative;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.path-cell::after {
|
| 142 |
+
content: '';
|
| 143 |
+
position: absolute;
|
| 144 |
+
top: 50%;
|
| 145 |
+
left: 50%;
|
| 146 |
+
transform: translate(-50%, -50%);
|
| 147 |
+
width: 60%;
|
| 148 |
+
height: 60%;
|
| 149 |
+
border-radius: 50%;
|
| 150 |
+
background-color: rgba(255, 255, 255, 0.2);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.winner-crown {
|
| 154 |
+
position: absolute;
|
| 155 |
+
top: -15px;
|
| 156 |
+
left: 50%;
|
| 157 |
+
transform: translateX(-50%);
|
| 158 |
+
font-size: 24px;
|
| 159 |
+
color: gold;
|
| 160 |
+
text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
| 161 |
+
}
|
| 162 |
+
</style>
|
| 163 |
+
</head>
|
| 164 |
+
<body class="text-gray-800">
|
| 165 |
+
<!-- Pantalla de inicio -->
|
| 166 |
+
<div id="start-screen" class="fixed inset-0 flex flex-col items-center justify-center p-4 z-50 bg-gradient-to-br from-blue-500 to-purple-600 text-white">
|
| 167 |
+
<div class="text-center mb-8">
|
| 168 |
+
<h1 class="text-5xl md:text-6xl font-bold mb-2 flex items-center justify-center">
|
| 169 |
+
<span class="mr-3">🎲</span>
|
| 170 |
+
<span>Parchís</span>
|
| 171 |
+
<span class="text-yellow-300 ml-2">Royale</span>
|
| 172 |
+
</h1>
|
| 173 |
+
<p class="text-xl md:text-2xl opacity-90">El clásico juego de mesa reinventado</p>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<div class="w-full max-w-md bg-white bg-opacity-10 backdrop-blur-sm rounded-xl p-6 shadow-xl">
|
| 177 |
+
<h2 class="text-2xl font-semibold mb-4 text-center">Crear o unirse a una partida</h2>
|
| 178 |
+
|
| 179 |
+
<div class="flex space-x-4 mb-6">
|
| 180 |
+
<button id="create-game-btn" class="flex-1 bg-yellow-400 hover:bg-yellow-500 text-gray-900 font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105 flex items-center justify-center">
|
| 181 |
+
<i class="fas fa-plus-circle mr-2"></i> Crear
|
| 182 |
+
</button>
|
| 183 |
+
<button id="join-game-btn" class="flex-1 bg-blue-400 hover:bg-blue-500 text-white font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105 flex items-center justify-center">
|
| 184 |
+
<i class="fas fa-sign-in-alt mr-2"></i> Unirse
|
| 185 |
+
</button>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
<div class="text-center text-sm opacity-80">
|
| 189 |
+
<p>Juega con amigos o contra la IA</p>
|
| 190 |
+
<p class="mt-1">Diversión garantizada para 2-6 jugadores</p>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
<button id="rules-btn" class="mt-8 text-white bg-transparent border border-white hover:bg-white hover:bg-opacity-20 px-4 py-2 rounded-lg transition-all flex items-center">
|
| 195 |
+
<i class="fas fa-book mr-2"></i> Ver reglas del juego
|
| 196 |
+
</button>
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<!-- Modal de creación de partida -->
|
| 200 |
+
<div id="create-game-modal" class="modal-overlay hidden">
|
| 201 |
+
<div class="modal-content w-full max-w-md bg-white p-6">
|
| 202 |
+
<div class="flex justify-between items-center mb-4">
|
| 203 |
+
<h3 class="text-2xl font-bold text-gray-800">Nueva partida</h3>
|
| 204 |
+
<button id="close-create-modal" class="text-gray-500 hover:text-gray-700">
|
| 205 |
+
<i class="fas fa-times"></i>
|
| 206 |
+
</button>
|
| 207 |
+
</div>
|
| 208 |
+
|
| 209 |
+
<div class="mb-6">
|
| 210 |
+
<label class="block text-gray-700 font-medium mb-2">Nombre del jugador</label>
|
| 211 |
+
<input type="text" id="player-name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Tu nombre">
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<div class="mb-6">
|
| 215 |
+
<label class="block text-gray-700 font-medium mb-2">Tablero</label>
|
| 216 |
+
<div class="flex space-x-4">
|
| 217 |
+
<div class="flex-1">
|
| 218 |
+
<input type="radio" id="board-4" name="board-type" value="4" class="hidden peer" checked>
|
| 219 |
+
<label for="board-4" class="block p-4 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-blue-500 peer-checked:bg-blue-50 peer-checked:ring-2 peer-checked:ring-blue-200">
|
| 220 |
+
<div class="flex flex-col items-center">
|
| 221 |
+
<div class="w-24 h-24 board-4 mb-2"></div>
|
| 222 |
+
<span>4 jugadores</span>
|
| 223 |
+
</div>
|
| 224 |
+
</label>
|
| 225 |
+
</div>
|
| 226 |
+
<div class="flex-1">
|
| 227 |
+
<input type="radio" id="board-6" name="board-type" value="6" class="hidden peer">
|
| 228 |
+
<label for="board-6" class="block p-4 border border-gray-300 rounded-lg cursor-pointer peer-checked:border-blue-500 peer-checked:bg-blue-50 peer-checked:ring-2 peer-checked:ring-blue-200">
|
| 229 |
+
<div class="flex flex-col items-center">
|
| 230 |
+
<div class="w-24 h-24 board-6 mb-2"></div>
|
| 231 |
+
<span>6 jugadores</span>
|
| 232 |
+
</div>
|
| 233 |
+
</label>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
</div>
|
| 237 |
+
|
| 238 |
+
<div class="mb-6">
|
| 239 |
+
<label class="block text-gray-700 font-medium mb-2">Dificultad</label>
|
| 240 |
+
<select id="game-difficulty" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 241 |
+
<option value="easy">Fácil (Clásico)</option>
|
| 242 |
+
<option value="medium">Medio (Bloqueos)</option>
|
| 243 |
+
<option value="hard">Difícil (Poderes especiales)</option>
|
| 244 |
+
</select>
|
| 245 |
+
</div>
|
| 246 |
+
|
| 247 |
+
<div class="mb-6">
|
| 248 |
+
<label class="block text-gray-700 font-medium mb-2">Color</label>
|
| 249 |
+
<div class="flex justify-center">
|
| 250 |
+
<div class="player-color-selector bg-red-500 selected" data-color="red"></div>
|
| 251 |
+
<div class="player-color-selector bg-blue-500" data-color="blue"></div>
|
| 252 |
+
<div class="player-color-selector bg-green-500" data-color="green"></div>
|
| 253 |
+
<div class="player-color-selector bg-yellow-400" data-color="yellow"></div>
|
| 254 |
+
<div class="player-color-selector bg-purple-500" data-color="purple"></div>
|
| 255 |
+
<div class="player-color-selector bg-orange-500" data-color="orange"></div>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
|
| 259 |
+
<button id="start-game-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105">
|
| 260 |
+
<i class="fas fa-play mr-2"></i> Crear partida
|
| 261 |
+
</button>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
<!-- Modal de código de invitación -->
|
| 266 |
+
<div id="invite-modal" class="modal-overlay hidden">
|
| 267 |
+
<div class="modal-content w-full max-w-md bg-white p-6">
|
| 268 |
+
<div class="flex justify-between items-center mb-4">
|
| 269 |
+
<h3 class="text-2xl font-bold text-gray-800">Invitar jugadores</h3>
|
| 270 |
+
<button id="close-invite-modal" class="text-gray-500 hover:text-gray-700">
|
| 271 |
+
<i class="fas fa-times"></i>
|
| 272 |
+
</button>
|
| 273 |
+
</div>
|
| 274 |
+
|
| 275 |
+
<div class="mb-6 text-center">
|
| 276 |
+
<p class="text-gray-700 mb-4">Comparte este código con otros jugadores para que se unan a tu partida:</p>
|
| 277 |
+
<div class="flex items-center justify-center mb-4">
|
| 278 |
+
<div id="game-code" class="text-3xl font-bold bg-gray-100 px-6 py-3 rounded-lg tracking-widest">ABCD12</div>
|
| 279 |
+
<button id="copy-code" class="ml-2 bg-blue-100 text-blue-600 p-2 rounded-lg hover:bg-blue-200 transition-all">
|
| 280 |
+
<i class="fas fa-copy"></i>
|
| 281 |
+
</button>
|
| 282 |
+
</div>
|
| 283 |
+
<p class="text-sm text-gray-500">O envía este enlace:</p>
|
| 284 |
+
<div class="flex items-center mt-2">
|
| 285 |
+
<input type="text" id="game-link" class="flex-1 px-3 py-2 border border-gray-300 rounded-l-lg focus:outline-none" readonly>
|
| 286 |
+
<button id="copy-link" class="bg-blue-600 text-white px-4 py-2 rounded-r-lg hover:bg-blue-700 transition-all">
|
| 287 |
+
<i class="fas fa-copy"></i>
|
| 288 |
+
</button>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
|
| 292 |
+
<div class="bg-blue-50 p-4 rounded-lg mb-6">
|
| 293 |
+
<h4 class="font-medium text-blue-800 mb-2 flex items-center">
|
| 294 |
+
<i class="fas fa-users mr-2"></i> Jugadores conectados
|
| 295 |
+
</h4>
|
| 296 |
+
<ul id="players-list" class="space-y-2">
|
| 297 |
+
<li class="flex items-center">
|
| 298 |
+
<div class="w-4 h-4 rounded-full bg-red-500 mr-2"></div>
|
| 299 |
+
<span>Jugador 1 (Tú)</span>
|
| 300 |
+
</li>
|
| 301 |
+
</ul>
|
| 302 |
+
</div>
|
| 303 |
+
|
| 304 |
+
<button id="begin-game-btn" class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
|
| 305 |
+
<i class="fas fa-flag-checkered mr-2"></i> Comenzar partida
|
| 306 |
+
</button>
|
| 307 |
+
</div>
|
| 308 |
+
</div>
|
| 309 |
+
|
| 310 |
+
<!-- Modal de unirse a partida -->
|
| 311 |
+
<div id="join-game-modal" class="modal-overlay hidden">
|
| 312 |
+
<div class="modal-content w-full max-w-md bg-white p-6">
|
| 313 |
+
<div class="flex justify-between items-center mb-4">
|
| 314 |
+
<h3 class="text-2xl font-bold text-gray-800">Unirse a partida</h3>
|
| 315 |
+
<button id="close-join-modal" class="text-gray-500 hover:text-gray-700">
|
| 316 |
+
<i class="fas fa-times"></i>
|
| 317 |
+
</button>
|
| 318 |
+
</div>
|
| 319 |
+
|
| 320 |
+
<div class="mb-6">
|
| 321 |
+
<label class="block text-gray-700 font-medium mb-2">Nombre del jugador</label>
|
| 322 |
+
<input type="text" id="join-player-name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Tu nombre">
|
| 323 |
+
</div>
|
| 324 |
+
|
| 325 |
+
<div class="mb-6">
|
| 326 |
+
<label class="block text-gray-700 font-medium mb-2">Código de partida</label>
|
| 327 |
+
<input type="text" id="join-game-code" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 uppercase" placeholder="ABCD12" maxlength="6">
|
| 328 |
+
</div>
|
| 329 |
+
|
| 330 |
+
<div class="mb-6">
|
| 331 |
+
<label class="block text-gray-700 font-medium mb-2">Color</label>
|
| 332 |
+
<div class="flex justify-center">
|
| 333 |
+
<div class="player-color-selector bg-red-500" data-color="red"></div>
|
| 334 |
+
<div class="player-color-selector bg-blue-500 selected" data-color="blue"></div>
|
| 335 |
+
<div class="player-color-selector bg-green-500" data-color="green"></div>
|
| 336 |
+
<div class="player-color-selector bg-yellow-400" data-color="yellow"></div>
|
| 337 |
+
<div class="player-color-selector bg-purple-500" data-color="purple"></div>
|
| 338 |
+
<div class="player-color-selector bg-orange-500" data-color="orange"></div>
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
+
|
| 342 |
+
<button id="confirm-join-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105">
|
| 343 |
+
<i class="fas fa-sign-in-alt mr-2"></i> Unirse a partida
|
| 344 |
+
</button>
|
| 345 |
+
</div>
|
| 346 |
+
</div>
|
| 347 |
+
|
| 348 |
+
<!-- Modal de reglas -->
|
| 349 |
+
<div id="rules-modal" class="modal-overlay hidden">
|
| 350 |
+
<div class="modal-content w-full max-w-2xl bg-white p-6">
|
| 351 |
+
<div class="flex justify-between items-center mb-4">
|
| 352 |
+
<h3 class="text-2xl font-bold text-gray-800">Reglas del Parchís</h3>
|
| 353 |
+
<button id="close-rules-modal" class="text-gray-500 hover:text-gray-700">
|
| 354 |
+
<i class="fas fa-times"></i>
|
| 355 |
+
</button>
|
| 356 |
+
</div>
|
| 357 |
+
|
| 358 |
+
<div class="prose max-w-none">
|
| 359 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 360 |
+
<div>
|
| 361 |
+
<h4 class="text-lg font-semibold text-blue-600 mb-2">Objetivo del juego</h4>
|
| 362 |
+
<p>El objetivo es llevar todas tus fichas desde tu base de salida hasta la base de llegada en el centro del tablero.</p>
|
| 363 |
+
|
| 364 |
+
<h4 class="text-lg font-semibold text-blue-600 mt-4 mb-2">Movimiento básico</h4>
|
| 365 |
+
<ul class="list-disc pl-5 space-y-1">
|
| 366 |
+
<li>Los jugadores tiran un dado por turnos.</li>
|
| 367 |
+
<li>Para sacar una ficha de la base, se necesita un 5.</li>
|
| 368 |
+
<li>Las fichas avanzan en sentido horario según el número del dado.</li>
|
| 369 |
+
<li>Si sacas un 6, puedes volver a tirar.</li>
|
| 370 |
+
</ul>
|
| 371 |
+
|
| 372 |
+
<h4 class="text-lg font-semibold text-blue-600 mt-4 mb-2">Capturas</h4>
|
| 373 |
+
<ul class="list-disc pl-5 space-y-1">
|
| 374 |
+
<li>Si una ficha cae en una casilla ocupada por una ficha rival, la ficha rival regresa a su base.</li>
|
| 375 |
+
<li>No puedes capturar en casillas seguras (marcadas con ⭐).</li>
|
| 376 |
+
<li>Si tienes dos fichas en la misma casilla, forman un bloqueo que no puede ser capturado.</li>
|
| 377 |
+
</ul>
|
| 378 |
+
</div>
|
| 379 |
+
|
| 380 |
+
<div>
|
| 381 |
+
<h4 class="text-lg font-semibold text-blue-600 mb-2">Zona final</h4>
|
| 382 |
+
<ul class="list-disc pl-5 space-y-1">
|
| 383 |
+
<li>Cuando una ficha completa una vuelta al tablero, entra en su pasillo de color.</li>
|
| 384 |
+
<li>Para entrar en la casilla final, el dado debe mostrar el número exacto necesario.</li>
|
| 385 |
+
<li>La primera persona en meter todas sus fichas gana.</li>
|
| 386 |
+
</ul>
|
| 387 |
+
|
| 388 |
+
<h4 class="text-lg font-semibold text-blue-600 mt-4 mb-2">Variantes especiales</h4>
|
| 389 |
+
<ul class="list-disc pl-5 space-y-1">
|
| 390 |
+
<li><strong>Modo bloqueos:</strong> Los bloqueos duran solo 2 turnos.</li>
|
| 391 |
+
<li><strong>Poderes especiales:</strong> Cada jugador tiene habilidades únicas.</li>
|
| 392 |
+
<li><strong>Super 6:</strong> Tres 6 seguidos hacen que tu ficha regrese a la base.</li>
|
| 393 |
+
</ul>
|
| 394 |
+
|
| 395 |
+
<h4 class="text-lg font-semibold text-blue-600 mt-4 mb-2">Consejos</h4>
|
| 396 |
+
<ul class="list-disc pl-5 space-y-1">
|
| 397 |
+
<li>Intenta mantener al menos una ficha en juego.</li>
|
| 398 |
+
<li>Usa los bloqueos estratégicamente para proteger tus fichas.</li>
|
| 399 |
+
<li>No te apresures a meter todas tus fichas al pasillo final.</li>
|
| 400 |
+
</ul>
|
| 401 |
+
</div>
|
| 402 |
+
</div>
|
| 403 |
+
|
| 404 |
+
<div class="mt-6 p-4 bg-yellow-50 rounded-lg border border-yellow-200">
|
| 405 |
+
<h4 class="text-lg font-semibold text-yellow-700 mb-2 flex items-center">
|
| 406 |
+
<i class="fas fa-lightbulb mr-2"></i> Dificultades especiales
|
| 407 |
+
</h4>
|
| 408 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 409 |
+
<div class="bg-white p-3 rounded-lg shadow-sm">
|
| 410 |
+
<h5 class="font-medium text-green-600">Fácil</h5>
|
| 411 |
+
<p class="text-sm">Juego clásico sin modificaciones.</p>
|
| 412 |
+
</div>
|
| 413 |
+
<div class="bg-white p-3 rounded-lg shadow-sm">
|
| 414 |
+
<h5 class="font-medium text-yellow-600">Medio</h5>
|
| 415 |
+
<p class="text-sm">Bloqueos temporales y casillas especiales.</p>
|
| 416 |
+
</div>
|
| 417 |
+
<div class="bg-white p-3 rounded-lg shadow-sm">
|
| 418 |
+
<h5 class="font-medium text-red-600">Difícil</h5>
|
| 419 |
+
<p class="text-sm">Poderes especiales y reglas avanzadas.</p>
|
| 420 |
+
</div>
|
| 421 |
+
</div>
|
| 422 |
+
</div>
|
| 423 |
+
</div>
|
| 424 |
+
|
| 425 |
+
<div class="mt-6 flex justify-center">
|
| 426 |
+
<button id="close-rules-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-6 rounded-lg transition-all">
|
| 427 |
+
Entendido
|
| 428 |
+
</button>
|
| 429 |
+
</div>
|
| 430 |
+
</div>
|
| 431 |
+
</div>
|
| 432 |
+
|
| 433 |
+
<!-- Pantalla de juego -->
|
| 434 |
+
<div id="game-screen" class="hidden">
|
| 435 |
+
<!-- Barra superior -->
|
| 436 |
+
<div class="bg-gray-800 text-white p-3 shadow-md">
|
| 437 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 438 |
+
<div class="flex items-center">
|
| 439 |
+
<button id="menu-btn" class="mr-4 text-white hover:text-yellow-300 transition-all">
|
| 440 |
+
<i class="fas fa-bars text-xl"></i>
|
| 441 |
+
</button>
|
| 442 |
+
<h1 class="text-xl font-bold flex items-center">
|
| 443 |
+
<span class="mr-2">🎲</span>
|
| 444 |
+
<span>Parchís</span>
|
| 445 |
+
<span class="text-yellow-300 ml-1">Royale</span>
|
| 446 |
+
</h1>
|
| 447 |
+
</div>
|
| 448 |
+
|
| 449 |
+
<div class="flex items-center space-x-4">
|
| 450 |
+
<div id="turn-indicator" class="px-3 py-1 rounded-full bg-blue-600 text-sm font-medium flex items-center">
|
| 451 |
+
<div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
|
| 452 |
+
<span>Tu turno</span>
|
| 453 |
+
</div>
|
| 454 |
+
<button id="dice-btn" class="dice bg-yellow-400 text-gray-900">🎲</button>
|
| 455 |
+
</div>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
|
| 459 |
+
<!-- Contenido principal del juego -->
|
| 460 |
+
<div class="container mx-auto p-4">
|
| 461 |
+
<div class="flex flex-col lg:flex-row gap-6">
|
| 462 |
+
<!-- Tablero de juego -->
|
| 463 |
+
<div class="flex-1 flex justify-center">
|
| 464 |
+
<div id="game-board" class="relative w-full max-w-2xl aspect-square board-4">
|
| 465 |
+
<!-- Las celdas y fichas se generarán dinámicamente con JavaScript -->
|
| 466 |
+
</div>
|
| 467 |
+
</div>
|
| 468 |
+
|
| 469 |
+
<!-- Panel lateral -->
|
| 470 |
+
<div class="w-full lg:w-80 space-y-4">
|
| 471 |
+
<!-- Información del jugador actual -->
|
| 472 |
+
<div class="bg-white rounded-xl shadow-md p-4">
|
| 473 |
+
<h3 class="font-bold text-lg mb-2 flex items-center">
|
| 474 |
+
<i class="fas fa-user mr-2"></i> Tu jugador
|
| 475 |
+
</h3>
|
| 476 |
+
<div class="flex items-center mb-3">
|
| 477 |
+
<div id="current-player-color" class="w-5 h-5 rounded-full mr-2"></div>
|
| 478 |
+
<span id="current-player-name" class="font-medium">Jugador 1</span>
|
| 479 |
+
</div>
|
| 480 |
+
<div class="grid grid-cols-2 gap-2">
|
| 481 |
+
<div class="bg-gray-100 p-2 rounded-lg">
|
| 482 |
+
<p class="text-xs text-gray-500">Fichas en juego</p>
|
| 483 |
+
<p id="pieces-in-play" class="font-bold">2</p>
|
| 484 |
+
</div>
|
| 485 |
+
<div class="bg-gray-100 p-2 rounded-lg">
|
| 486 |
+
<p class="text-xs text-gray-500">Fichas en meta</p>
|
| 487 |
+
<p id="pieces-in-home" class="font-bold">0</p>
|
| 488 |
+
</div>
|
| 489 |
+
</div>
|
| 490 |
+
</div>
|
| 491 |
+
|
| 492 |
+
<!-- Historial de dados -->
|
| 493 |
+
<div class="bg-white rounded-xl shadow-md p-4">
|
| 494 |
+
<h3 class="font-bold text-lg mb-3 flex items-center">
|
| 495 |
+
<i class="fas fa-history mr-2"></i> Historial
|
| 496 |
+
</h3>
|
| 497 |
+
<div id="dice-history" class="space-y-2 max-h-40 overflow-y-auto">
|
| 498 |
+
<!-- Los resultados de dados se agregarán aquí -->
|
| 499 |
+
</div>
|
| 500 |
+
</div>
|
| 501 |
+
|
| 502 |
+
<!-- Lista de jugadores -->
|
| 503 |
+
<div class="bg-white rounded-xl shadow-md p-4">
|
| 504 |
+
<h3 class="font-bold text-lg mb-3 flex items-center">
|
| 505 |
+
<i class="fas fa-users mr-2"></i> Jugadores
|
| 506 |
+
</h3>
|
| 507 |
+
<ul id="players-game-list" class="space-y-2">
|
| 508 |
+
<!-- Los jugadores se listarán aquí -->
|
| 509 |
+
</ul>
|
| 510 |
+
</div>
|
| 511 |
+
|
| 512 |
+
<!-- Chat (opcional) -->
|
| 513 |
+
<div class="bg-white rounded-xl shadow-md p-4 hidden">
|
| 514 |
+
<h3 class="font-bold text-lg mb-3 flex items-center">
|
| 515 |
+
<i class="fas fa-comments mr-2"></i> Chat
|
| 516 |
+
</h3>
|
| 517 |
+
<div class="bg-gray-50 rounded-lg p-2 h-32 overflow-y-auto mb-2">
|
| 518 |
+
<!-- Mensajes de chat -->
|
| 519 |
+
</div>
|
| 520 |
+
<div class="flex">
|
| 521 |
+
<input type="text" placeholder="Escribe un mensaje..." class="flex-1 border border-gray-300 rounded-l-lg px-3 py-2 focus:outline-none">
|
| 522 |
+
<button class="bg-blue-600 text-white px-4 rounded-r-lg">
|
| 523 |
+
<i class="fas fa-paper-plane"></i>
|
| 524 |
+
</button>
|
| 525 |
+
</div>
|
| 526 |
+
</div>
|
| 527 |
+
</div>
|
| 528 |
+
</div>
|
| 529 |
+
</div>
|
| 530 |
+
</div>
|
| 531 |
+
|
| 532 |
+
<!-- Modal de menú -->
|
| 533 |
+
<div id="menu-modal" class="modal-overlay hidden">
|
| 534 |
+
<div class="modal-content w-full max-w-md bg-white p-6">
|
| 535 |
+
<div class="flex justify-between items-center mb-6">
|
| 536 |
+
<h3 class="text-2xl font-bold text-gray-800">Menú del juego</h3>
|
| 537 |
+
<button id="close-menu-modal" class="text-gray-500 hover:text-gray-700">
|
| 538 |
+
<i class="fas fa-times"></i>
|
| 539 |
+
</button>
|
| 540 |
+
</div>
|
| 541 |
+
|
| 542 |
+
<div class="space-y-4">
|
| 543 |
+
<button class="w-full flex items-center justify-between p-3 bg-gray-100 hover:bg-gray-200 rounded-lg transition-all">
|
| 544 |
+
<span class="flex items-center">
|
| 545 |
+
<i class="fas fa-book mr-3 text-blue-600"></i>
|
| 546 |
+
<span>Reglas del juego</span>
|
| 547 |
+
</span>
|
| 548 |
+
<i class="fas fa-chevron-right text-gray-400"></i>
|
| 549 |
+
</button>
|
| 550 |
+
|
| 551 |
+
<button class="w-full flex items-center justify-between p-3 bg-gray-100 hover:bg-gray-200 rounded-lg transition-all">
|
| 552 |
+
<span class="flex items-center">
|
| 553 |
+
<i class="fas fa-cog mr-3 text-purple-600"></i>
|
| 554 |
+
<span>Ajustes</span>
|
| 555 |
+
</span>
|
| 556 |
+
<i class="fas fa-chevron-right text-gray-400"></i>
|
| 557 |
+
</button>
|
| 558 |
+
|
| 559 |
+
<button class="w-full flex items-center justify-between p-3 bg-gray-100 hover:bg-gray-200 rounded-lg transition-all">
|
| 560 |
+
<span class="flex items-center">
|
| 561 |
+
<i class="fas fa-users mr-3 text-green-600"></i>
|
| 562 |
+
<span>Invitar jugadores</span>
|
| 563 |
+
</span>
|
| 564 |
+
<i class="fas fa-chevron-right text-gray-400"></i>
|
| 565 |
+
</button>
|
| 566 |
+
|
| 567 |
+
<button id="exit-game-btn" class="w-full flex items-center justify-between p-3 bg-red-100 hover:bg-red-200 text-red-700 rounded-lg transition-all mt-6">
|
| 568 |
+
<span class="flex items-center">
|
| 569 |
+
<i class="fas fa-sign-out-alt mr-3"></i>
|
| 570 |
+
<span>Salir del juego</span>
|
| 571 |
+
</span>
|
| 572 |
+
</button>
|
| 573 |
+
</div>
|
| 574 |
+
</div>
|
| 575 |
+
</div>
|
| 576 |
+
|
| 577 |
+
<!-- Modal de ganador -->
|
| 578 |
+
<div id="winner-modal" class="modal-overlay hidden">
|
| 579 |
+
<div class="modal-content w-full max-w-md bg-white p-8 text-center">
|
| 580 |
+
<div class="mb-6">
|
| 581 |
+
<div class="text-6xl mb-4">🏆</div>
|
| 582 |
+
<h3 class="text-3xl font-bold text-gray-800 mb-2">¡Felicidades!</h3>
|
| 583 |
+
<p id="winner-name" class="text-xl text-gray-600">Jugador Rojo ha ganado</p>
|
| 584 |
+
</div>
|
| 585 |
+
|
| 586 |
+
<div class="bg-gray-100 rounded-lg p-4 mb-6">
|
| 587 |
+
<h4 class="font-medium text-gray-700 mb-2">Resumen de la partida</h4>
|
| 588 |
+
<div class="grid grid-cols-3 gap-2 text-sm">
|
| 589 |
+
<div class="bg-white p-2 rounded">
|
| 590 |
+
<p class="text-gray-500">Duración</p>
|
| 591 |
+
<p class="font-medium">12 min</p>
|
| 592 |
+
</div>
|
| 593 |
+
<div class="bg-white p-2 rounded">
|
| 594 |
+
<p class="text-gray-500">Turnos</p>
|
| 595 |
+
<p class="font-medium">24</p>
|
| 596 |
+
</div>
|
| 597 |
+
<div class="bg-white p-2 rounded">
|
| 598 |
+
<p class="text-gray-500">Dificultad</p>
|
| 599 |
+
<p class="font-medium">Media</p>
|
| 600 |
+
</div>
|
| 601 |
+
</div>
|
| 602 |
+
</div>
|
| 603 |
+
|
| 604 |
+
<div class="flex space-x-4">
|
| 605 |
+
<button id="rematch-btn" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition-all">
|
| 606 |
+
<i class="fas fa-redo mr-2"></i> Revancha
|
| 607 |
+
</button>
|
| 608 |
+
<button id="new-game-btn" class="flex-1 bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition-all">
|
| 609 |
+
<i class="fas fa-plus mr-2"></i> Nueva partida
|
| 610 |
+
</button>
|
| 611 |
+
</div>
|
| 612 |
+
</div>
|
| 613 |
+
</div>
|
| 614 |
+
|
| 615 |
+
<script>
|
| 616 |
+
// Variables del juego
|
| 617 |
+
let gameState = {
|
| 618 |
+
players: [],
|
| 619 |
+
currentPlayerIndex: 0,
|
| 620 |
+
diceValue: 0,
|
| 621 |
+
boardType: 4,
|
| 622 |
+
difficulty: 'medium',
|
| 623 |
+
gameStarted: false,
|
| 624 |
+
gameCode: '',
|
| 625 |
+
pieces: [],
|
| 626 |
+
paths: {},
|
| 627 |
+
safeSpots: [],
|
| 628 |
+
playerColors: ['red', 'blue', 'green', 'yellow', 'purple', 'orange'],
|
| 629 |
+
colorNames: {
|
| 630 |
+
red: 'Rojo',
|
| 631 |
+
blue: 'Azul',
|
| 632 |
+
green: 'Verde',
|
| 633 |
+
yellow: 'Amarillo',
|
| 634 |
+
purple: 'Morado',
|
| 635 |
+
orange: 'Naranja'
|
| 636 |
+
},
|
| 637 |
+
gameHistory: [],
|
| 638 |
+
playerName: '',
|
| 639 |
+
playerColor: 'red'
|
| 640 |
+
};
|
| 641 |
+
|
| 642 |
+
// Elementos del DOM
|
| 643 |
+
const elements = {
|
| 644 |
+
startScreen: document.getElementById('start-screen'),
|
| 645 |
+
gameScreen: document.getElementById('game-screen'),
|
| 646 |
+
createGameModal: document.getElementById('create-game-modal'),
|
| 647 |
+
inviteModal: document.getElementById('invite-modal'),
|
| 648 |
+
joinGameModal: document.getElementById('join-game-modal'),
|
| 649 |
+
rulesModal: document.getElementById('rules-modal'),
|
| 650 |
+
menuModal: document.getElementById('menu-modal'),
|
| 651 |
+
winnerModal: document.getElementById('winner-modal'),
|
| 652 |
+
gameBoard: document.getElementById('game-board'),
|
| 653 |
+
playerName: document.getElementById('player-name'),
|
| 654 |
+
joinPlayerName: document.getElementById('join-player-name'),
|
| 655 |
+
joinGameCode: document.getElementById('join-game-code'),
|
| 656 |
+
gameCode: document.getElementById('game-code'),
|
| 657 |
+
gameLink: document.getElementById('game-link'),
|
| 658 |
+
playersList: document.getElementById('players-list'),
|
| 659 |
+
playersGameList: document.getElementById('players-game-list'),
|
| 660 |
+
diceHistory: document.getElementById('dice-history'),
|
| 661 |
+
currentPlayerName: document.getElementById('current-player-name'),
|
| 662 |
+
currentPlayerColor: document.getElementById('current-player-color'),
|
| 663 |
+
piecesInPlay: document.getElementById('pieces-in-play'),
|
| 664 |
+
piecesInHome: document.getElementById('pieces-in-home'),
|
| 665 |
+
turnIndicator: document.getElementById('turn-indicator'),
|
| 666 |
+
diceBtn: document.getElementById('dice-btn')
|
| 667 |
+
};
|
| 668 |
+
|
| 669 |
+
// Inicialización del juego
|
| 670 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 671 |
+
// Generar código de juego aleatorio
|
| 672 |
+
gameState.gameCode = generateGameCode();
|
| 673 |
+
elements.gameCode.textContent = gameState.gameCode;
|
| 674 |
+
elements.gameLink.value = `${window.location.href}?game=${gameState.gameCode}`;
|
| 675 |
+
|
| 676 |
+
// Event listeners para botones
|
| 677 |
+
document.getElementById('create-game-btn').addEventListener('click', showCreateGameModal);
|
| 678 |
+
document.getElementById('join-game-btn').addEventListener('click', showJoinGameModal);
|
| 679 |
+
document.getElementById('rules-btn').addEventListener('click', showRulesModal);
|
| 680 |
+
document.getElementById('close-create-modal').addEventListener('click', hideCreateGameModal);
|
| 681 |
+
document.getElementById('close-invite-modal').addEventListener('click', hideInviteModal);
|
| 682 |
+
document.getElementById('close-join-modal').addEventListener('click', hideJoinGameModal);
|
| 683 |
+
document.getElementById('close-rules-modal').addEventListener('click', hideRulesModal);
|
| 684 |
+
document.getElementById('close-rules-btn').addEventListener('click', hideRulesModal);
|
| 685 |
+
document.getElementById('start-game-btn').addEventListener('click', startGameCreation);
|
| 686 |
+
document.getElementById('begin-game-btn').addEventListener('click', beginGame);
|
| 687 |
+
document.getElementById('confirm-join-btn').addEventListener('click', joinGame);
|
| 688 |
+
document.getElementById('copy-code').addEventListener('click', copyGameCode);
|
| 689 |
+
document.getElementById('copy-link').addEventListener('click', copyGameLink);
|
| 690 |
+
document.getElementById('menu-btn').addEventListener('click', showMenuModal);
|
| 691 |
+
document.getElementById('close-menu-modal').addEventListener('click', hideMenuModal);
|
| 692 |
+
document.getElementById('exit-game-btn').addEventListener('click', exitGame);
|
| 693 |
+
document.getElementById('rematch-btn').addEventListener('click', startRematch);
|
| 694 |
+
document.getElementById('new-game-btn').addEventListener('click', newGame);
|
| 695 |
+
elements.diceBtn.addEventListener('click', rollDice);
|
| 696 |
+
|
| 697 |
+
// Selectores de color
|
| 698 |
+
document.querySelectorAll('.player-color-selector').forEach(selector => {
|
| 699 |
+
selector.addEventListener('click', function() {
|
| 700 |
+
document.querySelector('.player-color-selector.selected')?.classList.remove('selected');
|
| 701 |
+
this.classList.add('selected');
|
| 702 |
+
gameState.playerColor = this.dataset.color;
|
| 703 |
+
});
|
| 704 |
+
});
|
| 705 |
+
|
| 706 |
+
// Verificar si hay un código de juego en la URL
|
| 707 |
+
const urlParams = new URLSearchParams(window.location.search);
|
| 708 |
+
const gameCodeParam = urlParams.get('game');
|
| 709 |
+
if (gameCodeParam) {
|
| 710 |
+
showJoinGameModal();
|
| 711 |
+
document.getElementById('join-game-code').value = gameCodeParam.toUpperCase();
|
| 712 |
+
}
|
| 713 |
+
});
|
| 714 |
+
|
| 715 |
+
// Funciones del juego
|
| 716 |
+
function generateGameCode() {
|
| 717 |
+
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
| 718 |
+
let result = '';
|
| 719 |
+
for (let i = 0; i < 6; i++) {
|
| 720 |
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
| 721 |
+
}
|
| 722 |
+
return result;
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
function showCreateGameModal() {
|
| 726 |
+
elements.createGameModal.classList.remove('hidden');
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
function hideCreateGameModal() {
|
| 730 |
+
elements.createGameModal.classList.add('hidden');
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
function showInviteModal() {
|
| 734 |
+
elements.inviteModal.classList.remove('hidden');
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
function hideInviteModal() {
|
| 738 |
+
elements.inviteModal.classList.add('hidden');
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
function showJoinGameModal() {
|
| 742 |
+
elements.joinGameModal.classList.remove('hidden');
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
function hideJoinGameModal() {
|
| 746 |
+
elements.joinGameModal.classList.add('hidden');
|
| 747 |
+
}
|
| 748 |
+
|
| 749 |
+
function showRulesModal() {
|
| 750 |
+
elements.rulesModal.classList.remove('hidden');
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
function hideRulesModal() {
|
| 754 |
+
elements.rulesModal.classList.add('hidden');
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
function showMenuModal() {
|
| 758 |
+
elements.menuModal.classList.remove('hidden');
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
function hideMenuModal() {
|
| 762 |
+
elements.menuModal.classList.add('hidden');
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
function showWinnerModal(winnerName) {
|
| 766 |
+
document.getElementById('winner-name').textContent = winnerName;
|
| 767 |
+
elements.winnerModal.classList.remove('hidden');
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
function hideWinnerModal() {
|
| 771 |
+
elements.winnerModal.classList.add('hidden');
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
function copyGameCode() {
|
| 775 |
+
navigator.clipboard.writeText(gameState.gameCode);
|
| 776 |
+
showToast('Código copiado al portapapeles');
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
function copyGameLink() {
|
| 780 |
+
navigator.clipboard.writeText(elements.gameLink.value);
|
| 781 |
+
showToast('Enlace copiado al portapapeles');
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
function showToast(message) {
|
| 785 |
+
const toast = document.createElement('div');
|
| 786 |
+
toast.className = 'fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-gray-800 text-white px-4 py-2 rounded-lg shadow-lg z-50 animate-fade-in-out';
|
| 787 |
+
toast.textContent = message;
|
| 788 |
+
document.body.appendChild(toast);
|
| 789 |
+
|
| 790 |
+
setTimeout(() => {
|
| 791 |
+
toast.remove();
|
| 792 |
+
}, 3000);
|
| 793 |
+
}
|
| 794 |
+
|
| 795 |
+
function startGameCreation() {
|
| 796 |
+
const playerName = elements.playerName.value.trim();
|
| 797 |
+
if (!playerName) {
|
| 798 |
+
showToast('Por favor ingresa tu nombre');
|
| 799 |
+
return;
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
gameState.playerName = playerName;
|
| 803 |
+
gameState.boardType = parseInt(document.querySelector('input[name="board-type"]:checked').value);
|
| 804 |
+
gameState.difficulty = document.getElementById('game-difficulty').value;
|
| 805 |
+
|
| 806 |
+
// Crear jugador local
|
| 807 |
+
const player = {
|
| 808 |
+
id: 'player-' + Date.now(),
|
| 809 |
+
name: playerName,
|
| 810 |
+
color: gameState.playerColor,
|
| 811 |
+
pieces: [],
|
| 812 |
+
isLocal: true,
|
| 813 |
+
isHost: true
|
| 814 |
+
};
|
| 815 |
+
|
| 816 |
+
gameState.players.push(player);
|
| 817 |
+
updatePlayersList();
|
| 818 |
+
|
| 819 |
+
hideCreateGameModal();
|
| 820 |
+
showInviteModal();
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
function updatePlayersList() {
|
| 824 |
+
elements.playersList.innerHTML = '';
|
| 825 |
+
elements.playersGameList.innerHTML = '';
|
| 826 |
+
|
| 827 |
+
gameState.players.forEach(player => {
|
| 828 |
+
// Para el modal de invitación
|
| 829 |
+
const playerItem = document.createElement('li');
|
| 830 |
+
playerItem.className = 'flex items-center';
|
| 831 |
+
playerItem.innerHTML = `
|
| 832 |
+
<div class="w-4 h-4 rounded-full bg-${player.color}-500 mr-2"></div>
|
| 833 |
+
<span>${player.name} ${player.isHost ? '(Anfitrión)' : ''}</span>
|
| 834 |
+
`;
|
| 835 |
+
elements.playersList.appendChild(playerItem);
|
| 836 |
+
|
| 837 |
+
// Para el panel de jugadores en el juego
|
| 838 |
+
const gamePlayerItem = document.createElement('li');
|
| 839 |
+
gamePlayerItem.className = 'flex items-center justify-between p-2 bg-gray-50 rounded-lg';
|
| 840 |
+
gamePlayerItem.innerHTML = `
|
| 841 |
+
<div class="flex items-center">
|
| 842 |
+
<div class="w-4 h-4 rounded-full bg-${player.color}-500 mr-2"></div>
|
| 843 |
+
<span class="font-medium">${player.name}</span>
|
| 844 |
+
</div>
|
| 845 |
+
<div class="text-sm text-gray-500">0/4</div>
|
| 846 |
+
`;
|
| 847 |
+
elements.playersGameList.appendChild(gamePlayerItem);
|
| 848 |
+
});
|
| 849 |
+
|
| 850 |
+
// Habilitar botón de comenzar si hay al menos 2 jugadores
|
| 851 |
+
document.getElementById('begin-game-btn').disabled = gameState.players.length < 2;
|
| 852 |
+
}
|
| 853 |
+
|
| 854 |
+
function beginGame() {
|
| 855 |
+
initializeGame();
|
| 856 |
+
hideInviteModal();
|
| 857 |
+
elements.startScreen.classList.add('hidden');
|
| 858 |
+
elements.gameScreen.classList.remove('hidden');
|
| 859 |
+
}
|
| 860 |
+
|
| 861 |
+
function joinGame() {
|
| 862 |
+
const playerName = elements.joinPlayerName.value.trim();
|
| 863 |
+
const gameCode = elements.joinGameCode.value.trim().toUpperCase();
|
| 864 |
+
|
| 865 |
+
if (!playerName) {
|
| 866 |
+
showToast('Por favor ingresa tu nombre');
|
| 867 |
+
return;
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
if (!gameCode || gameCode.length !== 6) {
|
| 871 |
+
showToast('Por favor ingresa un código de juego válido');
|
| 872 |
+
return;
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
// Simular unirse a una partida existente
|
| 876 |
+
gameState.playerName = playerName;
|
| 877 |
+
gameState.gameCode = gameCode;
|
| 878 |
+
|
| 879 |
+
// Crear jugador local (no anfitrión)
|
| 880 |
+
const player = {
|
| 881 |
+
id: 'player-' + Date.now(),
|
| 882 |
+
name: playerName,
|
| 883 |
+
color: gameState.playerColor,
|
| 884 |
+
pieces: [],
|
| 885 |
+
isLocal: true,
|
| 886 |
+
isHost: false
|
| 887 |
+
};
|
| 888 |
+
|
| 889 |
+
// Simular que ya hay un anfitrión
|
| 890 |
+
const hostPlayer = {
|
| 891 |
+
id: 'player-host',
|
| 892 |
+
name: 'Anfitrión',
|
| 893 |
+
color: 'red',
|
| 894 |
+
pieces: [],
|
| 895 |
+
isLocal: false,
|
| 896 |
+
isHost: true
|
| 897 |
+
};
|
| 898 |
+
|
| 899 |
+
gameState.players = [hostPlayer, player];
|
| 900 |
+
gameState.boardType = 4; // Asumir tablero de 4 jugadores
|
| 901 |
+
|
| 902 |
+
updatePlayersList();
|
| 903 |
+
|
| 904 |
+
hideJoinGameModal();
|
| 905 |
+
elements.startScreen.classList.add('hidden');
|
| 906 |
+
elements.gameScreen.classList.remove('hidden');
|
| 907 |
+
|
| 908 |
+
// Simular que el anfitrión comienza el juego después de unirse
|
| 909 |
+
setTimeout(() => {
|
| 910 |
+
initializeGame();
|
| 911 |
+
}, 1000);
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
function initializeGame() {
|
| 915 |
+
gameState.gameStarted = true;
|
| 916 |
+
gameState.currentPlayerIndex = 0;
|
| 917 |
+
|
| 918 |
+
// Configurar el tablero según el tipo
|
| 919 |
+
elements.gameBoard.className = `relative w-full max-w-2xl aspect-square board-${gameState.boardType}`;
|
| 920 |
+
|
| 921 |
+
// Crear las rutas del tablero
|
| 922 |
+
createBoardPaths();
|
| 923 |
+
|
| 924 |
+
// Inicializar fichas para cada jugador
|
| 925 |
+
initializePieces();
|
| 926 |
+
|
| 927 |
+
// Actualizar la interfaz del jugador actual
|
| 928 |
+
updateCurrentPlayerUI();
|
| 929 |
+
|
| 930 |
+
// Mostrar mensaje de inicio
|
| 931 |
+
showToast(`¡Comienza la partida! Es el turno de ${gameState.players[0].name}`);
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
function createBoardPaths() {
|
| 935 |
+
// Esto es una simplificación - en un juego real necesitarías coordenadas precisas
|
| 936 |
+
gameState.paths = {};
|
| 937 |
+
gameState.safeSpots = [];
|
| 938 |
+
|
| 939 |
+
// Crear rutas básicas para el tablero de 4 jugadores
|
| 940 |
+
if (gameState.boardType === 4) {
|
| 941 |
+
// 68 casillas estándar en el parchís de 4 jugadores
|
| 942 |
+
for (let i = 0; i < 68; i++) {
|
| 943 |
+
gameState.paths[`path-${i}`] = {
|
| 944 |
+
id: `path-${i}`,
|
| 945 |
+
position: i,
|
| 946 |
+
pieces: []
|
| 947 |
+
};
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
// 5 casillas seguras por jugador (incluyendo la de salida)
|
| 951 |
+
for (let i = 0; i < 4; i++) {
|
| 952 |
+
for (let j = 0; j < 5; j++) {
|
| 953 |
+
gameState.safeSpots.push(`safe-${i}-${j}`);
|
| 954 |
+
}
|
| 955 |
+
}
|
| 956 |
+
} else {
|
| 957 |
+
// Tablero de 6 jugadores con más casillas
|
| 958 |
+
for (let i = 0; i < 96; i++) {
|
| 959 |
+
gameState.paths[`path-${i}`] = {
|
| 960 |
+
id: `path-${i}`,
|
| 961 |
+
position: i,
|
| 962 |
+
pieces: []
|
| 963 |
+
};
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
// 5 casillas seguras por jugador
|
| 967 |
+
for (let i = 0; i < 6; i++) {
|
| 968 |
+
for (let j = 0; j < 5; j++) {
|
| 969 |
+
gameState.safeSpots.push(`safe-${i}-${j}`);
|
| 970 |
+
}
|
| 971 |
+
}
|
| 972 |
+
}
|
| 973 |
+
|
| 974 |
+
// Renderizar el tablero
|
| 975 |
+
renderBoard();
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
function renderBoard() {
|
| 979 |
+
elements.gameBoard.innerHTML = '';
|
| 980 |
+
|
| 981 |
+
// Esto es una representación simplificada del tablero
|
| 982 |
+
// En una implementación real, necesitarías posicionar cada celda con precisión
|
| 983 |
+
|
| 984 |
+
// Bases de inicio
|
| 985 |
+
gameState.players.forEach((player, index) => {
|
| 986 |
+
const base = document.createElement('div');
|
| 987 |
+
base.className = `absolute home-base bg-${player.color}-100 border-4 border-${player.color}-500`;
|
| 988 |
+
base.style.width = '80px';
|
| 989 |
+
base.style.height = '80px';
|
| 990 |
+
|
| 991 |
+
// Posicionar las bases según el número de jugadores
|
| 992 |
+
if (gameState.boardType === 4) {
|
| 993 |
+
if (index === 0) {
|
| 994 |
+
base.style.top = '10%';
|
| 995 |
+
base.style.left = '10%';
|
| 996 |
+
} else if (index === 1) {
|
| 997 |
+
base.style.top = '10%';
|
| 998 |
+
base.style.right = '10%';
|
| 999 |
+
} else if (index === 2) {
|
| 1000 |
+
base.style.bottom = '10%';
|
| 1001 |
+
base.style.right = '10%';
|
| 1002 |
+
} else {
|
| 1003 |
+
base.style.bottom = '10%';
|
| 1004 |
+
base.style.left = '10%';
|
| 1005 |
+
}
|
| 1006 |
+
} else {
|
| 1007 |
+
// Posicionamiento para 6 jugadores
|
| 1008 |
+
const angle = (index * 60) - 90; // -90 para empezar desde arriba
|
| 1009 |
+
const radius = 35;
|
| 1010 |
+
const centerX = 50;
|
| 1011 |
+
const centerY = 50;
|
| 1012 |
+
|
| 1013 |
+
const x = centerX + radius * Math.cos(angle * Math.PI / 180);
|
| 1014 |
+
const y = centerY + radius * Math.sin(angle * Math.PI / 180);
|
| 1015 |
+
|
| 1016 |
+
base.style.left = `${x}%`;
|
| 1017 |
+
base.style.top = `${y}%`;
|
| 1018 |
+
base.style.transform = 'translate(-50%, -50%)';
|
| 1019 |
+
}
|
| 1020 |
+
|
| 1021 |
+
elements.gameBoard.appendChild(base);
|
| 1022 |
+
});
|
| 1023 |
+
|
| 1024 |
+
// Casillas del camino
|
| 1025 |
+
Object.values(gameState.paths).forEach(path => {
|
| 1026 |
+
const cell = document.createElement('div');
|
| 1027 |
+
cell.className = 'absolute path-cell';
|
| 1028 |
+
cell.id = path.id;
|
| 1029 |
+
cell.dataset.position = path.position;
|
| 1030 |
+
|
| 1031 |
+
// Posicionamiento simplificado - en realidad necesitarías calcular la posición exacta
|
| 1032 |
+
cell.style.width = '20px';
|
| 1033 |
+
cell.style.height = '20px';
|
| 1034 |
+
cell.style.backgroundColor = '#f0f0f0';
|
| 1035 |
+
cell.style.borderRadius = '50%';
|
| 1036 |
+
cell.style.border = '1px solid #ddd';
|
| 1037 |
+
|
| 1038 |
+
// Posicionar en un círculo alrededor del tablero
|
| 1039 |
+
const totalCells = gameState.boardType === 4 ? 68 : 96;
|
| 1040 |
+
const angle = (path.position / totalCells) * 2 * Math.PI;
|
| 1041 |
+
const radius = 40;
|
| 1042 |
+
const centerX = 50;
|
| 1043 |
+
const centerY = 50;
|
| 1044 |
+
|
| 1045 |
+
const x = centerX + radius * Math.cos(angle);
|
| 1046 |
+
const y = centerY + radius * Math.sin(angle);
|
| 1047 |
+
|
| 1048 |
+
cell.style.left = `${x}%`;
|
| 1049 |
+
cell.style.top = `${y}%`;
|
| 1050 |
+
cell.style.transform = 'translate(-50%, -50%)';
|
| 1051 |
+
|
| 1052 |
+
elements.gameBoard.appendChild(cell);
|
| 1053 |
+
});
|
| 1054 |
+
|
| 1055 |
+
// Casillas seguras (simplificado)
|
| 1056 |
+
gameState.safeSpots.forEach(spot => {
|
| 1057 |
+
const safeCell = document.createElement('div');
|
| 1058 |
+
safeCell.className = 'absolute safe-spot';
|
| 1059 |
+
safeCell.id = spot;
|
| 1060 |
+
safeCell.style.width = '25px';
|
| 1061 |
+
safeCell.style.height = '25px';
|
| 1062 |
+
safeCell.style.backgroundColor = 'rgba(255, 255, 255, 0.7)';
|
| 1063 |
+
safeCell.style.borderRadius = '50%';
|
| 1064 |
+
|
| 1065 |
+
// Posicionamiento simplificado
|
| 1066 |
+
const parts = spot.split('-');
|
| 1067 |
+
const playerIndex = parseInt(parts[1]);
|
| 1068 |
+
const spotIndex = parseInt(parts[2]);
|
| 1069 |
+
|
| 1070 |
+
if (gameState.boardType === 4) {
|
| 1071 |
+
if (playerIndex === 0) {
|
| 1072 |
+
safeCell.style.left = `${20 + spotIndex * 5}%`;
|
| 1073 |
+
safeCell.style.top = '30%';
|
| 1074 |
+
} else if (playerIndex === 1) {
|
| 1075 |
+
safeCell.style.right = `${20 + spotIndex * 5}%`;
|
| 1076 |
+
safeCell.style.top = '30%';
|
| 1077 |
+
} else if (playerIndex === 2) {
|
| 1078 |
+
safeCell.style.right = `${20 + spotIndex * 5}%`;
|
| 1079 |
+
safeCell.style.bottom = '30%';
|
| 1080 |
+
} else {
|
| 1081 |
+
safeCell.style.left = `${20 + spotIndex * 5}%`;
|
| 1082 |
+
safeCell.style.bottom = '30%';
|
| 1083 |
+
}
|
| 1084 |
+
} else {
|
| 1085 |
+
// Posicionamiento para 6 jugadores
|
| 1086 |
+
const angle = (playerIndex * 60) - 90; // -90 para empezar desde arriba
|
| 1087 |
+
const radius = 30 + spotIndex * 5;
|
| 1088 |
+
const centerX = 50;
|
| 1089 |
+
const centerY = 50;
|
| 1090 |
+
|
| 1091 |
+
const x = centerX + radius * Math.cos(angle * Math.PI / 180);
|
| 1092 |
+
const y = centerY + radius * Math.sin(angle * Math.PI / 180);
|
| 1093 |
+
|
| 1094 |
+
safeCell.style.left = `${x}%`;
|
| 1095 |
+
safeCell.style.top = `${y}%`;
|
| 1096 |
+
safeCell.style.transform = 'translate(-50%, -50%)';
|
| 1097 |
+
}
|
| 1098 |
+
|
| 1099 |
+
elements.gameBoard.appendChild(safeCell);
|
| 1100 |
+
});
|
| 1101 |
+
|
| 1102 |
+
// Zona central (meta)
|
| 1103 |
+
const center = document.createElement('div');
|
| 1104 |
+
center.className = 'absolute home-base bg-white';
|
| 1105 |
+
center.style.width = '100px';
|
| 1106 |
+
center.style.height = '100px';
|
| 1107 |
+
center.style.left = '50%';
|
| 1108 |
+
center.style.top = '50%';
|
| 1109 |
+
center.style.transform = 'translate(-50%, -50%)';
|
| 1110 |
+
center.style.boxShadow = 'inset 0 0 15px rgba(0,0,0,0.2)';
|
| 1111 |
+
elements.gameBoard.appendChild(center);
|
| 1112 |
+
}
|
| 1113 |
+
|
| 1114 |
+
function initializePieces() {
|
| 1115 |
+
gameState.pieces = [];
|
| 1116 |
+
|
| 1117 |
+
gameState.players.forEach(player => {
|
| 1118 |
+
for (let i = 0; i < 4; i++) {
|
| 1119 |
+
const piece = {
|
| 1120 |
+
id: `piece-${player.id}-${i}`,
|
| 1121 |
+
playerId: player.id,
|
| 1122 |
+
color: player.color,
|
| 1123 |
+
position: 'home', // 'home', 'path-X', 'safe-X-Y', 'final'
|
| 1124 |
+
pathPosition: null,
|
| 1125 |
+
number: i + 1
|
| 1126 |
+
};
|
| 1127 |
+
|
| 1128 |
+
gameState.pieces.push(piece);
|
| 1129 |
+
player.pieces.push(piece);
|
| 1130 |
+
|
| 1131 |
+
// Renderizar la ficha
|
| 1132 |
+
renderPiece(piece);
|
| 1133 |
+
}
|
| 1134 |
+
});
|
| 1135 |
+
}
|
| 1136 |
+
|
| 1137 |
+
function renderPiece(piece) {
|
| 1138 |
+
// Eliminar cualquier representación previa de la ficha
|
| 1139 |
+
const existingPiece = document.getElementById(`piece-${piece.id}`);
|
| 1140 |
+
if (existingPiece) existingPiece.remove();
|
| 1141 |
+
|
| 1142 |
+
const pieceElement = document.createElement('div');
|
| 1143 |
+
pieceElement.id = `piece-${piece.id}`;
|
| 1144 |
+
pieceElement.className = `absolute piece bg-${piece.color}-500`;
|
| 1145 |
+
pieceElement.textContent = piece.number;
|
| 1146 |
+
pieceElement.dataset.pieceId = piece.id;
|
| 1147 |
+
|
| 1148 |
+
// Posicionar la ficha según su estado actual
|
| 1149 |
+
if (piece.position === 'home') {
|
| 1150 |
+
const player = gameState.players.find(p => p.id === piece.playerId);
|
| 1151 |
+
const playerIndex = gameState.players.indexOf(player);
|
| 1152 |
+
|
| 1153 |
+
// Encontrar la base del jugador
|
| 1154 |
+
const base = document.querySelectorAll('.home-base')[playerIndex];
|
| 1155 |
+
const baseRect = base.getBoundingClientRect();
|
| 1156 |
+
const boardRect = elements.gameBoard.getBoundingClientRect();
|
| 1157 |
+
|
| 1158 |
+
// Calcular posición relativa dentro de la base
|
| 1159 |
+
const offsetX = (piece.number % 2 === 0) ? 15 : -15;
|
| 1160 |
+
const offsetY = (piece.number > 2) ? 15 : -15;
|
| 1161 |
+
|
| 1162 |
+
pieceElement.style.left = `${((baseRect.left - boardRect.left) / boardRect.width * 100) + offsetX}%`;
|
| 1163 |
+
pieceElement.style.top = `${((baseRect.top - boardRect.top) / boardRect.height * 100) + offsetY}%`;
|
| 1164 |
+
} else if (piece.position.startsWith('path')) {
|
| 1165 |
+
const pathId = piece.position;
|
| 1166 |
+
const pathElement = document.getElementById(pathId);
|
| 1167 |
+
if (pathElement) {
|
| 1168 |
+
const pathRect = pathElement.getBoundingClientRect();
|
| 1169 |
+
const boardRect = elements.gameBoard.getBoundingClientRect();
|
| 1170 |
+
|
| 1171 |
+
pieceElement.style.left = `${(pathRect.left - boardRect.left + pathRect.width / 2) / boardRect.width * 100}%`;
|
| 1172 |
+
pieceElement.style.top = `${(pathRect.top - boardRect.top + pathRect.height / 2) / boardRect.height * 100}%`;
|
| 1173 |
+
}
|
| 1174 |
+
} else if (piece.position.startsWith('safe')) {
|
| 1175 |
+
const safeSpotId = piece.position;
|
| 1176 |
+
const safeSpotElement = document.getElementById(safeSpotId);
|
| 1177 |
+
if (safeSpotElement) {
|
| 1178 |
+
const safeRect = safeSpotElement.getBoundingClientRect();
|
| 1179 |
+
const boardRect = elements.gameBoard.getBoundingClientRect();
|
| 1180 |
+
|
| 1181 |
+
pieceElement.style.left = `${(safeRect.left - boardRect.left + safeRect.width / 2) / boardRect.width * 100}%`;
|
| 1182 |
+
pieceElement.style.top = `${(safeRect.top - boardRect.top + safeRect.height / 2) / boardRect.height * 100}%`;
|
| 1183 |
+
}
|
| 1184 |
+
} else if (piece.position === 'final') {
|
| 1185 |
+
// Posicionar en la zona central
|
| 1186 |
+
pieceElement.style.left = '50%';
|
| 1187 |
+
pieceElement.style.top = '50%';
|
| 1188 |
+
pieceElement.style.transform = 'translate(-50%, -50%)';
|
| 1189 |
+
|
| 1190 |
+
// Agregar corona si es la última ficha
|
| 1191 |
+
if (piece.number === 4) {
|
| 1192 |
+
const crown = document.createElement('div');
|
| 1193 |
+
crown.className = 'winner-crown';
|
| 1194 |
+
crown.innerHTML = '👑';
|
| 1195 |
+
pieceElement.appendChild(crown);
|
| 1196 |
+
}
|
| 1197 |
+
}
|
| 1198 |
+
|
| 1199 |
+
// Agregar evento de clic si es la ficha del jugador actual
|
| 1200 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1201 |
+
if (currentPlayer.isLocal && currentPlayer.id === piece.playerId) {
|
| 1202 |
+
pieceElement.classList.add('cursor-pointer', 'hover:scale-110');
|
| 1203 |
+
pieceElement.addEventListener('click', () => selectPiece(piece));
|
| 1204 |
+
}
|
| 1205 |
+
|
| 1206 |
+
elements.gameBoard.appendChild(pieceElement);
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
function updateCurrentPlayerUI() {
|
| 1210 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1211 |
+
|
| 1212 |
+
// Actualizar panel del jugador
|
| 1213 |
+
elements.currentPlayerName.textContent = currentPlayer.name;
|
| 1214 |
+
elements.currentPlayerColor.className = `w-5 h-5 rounded-full mr-2 bg-${currentPlayer.color}-500`;
|
| 1215 |
+
|
| 1216 |
+
// Contar fichas en juego y en casa
|
| 1217 |
+
const piecesInPlay = currentPlayer.pieces.filter(p => p.position !== 'home' && p.position !== 'final').length;
|
| 1218 |
+
const piecesInHome = currentPlayer.pieces.filter(p => p.position === 'final').length;
|
| 1219 |
+
|
| 1220 |
+
elements.piecesInPlay.textContent = piecesInPlay;
|
| 1221 |
+
elements.piecesInHome.textContent = piecesInHome;
|
| 1222 |
+
|
| 1223 |
+
// Actualizar indicador de turno
|
| 1224 |
+
elements.turnIndicator.innerHTML = `
|
| 1225 |
+
<div class="w-3 h-3 rounded-full bg-${currentPlayer.color}-500 mr-2"></div>
|
| 1226 |
+
<span>${currentPlayer.isLocal ? 'Tu turno' : 'Turno de ' + currentPlayer.name}</span>
|
| 1227 |
+
`;
|
| 1228 |
+
|
| 1229 |
+
// Habilitar/deshabilitar dado
|
| 1230 |
+
if (currentPlayer.isLocal) {
|
| 1231 |
+
elements.diceBtn.classList.remove('opacity-50', 'cursor-not-allowed');
|
| 1232 |
+
elements.diceBtn.classList.add('cursor-pointer', 'hover:scale-105');
|
| 1233 |
+
} else {
|
| 1234 |
+
elements.diceBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
| 1235 |
+
elements.diceBtn.classList.remove('cursor-pointer', 'hover:scale-105');
|
| 1236 |
+
}
|
| 1237 |
+
|
| 1238 |
+
// Actualizar lista de jugadores
|
| 1239 |
+
elements.playersGameList.innerHTML = '';
|
| 1240 |
+
gameState.players.forEach(player => {
|
| 1241 |
+
const piecesInHome = player.pieces.filter(p => p.position === 'final').length;
|
| 1242 |
+
|
| 1243 |
+
const playerItem = document.createElement('li');
|
| 1244 |
+
playerItem.className = `flex items-center justify-between p-2 rounded-lg ${player.id === currentPlayer.id ? 'bg-gray-200' : 'bg-gray-50'}`;
|
| 1245 |
+
playerItem.innerHTML = `
|
| 1246 |
+
<div class="flex items-center">
|
| 1247 |
+
<div class="w-4 h-4 rounded-full bg-${player.color}-500 mr-2"></div>
|
| 1248 |
+
<span class="font-medium">${player.name}</span>
|
| 1249 |
+
</div>
|
| 1250 |
+
<div class="text-sm ${piecesInHome === 4 ? 'text-green-600 font-bold' : 'text-gray-500'}">${piecesInHome}/4</div>
|
| 1251 |
+
`;
|
| 1252 |
+
|
| 1253 |
+
elements.playersGameList.appendChild(playerItem);
|
| 1254 |
+
});
|
| 1255 |
+
}
|
| 1256 |
+
|
| 1257 |
+
function rollDice() {
|
| 1258 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1259 |
+
if (!currentPlayer.isLocal) return;
|
| 1260 |
+
|
| 1261 |
+
// Deshabilitar el dado durante el lanzamiento
|
| 1262 |
+
elements.diceBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
| 1263 |
+
elements.diceBtn.classList.remove('cursor-pointer', 'hover:scale-105');
|
| 1264 |
+
|
| 1265 |
+
// Animación del dado
|
| 1266 |
+
let rolls = 0;
|
| 1267 |
+
const maxRolls = 10;
|
| 1268 |
+
const rollInterval = setInterval(() => {
|
| 1269 |
+
gameState.diceValue = Math.floor(Math.random() * 6) + 1;
|
| 1270 |
+
elements.diceBtn.textContent = getDiceFace(gameState.diceValue);
|
| 1271 |
+
rolls++;
|
| 1272 |
+
|
| 1273 |
+
if (rolls >= maxRolls) {
|
| 1274 |
+
clearInterval(rollInterval);
|
| 1275 |
+
finishDiceRoll();
|
| 1276 |
+
}
|
| 1277 |
+
}, 100);
|
| 1278 |
+
}
|
| 1279 |
+
|
| 1280 |
+
function getDiceFace(value) {
|
| 1281 |
+
const faces = ['⚀', '⚁', '⚂', '⚃', '⚄', '⚅'];
|
| 1282 |
+
return faces[value - 1];
|
| 1283 |
+
}
|
| 1284 |
+
|
| 1285 |
+
function finishDiceRoll() {
|
| 1286 |
+
// Agregar al historial
|
| 1287 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1288 |
+
const historyItem = document.createElement('div');
|
| 1289 |
+
historyItem.className = 'flex items-center justify-between py-1 px-2 bg-gray-100 rounded';
|
| 1290 |
+
historyItem.innerHTML = `
|
| 1291 |
+
<div class="flex items-center">
|
| 1292 |
+
<div class="w-3 h-3 rounded-full bg-${currentPlayer.color}-500 mr-2"></div>
|
| 1293 |
+
<span>${currentPlayer.name}</span>
|
| 1294 |
+
</div>
|
| 1295 |
+
<span class="font-bold">${gameState.diceValue}</span>
|
| 1296 |
+
`;
|
| 1297 |
+
elements.diceHistory.insertBefore(historyItem, elements.diceHistory.firstChild);
|
| 1298 |
+
|
| 1299 |
+
// Verificar si el jugador tiene movimientos posibles
|
| 1300 |
+
const movablePieces = currentPlayer.pieces.filter(piece => {
|
| 1301 |
+
if (piece.position === 'home' && gameState.diceValue === 5) return true;
|
| 1302 |
+
if (piece.position.startsWith('path') || piece.position.startsWith('safe')) return true;
|
| 1303 |
+
return false;
|
| 1304 |
+
});
|
| 1305 |
+
|
| 1306 |
+
if (movablePieces.length === 0) {
|
| 1307 |
+
showToast('No tienes movimientos posibles. Pasando turno...');
|
| 1308 |
+
setTimeout(nextTurn, 1500);
|
| 1309 |
+
} else {
|
| 1310 |
+
// Resaltar fichas que se pueden mover
|
| 1311 |
+
movablePieces.forEach(piece => {
|
| 1312 |
+
const pieceElement = document.getElementById(`piece-${piece.id}`);
|
| 1313 |
+
if (pieceElement) {
|
| 1314 |
+
pieceElement.classList.add('glow');
|
| 1315 |
+
}
|
| 1316 |
+
});
|
| 1317 |
+
|
| 1318 |
+
showToast(`Elige una ficha para mover ${gameState.diceValue} espacios`);
|
| 1319 |
+
}
|
| 1320 |
+
}
|
| 1321 |
+
|
| 1322 |
+
function selectPiece(piece) {
|
| 1323 |
+
// Solo permitir selección si es el turno del jugador y hay un valor de dado
|
| 1324 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1325 |
+
if (!currentPlayer.isLocal || gameState.diceValue === 0 || piece.playerId !== currentPlayer.id) return;
|
| 1326 |
+
|
| 1327 |
+
// Quitar resaltado de todas las fichas
|
| 1328 |
+
document.querySelectorAll('.piece').forEach(el => el.classList.remove('glow'));
|
| 1329 |
+
|
| 1330 |
+
// Mover la ficha según las reglas
|
| 1331 |
+
movePiece(piece, gameState.diceValue);
|
| 1332 |
+
|
| 1333 |
+
// Resetear el valor del dado
|
| 1334 |
+
gameState.diceValue = 0;
|
| 1335 |
+
elements.diceBtn.textContent = '🎲';
|
| 1336 |
+
|
| 1337 |
+
// Pasar al siguiente turno después de un breve retraso
|
| 1338 |
+
setTimeout(nextTurn, 1000);
|
| 1339 |
+
}
|
| 1340 |
+
|
| 1341 |
+
function movePiece(piece, spaces) {
|
| 1342 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1343 |
+
|
| 1344 |
+
// Mover ficha desde la base
|
| 1345 |
+
if (piece.position === 'home') {
|
| 1346 |
+
if (spaces === 5) {
|
| 1347 |
+
piece.position = `path-${currentPlayer.id}-0`; // Posición inicial del jugador
|
| 1348 |
+
showToast(`¡Ficha ${piece.number} ha salido de la base!`);
|
| 1349 |
+
} else {
|
| 1350 |
+
showToast('Necesitas un 5 para sacar una ficha de la base');
|
| 1351 |
+
return;
|
| 1352 |
+
}
|
| 1353 |
+
}
|
| 1354 |
+
// Mover ficha en el camino
|
| 1355 |
+
else if (piece.position.startsWith('path') || piece.position.startsWith('safe')) {
|
| 1356 |
+
// Lógica simplificada de movimiento
|
| 1357 |
+
const currentPath = piece.position;
|
| 1358 |
+
let newPosition;
|
| 1359 |
+
|
| 1360 |
+
if (currentPath.startsWith('path')) {
|
| 1361 |
+
const currentPos = parseInt(currentPath.split('-')[1]);
|
| 1362 |
+
newPosition = `path-${(currentPos + spaces) % (gameState.boardType === 4 ? 68 : 96)}`;
|
| 1363 |
+
} else {
|
| 1364 |
+
// Para casillas seguras, avanzar en el pasillo final
|
| 1365 |
+
const parts = currentPath.split('-');
|
| 1366 |
+
const playerIndex = parseInt(parts[1]);
|
| 1367 |
+
const spotIndex = parseInt(parts[2]);
|
| 1368 |
+
|
| 1369 |
+
if (spotIndex + spaces < 5) {
|
| 1370 |
+
newPosition = `safe-${playerIndex}-${spotIndex + spaces}`;
|
| 1371 |
+
} else {
|
| 1372 |
+
piece.position = 'final';
|
| 1373 |
+
showToast(`¡Ficha ${piece.number} ha llegado a la meta!`);
|
| 1374 |
+
|
| 1375 |
+
// Verificar si el jugador ha ganado
|
| 1376 |
+
checkWinCondition(currentPlayer);
|
| 1377 |
+
}
|
| 1378 |
+
}
|
| 1379 |
+
|
| 1380 |
+
if (newPosition) {
|
| 1381 |
+
// Verificar si hay una ficha rival en la nueva posición
|
| 1382 |
+
const targetPieces = gameState.pieces.filter(p => p.position === newPosition && p.playerId !== piece.playerId);
|
| 1383 |
+
|
| 1384 |
+
if (targetPieces.length > 0 && !gameState.safeSpots.includes(newPosition)) {
|
| 1385 |
+
// Capturar la ficha rival
|
| 1386 |
+
targetPieces.forEach(targetPiece => {
|
| 1387 |
+
targetPiece.position = 'home';
|
| 1388 |
+
renderPiece(targetPiece);
|
| 1389 |
+
showToast(`¡Has capturado una ficha de ${gameState.players.find(p => p.id === targetPiece.playerId).name}!`);
|
| 1390 |
+
});
|
| 1391 |
+
}
|
| 1392 |
+
|
| 1393 |
+
piece.position = newPosition;
|
| 1394 |
+
}
|
| 1395 |
+
}
|
| 1396 |
+
|
| 1397 |
+
// Renderizar la ficha en su nueva posición
|
| 1398 |
+
renderPiece(piece);
|
| 1399 |
+
|
| 1400 |
+
// Si el dado fue 6, permitir otro lanzamiento
|
| 1401 |
+
if (spaces === 6) {
|
| 1402 |
+
showToast('¡Obtuviste un 6! Tira de nuevo');
|
| 1403 |
+
gameState.diceValue = 0;
|
| 1404 |
+
elements.diceBtn.textContent = '🎲';
|
| 1405 |
+
elements.diceBtn.classList.remove('opacity-50', 'cursor-not-allowed');
|
| 1406 |
+
elements.diceBtn.classList.add('cursor-pointer', 'hover:scale-105');
|
| 1407 |
+
}
|
| 1408 |
+
}
|
| 1409 |
+
|
| 1410 |
+
function checkWinCondition(player) {
|
| 1411 |
+
const piecesInHome = player.pieces.filter(p => p.position === 'final').length;
|
| 1412 |
+
|
| 1413 |
+
if (piecesInHome === 4) {
|
| 1414 |
+
// Juego terminado
|
| 1415 |
+
showWinnerModal(`${player.name} (${gameState.colorNames[player.color]}) ha ganado!`);
|
| 1416 |
+
|
| 1417 |
+
// Deshabilitar interacciones
|
| 1418 |
+
elements.diceBtn.classList.add('opacity-50', 'cursor-not-allowed');
|
| 1419 |
+
elements.diceBtn.classList.remove('cursor-pointer', 'hover:scale-105');
|
| 1420 |
+
|
| 1421 |
+
// Quitar eventos de clic de las fichas
|
| 1422 |
+
document.querySelectorAll('.piece').forEach(p => p.style.pointerEvents = 'none');
|
| 1423 |
+
}
|
| 1424 |
+
}
|
| 1425 |
+
|
| 1426 |
+
function nextTurn() {
|
| 1427 |
+
gameState.currentPlayerIndex = (gameState.currentPlayerIndex + 1) % gameState.players.length;
|
| 1428 |
+
updateCurrentPlayerUI();
|
| 1429 |
+
|
| 1430 |
+
// Simular turno de IA si no es el jugador local
|
| 1431 |
+
const currentPlayer = gameState.players[gameState.currentPlayerIndex];
|
| 1432 |
+
if (!currentPlayer.isLocal && gameState.gameStarted) {
|
| 1433 |
+
setTimeout(() => {
|
| 1434 |
+
rollDice();
|
| 1435 |
+
|
| 1436 |
+
// Simular selección de ficha después de un retraso
|
| 1437 |
+
setTimeout(() => {
|
| 1438 |
+
const movablePieces = currentPlayer.pieces.filter(piece => {
|
| 1439 |
+
if (piece.position === 'home' && gameState.diceValue === 5) return true;
|
| 1440 |
+
if (piece.position.startsWith('path') || piece.position.startsWith('safe')) return true;
|
| 1441 |
+
return false;
|
| 1442 |
+
});
|
| 1443 |
+
|
| 1444 |
+
if (movablePieces.length > 0) {
|
| 1445 |
+
const randomPiece = movablePieces[Math.floor(Math.random() * movablePieces.length)];
|
| 1446 |
+
movePiece(randomPiece, gameState.diceValue);
|
| 1447 |
+
|
| 1448 |
+
// Pasar al siguiente turno
|
| 1449 |
+
setTimeout(nextTurn, 1000);
|
| 1450 |
+
} else {
|
| 1451 |
+
nextTurn();
|
| 1452 |
+
}
|
| 1453 |
+
}, 1000);
|
| 1454 |
+
}, 1500);
|
| 1455 |
+
}
|
| 1456 |
+
}
|
| 1457 |
+
|
| 1458 |
+
function exitGame() {
|
| 1459 |
+
if (confirm('¿Estás seguro de que quieres salir de la partida?')) {
|
| 1460 |
+
hideMenuModal();
|
| 1461 |
+
elements.gameScreen.classList.add('hidden');
|
| 1462 |
+
elements.startScreen.classList.remove('hidden');
|
| 1463 |
+
|
| 1464 |
+
// Resetear estado del juego
|
| 1465 |
+
resetGameState();
|
| 1466 |
+
}
|
| 1467 |
+
}
|
| 1468 |
+
|
| 1469 |
+
function startRematch() {
|
| 1470 |
+
hideWinnerModal();
|
| 1471 |
+
resetGameState();
|
| 1472 |
+
initializeGame();
|
| 1473 |
+
}
|
| 1474 |
+
|
| 1475 |
+
function newGame() {
|
| 1476 |
+
hideWinnerModal();
|
| 1477 |
+
elements.gameScreen.classList.add('hidden');
|
| 1478 |
+
elements.startScreen.classList.remove('hidden');
|
| 1479 |
+
resetGameState();
|
| 1480 |
+
}
|
| 1481 |
+
|
| 1482 |
+
function resetGameState() {
|
| 1483 |
+
gameState = {
|
| 1484 |
+
...gameState,
|
| 1485 |
+
currentPlayerIndex: 0,
|
| 1486 |
+
diceValue: 0,
|
| 1487 |
+
gameStarted: false,
|
| 1488 |
+
pieces: [],
|
| 1489 |
+
paths: {},
|
| 1490 |
+
players: gameState.players.filter(p => p.isLocal)
|
| 1491 |
+
};
|
| 1492 |
+
|
| 1493 |
+
// Resetear UI
|
| 1494 |
+
elements.diceHistory.innerHTML = '';
|
| 1495 |
+
elements.diceBtn.textContent = '🎲';
|
| 1496 |
+
}
|
| 1497 |
+
</script>
|
| 1498 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Dommos/parch" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 1499 |
+
</html>
|