From df76acbbc8216ec241e731cd656ab3efdfe5b62f Mon Sep 17 00:00:00 2001 From: legonzaur Date: Mon, 15 Jul 2024 18:04:19 +0200 Subject: [PATCH] Fix : sacrifice in Discard --- src/games/controllers/turn.controller.ts | 7 +++++++ src/main.ts | 1 + src/users/users.service.ts | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/games/controllers/turn.controller.ts b/src/games/controllers/turn.controller.ts index aeae8e1..15d413b 100644 --- a/src/games/controllers/turn.controller.ts +++ b/src/games/controllers/turn.controller.ts @@ -279,6 +279,7 @@ export class TurnController { CardEffects.RESTACK_DISCARDED_ACTION, CardEffects.RESTACK_DISCARDED_CARD, CardEffects.RESTACK_DISCARDED_CHAMPION, + CardEffects.SACRIFICE, ]; let targetCard: Card; @@ -302,6 +303,12 @@ export class TurnController { ); } + if (!targetCard && token.effect == CardEffects.SACRIFICE) { + targetCard = currentPlayer.board.cards.find((c) => + c._id.equals(useTokenDto.cardId), + ); + } + if (token.effect != CardEffects.DRAW_AND_DISCARD) { if (currentPlayer.discardMarkers || currentPlayer.fuckUMarkers) { throw new HttpException( diff --git a/src/main.ts b/src/main.ts index 3160926..514da89 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,6 +8,7 @@ import mongoose from 'mongoose'; async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors({ origin: 'http://localhost:3000', credentials: true }); + app.setGlobalPrefix(process.env.API_PREFIX); const config = new DocumentBuilder() .setTitle('Heron Game') .setDescription('Heron') diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 0a4f7f0..a07cb94 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -26,7 +26,8 @@ export class UsersService { client_secret: process.env.DISCORD_CLIENTSECRET, code, grant_type: 'authorization_code', - redirect_uri: process.env.API_ENDPOINT + '/login', + redirect_uri: + process.env.API_ENDPOINT + process.env.API_PREFIX + '/login', }); } else if (refresh_token) { body = new URLSearchParams({