Skip to content

Commit

Permalink
feat(Game): List of voters against one player below him. Closes #156
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Apr 22, 2021
1 parent e7fe57f commit 4bb2109
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 50 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

### 🌟 Enhancements

* [#156](https://github.com/antoinezanardi/werewolves-assistant-web/issues/156) - List of voters against one player below him.
* [#180](https://github.com/antoinezanardi/werewolves-assistant-web/issues/180) - Role types.
* [#182](https://github.com/antoinezanardi/werewolves-assistant-web/issues/182) - Accordions in About page for roles.
* [#185](https://github.com/antoinezanardi/werewolves-assistant-web/issues/185) - Reset base rules button in game roles options.
Expand All @@ -34,8 +35,8 @@
* `vue-slider-component` installed with version `3.2.11`.
* `vuedraggable` installed with version `2.24.3`.
* `@fortawesome/fontawesome-free` updated to version `5.15.3`.
* `@sentry/browser` updated to version `6.2.5`.
* `@sentry/integrations` updated to version `6.2.5`.
* `@sentry/browser` updated to version `6.3.0`.
* `@sentry/integrations` updated to version `6.3.0`.
* `@vue/cli-plugin-e2e-cypress` updated to version `4.5.12`.
* `@vue/cli-plugin-eslint` updated to version `4.5.12`.
* `@vue/cli-plugin-router` updated to version `4.5.12`.
Expand Down
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dependencies": {
"@chenfengyuan/vue-countdown": "^1.1.5",
"@fortawesome/fontawesome-free": "^5.15.3",
"@sentry/browser": "^6.2.5",
"@sentry/integrations": "^6.2.5",
"@sentry/browser": "^6.3.0",
"@sentry/integrations": "^6.3.0",
"animate.css": "^4.1.1",
"axios": "^0.21.1",
"bootstrap": "^4.6.0",
Expand Down
2 changes: 2 additions & 0 deletions src/components/Game/GameContent/GameContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ export default {
this.events.push(new GameEvent({ type: `no-death-after-votes`, targets: this.game.history[0].play.targets }));
} else if (lastGameHistoryEntry.play.action === "choose-card") {
this.events.push(new GameEvent({ type: `thief-chooses-card`, targets: [{ player: this.game.originalThiefPlayer }] }));
} else if (lastGameHistoryEntry.play.action === "sniff") {
this.events.push(new GameEvent({ type: `fox-sniffs`, targets: this.game.history[0].play.targets }));
}
}
},
Expand Down
12 changes: 12 additions & 0 deletions src/components/Game/GameEventMonitor/GameEvent/GameEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,23 @@ export default {
messages: [i18n.t("GameEvent.messages.foxStarts")],
soundEffect: "fox-plays",
},
"fox-sniffs": {
messages: [
...insertIf(!this.hasGameEventTargets, i18n.t("GameEvent.messages.foxSkipsHisTurn")),
...insertIf(this.hasGameEventTargets, i18n.t("GameEvent.messages.foxSniffs")),
...insertIf(this.hasGameEventTargets && this.doTargetsIncludeWerewolf, i18n.t("GameEvent.messages.foxFoundWerewolf")),
...insertIf(this.hasGameEventTargets && !this.doTargetsIncludeWerewolf, i18n.t("GameEvent.messages.foxDidntFoundWerewolf")),
],
soundEffect: "fox-plays",
},
};
},
hasGameEventTargets() {
return !!this.event.targets.length;
},
doTargetsIncludeWerewolf() {
return this.event.targets.find(({ player }) => player.side.current === "werewolves");
},
gameEventMessages() {
return this.gameEventMetadata[this.event.type] ? this.gameEventMetadata[this.event.type].messages : [];
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import ravenMarkSVG from "@/assets/svg/attributes/raven-marked.svg";
import eatenSVG from "@/assets/svg/attributes/eaten.svg";
import voteSVG from "@/assets/svg/actions/vote.svg";
import thiefSVG from "@/assets/svg/roles/thief.svg";
import foxSVG from "@/assets/svg/roles/fox.svg";
export default {
name: "GameEventImage",
Expand Down Expand Up @@ -98,6 +99,7 @@ export default {
"player-starts-game-revealed": seenSVG,
"no-death-after-votes": voteSVG,
"thief-chooses-card": thiefSVG,
"fox-sniffs": foxSVG,
};
return effectGameEventTypeImageSource[this.event.type];
},
Expand Down
11 changes: 8 additions & 3 deletions src/components/shared/Game/PlayField/CancelActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
<span v-html="$t('CancelActionButton.cancel')"/>
<i class="fa fa-times-circle ml-2"/>
</span>
<span v-else-if="!targetedPlayersForAttribute.length && game.isFirstWaitingSkippableAction"
class="text-muted d-flex align-items-center small font-italic font-weight-bold">
<span v-else class="text-muted d-flex align-items-center small font-italic font-weight-bold">
<i class="fa fa-chevron-down animate__animated animate__slow animate__swing animate__infinite mr-2"/>
<span v-html="$t('CancelActionButton.chooseTargetIfNot')"/>
<span v-html="noTargetSelectedText"/>
</span>
</transition>
</template>
Expand Down Expand Up @@ -42,6 +41,12 @@ export default {
}
return "";
},
noTargetSelectedText() {
if (this.game.isFirstWaitingSkippableAction) {
return this.$t("CancelActionButton.chooseTargetIfNot");
}
return this.$t("CancelActionButton.pleaseChooseTarget");
},
},
methods: {
cancelAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<div class="player-voters mt-1">
<transition-group tag="div" name="translate-down-fade">
<PlayerVoter v-for="voter of votersAgainstPlayer" :key="voter._id" :player="voter"/>
<i v-if="player.hasActiveAttribute('raven-marked', game)" key="raven-mark" v-tooltip="ravenMarkTooltip"
class="fa fa-crow mx-1"/>
</transition-group>
</div>
</div>
Expand Down Expand Up @@ -75,6 +77,10 @@ export default {
voteText() {
return this.player.canVote(this.game) ? this.$t("PlayerVote.voteFor") : this.$t("PlayerVote.cantVote");
},
ravenMarkTooltip() {
const { markPenalty } = this.game.options.roles.raven;
return this.$tc("PlayerVote.playerIsRavenMarked", markPenalty, { markPenalty });
},
},
methods: {
filterByPlayerName(option, search) {
Expand Down
18 changes: 15 additions & 3 deletions src/components/shared/Game/PlayerVotes/PlayerVote/PlayerVoter.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<i v-tooltip="voterTooltip" class="fa fa-user mx-1"/>
<i v-tooltip="voterTooltip" class="fa mx-1" :class="voterClasses"/>
</template>

<script>
Expand All @@ -17,10 +17,22 @@ export default {
computed: {
...mapGetters("game", { game: "game" }),
voterTooltip() {
let content;
if (this.game.firstWaiting.to === "vote") {
return this.$t("PlayerVoter.voterWantsThisPlayerToBeHanged", this.player);
content = this.$t("PlayerVoter.voterWantsThisPlayerToBeHanged", this.player);
if (this.hasVoterDoubleVote) {
content += `<hr class="bg-dark my-1"/><span class="font-italic">${this.$t("PlayerVoter.voteIsDoubled")}</span>`;
}
} else {
content = this.$t("PlayerVoter.voterWantsThisPlayerToBeSheriff", this.player);
}
return this.$t("PlayerVoter.voterWantsThisPlayerToBeSheriff", this.player);
return { content };
},
voterClasses() {
return this.player.hasActiveAttribute("sheriff", this.game) ? "fa-user text-warning" : "fa-user";
},
hasVoterDoubleVote() {
return this.player.hasActiveAttribute("sheriff", this.game) && this.game.options.roles.sheriff.hasDoubledVote;
},
},
};
Expand Down
14 changes: 10 additions & 4 deletions src/plugins/vue-i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -967,11 +967,13 @@
"voteFor": "Vote pour",
"none": "Personne",
"playerHasVoted": "Ce joueur a voté",
"cantVote": "n'a pas le droit de voter"
"cantVote": "n'a pas le droit de voter",
"playerIsRavenMarked": "Ce joueur a 1 vote contre lui à cause de la marque du Corbeau | Ce joueur a {markPenalty} votes contre lui à cause de la marque du Corbeau"
},
"PlayerVoter": {
"voterWantsThisPlayerToBeSheriff": "{name} vote pour que ce joueur soit maire",
"voterWantsThisPlayerToBeHanged": "{name} vote pour que ce joueur soit pendu"
"voterWantsThisPlayerToBeHanged": "{name} vote pour que ce joueur soit pendu",
"voteIsDoubled": "Étant le maire, son vote compte double"
},
"GameVillagersSide": {
"villagers": "Villageois",
Expand Down Expand Up @@ -1267,7 +1269,8 @@
"cancel": "Annuler",
"cancelTarget": "Annuler cette cible",
"cancelSide": "Annuler le choix du camp",
"chooseTargetIfNot": "Choisissez une cible dans le cas contraire"
"chooseTargetIfNot": "Choisissez une cible dans le cas contraire",
"pleaseChooseTarget": "Veuillez choisir une cible"
},
"SelectAllTargetsButton": {
"selectAll": "Tout sélectionner",
Expand Down Expand Up @@ -1368,7 +1371,10 @@
"thiefChoosesCard": "Si le Voleur a choisi une carte, le maître du jeu va procéder à l'échange. Les deux cartes restantes sont replacées faces cachées au centre de la table.",
"stutteringJudgeStarts": "Le Juge Bègue se réveille et va convenir d'un signe avec le maître du jeu. Ce signe réalisé pendant un vote en déclenchera un second juste après l'annonce de la victime.",
"whiteWerewolfStarts": "Le Loup-Garou Blanc se réveille et va, s'il le souhaite, dévorer l'un de ses congénères.",
"foxStarts": "Le Renard se réveille et va, s'il le souhaite, flaire un groupe de joueurs pour espérer débusquer un Loup-Garou."
"foxStarts": "Le Renard se réveille et va, s'il le souhaite, flaire un groupe de joueurs pour espérer débusquer un Loup-Garou.",
"foxSniffs": "Le Renard a décidé de flairer un potentiel canidé dans un groupe de joueurs. La maître du jeu va devoir mimer la phrase suivante au Renard.",
"foxFoundWerewolf": "Le Renard a flairé un Loup-Garou ! Faites un pouce vers le haut pour l'informer du résultat de son enquête.",
"foxDidntFindWerewolf": "Le Renard n'a flairé aucun Loup-Garou ! Faites un pouce vers le bas pour l'informer du résultat de son enquête."
}
},
"Statistics": {
Expand Down

0 comments on commit 4bb2109

Please sign in to comment.