diff --git a/README.md b/README.md index 52762f4..792fb84 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Game for ***p*** players, weight ***w*** and the cards ( ***v*** Villagers and { key: 'werewolf', amount: f, role: 'Werewolf', description: 'Werewolf description'}, { key: 'mason', amount: m, role: 'Mason', description: 'Mason description'} ], - lang: en, + language: en, weight : w, players : p }; @@ -307,5 +307,5 @@ kills everyone every night. The function will return a game object. deck: customCards, mode: 'CHAOS' }; - const game = wwb.getChaosGame(players, options); + const game = wwb.getGame(players, options); ``` diff --git a/package.json b/package.json index 1dad4f9..73ebf5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "werewolf-brain", - "version": "2.2.1", + "version": "2.2.2", "description": "Werewolf game brain", "scripts": { "test": "mocha tests --recursive", diff --git a/src/game.js b/src/game.js index db18cd1..f1f1ef8 100644 --- a/src/game.js +++ b/src/game.js @@ -33,7 +33,8 @@ function newGame() { gameCandidate = { deck: {}, weight: 100, - players: 0 + players: 0, + language: '', }; } @@ -129,6 +130,7 @@ function getGame(players, language, chosenCards, gameMode) { } gameCandidate.deck = languages.translateDeck(gameCandidate.deck, language); gameCandidate.screenplay = screenplayFromGame(gameCandidate.deck, chosenCards); + gameCandidate.language = language; return gameCandidate; } diff --git a/tests/game.js b/tests/game.js index 1294455..bcea299 100644 --- a/tests/game.js +++ b/tests/game.js @@ -35,6 +35,10 @@ describe('Game', () => { this.game.should.not.be.empty(); }); + it('should contain the language on each normal game created.', function () { + this.game.should.have.property('language').which.is.a.String(); + }); + it('should contain the weight on each normal game created.', function () { this.game.should.have.property('weight').which.is.a.Number(); }); @@ -65,6 +69,10 @@ describe('Game', () => { this.game.should.not.be.empty(); }); + it('should contain the language on each chaos game created.', function () { + this.game.should.have.property('language').which.is.a.String(); + }); + it('should contain the weight on each chaos game created.', function () { this.game.should.have.property('weight').which.is.a.Number(); });