Skip to content

Commit

Permalink
[trivial] formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkey-bored committed Feb 22, 2024
1 parent 02f409b commit 68fb1c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions development/code/logic/PieceLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,28 +223,28 @@ function move(

function failToKillPiece(draggedPiece: Piece, targetPiece: Piece) {
destroyItemOnPiece(targetPiece);

// Takes the difference of the dragged and target positions in both axis,
// if the dragged position is higher - it would be positive, if lower - negative
// if the dragged position is higher - it would be positive, if lower - negative
// then I use that to determine the direction to move away from the target position
// and divide it by itself cause I wanna move by 1 in any direction
// and divide it by itself cause I wanna move by 1 in any direction
let directionX = 0;
let directionY = 0;
const targetXPosition = targetPiece.position.coordinates[0];
const targetYPosition = targetPiece.position.coordinates[1];
const deltaX = draggedPiece.position.coordinates[0] - targetXPosition;
const deltaY = draggedPiece.position.coordinates[1] - targetYPosition;
if (deltaX !== 0) {
directionX = (deltaX) / (Math.abs(deltaX));
directionX = deltaX / Math.abs(deltaX);
}
if (deltaY !== 0) {
directionY = (deltaY) / (Math.abs(deltaY));
directionY = deltaY / Math.abs(deltaY);
}

const newPosition: Position = {
coordinates: [targetXPosition + directionX, targetYPosition + directionY],
boardId: draggedPiece.position.boardId,
}
};
movePieceOnBoard(draggedPiece, newPosition);
draggedPiece.position = newPosition;

Expand Down
4 changes: 3 additions & 1 deletion development/code/logic/rules/BountyRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class BountyRule extends BaseRule {
position: { coordinates: pieceCoordinates },
} = piece;
new RuleLog(
`There is an open bounty on a ${playerColor} ${pieceName} [${pieceCoordinates.join(',')}].`,
`There is an open bounty on a ${playerColor} ${pieceName} [${pieceCoordinates.join(
',',
)}].`,
).addToQueue();
}
});
Expand Down

0 comments on commit 68fb1c4

Please sign in to comment.