@@ -295,26 +295,49 @@ export class InProgress {
295295 && ( ( p . userType !== USER_TYPES . MODERATOR && p . userType !== USER_TYPES . SPECTATOR )
296296 || p . killed )
297297 ) ;
298- this . renderGroupOfPlayers (
299- teamEvil ,
300- this . killPlayerHandlers ,
301- this . revealRoleHandlers ,
302- this . stateBucket . currentGameState . accessCode ,
303- ALIGNMENT . EVIL ,
304- this . stateBucket . currentGameState . people . find ( person =>
305- person . id === this . stateBucket . currentGameState . currentModeratorId ) . userType ,
306- this . socket
307- ) ;
308- this . renderGroupOfPlayers (
309- teamGood ,
310- this . killPlayerHandlers ,
311- this . revealRoleHandlers ,
312- this . stateBucket . currentGameState . accessCode ,
313- ALIGNMENT . GOOD ,
314- this . stateBucket . currentGameState . people . find ( person =>
315- person . id === this . stateBucket . currentGameState . currentModeratorId ) . userType ,
316- this . socket
298+ const teamIndependent = this . stateBucket . currentGameState . people . filter ( ( p ) => p . alignment === ALIGNMENT . INDEPENDENT
299+ && ( ( p . userType !== USER_TYPES . MODERATOR && p . userType !== USER_TYPES . SPECTATOR )
300+ || p . killed )
317301 ) ;
302+ if ( teamEvil . length > 0 ) {
303+ document . getElementById ( `${ ALIGNMENT . EVIL } -players` ) . style . display = 'block' ;
304+ this . renderGroupOfPlayers (
305+ teamEvil ,
306+ this . killPlayerHandlers ,
307+ this . revealRoleHandlers ,
308+ this . stateBucket . currentGameState . accessCode ,
309+ ALIGNMENT . EVIL ,
310+ this . stateBucket . currentGameState . people . find ( person =>
311+ person . id === this . stateBucket . currentGameState . currentModeratorId ) . userType ,
312+ this . socket
313+ ) ;
314+ }
315+ if ( teamGood . length > 0 ) {
316+ document . getElementById ( `${ ALIGNMENT . GOOD } -players` ) . style . display = 'block' ;
317+ this . renderGroupOfPlayers (
318+ teamGood ,
319+ this . killPlayerHandlers ,
320+ this . revealRoleHandlers ,
321+ this . stateBucket . currentGameState . accessCode ,
322+ ALIGNMENT . GOOD ,
323+ this . stateBucket . currentGameState . people . find ( person =>
324+ person . id === this . stateBucket . currentGameState . currentModeratorId ) . userType ,
325+ this . socket
326+ ) ;
327+ }
328+ if ( teamIndependent . length > 0 ) {
329+ document . getElementById ( `${ ALIGNMENT . INDEPENDENT } -players` ) . style . display = 'block' ;
330+ this . renderGroupOfPlayers (
331+ teamIndependent ,
332+ this . killPlayerHandlers ,
333+ this . revealRoleHandlers ,
334+ this . stateBucket . currentGameState . accessCode ,
335+ ALIGNMENT . INDEPENDENT ,
336+ this . stateBucket . currentGameState . people . find ( person =>
337+ person . id === this . stateBucket . currentGameState . currentModeratorId ) . userType ,
338+ this . socket
339+ ) ;
340+ }
318341 document . getElementById ( 'players-alive-label' ) . innerText =
319342 'Players: ' + this . stateBucket . currentGameState . people . filter ( ( person ) => ! person . out ) . length + ' / ' +
320343 this . stateBucket . currentGameState . gameSize + ' Alive' ;
@@ -460,9 +483,12 @@ function renderPlayerRole (gameState) {
460483 if ( gameState . client . alignment === ALIGNMENT . GOOD ) {
461484 document . getElementById ( 'game-role' ) . classList . add ( 'game-role-good' ) ;
462485 name . classList . add ( 'good' ) ;
463- } else {
486+ } else if ( gameState . client . alignment === ALIGNMENT . EVIL ) {
464487 document . getElementById ( 'game-role' ) . classList . add ( 'game-role-evil' ) ;
465488 name . classList . add ( 'evil' ) ;
489+ } else if ( gameState . client . alignment === ALIGNMENT . INDEPENDENT ) {
490+ document . getElementById ( 'game-role' ) . classList . add ( 'game-role-independent' ) ;
491+ name . classList . add ( 'independent' ) ;
466492 }
467493 name . setAttribute ( 'title' , gameState . client . gameRole ) ;
468494 if ( gameState . client . out ) {
0 commit comments