Feat : add Prepare token

This commit is contained in:
2024-07-13 16:49:31 +02:00
parent 2e0485cc87
commit 8ca627a047
5 changed files with 203 additions and 8 deletions
+38
View File
@@ -223,4 +223,42 @@ export class TurnService {
);
await game.save({ session });
}
@WithTransaction
async makeDiscard(
game: Document<Game> & Game,
token: Effect,
target: Player,
session?: mongoose.mongo.ClientSession,
) {
target.fuckUMarkers++;
const index = game.currentTurn.tokens.findIndex((t) =>
t._id.equals(token._id),
);
if (index == -1) {
throw new Error('Token not found');
}
game.currentTurn.tokens.splice(index, 1);
await game.save({ session });
}
@WithTransaction
async useToken(
game: Document<Game> & Game,
token: Effect,
target: Card,
session?: mongoose.mongo.ClientSession,
) {
return;
}
@WithTransaction
async useTokenOnEnemyBoard(
game: Document<Game> & Game,
targetPlayer: Player,
token: Effect,
target: Card,
session?: mongoose.mongo.ClientSession,
) {}
}