Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Commit

Permalink
fix: set turn boolean for the first turn (#27)
Browse files Browse the repository at this point in the history
It turns out a turn change event is not emitted on the first turn of a
game. However, we can utilize the presence of the coin in the initial
mulligan to determine who goes first.
  • Loading branch information
rikumiyao authored and Alex Van Camp committed May 6, 2019
1 parent d17141a commit 818a969
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/line-parsers/zone-change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ export class ZoneChangeLineParser extends AbstractLineParser {
player.questCounter = -1;
}
}

if (gameState.mulliganActive && data.cardName === 'The Coin' && data.toZone === 'HAND') {
const player = gameState.getPlayerById(3 - data.playerId); // Player 1's opponent is Player 2, Player 2's opponent is Player 1
if (player) {
player.turn = true;
}
}
}

formatLogMessage(parts: string[]): string {
Expand Down

0 comments on commit 818a969

Please sign in to comment.