End conditions #40

Merged
thorsten-rausch merged 3 commits from end_conditions into main 2021-06-18 11:32:58 +00:00
Showing only changes of commit 0e4fd19933 - Show all commits

View File

@ -1,11 +1,10 @@
const Player = require('./Player');
const Hunter = require("./Hunter");
class Game {
static MAX_PLAYERS = 4;
static WIN_POSITION = 16;
static STATUS = {
SETTING_UP: 0,
ONGOING: 1,
@ -83,7 +82,7 @@ class Game {
update_game_status() {
if (!this.players.some(player => player.isAlive === true)) this.currentStatus = Game.STATUS.IS_DRAW;
let index = this.players.findIndex(player => player.position > 15);
let index = this.players.findIndex(player => player.position >= Game.WIN_POSITION);
if (index !== -1) {
this.currentStatus = Game.STATUS.IS_WON;
this.winnerIndex = index;