Skip to content

Commit

Permalink
Merge pull request #95 from lycan-city/game-with-language
Browse files Browse the repository at this point in the history
Game with language
  • Loading branch information
vetom authored Feb 24, 2019
2 parents e005eb0 + 1622604 commit 14a4192
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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);
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "werewolf-brain",
"version": "2.2.1",
"version": "2.2.2",
"description": "Werewolf game brain",
"scripts": {
"test": "mocha tests --recursive",
Expand Down
4 changes: 3 additions & 1 deletion src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function newGame() {
gameCandidate = {
deck: {},
weight: 100,
players: 0
players: 0,
language: '',
};
}

Expand Down Expand Up @@ -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;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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();
});
Expand Down

0 comments on commit 14a4192

Please sign in to comment.