Lesterpig/openparty-mafia

View on GitHub
stages/mafia_after.js

Summary

Maintainability
A
0 mins
Test Coverage
// The second part of the night
module.exports = function() {

  return {
    start: function(room, callback) {
      var duration = 0;
      room.players.forEach(function(p) {
        var r = p.player.roles;
        if(r.dead) return;
        for(var role in r) {
          if(r[role].afterMafia) {
            duration = 20;
          }
        }
      });
      callback(null, duration);
    },
    end: function(room, callback) {
      if(!room.gameplay.gamemasterMode) {
        room.nextStage("vote");
      } else {
        room.nextStage("wait");
      }
    }
  };

};