0
0
Fork 0

Draw new cards for a team when the spirit selects a card to answer rather than right when the medium sends the card to the spirit.

This commit is contained in:
Oliver-Akins 2021-01-05 14:20:54 -07:00
parent d428d1160b
commit ee16218c18

View file

@ -20,8 +20,11 @@ export default (io: Server, socket: Socket, data: SendCard) => {
// The writer is answering
if (data.from === "writer") {
game.log.debug(` Writer selected question to answer.`);
game.log.debug(`Writer selected question to answer.`);
// Draw new cards for team
deck.discard(data.text);
team.addCardsToHand(game.questions.draw(conf.game.hand_size - team.hand.length));
team.selectQuestion(data.text);
socket.emit(`UpdateHand`, {
@ -29,6 +32,11 @@ export default (io: Server, socket: Socket, data: SendCard) => {
mode: "replace",
questions: []
});
io.to(`${game.id}:${team.id}:guesser`).emit(`UpdateHand`, {
status: 200,
mode: "replace",
questions: team.hand
});
return;
}
@ -38,7 +46,6 @@ export default (io: Server, socket: Socket, data: SendCard) => {
// Update the team's hand
team.removeCard(data.text);
team.addCardsToHand(game.questions.draw(conf.game.hand_size - team.hand.length));
// send the question text to the writer player
io.to(`${game.id}:${team.id}:writer`).emit(`UpdateHand`, {