removed comments
This commit is contained in:
@@ -4,13 +4,11 @@ import { getUser } from "../state/connection.js";
|
||||
|
||||
const API_URL = "http://localhost:8000/api/v1";
|
||||
|
||||
// --- HELPER: Card Strength for Auto-Play ---
|
||||
const getStrength = (rank) => {
|
||||
const strengthMap = { 1: 10, 7: 9, 13: 8, 11: 7, 12: 6, 6: 5, 5: 4, 4: 3, 3: 2, 2: 1 };
|
||||
return strengthMap[rank] || 0;
|
||||
};
|
||||
|
||||
// --- HELPER: Draw Card Logic ---
|
||||
const drawCard = (game, playerId) => {
|
||||
const player = game.players[playerId];
|
||||
if (!player) return;
|
||||
@@ -24,7 +22,6 @@ const drawCard = (game, playerId) => {
|
||||
}
|
||||
};
|
||||
|
||||
// --- HELPER: Sanitize Data ---
|
||||
const sanitizeState = (state, game) => {
|
||||
if (!state) return null;
|
||||
const p1 = game.player1 || state.player1 || {};
|
||||
@@ -90,7 +87,6 @@ async function saveGameResult(gameId, result, token) {
|
||||
}
|
||||
}
|
||||
|
||||
// --- SHARED END GAME LOGIC ---
|
||||
const performGameEnd = (io, game, gameId, winnerId, loserId, reason) => {
|
||||
const result = {
|
||||
action: "game_ended",
|
||||
@@ -267,7 +263,6 @@ export default (io, socket) => {
|
||||
if (user) handleGameMove(io, gameId, user.id, cardId);
|
||||
});
|
||||
|
||||
// --- NEW: SURRENDER HANDLER ---
|
||||
socket.on("surrender", ({ gameId }) => {
|
||||
const user = getUser(socket.id);
|
||||
const game = getGame(gameId);
|
||||
|
||||
Reference in New Issue
Block a user