diff --git a/client/src/modules/GameCreationStepManager.js b/client/src/modules/GameCreationStepManager.js index 2dd9b54..c46b891 100644 --- a/client/src/modules/GameCreationStepManager.js +++ b/client/src/modules/GameCreationStepManager.js @@ -320,6 +320,7 @@ function showButtons(back, forward, forwardHandler, backHandler, builtGame=null) backButton.addEventListener('click', backHandler); backButton.setAttribute("id", "step-back-button"); backButton.classList.add('cancel'); + backButton.classList.add('app-button'); document.getElementById("tracker-container").prepend(backButton); } @@ -328,11 +329,13 @@ function showButtons(back, forward, forwardHandler, backHandler, builtGame=null) fwdButton.innerHTML = "Next \u25b6"; fwdButton.addEventListener('click', forwardHandler); fwdButton.setAttribute("id", "step-forward-button"); + fwdButton.classList.add('app-button'); document.getElementById("tracker-container").appendChild(fwdButton); } else if (forward && builtGame !== null) { let createButton = document.createElement("button"); createButton.innerText = "Create"; createButton.setAttribute("id", "create-game"); + createButton.classList.add('app-button'); createButton.addEventListener("click", () => { forwardHandler( builtGame.deck.filter((card) => card.quantity > 0), @@ -369,6 +372,7 @@ function loadCustomRoles(deckManager) { let createRoleButton = document.createElement("button"); createRoleButton.setAttribute("id", "custom-role-btn"); + createRoleButton.classList.add('app-button'); createRoleButton.innerText = '+ Create Custom Role'; let form = document.createElement("form"); diff --git a/client/src/modules/GameStateRenderer.js b/client/src/modules/GameStateRenderer.js index 93fd873..a17795a 100644 --- a/client/src/modules/GameStateRenderer.js +++ b/client/src/modules/GameStateRenderer.js @@ -245,6 +245,10 @@ export class GameStateRenderer { this.transferModHandlers, this.socket ); + + if (document.querySelectorAll('.potential-moderator').length === 0) { + document.getElementById("transfer-mod-modal-content").innerText = "There is nobody available to transfer to." + } } renderEndOfGame() { diff --git a/client/src/modules/Templates.js b/client/src/modules/Templates.js index c1179a5..3bbade3 100644 --- a/client/src/modules/Templates.js +++ b/client/src/modules/Templates.js @@ -16,7 +16,7 @@ export const templates = { "" + "" + "
" + - "
" + "" + "
" + @@ -43,7 +43,7 @@ export const templates = { "
" + "
" + "
" + - "
" + "" + "" + "
" + - "
" + "" + "
" + @@ -79,7 +79,7 @@ export const templates = { "

Transfer Mod Powers 👑

" + "
" + "" + "
" + "
" + @@ -92,7 +92,7 @@ export const templates = { "
" + "" + "
" + - "
" + "" + "
" + @@ -116,7 +116,7 @@ export const templates = { "

Transfer Mod Powers 👑

" + "
" + "" + "" + "" + @@ -129,7 +129,7 @@ export const templates = { "
" + "
" + "" + "
" + - "
" + "" + "", END_OF_GAME_VIEW: "

The moderator has ended the game. Roles are revealed.

" + "
" + "
" + - "
" + "
" + "" + - "" + + "" + "" + "
" + "
" + diff --git a/client/src/scripts/game.js b/client/src/scripts/game.js index 0c9d578..082d452 100644 --- a/client/src/scripts/game.js +++ b/client/src/scripts/game.js @@ -87,6 +87,7 @@ function initializeGame(stateBucket, socket, timerWorker, userId, gameStateRende } function processGameState (currentGameState, userId, socket, gameStateRenderer, gameTimerManager, timerWorker) { + console.log(currentGameState); displayClientInfo(currentGameState.client.name, currentGameState.client.userType); switch (currentGameState.status) { case globals.STATUS.LOBBY: diff --git a/client/src/styles/GLOBAL.css b/client/src/styles/GLOBAL.css index 1728faa..12aa42b 100644 --- a/client/src/styles/GLOBAL.css +++ b/client/src/styles/GLOBAL.css @@ -34,7 +34,6 @@ body { margin: 0 auto; position: relative; background-color: #0f0f10; - height: 100vh; } .bmc-btn { @@ -140,7 +139,7 @@ button { justify-content: center; } -button:not(#navbar-hamburger), input[type="submit"] { +.app-button, input[type="submit"] { font-family: 'signika-negative', sans-serif !important; padding: 10px; background-color: #13762b; @@ -152,10 +151,14 @@ button:not(#navbar-hamburger), input[type="submit"] { text-shadow: 0 3px 4px rgb(0 0 0 / 55%); } -button:not(#navbar-hamburger):active, input[type=submit]:active { +.app-button:active, input[type=submit]:active { border: 2px solid #21ba45; } +.cancel { + background-color: #762323 !important; +} + .cancel:hover { background-color: #623232 !important; border: 2px solid #8a1c1c !important; @@ -172,7 +175,7 @@ button:not(#navbar-hamburger):active, input[type=submit]:active { align-items: center; } -button:not(#navbar-hamburger):hover, input[type="submit"]:hover, #game-link:hover { +.app-button:hover, input[type="submit"]:hover, #game-link:hover { background-color: #326243; border: 2px solid #1c8a36; } diff --git a/client/src/styles/game.css b/client/src/styles/game.css index 1983805..f32930f 100644 --- a/client/src/styles/game.css +++ b/client/src/styles/game.css @@ -14,10 +14,6 @@ margin: 0.5em 0; } -body { - margin-bottom: 100px; -} - #lobby-players { overflow-y: auto; max-height: 30em; @@ -49,7 +45,7 @@ body { flex-wrap: wrap; display: flex; width: 95%; - margin: 1em auto 0 auto; + margin: 1em auto 85px auto; } #game-state-container h2 { @@ -66,7 +62,7 @@ h1 { margin: 0.5em auto; } -#game-state-container > div:not(#transfer-mod-modal-background):not(#transfer-mod-modal){ +#game-state-container > div:not(#transfer-mod-modal-background):not(#transfer-mod-modal):not(#game-people-container) { margin: 1em; } @@ -76,7 +72,7 @@ h1 { #footer.game-page-footer { margin-top: 1em; - margin-bottom: 1em; + margin-bottom: 85px; } #footer.game-page-footer a { @@ -581,6 +577,13 @@ label[for='moderator'] { background-color: #3f5256; font-size: 18px; padding: 10px; + border: 2px transparent; + border-radius: 3px; + color: #d7d7d7; +} + +.make-mod-button:hover { + cursor: pointer; } .good-players { @@ -660,12 +663,14 @@ label[for='moderator'] { padding: 10px 10px 0 10px; border-radius: 3px; min-height: 25em; - min-width: 18em; - max-width: 30em; + max-width: 25em; + min-width: 17em; + margin-top: 1em; } #transfer-mod-modal-content { margin-bottom: 2em; + color: #d7d7d7; } #game-state-container.vertical-flex { @@ -683,7 +688,7 @@ label[for='moderator'] { } #game-state-container { - margin: 0 auto 0 auto; + margin: 0 auto 85px auto; } button { diff --git a/client/src/styles/home.css b/client/src/styles/home.css index a727b4f..2bcc5f7 100644 --- a/client/src/styles/home.css +++ b/client/src/styles/home.css @@ -1,6 +1,6 @@ html { - background: rgb(0,0,0); - background: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgb(17 18 18) 35%, rgba(27,31,31,1) 100%); + /*background: rgb(0,0,0); + background: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgb(17 18 18) 35%, rgba(27,31,31,1) 100%);*/ } body { diff --git a/client/src/views/create.html b/client/src/views/create.html index 6f35d31..ae67cae 100644 --- a/client/src/views/create.html +++ b/client/src/views/create.html @@ -41,7 +41,7 @@ diff --git a/client/src/views/game.html b/client/src/views/game.html index f23c587..89ab19a 100644 --- a/client/src/views/game.html +++ b/client/src/views/game.html @@ -58,15 +58,6 @@
- diff --git a/client/src/views/home.html b/client/src/views/home.html index 00cea22..4239e3f 100644 --- a/client/src/views/home.html +++ b/client/src/views/home.html @@ -26,7 +26,7 @@

A tool to run werewolf when not in-person, or in any setting without a deck of cards.

- +
diff --git a/server/modules/GameManager.js b/server/modules/GameManager.js index 35ce963..124ed35 100644 --- a/server/modules/GameManager.js +++ b/server/modules/GameManager.js @@ -102,13 +102,15 @@ class GameManager { let person = game.people.find((person) => person.id === personId) if (person && !person.out) { this.logger.debug('game ' + accessCode + ': killing player ' + person.name); - person.userType = globals.USER_TYPES.KILLED_PLAYER; + if (person.userType !== globals.USER_TYPES.TEMPORARY_MODERATOR) { + person.userType = globals.USER_TYPES.KILLED_PLAYER; + } person.out = true; + namespace.in(accessCode).emit(globals.CLIENT_COMMANDS.KILL_PLAYER, person.id); // temporary moderators will transfer their powers automatically to the first person they kill. if (game.moderator.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { transferModeratorPowers(game, person, namespace, this.logger); } - namespace.in(accessCode).emit(globals.CLIENT_COMMANDS.KILL_PLAYER, person.id) } } }); @@ -313,19 +315,27 @@ class Singleton { function transferModeratorPowers(game, person, namespace, logger) { if (person && (person.out || person.userType === globals.USER_TYPES.SPECTATOR)) { logger.debug('game ' + game.accessCode + ': transferring mod powers to ' + person.name); - if (game.people.includes(game.moderator)) { // the current moderator was at one point a dealt-in player. - game.moderator.userType = globals.USER_TYPES.KILLED_PLAYER; // restore their state from before being made mod. + if (game.moderator === person) { + logger.debug('temp mod killed themselves'); + person.userType = globals.USER_TYPES.MODERATOR; } else { - game.moderator.userType = globals.USER_TYPES.SPECTATOR; - if (!game.spectators.includes(game.moderator)) { - game.spectators.push(game.moderator); - } - if (game.spectators.includes(person)) { - game.spectators.splice(game.spectators.indexOf(person), 1); - } + if (game.moderator.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) { + game.moderator.userType = globals.USER_TYPES.PLAYER; + } else if (game.moderator.gameRole) { // the current moderator was at one point a dealt-in player. + game.moderator.userType = globals.USER_TYPES.KILLED_PLAYER; // restore their state from before being made mod. + } else if (game.moderator.userType === globals.USER_TYPES.MODERATOR) { + game.moderator.userType = globals.USER_TYPES.SPECTATOR; + if (!game.spectators.includes(game.moderator)) { + game.spectators.push(game.moderator); + } + if (game.spectators.includes(person)) { + game.spectators.splice(game.spectators.indexOf(person), 1); + } + } + person.userType = globals.USER_TYPES.MODERATOR; + game.moderator = person; } - person.userType = globals.USER_TYPES.MODERATOR; - game.moderator = person; + namespace.in(game.accessCode).emit(globals.EVENTS.SYNC_GAME_STATE); } }