From 7b2c781d3ef68e9966a07226a502e07326188172 Mon Sep 17 00:00:00 2001 From: antoinezanardi Date: Sun, 31 Jan 2021 13:28:54 +0100 Subject: [PATCH] feat(Game): Game option for no sheriff. Closes #102 --- CHANGELOG.md | 3 ++- package-lock.json | 12 ++++++------ package.json | 2 +- src/classes/Game.js | 2 +- src/components/Game/GameContent/GameContent.vue | 2 +- .../GamePlayFieldContent/ElectSheriffPlayField.vue | 4 +++- .../GamePlayFieldTutorial/GamePlayFieldTutorial.vue | 9 +++++---- src/components/shared/Game/GameResult/GameResult.vue | 8 +++++--- src/plugins/vue-i18n/fr.json | 5 +++-- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c46b8e..c85422e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * [#96](https://github.com/antoinezanardi/werewolves-assistant-web/issues/96) - Implement the Vile Father Of Wolves role. * [#99](https://github.com/antoinezanardi/werewolves-assistant-web/issues/99) - Display revealed players * [#100](https://github.com/antoinezanardi/werewolves-assistant-web/issues/100) - Implement the Ancient role. +* [#102](https://github.com/antoinezanardi/werewolves-assistant-web/issues/102) - Game option for no sheriff. * [#103](https://github.com/antoinezanardi/werewolves-assistant-web/issues/103) - Implement the Scapegoat role. * [#104](https://github.com/antoinezanardi/werewolves-assistant-web/issues/104) - Implement the Idiot role. * [#111](https://github.com/antoinezanardi/werewolves-assistant-web/issues/111) - Add game sides in modal for smaller screens. @@ -48,7 +49,7 @@ * `@vue/cli-plugin-vuex` updated to version `4.5.11`. * `@vue/cli-service` updated to version `4.5.11`. * `bootstrap` updated to version `4.6.0`. -* `eslint` updated to version `7.18.0`. +* `eslint` updated to version `7.19.0`. * `eslint-plugin-vue` updated to version `7.5.0`. * `qs` updated to version `6.9.6`. * `sass-loader` updated to version `10.1.1`. diff --git a/package-lock.json b/package-lock.json index b353566..e6ff01a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4678,9 +4678,9 @@ } }, "eslint": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", - "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz", + "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -5932,9 +5932,9 @@ } }, "flatted": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz", - "integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, "flush-write-stream": { diff --git a/package.json b/package.json index 69acd13..d2331f7 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@vue/eslint-config-airbnb": "^5.3.0", "@vue/test-utils": "^1.1.2", "chai": "^4.1.2", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-vue": "^7.5.0", "vue-template-compiler": "^2.6.12" diff --git a/src/classes/Game.js b/src/classes/Game.js index f0a1903..342d84f 100644 --- a/src/classes/Game.js +++ b/src/classes/Game.js @@ -140,7 +140,7 @@ class Game { const oneTargetActions = ["look", "eat", "protect", "shoot", "settle-votes", "delegate", "choose-model", "use-potion"]; const twoTargetsActions = ["charm"]; const noLimitActions = ["ban-voting"]; - if (oneTargetActions.includes(to)) { + if (oneTargetActions.includes(to) || to === "charm" && this.piedPiperTargets.length === 1) { return 1; } else if (twoTargetsActions.includes(to)) { return 2; diff --git a/src/components/Game/GameContent/GameContent.vue b/src/components/Game/GameContent/GameContent.vue index c3c4c52..401399b 100644 --- a/src/components/Game/GameContent/GameContent.vue +++ b/src/components/Game/GameContent/GameContent.vue @@ -118,7 +118,7 @@ export default { } }, generateGamePhaseEvent() { - if (this.game.tick === 2) { + if (!this.game.options.roles.sheriff.enabled && this.game.tick === 1 || this.game.options.roles.sheriff.enabled && this.game.tick === 2) { return this.events.push(new GameEvent({ type: "night-falls" })); } else if (this.game.history.length && (this.game.phase !== this.game.history[0].phase || this.game.turn !== this.game.history[0].turn)) { diff --git a/src/components/Game/GameContent/GamePlayField/GamePlayFieldContent/ElectSheriffPlayField.vue b/src/components/Game/GameContent/GamePlayField/GamePlayFieldContent/ElectSheriffPlayField.vue index f1e30ac..fafe8bf 100644 --- a/src/components/Game/GameContent/GamePlayField/GamePlayFieldContent/ElectSheriffPlayField.vue +++ b/src/components/Game/GameContent/GamePlayField/GamePlayFieldContent/ElectSheriffPlayField.vue @@ -1,10 +1,11 @@