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

Implement a Pass event #477

Open
nicolodavis opened this issue Sep 27, 2019 · 7 comments

Comments

@nicolodavis
Copy link
Owner

@nicolodavis nicolodavis commented Sep 27, 2019

This will be simple event that merely ends the turn and also removes the player from ctx.playOrder.

@nicolodavis nicolodavis mentioned this issue Sep 27, 2019
0 of 2 tasks complete
@nicolodavis nicolodavis added this to the v1.0 milestone Oct 2, 2019
@blunket

This comment has been minimized.

Copy link
Contributor

@blunket blunket commented Oct 2, 2019

Could this also be used as a "surrender" event?

Or can we make the ctx.playOrder removal optional and/or add a callback for after this?

@nicolodavis

This comment has been minimized.

Copy link
Owner Author

@nicolodavis nicolodavis commented Oct 5, 2019

I think a surrender event might be better implemented as a plugin because it needs to store state (while the pass event is stateless).

@nicolodavis

This comment has been minimized.

Copy link
Owner Author

@nicolodavis nicolodavis commented Oct 5, 2019

What do you mean by making the removal from playOrder optional? I would think that it is necessary to do that to implement a pass move, no?

@danielimmke

This comment has been minimized.

Copy link
Contributor

@danielimmke danielimmke commented Oct 6, 2019

I'd like to work on this. I've been onboarding onto the codebase and think I could have a PR within the week for it.

@nicolodavis

This comment has been minimized.

Copy link
Owner Author

@nicolodavis nicolodavis commented Oct 7, 2019

Thanks @danielimmke. Looking forward to it.

@danielimmke

This comment has been minimized.

Copy link
Contributor

@danielimmke danielimmke commented Oct 7, 2019

Hey @nicolodavis thanks for replying. I have a very basic version of this working but wanted to make sure I 100% understood the requirements before submitting a PR. A "Pass" to me is just the same as ending a turn without doing anything. So I created a new event but copied the EndTurn method and removed the check that stops EndTurn from happening (around the comment // Prevent ending the turn if moveLimit haven't been made.)

This seems to work in my testing. It increments the turn and switches the player. I wanted to make sure I wasn't missing something. The other question I had was, it seems like a move calls endTurn automatically at the end. Could a user implement this functionality right now by just creating a move called pass that doesn't do anything? Are we just formalizing that as an event?

@nicolodavis

This comment has been minimized.

Copy link
Owner Author

@nicolodavis nicolodavis commented Oct 8, 2019

@danielimmke A pass is similar to a no-op move that merely calls endTurn (and you can in fact create a move to do exactly this). However, it also accomplishes another important thing which is to remove the player from playOrder. This will cause the turn to skip over the player the next time it comes around. It's also possible to simulate this using a move and a custom turn order, but we're merely formalizing this into a convenient event that makes it easier for users.

Now that I think about it, it probably makes sense to support two behaviors (one that removes the player from the turn order and one that does not):

1. pass()

Identical to endTurn().

2. pass({ remove: true })

Also removes the player from playOrder. Once playOrder is empty, we should automatically end the phase.

As far as the implementation is concerned, I would recommend just calling endTurn directly from the "pass" event rather than duplicating any logic.

@danielimmke danielimmke mentioned this issue Oct 13, 2019
2 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.