Close #19
This commit is contained in:
@@ -179,7 +179,7 @@ export const tokenMappings = {
|
|||||||
[CardEffects.PREPARE]: async (
|
[CardEffects.PREPARE]: async (
|
||||||
game: Document<Game> & Game,
|
game: Document<Game> & Game,
|
||||||
_effect: Effect,
|
_effect: Effect,
|
||||||
_player: Player,
|
player: Player,
|
||||||
card: Card,
|
card: Card,
|
||||||
_gameService: GameService,
|
_gameService: GameService,
|
||||||
turnService: TurnService,
|
turnService: TurnService,
|
||||||
@@ -208,7 +208,7 @@ export const tokenMappings = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const e of targetEffects) {
|
for (const e of targetEffects) {
|
||||||
await turnService.unlockEffect(game, e, session);
|
await turnService.unlockEffect(game, player, e, card, session);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[CardEffects.STUN]: async (
|
[CardEffects.STUN]: async (
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ export class TurnService {
|
|||||||
@WithTransaction
|
@WithTransaction
|
||||||
async unlockEffect(
|
async unlockEffect(
|
||||||
game: Document<Game> & Game,
|
game: Document<Game> & Game,
|
||||||
|
player: Player,
|
||||||
effect: Effect,
|
effect: Effect,
|
||||||
|
card: Card,
|
||||||
session: mongoose.mongo.ClientSession,
|
session: mongoose.mongo.ClientSession,
|
||||||
) {
|
) {
|
||||||
const index = game.currentTurn.lockedEffects.findIndex((ee) =>
|
const index = game.currentTurn.lockedEffects.findIndex((ee) =>
|
||||||
@@ -75,7 +77,13 @@ export class TurnService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (const sub of effect.subEffects) {
|
for (const sub of effect.subEffects) {
|
||||||
await this.unlockEffect(game, sub, session);
|
await this.unlockEffect(game, player, sub, card, session);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const e of [effect, ...effect.subEffects]) {
|
||||||
|
if (isAutoActivable(e)) {
|
||||||
|
await this.lockEffect(game, player, e, card, session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await game.save({ session });
|
await game.save({ session });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user