Skip to content

Commit

Permalink
refactor(accursed-wolf-father): rename vile-father-of-wolves to accur…
Browse files Browse the repository at this point in the history
…sed-wolf-father according to official rulebook (#697)

Closes #683
  • Loading branch information
antoinezanardi committed Nov 30, 2023
1 parent 493147f commit a3ea194
Show file tree
Hide file tree
Showing 32 changed files with 20,044 additions and 20,057 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Vile Father of Wolves Role" type="js.build_tools.npm" folderName="Cucumber Tags">
<configuration default="false" name="Accursed Wolf-Father Role" type="js.build_tools.npm" folderName="Cucumber Tags">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="test:cucumber" />
</scripts>
<arguments value="-- --tags &quot;@vile-father-of-wolves-role&quot;" />
<arguments value="-- --tags &quot;@accursed-wolf-father-role&quot;" />
<node-interpreter value="project" />
<envs />
<method v="2" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This is the **next** version of the current **[Werewolves Assistant API](https:/

**27 different official roles** are available to play :

| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/werewolf/werewolf-small.jpeg?raw=true" width="40"/><br/>**Werewolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/big-bad-wolf/big-bad-wolf-small.jpeg?raw=true" width="40"/><br/>**Big Bad Wolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/vile-father-of-wolves/vile-father-of-wolves-small.jpeg?raw=true" width="40"/><br/>**Vile Father Of Wolves** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/white-werewolf/white-werewolf-small.jpeg?raw=true" width="40"/><br/>**White Werewolf** |
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/werewolf/werewolf-small.jpeg?raw=true" width="40"/><br/>**Werewolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/big-bad-wolf/big-bad-wolf-small.jpeg?raw=true" width="40"/><br/>**Big Bad Wolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/accursed-wolf-father/accursed-wolf-father-small.jpeg?raw=true" width="40"/><br/>**Accursed Wolf-Father** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/white-werewolf/white-werewolf-small.jpeg?raw=true" width="40"/><br/>**White Werewolf** |
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/villager/villager-small.jpeg?raw=true" width="40"/><br/>**Villager** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/villager/villager-small.jpeg?raw=true" width="40"/><br/> **Villager-Villager** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/seer/seer-small.jpeg?raw=true" width="40"/><br/>**Seer** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/cupid/cupid-small.jpeg?raw=true" width="40"/><br/>**Cupid** |
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/witch/witch-small.jpeg?raw=true" width="40"/><br/>**Witch** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/hunter/hunter-small.jpeg?raw=true" width="40"/><br/>**Hunter** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/little-girl/little-girl-small.jpeg?raw=true" width="40"/><br/>**Little Girl** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/defender/defender-small.jpeg?raw=true" width="40"/><br/>**Defender** |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MakeGamePlayTargetDto {
@IsMongoId()
public playerId: Types.ObjectId;

@ApiProperty({ description: `Can be set only if there is a \`vile father of wolves\` in the game and game's upcoming action is \`${GamePlayActions.EAT}\`. If set to \`true\`, the \`werewolves\` victim will instantly join the \`werewolves\` side if possible.` })
@ApiProperty({ description: `Can be set only if there is a \`accursed wolf-father\` in the game and game's upcoming action is \`${GamePlayActions.EAT}\`. If set to \`true\`, the \`werewolves\` victim will instantly join the \`werewolves\` side if possible.` })
@IsOptional()
@IsBoolean()
@Expose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class GameHistoryRecordRepository {
return this.gameHistoryRecordModel.find(filter);
}

public async getGameHistoryVileFatherOfWolvesInfectedRecords(gameId: Types.ObjectId): Promise<GameHistoryRecord[]> {
public async getGameHistoryAccursedWolfFatherInfectedRecords(gameId: Types.ObjectId): Promise<GameHistoryRecord[]> {
const filter: FilterQuery<GameHistoryRecord> = {
gameId,
"play.action": GamePlayActions.EAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class GameHistoryRecordService {
return this.gameHistoryRecordRepository.getGameHistoryWitchUsesSpecificPotionRecords(gameId, potion);
}

public async getGameHistoryVileFatherOfWolvesInfectedRecords(gameId: Types.ObjectId): Promise<GameHistoryRecord[]> {
return this.gameHistoryRecordRepository.getGameHistoryVileFatherOfWolvesInfectedRecords(gameId);
public async getGameHistoryAccursedWolfFatherInfectedRecords(gameId: Types.ObjectId): Promise<GameHistoryRecord[]> {
return this.gameHistoryRecordRepository.getGameHistoryAccursedWolfFatherInfectedRecords(gameId);
}

public async getGameHistoryJudgeRequestRecords(gameId: Types.ObjectId): Promise<GameHistoryRecord[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export class GamePlayValidatorService {
if (!infectedTargets.length) {
return;
}
const hasVileFatherOfWolvesInfected = (await this.gameHistoryRecordService.getGameHistoryVileFatherOfWolvesInfectedRecords(game._id)).length > 0;
const vileFatherOfWolvesPlayer = getPlayerWithCurrentRole(game, RoleNames.VILE_FATHER_OF_WOLVES);
if (!vileFatherOfWolvesPlayer || !isPlayerAliveAndPowerful(vileFatherOfWolvesPlayer, game) || hasVileFatherOfWolvesInfected) {
const hasAccursedWolfFatherInfected = (await this.gameHistoryRecordService.getGameHistoryAccursedWolfFatherInfectedRecords(game._id)).length > 0;
const accursedWolfFatherPlayer = getPlayerWithCurrentRole(game, RoleNames.ACCURSED_WOLF_FATHER);
if (!accursedWolfFatherPlayer || !isPlayerAliveAndPowerful(accursedWolfFatherPlayer, game) || hasAccursedWolfFatherInfected) {
throw new BadGamePlayPayloadException(BadGamePlayPayloadReasons.UNEXPECTED_INFECTED_TARGET);
}
this.validateGamePlayTargetsBoundaries(infectedTargets, { min: 1, max: 1 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const GAME_HISTORY_RECORD_PLAY_TARGET_API_PROPERTIES: ReadonlyDeep<Record<keyof
...convertMongoosePropOptionsToApiPropertyOptions(GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS.player),
},
isInfected: {
description: "Only if there is the `vile father of wolves` in the game and the action is eat from werewolves. If set to `true`, the target joined the werewolves side",
description: "Only if there is the `accursed wolf-father` in the game and the action is eat from werewolves. If set to `true`, the target joined the werewolves side",
...convertMongoosePropOptionsToApiPropertyOptions(GAME_HISTORY_RECORD_PLAY_TARGET_FIELDS_SPECS.isInfected),
},
drankPotion: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const PIED_PIPER_GAME_OPTIONS_API_PROPERTIES: ReadonlyDeep<Record<keyof PiedPipe
...convertMongoosePropOptionsToApiPropertyOptions(PIED_PIPER_GAME_OPTIONS_FIELDS_SPECS.charmedPeopleCountPerNight),
},
isPowerlessIfInfected: {
description: "If set to `true`, `pied piper` will be `powerless` if he is infected by the `vile father of wolves`",
description: "If set to `true`, `pied piper` will be `powerless` if he is infected by the `accursed wolf-father`",
...convertMongoosePropOptionsToApiPropertyOptions(PIED_PIPER_GAME_OPTIONS_FIELDS_SPECS.isPowerlessIfInfected),
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/modules/role/constants/role.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const WEREWOLF_ROLES: ReadonlyDeep<Role[]> = plainToInstance(Role, [
recommendedMinPlayers: 15,
},
{
name: RoleNames.VILE_FATHER_OF_WOLVES,
name: RoleNames.ACCURSED_WOLF_FATHER,
side: RoleSides.WEREWOLVES,
type: RoleTypes.WEREWOLF,
origin: RoleOrigins.CHARACTERS,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/role/enums/role.enum.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enum RoleNames {
WEREWOLF = "werewolf",
BIG_BAD_WOLF = "big-bad-wolf",
VILE_FATHER_OF_WOLVES = "vile-father-of-wolves",
ACCURSED_WOLF_FATHER = "accursed-wolf-father",
WHITE_WEREWOLF = "white-werewolf",
VILLAGER = "villager",
VILLAGER_VILLAGER = "villager-villager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Feature: 🎲 Game Creation
Given a created game with the following players
| name | role |
| Antoine | werewolf |
| Olivia | vile-father-of-wolves |
| Olivia | accursed-wolf-father |
| JB | big-bad-wolf |
| Thomas | white-werewolf |
Then the request should have failed with status code 400
Expand Down Expand Up @@ -158,7 +158,7 @@ Feature: 🎲 Game Creation
And the request exception error should be "Bad Request"
And the request exception messages should be
| message |
| players.4.role.name must be one of the following values: werewolf, big-bad-wolf, vile-father-of-wolves, white-werewolf, villager, villager-villager, seer, cupid, witch, hunter, little-girl, defender, elder, scapegoat, idiot, two-sisters, three-brothers, fox, bear-tamer, stuttering-judge, rusty-sword-knight, thief, wild-child, wolf-hound, angel, pied-piper, scandalmonger |
| players.4.role.name must be one of the following values: werewolf, big-bad-wolf, accursed-wolf-father, white-werewolf, villager, villager-villager, seer, cupid, witch, hunter, little-girl, defender, elder, scapegoat, idiot, two-sisters, three-brothers, fox, bear-tamer, stuttering-judge, rusty-sword-knight, thief, wild-child, wolf-hound, angel, pied-piper, scandalmonger |

Scenario: 🎲 Game can't be created if there is only one of the two sisters

Expand Down Expand Up @@ -525,12 +525,12 @@ Feature: 🎲 Game Creation
| message |
| players.role can't exceed role maximum occurrences in game. Please check `maxInGame` property of roles |

Scenario: 🎲 Game can't be created if there are two vile father of wolves
Scenario: 🎲 Game can't be created if there are two accursed wolf-father

Given a created game with the following players
| name | role |
| Antoine | vile-father-of-wolves |
| Olivia | vile-father-of-wolves |
| Antoine | accursed-wolf-father |
| Olivia | accursed-wolf-father |
| JB | idiot |
| Thomas | werewolf |
Then the request should have failed with status code 400
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Feature: 📜 Game History
| name | role |
| Antoine | seer |
| Juju | witch |
| Doudou | vile-father-of-wolves |
| Doudou | accursed-wolf-father |
| JB | defender |
| Thomas | scandalmonger |
Then the game's current play should be seer to look
Expand Down Expand Up @@ -277,7 +277,7 @@ Feature: 📜 Game History
Then the play's targets from the previous history record should be undefined
And the game's current play should be werewolves to eat

When the vile father of wolves infects the player named Thomas
When the accursed wolf-father infects the player named Thomas
And the most recent history record is retrieved
Then the play's targets from the previous history record should be the following players
| name |
Expand Down

0 comments on commit a3ea194

Please sign in to comment.