Close #32 -> Hand Discarding Size Increase
This commit is contained in:
parent
6a0536761c
commit
6332673160
1 changed files with 9 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { conf, games, log } from '../main';
|
||||
import { games, log } from '../main';
|
||||
import { Server, Socket } from 'socket.io';
|
||||
|
||||
export default (io: Server, socket: Socket, data: NewHand) => {
|
||||
|
|
@ -18,6 +18,13 @@ export default (io: Server, socket: Socket, data: NewHand) => {
|
|||
let team = game.teams[data.team - 1];
|
||||
let deck = game.questions;
|
||||
|
||||
/**
|
||||
* The amount of cards that the team has in their hand prior to
|
||||
* discarding all of their hand, this is used to make sure that they
|
||||
* get back the same number of cards that they had in their hand.
|
||||
*/
|
||||
let handSize = team.hand.length;
|
||||
|
||||
// Empty the medium's hand to the discard pile so we know where the
|
||||
// cards are.
|
||||
for (var card of team.hand) {
|
||||
|
|
@ -27,7 +34,7 @@ export default (io: Server, socket: Socket, data: NewHand) => {
|
|||
};
|
||||
|
||||
// Add the questions and then alert the game clients about the changes
|
||||
team.addCardsToHand(deck.draw(conf.game.hand_size));
|
||||
team.addCardsToHand(deck.draw(handSize));
|
||||
game.log.silly(`Drew a new hand of cards for team ${data.team}.`);
|
||||
io.to(game.id).emit(`UpdateHand`, {
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue