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

Increment current player at start of phase in TurnOrder.DEFAULT #521

Merged
merged 6 commits into from
Nov 24, 2019
Merged

Increment current player at start of phase in TurnOrder.DEFAULT #521

merged 6 commits into from
Nov 24, 2019

Conversation

delucis
Copy link
Member

@delucis delucis commented Nov 24, 2019

This would close #517

Changes

  1. TurnOrder.DEFAULT will now increment the current player at the start of a phase and includes a check to prevent incrementing if the phase is a game’s starting phase.

  2. Adds TurnOrder.CONTINUE to provide the old default behaviour for those who need it. Is this a good name? I couldn’t think of anything clearer that would still be concise.

Breaking Changes

This change will break current behaviour for anyone:

  • Using v0.33 or higher, AND
  • Using phases, AND
  • Using TurnOrder.DEFAULT directly or not setting a custom turn.order.first

Migration

If currently using the default turn order directly, use TurnOrder.CONTINUE instead:

import { TurnOrder } from 'boardgame.io/core'

const turn = {
- order: TurnOrder.DEFAULT,
+ order: TurnOrder.CONTINUE,
}

If currently not setting a turn order (and using phases), import TurnOrder:

+ import { TurnOrder } from 'boardgame.io/core'

const turn = {
+ order: TurnOrder.CONTINUE,
}

Increments the current player at the start of phases when using TurnOrder.DEFAULT (which currently
maintains the player across phase changes). Includes a check so that the player is NOT incremented
at the start of a game.

BREAKING CHANGE: The current player is now incremented at the start of a new phase. Previously the
current player was unchanged when a phase ended.
This implements the previous TurnOrder.DEFAULT for those who need this 
less common pattern.
@nicolodavis nicolodavis merged commit ad08b8a into boardgameio:master Nov 24, 2019
@delucis delucis deleted the delucis/fix/turn-order-default branch November 24, 2019 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

currentPlayer not advancing using TurnOrder.DEFAULT at phase end.
2 participants