@@ -329,7 +329,7 @@ export function Flow({ moves, phases, endIf, turn, events, plugins }) {
329329 if ( fn === EndTurn ) {
330330 const currentPlayer = state . ctx . currentPlayer ;
331331 if ( turnsEnded . has ( currentPlayer ) ) {
332- const ctx = { ...state . ctx , currentPlayer : '' } ;
332+ const ctx = { ...state . ctx , currentPlayer : null , stage : null } ;
333333 return { ...state , ctx } ;
334334 }
335335 turnsEnded . add ( currentPlayer ) ;
@@ -426,7 +426,7 @@ export function Flow({ moves, phases, endIf, turn, events, plugins }) {
426426 const conf = GetPhase ( ctx ) ;
427427
428428 // Initialize the turn order state.
429- if ( currentPlayer !== undefined ) {
429+ if ( currentPlayer ) {
430430 ctx = { ...ctx , currentPlayer } ;
431431 } else {
432432 ctx = InitTurnOrderState ( G , ctx , conf . turn ) ;
@@ -513,7 +513,7 @@ export function Flow({ moves, phases, endIf, turn, events, plugins }) {
513513 }
514514
515515 function ShouldEndTurn ( { G, ctx } ) {
516- if ( ctx . currentPlayer === '' ) {
516+ if ( ctx . currentPlayer === null ) {
517517 return false ;
518518 }
519519
@@ -593,7 +593,7 @@ export function Flow({ moves, phases, endIf, turn, events, plugins }) {
593593 let { G, ctx } = state ;
594594
595595 // If we are not in a turn currently, do nothing.
596- if ( ctx . currentPlayer === '' ) {
596+ if ( ctx . currentPlayer === null ) {
597597 return state ;
598598 }
599599
@@ -618,8 +618,8 @@ export function Flow({ moves, phases, endIf, turn, events, plugins }) {
618618 next . push ( { fn : UpdateTurn , arg, currentPlayer : ctx . currentPlayer } ) ;
619619 }
620620
621- // Reset currentPlayer.
622- ctx = { ...ctx , currentPlayer : '' , stage : null } ;
621+ // Reset currentPlayer and stages .
622+ ctx = { ...ctx , currentPlayer : null , stage : null } ;
623623
624624 // Add log entry.
625625 const action = gameEvent ( 'endTurn' , arg ) ;
0 commit comments