-
-
Notifications
You must be signed in to change notification settings - Fork 2
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(game): idiot spared life event #618
Conversation
Important Review skippedReview was skipped as selected files did not have any reviewable changes. Files selected but had no reviewable changes (1)
You can disable this status message by setting the WalkthroughThe update to Werewolves Assistant Web (version 1.25.0) introduces new game features and events: a confirmation dialog in the game lobby before starting a game, player card functionality, and the addition of the "Idiot" role with corresponding events and sound effects. The update improves testing setups, including the simulation of game events for varied player roles and additional unit tests for ensuring functionality. Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this 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
Files ignored due to path filters (2)
public/audio/sound-effects/dumb-huh.webm
is excluded by!**/*.webm
tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameIdiotIsSparedEvent/__snapshots__/GameIdiotIsSparedEvent.nuxt.spec.ts.snap
is excluded by!**/*.snap
Files selected for processing (22)
- .run/Idiot Role.run.xml (1 hunks)
- CHANGELOG.md (1 hunks)
- app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.vue (2 hunks)
- app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameIdiotIsSparedEvent/GameIdiotIsSparedEvent.vue (1 hunks)
- app/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/GameEventTextsManager.vue (2 hunks)
- app/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/game-event-texts-manager.types.ts (1 hunks)
- app/components/shared/game/game-event/GameEventWithTexts/GameEventWithTexts.vue (1 hunks)
- app/components/shared/game/game-event/GameEventWithTexts/game-event-with-texts.types.ts (1 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 (2 hunks)
- package.json (1 hunks)
- tests/acceptance/features/game/features/role/idiot.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 (1 hunks)
- tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameIdiotIsSparedEvent/GameIdiotIsSparedEvent.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/GameEventTextsManager.nuxt.spec.ts (1 hunks)
- tests/unit/specs/components/shared/game/game-event/GameEventWithTexts/GameEventWithTexts.nuxt.spec.ts (2 hunks)
- tests/unit/specs/stores/audio/useAudioStore.spec.ts (2 hunks)
- tests/unit/specs/stores/game/game-event/useGameEventsStore.spec.ts (2 hunks)
Files skipped from review due to trivial changes (5)
- .run/Idiot Role.run.xml
- CHANGELOG.md
- app/components/shared/game/game-event/GameEventWithTexts/game-event-with-texts.types.ts
- app/stores/audio/constants/audio.constants.ts
- package.json
Additional comments not posted (27)
app/stores/game/game-event/constants/game-event.constants.ts (1)
14-14
: New event type added.The event type
"idiot-is-spared"
has been correctly added to the list of game event types.app/components/shared/game/game-event/GameEventWithTexts/GameEventWithTexts.vue (2)
16-16
: Ensure event handler alignment.The event handler
onGameEventTextChangeFromGameEventTextsManager
is correctly integrated to handlegame-event-text-change
events.
22-31
: Correct imports and setup for event handling.The
GameEventWithTextsEmits
type andonGameEventTextChangeFromGameEventTextsManager
function are correctly defined and used.tests/unit/specs/components/shared/game/game-event/GameEventWithTexts/GameEventWithTexts.nuxt.spec.ts (2)
1-1
: LGTM! Imports are necessary for type checking.The added type imports ensure proper typing of props and emits.
51-61
: LGTM! Tests for event emission are necessary.The new describe block and test ensure that the
gameEventTextChange
event is emitted correctly.app/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/GameEventTextsManager.vue (3)
42-42
: LGTM! Imports are necessary for type checking.The added type imports ensure proper typing of props and emits.
47-48
: LGTM! Properly defining emits is crucial.The
defineEmits
function ensures that the component's emits are properly typed and handled.
81-84
: LGTM! The watch function ensures correct event emission.The watch function ensures that the
gameEventTextChange
event is emitted whenever thecurrentGameEventText
changes.app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameEventsMonitorCurrentEvent.vue (2)
27-27
: LGTM! Importing the new component is necessary.The import statement includes the
GameIdiotIsSparedEvent
component, which is necessary for the new functionality.
58-58
: LGTM! Correctly mapping the new event type.The addition ensures that the
GameIdiotIsSparedEvent
component is used when the event type is "idiot-is-spared".tests/acceptance/features/game/features/role/idiot.feature (1)
1-99
: LGTM! Comprehensive acceptance tests.The scenarios cover various aspects of the "Idiot" role and ensure that the new functionality is thoroughly tested.
app/stores/game/game-event/useGameEventsStore.ts (1)
Line range hint
25-31
:
Verify the impact of the removedgame
parameter.The removal of the
game
parameter simplifies the function signature. Ensure that this modification does not impact the function's logic and usage in other parts of the codebase.Verification successful
Verification successful: The removal of the
game
parameter does not impact the function's logic or usage.The function
getLastGameHistoryRecordCharmEvents
is used correctly within the context provided, and the removal of thegame
parameter simplifies the function signature without causing issues.
app/stores/game/game-event/useGameEventsStore.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the removed `game` parameter in `getLastGameHistoryRecordCharmEvents`. # Test: Search for the function usage. Expect: No errors due to the removed parameter. rg --type python $'getLastGameHistoryRecordCharmEvents'Length of output: 85
Script:
#!/bin/bash # Description: Verify the impact of the removed `game` parameter in `getLastGameHistoryRecordCharmEvents`. # Test: Search for the function usage. Expect: No errors due to the removed parameter. rg --type ts 'getLastGameHistoryRecordCharmEvents'Length of output: 303
Script:
#!/bin/bash # Description: Show the surrounding code to understand the usage and impact of the removed `game` parameter. # Display 5 lines before and after the function usage to provide context. rg --type ts 'getLastGameHistoryRecordCharmEvents' -A 5 -B 5Length of output: 2071
tests/unit/specs/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/GameEventTextsManager.nuxt.spec.ts (1)
111-117
: LGTM! Verify the event payload.The test correctly checks if the
gameEventTextChange
event is emitted. Ensure that the event payload is also verified to maintain the component's integrity.tests/unit/specs/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameIdiotIsSparedEvent/GameIdiotIsSparedEvent.nuxt.spec.ts (4)
39-42
: LGTM!The snapshot test ensures that the component's structure and appearance remain consistent.
44-49
: LGTM!The snapshot test ensures that the component's structure and appearance remain consistent when fully rendered.
52-62
: LGTM!The test correctly checks if the appropriate event texts are passed to the component.
117-124
: LGTM!The test correctly checks if the appropriate sound effects are played based on the emitted event text changes.
tests/unit/specs/stores/audio/useAudioStore.spec.ts (1)
Line range hint
24-38
:
LGTM!The test correctly checks if the appropriate number of sound effects are created when the store is initialized.
tests/acceptance/features/game/step-definitions/game-options/game-options.given-steps.ts (1)
146-150
: LGTM!The new Given step to prevent the revealed idiot's death on elder's death follows the established pattern and looks good.
tests/acceptance/features/game/step-definitions/player/player-attribute/player-attribute.then-steps.ts (1)
159-163
: LGTM!The new Then step to check if the player has the attribute "cant-vote by survivors" follows the established pattern and looks good.
tests/unit/specs/stores/game/game-event/useGameEventsStore.spec.ts (1)
423-471
: LGTM!The new test cases for the "idiot-is-spared" event ensure that the event is generated correctly when the conditions are met. The tests are comprehensive and follow the established pattern.
modules/i18n/locales/en.json (1)
1400-1404
: LGTM! Addition of new event strings is consistent.The new event "GameIdiotIsSparedEvent" has been added correctly and is consistent with the existing structure.
modules/i18n/locales/fr.json (2)
1316-1316
: LGTM!The addition of the "playerCanRevealRole" key-value pair is correct and consistent with the existing keys and values.
1400-1404
: LGTM!The addition of the "GameIdiotIsSparedEvent" key-value pairs is correct and consistent with the existing keys and values.
app/components/shared/game/game-event/GameEventWithTexts/GameEventTextsManager/game-event-texts-manager.types.ts (1)
5-7
: LGTM!The type definition for
GameEventTextsManagerEmits
is correct and appropriate.app/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameIdiotIsSparedEvent/GameIdiotIsSparedEvent.vue (2)
1-16
: LGTM!The template block is well-structured and correctly binds the properties and events.
18-59
: LGTM!The script setup block is well-structured with appropriate imports and setup logic.
function getRevealedRolePlayerGameEvents(game: Game): GameEvent[] { | ||
const { lastGameHistoryRecord } = game; | ||
if (lastGameHistoryRecord?.revealedPlayers?.some(player => player.role.current === "idiot") === true) { | ||
return [GameEvent.create({ type: "idiot-is-spared" })]; | ||
} | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Add unit tests for the new function.
The function correctly checks for the "idiot" role and returns the appropriate game event. Ensure that unit tests cover this new functionality.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
Quality Gate passedIssues Measures |
## [1.26.0](v1.25.0...v1.26.0) (2024-07-18) ### 🚀 Features * **game:** idiot spared life event ([#618](#618)) ([b5b77d1](b5b77d1)) * **game:** votes duration ([#646](#646)) ([d1384bb](d1384bb)) * **img:** add placeholder while images are loading ([#624](#624)) ([4d7419a](4d7419a)) * **pied-piper:** charmed people are revealed game option ([#639](#639)) ([05da133](05da133)) * **werewolf:** werewolf can eat each other game options ([#640](#640)) ([63923f3](63923f3)) ### 🐛 Bug Fixes * **deps:** update dependency @fortawesome/fontawesome-free to ^6.6.0 ([#643](#643)) ([c452a5d](c452a5d)) ### ✅ Tests * **three-brothers:** acceptance tests ([#626](#626)) ([b939bc1](b939bc1)) * **two-sisters:** acceptance tests ([#625](#625)) ([6bf5de2](6bf5de2)) ### 🧹 Chore * **deps:** update dependency @eslint/config-inspector to ^0.5.2 ([#647](#647)) ([9e7f69d](9e7f69d)) * **deps:** update dependency @nuxtjs/tailwindcss to ^6.12.1 ([#630](#630)) ([871619a](871619a)) * **deps:** update dependency eslint to ^9.7.0 ([#632](#632)) ([2a24fb9](2a24fb9)) * **deps:** update dependency husky to ^9.1.0 ([#648](#648)) ([67439d4](67439d4)) * **deps:** update dependency prettier to ^3.3.3 ([#633](#633)) ([299f29a](299f29a)) * **deps:** update dependency qs to ^6.12.3 ([#621](#621)) ([49cf119](49cf119)) * **deps:** update dependency rimraf to ^6.0.1 ([#629](#629)) ([7613fee](7613fee)) * **deps:** update dependency rimraf to v6 ([#623](#623)) ([6764092](6764092)) * **deps:** update dependency sass to ^1.77.7 ([#627](#627)) ([4f8f044](4f8f044)) * **deps:** update dependency sass to ^1.77.8 ([#631](#631)) ([442abf4](442abf4)) * **deps:** update dependency tailwindcss to ^3.4.5 ([#637](#637)) ([6ae364c](6ae364c)) * **deps:** update dependency tailwindcss to ^3.4.6 ([#642](#642)) ([87253ce](87253ce)) * **deps:** update dependency type-fest to ^4.22.0 ([#644](#644)) ([ae93b7b](ae93b7b)) * **deps:** update dependency vue to ^3.4.32 ([#645](#645)) ([b2e2084](b2e2084)) * **deps:** update node.js to >=20.15.1 ([#617](#617)) ([6629992](6629992)) * **deps:** update playwright monorepo to ^1.45.2 ([#641](#641)) ([152eb1a](152eb1a)) * **deps:** update pnpm to v9.5.0 ([#615](#615)) ([b84e26e](b84e26e)) * **deps:** update typescript-eslint monorepo to ^7.16.0 ([#619](#619)) ([6209cbe](6209cbe)) * **deps:** update typescript-eslint monorepo to ^7.16.1 ([#638](#638)) ([800d22c](800d22c)) * **deps:** update vitest monorepo to ^2.0.2 ([#628](#628)) ([a1d4940](a1d4940)) * **deps:** update vitest monorepo to v2 (major) ([#616](#616)) ([d5eb23f](d5eb23f)) * **locale:** improve some french i18n ([#649](#649)) ([2bbc1b4](2bbc1b4)) * **sandbox-api:** bump sandbox api version to 1-33-0 ([#635](#635)) ([8a10d59](8a10d59))
🎉 This PR is included in version 1.26.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores