Skip to content

Commit

Permalink
[#84] Fixed pieces not being properly killed in heaven/hell
Browse files Browse the repository at this point in the history
  • Loading branch information
Ido-Barnea committed Nov 11, 2023
1 parent dadbae6 commit e8a0a9e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion development/src/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,17 @@ function actOnTurnPieceToPiece(draggedPiece: Piece, targetPiece: Piece) {
spawnPieceOnBoard(targetPiece);
} else {
Logger.logKill(`A ${targetPiece.player.color} ${targetPiece.name} was permanently killed by a ${draggedPiece.player.color} ${draggedPiece.name}.`);
killPiece(targetPiece);
pieces.forEach((piece) => {
const areOnTheSamePosition = comparePositions(
targetPiece.position,
piece.position,
);
const areTheSame = piece === targetPiece;

if (areOnTheSamePosition && !areTheSame) {
killPiece(piece);
}
});
}

const targetSquare: Square = { position: targetPiece.position };
Expand Down

0 comments on commit e8a0a9e

Please sign in to comment.