@@ -377,18 +377,17 @@ export class TurnService {
|
||||
}
|
||||
|
||||
game.currentTurn.drawAndDiscardCurrentAmount = 0;
|
||||
game.currentTurn.drawAndDiscardCurrentEffect = null;
|
||||
// if (token) {
|
||||
// const index = game.currentTurn.tokens.findIndex((t) =>
|
||||
// t._id.equals(token._id),
|
||||
// );
|
||||
// game.currentTurn.tokens.splice(index, 1);
|
||||
// this.eventEmitter.emit('sse.game.' + game._id.toHexString(), {
|
||||
// type: 'currentTurn.useToken',
|
||||
// tokenId: token._id.toHexString(),
|
||||
// });
|
||||
// game.currentTurn.drawAndDiscardCurrentEffect = null;
|
||||
// }
|
||||
if (game.currentTurn.drawAndDiscardCurrentEffect) {
|
||||
const tokenIndex = game.currentTurn.tokens.findIndex((t) =>
|
||||
t._id.equals(game.currentTurn.drawAndDiscardCurrentEffect._id),
|
||||
);
|
||||
game.currentTurn.tokens.splice(tokenIndex, 1);
|
||||
this.eventEmitter.emit('sse.game.' + game._id.toHexString(), {
|
||||
type: 'currentTurn.useToken',
|
||||
tokenId: game.currentTurn.drawAndDiscardCurrentEffect._id.toHexString(),
|
||||
});
|
||||
game.currentTurn.drawAndDiscardCurrentEffect = null;
|
||||
}
|
||||
|
||||
await game.save({ session });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user