]> git.cworth.org Git - empires-server/blobdiff - empathy.js
To rule on the judging "Move On" button require a maority of answered players
[empires-server] / empathy.js
index ae400a6009709deceef876caa71343a1957a4d1a..eeb33c2c6be229e83155a622ee07e63be3212e9b 100644 (file)
@@ -135,8 +135,11 @@ class Empathy extends Game {
       answers: answers
     });
 
-    /* And notify all players that this player has answered. */
+    /* Update state (to be sent out to any future clients) */
+    this.state.players_answering.delete(player.name);
     this.state.players_answered.push(player.name);
+
+    /* And notify all players that this player has answered. */
     this.broadcast_event_object('player-answered', player.name);
 
     return { valid: true };
@@ -244,8 +247,11 @@ class Empathy extends Game {
       }
     }
 
-    /* And notify all players this this player has judged. */
+    /* Update state (to be sent out to any future clients) */
+    this.state.players_judging.delete(player.name);
     this.state.players_judged.push(player.name);
+
+    /* And notify all players this this player has judged. */
     this.broadcast_event_object('player-judged', player.name);
 
     return { valid: true };
@@ -514,7 +520,7 @@ router.post('/end-judging/:prompt_id([0-9]+)', (request, response) => {
   else
     response.sendStatus(404);
 
-  if (game.state.end_judging.size > (game.state.players_judged.length / 2))
+  if (game.state.end_judging.size > (game.state.players_answered.length / 2))
     game.compute_scores();
 });