Skip to content

Commit

Permalink
feat(GameOptions): Wild Child transformation is revealed option. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Apr 26, 2021
1 parent 55d2206 commit ad6b7f4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* [#166](https://github.com/antoinezanardi/werewolves-assistant-web/issues/166) - Number of vote requests for Stuttering Judge option.
* [#167](https://github.com/antoinezanardi/werewolves-assistant-web/issues/167) - Time for the Sheriff to be elected option.
* [#168](https://github.com/antoinezanardi/werewolves-assistant-web/issues/168) - Thief not obliged to choose between werewolves cards option.
* [#169](https://github.com/antoinezanardi/werewolves-assistant-web/issues/169) - Wild Child transformation is revealed option.
* [#170](https://github.com/antoinezanardi/werewolves-assistant-web/issues/170) - Dog Wolf chosen side is revealed option.
* [#183](https://github.com/antoinezanardi/werewolves-assistant-web/issues/183) - Audio options in parameters modal.
* [#188](https://github.com/antoinezanardi/werewolves-assistant-web/issues/188) - Modal for helping players with roles.
Expand Down
5 changes: 5 additions & 0 deletions src/components/Game/GameContent/GameContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export default {
if (!this.game.history.length) {
return;
}
const { wildChildPlayer, options } = this.game;
const { deadPlayers, revealedAlivePlayers, phase: previousPhase, turn: previousTurn } = this.game.history[0];
if (this.game.phase === "day" && previousPhase === "night" ||
previousPhase === "night" && this.game.phase === "night" && previousTurn !== this.game.turn) {
Expand All @@ -181,6 +182,10 @@ export default {
}
for (const deadPlayer of deadPlayers) {
this.events.push(new GameEvent({ type: "player-dies", targets: [{ player: deadPlayer }] }));
if (options.roles.wildChild.isTransformationRevealed && deadPlayer.hasAttribute("worshiped") &&
wildChildPlayer.side.current === "werewolves") {
this.events.push(new GameEvent({ type: "wild-child-joins-werewolves", targets: [{ player: wildChildPlayer }] }));
}
}
for (const revealedPlayer of revealedAlivePlayers) {
this.events.push(new GameEvent({ type: "player-role-revealed", targets: [{ player: revealedPlayer }] }));
Expand Down
11 changes: 9 additions & 2 deletions src/components/Game/GameEventMonitor/GameEvent/GameEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default {
"bear-growls": this.gameEventBearGrowlsMetadata,
"bear-stays-calm": this.gameEventBearStaysCalmMetadata,
"dog-wolf-chooses-side": this.gameEventDogWolfChoosesSideMetadata,
"wild-child-joins-werewolves": this.gameEventWildChildJoinsWerewolvesMetadata,
...this.gameEventTurnMetadata,
};
},
Expand Down Expand Up @@ -455,15 +456,21 @@ export default {
soundEffect: "bear-growls",
};
},
gameEventBearStaysCalmMetadata() {
return { messages: [i18n.t("GameEvent.messages.bearStaysCalm")] };
},
gameEventDogWolfChoosesSideMetadata() {
const chosenSideText = this.event.side === "werewolves" ? "dogWolfHasChosenWerewolves" : "dogWolfHasChosenVillagers";
return {
messages: [i18n.t(`GameEvent.messages.${chosenSideText}`)],
soundEffect: "dog-wolf-plays",
};
},
gameEventBearStaysCalmMetadata() {
return { messages: [i18n.t("GameEvent.messages.bearStaysCalm")] };
gameEventWildChildJoinsWerewolvesMetadata() {
return {
messages: [i18n.t("GameEvent.messages.wildChildJoinsWerewolves")],
soundEffect: "big-bad-wolf-plays",
};
},
hasGameEventTargets() {
return !!this.event.targets.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default {
"thief-chooses-card": thiefSVG,
"fox-sniffs": foxSVG,
"dog-wolf-chooses-side": this.event.side === "werewolves" ? eatenSVG : villagerSVG,
"wild-child-joins-werewolves": eatenSVG,
};
return effectGameEventTypeImageSource[this.event.type];
},
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/vue-i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,8 @@
"growBecauseInfected": "Ou alors ... que le Montreur d'Ours a été infecté et est lui-même un Loup-Garou !",
"bearStaysCalm": "L'Ours du Montreur est d'un calme exemplaire ce matin, il n'a donc pas de canidé comme voisin direct.",
"dogWolfHasChosenWerewolves": "Le Chien-Loup a décidé de rejoindre les Loups-Garous. Son instinct animal a pris le dessus sur sa loyauté...",
"dogWolfHasChosenVillagers": "Le Chien-Loup a décidé de rester avec les Villageois. Sa loyauté envers ses maîtres est remarquable !"
"dogWolfHasChosenVillagers": "Le Chien-Loup a décidé de rester avec les Villageois. Sa loyauté envers ses maîtres est remarquable !",
"wildChildJoinsWerewolves": "Ce joueur tout juste décédé était le modèle de l'Enfant Sauvage ! La colère et la rage de ce dernier réveille son instinct animal, il rejoint donc le camp des Loups-Garous, sa véritable nature."
}
},
"Statistics": {
Expand Down

0 comments on commit ad6b7f4

Please sign in to comment.