Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(elder): elder has taken revenge event #656

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

antoinezanardi
Copy link
Owner

@antoinezanardi antoinezanardi commented Jul 19, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new game event: Elder taking revenge, with associated visuals and audio effects.
    • Added functionality to track player attribute alterations in game history.
    • New options for game setup affecting the Elder's gameplay.
    • Enhanced event handling with a dedicated component for Elder's revenge event.
  • Bug Fixes

    • Improved import statements for clarity and consistency in component mapping.
  • Documentation

    • Added new localization entries for game events in English, enhancing narrative depth.
  • Tests

    • Expanded test coverage for game events, particularly focusing on the Elder's role and related attributes.
  • Chores

    • Streamlined pre-commit and commit message hook scripts for better efficiency.

@antoinezanardi antoinezanardi added the 🚀 feature New feature or request label Jul 19, 2024
@antoinezanardi antoinezanardi self-assigned this Jul 19, 2024
Copy link

coderabbitai bot commented Jul 19, 2024

Walkthrough

This update enhances the game framework significantly, focusing on the Elder role and its associated events. Key changes include new Vue components for event handling, optimized event generation logic, streamlined commit hooks, and added localization entries. The overall improvements enrich gameplay and player interaction, making the game more dynamic and enjoyable.

Changes

Files Change Summary
.husky/... Removed shebang lines and Husky script sourcing to simplify execution context in commit hooks.
.run/Elder Role.run.xml Introduced a new XML configuration for Cucumber.js testing specific to the Elder Role scenario.
app/components/pages/game/GameElderHasTakenRevengeEvent/..., app/components/pages/game/GameEventsMonitorCurrentEvent/... Added a Vue component for the Elder's revenge event and updated event mappings to improve clarity and functionality.
app/composables/api/game/constants/game-history-record/game-history-record.constants.ts, app/composables/api/game/game-event/useGameEventsGenerator.ts Introduced new constants and composable functions to manage player attribute alterations and streamline event generation logic.
app/composables/api/game/game-history-record/useGameLastHistoryRecord.ts, app/composables/api/game/game-play/useCurrentGamePlay.ts Enhanced composables with new methods and improved parameter flexibility for better usability.
app/stores/game/game-event/constants/game-event.constants.ts, app/stores/game/game-event/useGameEventsStore.ts Updated game event types and refactored logic in the store to simplify event handling processes.
modules/i18n/locales/en.json, modules/i18n/locales/fr.json Added localization strings for the new Elder revenge event in both English and French.
tests/... Expanded test coverage to include new features and ensure functionality across components and composables related to the Elder role.

Sequence Diagram(s)

sequenceDiagram
    participant Player
    participant Game
    participant Elder
    participant EventGenerator
    participant EventHandler

    Player->>Game: Start Game
    Game->>Elder: Assign Elder Role
    Player->>Elder: Trigger Revenge
    Elder->>EventGenerator: Generate Event
    EventGenerator->>EventHandler: Handle Revenge Event
    EventHandler->>Player: Notify Revenge Outcome
Loading

🐇 In the meadow soft and bright,
A tale of Elder takes its flight.
With thunder's roar and vengeful might,
Villagers tremble in the night!
New events and code refined,
A game more fun, a joy defined! ✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2b6f4be and 219c12e.

Files ignored due to path filters (4)
  • public/audio/sound-effects/thunder.mp3 is excluded by !**/*.mp3
  • public/audio/sound-effects/thunder.webm is excluded by !**/*.webm
  • public/svg/misc/storm.svg is excluded by !**/*.svg
  • tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameElderHasTakenRevengeEvent/__snapshots__/GameElderHasTakenRevengeEvent.nuxt.spec.ts.snap is excluded by !**/*.snap
Files selected for processing (30)
  • .husky/commit-msg (1 hunks)
  • .husky/pre-commit (1 hunks)
  • .run/Elder Role.run.xml (1 hunks)
  • app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameElderHasTakenRevengeEvent/GameElderHasTakenRevengeEvent.vue (1 hunks)
  • app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.vue (3 hunks)
  • app/composables/api/game/constants/game-history-record/game-history-record.constants.ts (1 hunks)
  • app/composables/api/game/game-event/useGameEventsGenerator.ts (1 hunks)
  • app/composables/api/game/game-history-record/useGameLastHistoryRecord.ts (1 hunks)
  • app/composables/api/game/game-play/useCurrentGamePlay.ts (3 hunks)
  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.ts (1 hunks)
  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.types.ts (1 hunks)
  • app/composables/api/game/types/game-history-record/game-history-record.class.ts (2 hunks)
  • app/stores/audio/constants/audio.constants.ts (1 hunks)
  • app/stores/game/game-event/constants/game-event.constants.ts (1 hunks)
  • app/stores/game/game-event/useGameEventsStore.ts (3 hunks)
  • modules/i18n/locales/en.json (1 hunks)
  • modules/i18n/locales/fr.json (1 hunks)
  • tests/acceptance/features/game/features/role/elder.feature (1 hunks)
  • tests/acceptance/features/game/step-definitions/game-options/game-options.given-steps.ts (1 hunks)
  • tests/acceptance/features/game/step-definitions/player/player-attribute/player-attribute.then-steps.ts (2 hunks)
  • tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameElderHasTakenRevengeEvent/GameElderHasTakenRevengeEvent.nuxt.spec.ts (1 hunks)
  • tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.nuxt.spec.ts (2 hunks)
  • tests/unit/specs/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.spec.ts (1 hunks)
  • tests/unit/specs/composables/api/game/game-history-record/game-history-record.class.spec.ts (4 hunks)
  • tests/unit/specs/composables/api/game/game-history-record/useGameLastHistoryRecord.spec.ts (2 hunks)
  • tests/unit/specs/stores/audio/useAudioStore.spec.ts (2 hunks)
  • tests/unit/specs/stores/game/game-event/useGameEventsStore.spec.ts (3 hunks)
  • tests/unit/utils/factories/composables/api/game/game-event/useGameEventsGenerator.spec.ts (1 hunks)
  • tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.factory.ts (1 hunks)
  • tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record.factory.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • .husky/pre-commit
  • app/stores/audio/constants/audio.constants.ts
Additional comments not posted (87)
.husky/commit-msg (1)

1-1: Potential Issue: Removed shebang and sourcing lines.

The removal of the shebang (#!/usr/bin/env sh) and the line sourcing the Husky shell script (. "$(dirname -- "$0")/_/husky.sh") might cause issues if the script relies on any configurations or variables defined in the removed lines. Ensure that npx commitlint works correctly without the previous setup.

app/composables/api/game/constants/game-history-record/game-history-record.constants.ts (2)

9-13: LGTM!

The new constant GAME_HISTORY_RECORD_PLAYER_ATTRIBUTE_ALTERATION_STATUSES is correctly defined as a read-only array.


15-18: LGTM! But verify the usage of the new constant in the codebase.

The export statement correctly includes the new constant. Ensure that the new constant is used appropriately in the codebase.

Verification successful

The new constant GAME_HISTORY_RECORD_PLAYER_ATTRIBUTE_ALTERATION_STATUSES is properly used in the codebase.

  • tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.factory.ts
  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.types.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new constant in the codebase.

# Test: Search for the usage of the new constant. Expect: Occurrences of the new constant.
rg --type ts 'GAME_HISTORY_RECORD_PLAYER_ATTRIBUTE_ALTERATION_STATUSES'

Length of output: 1645

app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.types.ts (1)

1-6: LGTM! But verify the usage of the new type in the codebase.

The new type GameHistoryRecordPlayerAttributeAlterationStatus is correctly defined using TupleToUnion from type-fest and exported. Ensure that the new type is used appropriately in the codebase.

Verification successful

The new type GameHistoryRecordPlayerAttributeAlterationStatus is appropriately used in the codebase.

The type is utilized in both implementation and test files, ensuring its functionality is integrated and tested.

  • tests/unit/specs/composables/api/game/game-history-record/useGameLastHistoryRecord.spec.ts
  • app/composables/api/game/game-history-record/useGameLastHistoryRecord.ts
  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.ts
  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.types.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new type in the codebase.

# Test: Search for the usage of the new type. Expect: Occurrences of the new type.
rg --type ts 'GameHistoryRecordPlayerAttributeAlterationStatus'

Length of output: 2426

app/stores/game/game-event/constants/game-event.constants.ts (1)

15-15: LGTM!

The addition of the new event type "elder-has-taken-revenge" is correct and consistent with the existing event types.

.run/Elder Role.run.xml (1)

1-12: LGTM!

The new configuration for running Cucumber.js tests with specific options and environment variables is correctly set up.

tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record.factory.ts (1)

17-17: LGTM!

The addition of the new parameter playerAttributeAlterations to the createFakeGameHistoryRecord function is correct and consistent with the existing parameters.

app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.ts (4)

25-25: Export looks good.

The class is correctly exported.


1-5: Imports look good but verify the paths.

The imports are correct and necessary for the class functionality. Ensure that the paths are correct and the imported modules exist.

Verification successful

Imports are correct and necessary.

The paths for all the imported modules have been verified and exist in the codebase.

  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.types.ts
  • app/composables/api/game/types/game.types.ts
  • app/composables/api/game/types/players/player-attribute/player-attribute.types.ts
  • app/utils/constants/class-transformer.constants.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the imported modules.

# Test: Check if the imported modules exist. Expect: All modules should exist.
fd 'game-history-record-player-attribute-alteration.types' | xargs -I {} echo "Module found: {}"
fd 'game.types' | xargs -I {} echo "Module found: {}"
fd 'player-attribute.types' | xargs -I {} echo "Module found: {}"
fd 'class-transformer.constants' | xargs -I {} echo "Module found: {}"

Length of output: 838


20-22: Static method looks good but ensure proper usage.

The create method uses plainToInstance to create an instance from a plain object. Ensure that this method is used correctly in the rest of the codebase.

Verification successful

The create method is used correctly in the codebase.

The method is utilized in the following test files, indicating proper usage:

  • tests/unit/specs/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.spec.ts
  • tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.factory.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `create` method.

# Test: Search for the usage of the `create` method. Expect: The method should be used correctly.
rg --type python -A 5 $'create'

Length of output: 61


Script:

#!/bin/bash
# Description: Verify the usage of the `create` method in TypeScript files.

# Test: Search for the usage of the `create` method. Expect: The method should be used correctly.
rg --type ts -A 5 'GameHistoryRecordPlayerAttributeAlteration.create'

Length of output: 2905


7-18: Properties look good but ensure they are correctly initialized.

The properties name, source, playerName, and status are correctly defined and exposed. Ensure that these properties are correctly initialized in the rest of the codebase.

tests/unit/specs/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.spec.ts (2)

1-1: Import looks good.

The import statement is correct and necessary for the test functionality.


3-21: Test case looks good but ensure comprehensive coverage.

The test case for the create method is well-written and checks the correctness of the method. However, ensure that all edge cases and possible scenarios are covered in the tests.

tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.factory.ts (2)

1-5: Imports look good but verify the paths.

The imports are correct and necessary for the factory functionality. Ensure that the paths are correct and the imported modules exist.

Verification successful

Imports look good but verify the paths.

The imports are correct and necessary for the factory functionality. All imported modules exist and the paths are correct.

  • app/composables/api/game/types/game-history-record/game-history-record-player-attribute-alteration/game-history-record-player-attribute-alteration.class.ts
  • app/composables/api/game/constants/game-history-record/game-history-record.constants.ts
  • app/composables/api/game/constants/game.constants.ts
  • app/composables/api/game/constants/player/player-attribute/player-attribute.constants.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the imported modules.

# Test: Check if the imported modules exist. Expect: All modules should exist.
fd 'game-history-record-player-attribute-alteration.class' | xargs -I {} echo "Module found: {}"
fd 'game-history-record.constants' | xargs -I {} echo "Module found: {}"
fd 'game.constants' | xargs -I {} echo "Module found: {}"
fd 'player-attribute.constants' | xargs -I {} echo "Module found: {}"

Length of output: 1086


7-15: Factory function looks good but ensure proper usage.

The factory function uses the faker library to generate fake data for the properties of the GameHistoryRecordPlayerAttributeAlteration class. Ensure that this function is used correctly in the rest of the codebase.

Verification successful

Factory function usage verified.

The createFakeGameHistoryRecordPlayerAttributeAlteration factory function is used correctly in the codebase, primarily within unit tests.

  • tests/unit/specs/composables/api/game/game-history-record/game-history-record.class.spec.ts
  • tests/unit/specs/composables/api/game/game-history-record/useGameLastHistoryRecord.spec.ts
  • tests/unit/utils/factories/composables/api/game/game-event/useGameEventsGenerator.spec.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the factory function.

# Test: Search for the usage of the factory function. Expect: The function should be used correctly.
rg --type python -A 5 $'createFakeGameHistoryRecordPlayerAttributeAlteration'

Length of output: 107


Script:

#!/bin/bash
# Description: Verify the usage of the factory function.

# Test: Search for the usage of the factory function. Expect: The function should be used correctly.
rg --type ts -A 5 'createFakeGameHistoryRecordPlayerAttributeAlteration'

Length of output: 11852

app/composables/api/game/types/game-history-record/game-history-record.class.ts (1)

38-40: LGTM! Ensure the new property is utilized correctly.

The addition of playerAttributeAlterations with proper annotations is well-implemented.

However, verify that this new property is correctly utilized throughout the codebase.

Verification successful

The new property playerAttributeAlterations is utilized correctly.

The property playerAttributeAlterations is integrated and used in various parts of the codebase, including test files, indicating proper utilization and testing.

  • tests/unit/specs/composables/api/game/game-history-record/useGameLastHistoryRecord.spec.ts
  • tests/unit/specs/composables/api/game/game-history-record/game-history-record.class.spec.ts
  • tests/unit/utils/factories/composables/api/game/game-event/useGameEventsGenerator.spec.ts
  • tests/unit/utils/factories/composables/api/game/game-history-record/game-history-record.factory.ts
  • app/composables/api/game/game-history-record/useGameLastHistoryRecord.ts
  • app/composables/api/game/types/game-history-record/game-history-record.class.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new property `playerAttributeAlterations`.

# Test: Search for the property usage. Expect: Proper utilization of the new property.
rg --type python -A 5 $'playerAttributeAlterations'

Length of output: 81


Script:

#!/bin/bash
# Description: Verify the usage of the new property `playerAttributeAlterations`.

# Test: Search for the property usage in TypeScript files. Expect: Proper utilization of the new property.
rg --type typescript -A 5 'playerAttributeAlterations'

Length of output: 89


Script:

#!/bin/bash
# Description: Verify the usage of the new property `playerAttributeAlterations`.

# Test: Search for the property usage in TypeScript files. Expect: Proper utilization of the new property.
rg --type ts -A 5 'playerAttributeAlterations'

Length of output: 7368

app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameElderHasTakenRevengeEvent/GameElderHasTakenRevengeEvent.vue (2)

1-15: LGTM!

The template is well-structured and uses appropriate components.


17-49: LGTM!

The script setup is well-implemented, ensuring proper event handling and state management.

app/composables/api/game/game-history-record/useGameLastHistoryRecord.ts (2)

1-6: LGTM!

The import statements are correct and necessary for the composable functionality.


14-35: LGTM!

The changes enhance the composable's flexibility and functionality. The new method doesHavePlayerAttributeAlteration is well-implemented.

tests/unit/specs/composables/api/game/game-history-record/game-history-record.class.spec.ts (3)

1-1: Import statement for the new factory function looks good.

The import statement follows the existing pattern and is correctly placed.


15-18: Creation of player attribute alterations looks good.

The array is correctly created and populated using the factory function.


Line range hint 29-41:
Inclusion of playerAttributeAlterations in the GameHistoryRecord.create() method and the expected game history record looks good.

The changes ensure that the test checks for equality against the modified structure.

app/stores/game/game-event/useGameEventsStore.ts (3)

2-2: Import statement for the new method looks good.

The import statement follows the existing pattern and is correctly placed.


Line range hint 15-28:
Refactoring to use generateGameEventsFromGame looks good.

The refactoring simplifies the function and reduces complexity.


32-32: Modification in the way mustCurrentGamePlayBeSkipped is called looks good.

The change improves clarity and is a minor adjustment.

app/composables/api/game/game-play/useCurrentGamePlay.ts (4)

1-1: Import statement for MaybeRef looks good.

The import statement follows the existing pattern and is correctly placed.


16-16: Change in the parameter type of the useCurrentGamePlay function looks good.

The change enhances the function's flexibility and is correctly implemented.


17-19: Usage of computed properties for currentPlay and gameOptions looks good.

The update improves clarity and efficiency.


Line range hint 21-44:
Refactored logic for conditions related to the game's current play and eligible targets looks good.

The refactoring streamlines the code and enhances readability.

tests/acceptance/features/game/features/role/elder.feature (3)

5-35: Scenario: "Elder has two lives against werewolves but takes his revenge if he dies from villagers"

  • Line 6-13: The setup steps are clear and correctly define the game state.
  • Line 14-22: The steps correctly simulate the werewolves attacking the Elder and the Elder surviving.
  • Line 23-27: The steps correctly simulate the villagers voting to kill the Elder.
  • Line 28-35: The steps correctly check the Elder's revenge mechanism and the resulting game state.

Overall, the scenario is well-defined and covers the necessary actions and assertions.


39-56: Scenario: "Elder has only one life against werewolves if game master sets it in game options"

  • Line 40-47: The setup steps are clear and correctly define the game state with the Elder having only one life.
  • Line 49-55: The steps correctly simulate the werewolves attacking the Elder and the Elder dying.

Overall, the scenario is well-defined and covers the necessary actions and assertions.


57-84: Scenario: "Elder doesn't take his revenge on villagers if game master doesn't allow it in game options"

  • Line 58-65: The setup steps are clear and correctly define the game state with the Elder not allowed to take revenge.
  • Line 67-74: The steps correctly simulate the werewolves attacking the Elder and the Elder surviving.
  • Line 76-79: The steps correctly simulate the villagers voting to kill the Elder.
  • Line 81-84: The steps correctly check that the Elder does not take revenge and the resulting game state.

Overall, the scenario is well-defined and covers the necessary actions and assertions.

app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.vue (3)

27-27: New import for GameElderHasTakenRevengeEvent

The import statement for GameElderHasTakenRevengeEvent is correctly added.


38-38: Updated import for GameWolfHoundHasChosenSideEvent

The import statement for GameWolfHoundHasChosenSideEvent is correctly updated to maintain consistency.


58-60: Updated event type mappings

The event type mappings for wolf-hound-has-chosen-side and elder-has-taken-revenge are correctly updated and added, respectively.

app/composables/api/game/game-event/useGameEventsGenerator.ts (6)

17-24: Function getLastGameHistoryRecordCharmEvents

The function correctly generates charm events based on the source of the game play. The logic is clear and covers the necessary sources.


26-44: Function getLastGameActionEvents

The function correctly generates game events based on the last game action. The logic is clear and covers the necessary actions.


46-52: Function getRevealedRolePlayerGameEvents

The function correctly generates game events for players with revealed roles. The logic is clear and covers the necessary roles.


54-59: Function getDeadPlayerGameEvents

The function correctly generates game events for dead players. The logic is clear and covers the necessary cases.


61-68: Function getLastGameHistoryRecordPlayerAttributeAlterationEvents

The function correctly generates game events based on player attribute alterations. The logic is clear and covers the necessary attributes.


70-89: Function generateGameEventsFromGame

The function correctly generates all game events based on the current game state. The logic is clear and covers the necessary game states and events.

tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameElderHasTakenRevengeEvent/GameElderHasTakenRevengeEvent.nuxt.spec.ts (7)

26-34: LGTM! Helper function is well-defined.

The mountGameElderHasTakenRevengeEventComponent function correctly mounts the component with the provided options and testing Pinia.


42-45: LGTM! Test block correctly verifies snapshot matching.

The test ensures that the component matches the snapshot when rendered.


47-51: LGTM! Test block correctly verifies sound effect playback.

The test ensures that the thunder sound is played when the component is rendered.


53-74: LGTM! Test block correctly verifies texts passed to the component.

The tests ensure that the correct texts are passed to the component based on different scenarios.


77-104: LGTM! Test block correctly verifies flipping player card rendering.

The tests ensure that the flipping player card component is rendered correctly based on different scenarios.


36-40: LGTM! beforeEach block correctly sets up the necessary state for the tests.

The beforeEach block mounts the component and sets up the game store before each test.


15-105: LGTM! Describe block correctly defines the test suite for the component.

The describe block contains the overall structure for the test suite.

tests/unit/specs/composables/api/game/game-history-record/useGameLastHistoryRecord.spec.ts (2)

54-58: LGTM! Test block correctly verifies lastTargetedPlayers function.

The tests ensure that the lastTargetedPlayers function returns the correct players based on different scenarios.


60-147: LGTM! Test block correctly verifies doesHavePlayerAttributeAlteration function.

The tests ensure that the doesHavePlayerAttributeAlteration function returns the correct boolean based on different scenarios.

tests/unit/specs/stores/audio/useAudioStore.spec.ts (6)

Line range hint 24-38:
LGTM! Test block correctly verifies the initial state of the store.

The tests ensure that the initial state of the useAudioStore store is correct.


Line range hint 60-67:
LGTM! Test block correctly verifies loadSoundEffects function.

The tests ensure that the loadSoundEffects function loads all sound effects.


Line range hint 69-76:
LGTM! Test block correctly verifies loadBackgroundAudios function.

The tests ensure that the loadBackgroundAudios function loads all background audios.


Line range hint 78-87:
LGTM! Test block correctly verifies loadAllAudios function.

The tests ensure that the loadAllAudios function loads all audios.


Line range hint 89-95:
LGTM! Test block correctly verifies playSoundEffect function.

The tests ensure that the playSoundEffect function plays the correct sound effect.


Line range hint 97-118:
LGTM! Test block correctly verifies fadeOutPlayingBackgroundAudio function.

The tests ensure that the fadeOutPlayingBackgroundAudio function works correctly based on different scenarios.

tests/unit/specs/stores/game/game-event/useGameEventsStore.spec.ts (3)

18-20: LGTM! The new mock for useGameEventsGenerator is correctly implemented.

The method generateGameEventsFromGame is appropriately mocked using vi.fn().


27-29: LGTM! The new mock declaration for useGameEventsGenerator is correctly implemented.

The declaration is consistent with the existing mocking approach.


131-138: LGTM! The test case for generateAndSetGameEventsFromGame is correctly simplified.

The test verifies that generateGameEventsFromGame is called with the correct game object, improving maintainability.

tests/acceptance/features/game/step-definitions/player/player-attribute/player-attribute.then-steps.ts (2)

103-111: LGTM! The enhancement to the step definition for checking the "powerless by elder" attribute is well-implemented.

The optional parameter notPowerless improves the flexibility of the step definition, and the conditional check is correctly handled.


179-185: LGTM! The new step definition for handling multiple players with the "powerless by elder" attribute is well-implemented.

This enhancement improves the testing capabilities by enabling batch checks for player attributes.

tests/acceptance/features/game/step-definitions/game-options/game-options.given-steps.ts (2)

189-194: LGTM! The new step definition for setting the elder's lives count is well-implemented.

The step follows the existing pattern for setting game options, ensuring consistency.


196-200: LGTM! The new step definition for preventing the elder from taking revenge is well-implemented.

The step follows the existing pattern for setting game options, ensuring consistency.

tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.nuxt.spec.ts (4)

6-6: LGTM! Import statement for GameElderHasTakenRevengeEvent is correct.

The import statement follows the existing pattern and is correctly added.


8-8: LGTM! Import statement for GameIdiotIsSparedEvent is correct.

The import statement follows the existing pattern and is correctly added.


194-204: LGTM! Test case for GameIdiotIsSparedEvent is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game events store and verifies the component's existence.


206-216: LGTM! Test case for GameElderHasTakenRevengeEvent is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game events store and verifies the component's existence.

tests/unit/utils/factories/composables/api/game/game-event/useGameEventsGenerator.spec.ts (14)

1-16: LGTM! Import statements are correct.

The import statements follow the existing pattern and are correctly added.


30-40: LGTM! Test case for generating game starts and turn starts events is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


41-52: LGTM! Test case for generating game starts, villager-villager introduction, and turn starts events is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


53-57: LGTM! Test case for not generating seer has seen event when last game history is null is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


58-65: LGTM! Test case for not generating seer has seen event when last game history record action is not look is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


66-76: LGTM! Test case for generating seer has seen event when last game history record action is look is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


77-90: LGTM! Test case for generating day rises and turn starts events is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


91-104: LGTM! Test case for generating night falls and turn starts events is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


105-115: LGTM! Test case for generating turn starts event without game phase event when game phase tick is 1 but name is twilight is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


116-136: LGTM! Test case for generating turn starts event when neither game tick nor phase tick is 1 is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


137-163: LGTM! Test case for generating player dies event when game current play action is bury-dead-bodies is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


166-176: LGTM! Test case for not generating sheriff has been elected event when last game history record action is elect-sheriff but voting result is not sheriff-election is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


200-214: LGTM! Test case for generating sheriff promotion event when last game history record action is elect-sheriff and voting result is sheriff-election is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.


354-376: LGTM! Test case for generating elder has taken revenge event when last game history record has an attached player attribute alteration to powerless by elder is correct.

The test case is well-structured and follows the existing pattern. It correctly sets up the game and verifies the generated events.

modules/i18n/locales/en.json (2)

1445-1445: LGTM!

The entry "cantFindElder" is clear and correctly formatted.


1446-1446: LGTM!

The entry "elderHasBeenMurderedByVillager" is clear and correctly formatted.

modules/i18n/locales/fr.json (3)

1445-1445: LGTM!

The translation for the message when the Elder cannot be found is correct and consistent.


1446-1446: LGTM!

The translation for the message when the Elder has been killed by a villager is correct and consistent.


1447-1447: LGTM!

The translation for the message when the Elder takes revenge is correct and consistent.

modules/i18n/locales/en.json Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 219c12e and cd0f676.

Files selected for processing (2)
  • modules/i18n/locales/en.json (1 hunks)
  • tests/acceptance/features/game/features/role/elder.feature (1 hunks)
Files skipped from review due to trivial changes (1)
  • modules/i18n/locales/en.json
Files skipped from review as they are similar to previous changes (1)
  • tests/acceptance/features/game/features/role/elder.feature

Copy link

sonarcloud bot commented Jul 19, 2024

@antoinezanardi antoinezanardi merged commit 25f46d5 into develop Jul 19, 2024
15 checks passed
@antoinezanardi antoinezanardi deleted the feat/elder-takes-revenge-event branch July 19, 2024 16:18
antoinezanardi pushed a commit that referenced this pull request Aug 7, 2024
## [1.27.0](v1.26.0...v1.27.0) (2024-08-07)

### 🚀 Features

* **bear-tamer:** bear tamer events ([#677](#677)) ([3d890fd](3d890fd))
* **docker:** docker file and push to hub ([#708](#708)) ([3e1a22d](3e1a22d))
* **elder:** elder has taken revenge event ([#656](#656)) ([25f46d5](25f46d5))
* **fox:** game events ([#692](#692)) ([0de3432](0de3432))
* **game-lobby:** additional cards manager ([#706](#706)) ([5eb8ce3](5eb8ce3))
* **game-lobby:** display position coordinator button on two players ([#698](#698)) ([404b184](404b184))
* **game:** game events from api ([#674](#674)) ([cc5938b](cc5938b))
* **scandalmonger:** scandalmonger mark is active event ([#681](#681)) ([828acaa](828acaa))

### 🐛 Bug Fixes

* **deps:** update dependency primevue to v4 ([#605](#605)) ([c05c2be](c05c2be))

### ✅ Tests

* **fox:** targets in game events ([#696](#696)) ([7eb4ff6](7eb4ff6))
* **rusty-sword-knight:** acceptance tests ([#689](#689)) ([8b60d86](8b60d86))

### 🧹 Chore

* **deps:** update antoinezanardi/werewolves-assistant-api docker tag to v1.35.1 ([#720](#720)) ([a4eef03](a4eef03))
* **deps:** update dependency @commitlint/cli to ^19.4.0 ([#721](#721)) ([10ae971](10ae971))
* **deps:** update dependency @nuxt/test-utils to ^3.14.0 ([#684](#684)) ([e842c26](e842c26))
* **deps:** update dependency @nuxtjs/i18n to ^8.3.2 ([#686](#686)) ([a5fc6d6](a5fc6d6))
* **deps:** update dependency @nuxtjs/i18n to ^8.3.3 ([#688](#688)) ([6c04526](6c04526))
* **deps:** update dependency @pinia/nuxt to ^0.5.2 ([#679](#679)) ([268cb94](268cb94))
* **deps:** update dependency @pinia/nuxt to ^0.5.3 ([#712](#712)) ([4c0e823](4c0e823))
* **deps:** update dependency @pinia/testing to ^0.1.4 ([#680](#680)) ([6aaa549](6aaa549))
* **deps:** update dependency @pinia/testing to ^0.1.5 ([#713](#713)) ([1e865de](1e865de))
* **deps:** update dependency @stryker-mutator/core to ^8.4.0 ([#717](#717)) ([18fd997](18fd997))
* **deps:** update dependency @stylistic/eslint-plugin to ^2.4.0 ([#687](#687)) ([b96f302](b96f302))
* **deps:** update dependency @stylistic/eslint-plugin to ^2.6.1 ([#701](#701)) ([d057800](d057800))
* **deps:** update dependency @types/eslint to v9 ([#665](#665)) ([e4cf01c](e4cf01c))
* **deps:** update dependency eslint to ^9.8.0 ([#685](#685)) ([722ad20](722ad20))
* **deps:** update dependency husky to ^9.1.1 ([#650](#650)) ([03ff232](03ff232))
* **deps:** update dependency husky to ^9.1.2 ([#675](#675)) ([8b450f1](8b450f1))
* **deps:** update dependency husky to ^9.1.3 ([#683](#683)) ([8fb79bb](8fb79bb))
* **deps:** update dependency husky to ^9.1.4 ([#690](#690)) ([8e4afd7](8e4afd7))
* **deps:** update dependency lint-staged to ^15.2.8 ([#707](#707)) ([9d0ea50](9d0ea50))
* **deps:** update dependency msw to ^2.3.2 ([#654](#654)) ([df18287](df18287))
* **deps:** update dependency msw to ^2.3.3 ([#667](#667)) ([4e31286](4e31286))
* **deps:** update dependency msw to ^2.3.4 ([#668](#668)) ([d368d3a](d368d3a))
* **deps:** update dependency msw to ^2.3.5 ([#705](#705)) ([e44c938](e44c938))
* **deps:** update dependency pinia to ^2.2.0 ([#682](#682)) ([a264598](a264598))
* **deps:** update dependency pinia to ^2.2.1 ([#714](#714)) ([7ec9618](7ec9618))
* **deps:** update dependency prettier-plugin-gherkin to ^2.4.1 ([#678](#678)) ([fdf456f](fdf456f))
* **deps:** update dependency prettier-plugin-gherkin to v3 ([#693](#693)) ([951b899](951b899))
* **deps:** update dependency qs to ^6.13.0 ([#703](#703)) ([be22e54](be22e54))
* **deps:** update dependency tailwindcss to ^3.4.7 ([#676](#676)) ([9653815](9653815))
* **deps:** update dependency tailwindcss to ^3.4.8 ([#722](#722)) ([706364a](706364a))
* **deps:** update dependency tsx to ^4.16.3 ([#694](#694)) ([ac58a05](ac58a05))
* **deps:** update dependency tsx to ^4.16.5 ([#702](#702)) ([bd33184](bd33184))
* **deps:** update dependency type-fest to ^4.22.1 ([#651](#651)) ([e21922d](e21922d))
* **deps:** update dependency type-fest to ^4.23.0 ([#661](#661)) ([54e81b0](54e81b0))
* **deps:** update dependency typescript to ^5.5.4 ([#666](#666)) ([b3d9999](b3d9999))
* **deps:** update dependency validate-branch-name to ^1.3.1 ([#672](#672)) ([ee73726](ee73726))
* **deps:** update dependency vue to ^3.4.33 ([#655](#655)) ([2b6f4be](2b6f4be))
* **deps:** update dependency vue to ^3.4.34 ([#671](#671)) ([a4628ae](a4628ae))
* **deps:** update dependency vue to ^3.4.35 ([#695](#695)) ([632b6e6](632b6e6))
* **deps:** update dependency vue to ^3.4.36 ([#715](#715)) ([0e26759](0e26759))
* **deps:** update dependency vue-router to ^4.4.2 ([#699](#699)) ([55c7ea4](55c7ea4))
* **deps:** update dependency vue-router to ^4.4.3 ([#716](#716)) ([41940fc](41940fc))
* **deps:** update dependency vue-tsc to ^2.0.28 ([#658](#658)) ([376855f](376855f))
* **deps:** update dependency vue-tsc to ^2.0.29 ([#673](#673)) ([e8c0b73](e8c0b73))
* **deps:** update node docker tag to v22.6.0 ([#718](#718)) ([2b3eb0f](2b3eb0f))
* **deps:** update node.js to >=20.16.0 ([#670](#670)) ([4b03818](4b03818))
* **deps:** update nuxtjs monorepo to ^3.12.4 ([#653](#653)) ([08a94ce](08a94ce))
* **deps:** update playwright monorepo to ^1.45.3 ([#663](#663)) ([99322ea](99322ea))
* **deps:** update playwright monorepo to ^1.46.0 ([#710](#710)) ([cdcc769](cdcc769))
* **deps:** update pnpm to v9.6.0 ([#657](#657)) ([8a18dec](8a18dec))
* **deps:** update pnpm to v9.7.0 ([#719](#719)) ([deb0b81](deb0b81))
* **deps:** update stryker-js monorepo to ^8.3.0 ([#704](#704)) ([0d4788e](0d4788e))
* **deps:** update stryker-js monorepo to ^8.4.0 ([#711](#711)) ([5def08d](5def08d))
* **deps:** update typescript-eslint monorepo to ^7.17.0 ([#664](#664)) ([cf7484f](cf7484f))
* **deps:** update typescript-eslint monorepo to ^7.18.0 ([#691](#691)) ([fe46fff](fe46fff))
* **deps:** update typescript-eslint monorepo to ^8.0.1 ([#709](#709)) ([d189e1e](d189e1e))
* **deps:** update typescript-eslint monorepo to v8 (major) ([#700](#700)) ([de6cf8d](de6cf8d))
* **deps:** update vitest monorepo to ^2.0.3 ([#636](#636)) ([0cdd8e6](0cdd8e6))
* **deps:** update vitest monorepo to ^2.0.4 ([#659](#659)) ([a4a5d77](a4a5d77))
* **deps:** update vitest monorepo to ^2.0.5 ([#697](#697)) ([5783273](5783273))
@antoinezanardi
Copy link
Owner Author

🎉 This PR is included in version 1.27.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feature New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant