Fix : sacrifice on discard not working

This commit is contained in:
2024-07-16 23:42:45 +02:00
parent df76acbbc8
commit 73efadbaed
+10 -1
View File
@@ -258,7 +258,16 @@ export const tokenMappings = {
HttpStatus.BAD_REQUEST,
);
}
await gameService.destroyCard(card, player.board, game, session);
if (player.discard.cards.some((c) => c._id.equals(card._id))) {
await gameService.destroyCard(card, player.discard, game, session);
} else if (player.board.cards.some((c) => c._id.equals(card._id))) {
await gameService.destroyCard(card, player.board, game, session);
} else {
throw new HttpException(
'Card not found in Discard or Board',
HttpStatus.NOT_FOUND,
);
}
},
[CardEffects.RESTACK_DISCARDED_CHAMPION]: async (
game: Document<Game> & Game,