fixing game history and removing comments
This commit is contained in:
@@ -48,11 +48,9 @@ class BiscaGame {
|
||||
|
||||
this.dealInitialCards();
|
||||
|
||||
// --- FIX: Ensure currentTurn uses the original ID type (Number) ---
|
||||
// Object.keys returns strings ("1"), which breaks strict checks against user.id (1)
|
||||
const playerKeys = Object.keys(this.players);
|
||||
const startKey = playerKeys.find((key) => key != 1) || playerKeys[0];
|
||||
this.currentTurn = this.players[startKey].id;
|
||||
this.currentTurn = this.players[startKey].id;
|
||||
|
||||
this.startTime = Date.now();
|
||||
this.status = "playing";
|
||||
@@ -192,7 +190,6 @@ class BiscaGame {
|
||||
this.players[winnerId].tricks += 1;
|
||||
this.currentTurn = winnerId;
|
||||
|
||||
// --- FIX: Always draw if deck has cards (Removed type check) ---
|
||||
if (this.deck.length > 0 || this.trumpCard) {
|
||||
this.drawCard(winnerId);
|
||||
this.drawCard(this.getOpponentId(winnerId));
|
||||
@@ -222,8 +219,8 @@ class BiscaGame {
|
||||
const finalLoser = isDraw
|
||||
? null
|
||||
: gameWinnerId == p1Obj.id
|
||||
? p2Obj.id
|
||||
: p1Obj.id;
|
||||
? p2Obj.id
|
||||
: p1Obj.id;
|
||||
|
||||
const result = {
|
||||
action: "game_ended",
|
||||
@@ -237,7 +234,7 @@ class BiscaGame {
|
||||
player2_points: p2Obj.points,
|
||||
totalTime: totalTime,
|
||||
};
|
||||
|
||||
|
||||
if (this.onGameEnd) {
|
||||
this.onGameEnd(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user