Skip to content

Commit

Permalink
[trivial] Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ido-Barnea committed Jan 13, 2024
1 parent cb6c303 commit cfb3238
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions development/code/logic/PieceLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function handleTargetType(
targetSquare: Square,
) {
if (target instanceof Item) {
handlePieceOnItem(draggedPiece, target);
handleMovingOnItem(draggedPiece, target.position);
}

onActionPieceToSquare(draggedPiece, targetSquare);
Expand Down Expand Up @@ -222,14 +222,7 @@ function handlePieceSpawning(targetPiece: Piece) {
});

game.getItems().forEach((item) => {
const areOnTheSamePosition = comparePositions(
targetPiece.position,
item.position,
);

if (areOnTheSamePosition) {
handlePieceOnItem(targetPiece, item);
}
handleMovingOnItem(targetPiece, item.position);
});

spawnPieceOnBoard(targetPiece);
Expand All @@ -256,15 +249,6 @@ export function permanentlyKillPiece(targetPiece: Piece, draggedPiece: Piece) {
commonKillPieceActions(targetPiece);
}

function handlePieceOnItem(draggedPiece: Piece, targetItem: Item) {
switch (targetItem.name) {
case ('trap'): {
pieceMovedOnTrap(draggedPiece, targetItem);
break;
}
}
}

function handleMovingOnItem(piece: Piece, position: Position) {
const item = getItemByPosition(position);
if (item) {
Expand Down

0 comments on commit cfb3238

Please sign in to comment.