Closed lijim closed 1 year ago
We currently have some logic that resolves effects like this:
const newBoardState = resolveEffect( board, effectParams, playerName, true, sendChatMessageForRoom(socket) ); if (newBoardState) { const gameResult = calculateGameResult( prevGameState, newBoardState ); if (gameResult) { addGameResult(gameResult); recordGameResultToDatabase(gameResult); } } // TODO: add error handling when user tries to take an invalid action room.board = newBoardState; // apply state changes to in-memory storage of boards broadcastBoardForRoom(room.roomName);
The issue is that if newBoardState is null, we lock the board up and make it so that the game doesn't continue
I'm not sure what exact steps we need to repro, but it seems to involve auto-resolving effects within the game (e.g. summon a unit, buff the team)
const { effectQueue } = activePlayer; if ( verifyEffect && (!effectQueue?.length || !isEqual(effectQueue[effectQueue.length - 1], effect)) ) { return null; }
It's possible that returning the board state instead of returning null early will fix this OR we can make it so it only sets a room's board if newBoardState exists
newBoardState
We currently have some logic that resolves effects like this:
The issue is that if newBoardState is null, we lock the board up and make it so that the game doesn't continue
I'm not sure what exact steps we need to repro, but it seems to involve auto-resolving effects within the game (e.g. summon a unit, buff the team)
It's possible that returning the board state instead of returning null early will fix this OR we can make it so it only sets a room's board if
newBoardState
exists