Skip to content

Custom turn order that automatically skips turns #904

Answered by delucis
dondragon2 asked this question in Q&A
Discussion options

You must be logged in to vote

@dondragon2 You can implement this using a custom turn order. Here’s a basic example that re-implements the default behaviour:

const game = {
  turn: {
    order: {
      // Get the initial value of playOrderPos at the beginning of the phase.
      first: (G, ctx) => 0,

      // Get the next value of playOrderPos at the end of each turn.
      next: (G, ctx) => {
        const nextPos = (ctx.playOrderPos + 1) % ctx.numPlayers;
        return nextPos;
      },
    },
  },
};

In your case, you would find the next player based on your criteria and return their position in the play order. For example, if you have some function that can return the next player ID, you might write a next method…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by delucis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #859 on February 02, 2021 09:32.