Merge branch 'game-page-enhancements' of https://github.com/AlecM33/Werewolf into game-page-enhancements

This commit is contained in:
Alec Maier
2020-04-12 14:00:32 -04:00
3 changed files with 39 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ export const cards = [
role: "Dream Wolf",
team: "evil",
description: "If a Werewolf dies, you become a Werewolf. You do not wake up with the Werewolves until this happens.",
isTypeOfWerewolf: true
isTypeOfWerewolf: false
},
{
role: "Minion",

View File

@@ -17,13 +17,14 @@ class Card {
}
class Game {
constructor(accessCode, size, deck, time) {
constructor(accessCode, size, deck, time, hasDreamWolf) {
this.accessCode = accessCode;
this.size = size;
this.deck = deck;
this.time = time;
this.players = [];
this.status = "lobby";
this.hasDreamWolf = hasDreamWolf;
this.endTime = null;
}
}
@@ -230,11 +231,13 @@ function createGame() {
// send a new game to the server, and then join it
const playerInfo = {name: document.getElementById("name").value, code: code, id: id};
let gameDeck = buildDeckFromQuantities();
const game = new Game(
code,
gameSize,
buildDeckFromQuantities(),
Math.ceil(document.getElementById("time").value)
gameDeck,
Math.ceil(document.getElementById("time").value),
gameDeck.find((card) => card.role === "Dream Wolf") !== undefined
);
socket.emit('newGame', game, function() {
socket.emit('joinGame', playerInfo);