diff --git a/development/code/LogicAdapter.ts b/development/code/LogicAdapter.ts index 21631f2b..eae4541c 100644 --- a/development/code/LogicAdapter.ts +++ b/development/code/LogicAdapter.ts @@ -171,8 +171,8 @@ export function movePieceOnBoard( } export function destroyPieceOnBoard(piece: Piece) { - const tpieceCoordinates = piece.position.coordinates; - const squareId = tpieceCoordinates.join(','); + const pieceCoordinates = piece.position.coordinates; + const squareId = pieceCoordinates.join(','); destroyElementOnBoardByPosition(squareId, piece.position.boardId); } diff --git a/development/code/logic/PieceLogic.ts b/development/code/logic/PieceLogic.ts index 972f2da8..7e8493cb 100644 --- a/development/code/logic/PieceLogic.ts +++ b/development/code/logic/PieceLogic.ts @@ -242,14 +242,12 @@ function killPieceByAnotherPiece( draggedPiece.player.gold += targetPiece.killCount; } - destroyPieceOnBoard(targetPiece); killPiece(targetPiece); new KillLog(targetPiece, draggedPiece).addToQueue(); return true; } function killPieceByGame(targetPiece: Piece, killCause: string) { - destroyPieceOnBoard(targetPiece); killPiece(targetPiece); new KillLog(targetPiece, killCause).addToQueue(); } @@ -269,6 +267,8 @@ function killPiece(targetPiece: Piece) { } function handleOverworldKill(targetPiece: Piece) { + destroyPieceOnBoard(targetPiece); + if (targetPiece.killCount > 0 || targetPiece instanceof King) { targetPiece.position.boardId = HELL_BOARD_ID; } else { diff --git a/development/code/logic/pieces/DoubleQueen.test.ts b/development/code/logic/pieces/DoubleQueen.test.ts index 2db43904..2e66eadc 100644 --- a/development/code/logic/pieces/DoubleQueen.test.ts +++ b/development/code/logic/pieces/DoubleQueen.test.ts @@ -73,7 +73,10 @@ describe('Piece killing', () => { coordinates: [2, 2], boardId: OVERWORLD_BOARD_ID, }; - const killerDoubleQueen = new DoubleQueen(initialKillerPosition, whitePlayer); + const killerDoubleQueen = new DoubleQueen( + initialKillerPosition, + whitePlayer, + ); const victimPosition: Position = { coordinates: [2, 5],