-
Notifications
You must be signed in to change notification settings - Fork 42
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
gameEvents: created CHALLENGE_UNO
event.
#154
gameEvents: created CHALLENGE_UNO
event.
#154
Conversation
@sethdivyansh is attempting to deploy a commit to the Shivansh Bhatanagar's projects Team on Vercel. A member of the Team first needs to authorize it. |
CHALLENGE_UNO
event.
Its a typescript error. The Player type has been renamed. Make the changes accordingly |
d69fee6
to
7eab482
Compare
@kuv2707 I have made the changes. |
7eab482
to
e0e4525
Compare
|
||
export function challengeUNO(game: GameEngine, event: GameEvent): EventResult { | ||
assert(event.type === 'CHALLENGE_UNO', 'Invalid event type'); | ||
const player = getPlayer(game, event.playerId); |
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.
event.playerId refers to the id of the player who triggered the event (it is set in the handleAppEvent
function)
We should modify the event type to have a field challengedPlayerId
inside data (which is no longer optional)
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.
Done 👍
Please review the changes.
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.
Looks like we are allowing the player to be able to challenge himself😂
Let's keep that as an easter egg.
Oh right! I didn't think of it. |
- Created `challengeUno.ts`. - Checked if a player can be challenged. - Player can be challenged only if `vulnerableToUNO` is equal to that player. - If the challenge is successful, the player must draw two cards from the deck. - Created tests for the challenge_uno event and its corner cases. fixes: shivansh-bhatnagar18#145
e0e4525
to
a7fa6da
Compare
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.
Looks great!
I really appreciate that you write tests for all the new logic
fixes: #145
Description
challengeUno.ts
.vulnerableToUNO
is equal to that player.events.test.ts
.How to Test
I have created some tests in
events.test.ts
Checklist