Closed sladwig closed 6 years ago
I like this in principle, but I think it would complicate the semantics and the implementation. For example:
endPhase calls endTurnIf. What happens if these two return conflicting objects?
similarly, endTurn calls endPhaseIf
I think it's cleaner for endPhase to only deal with phase related stuff and endTurn to deal with turn related stuff.
For your case, can't you use the Events API to change the player from the ctx object?
have been trying to update boardgame.io (from v0.20.1), which somehow doesn't work as smooth as expected and trough that stumbled on the commit above and thought it would be nice for consistency... haven't thought about/tried the Events API, will try it and close for now.
analogous to this commit (allow setting the next player via endTurn), I would want to use similar API for setting the next player via
endPhase
. I think it could clean up myturnOrder
code a bit, since I wouldn't have to save the result of the first phase in G, to check inturnOrder
function whose turn it is.Since with
endPhase
you can return the next phase, which is kind of cool by itself. Maybe being able to return an object like{nextPhase: 'next_phase', nextPlayer: 'next_player'}
could be a solution? So either wayendPhase
orendTurn
would be able to changenextPlayer
and/ornextPhase
.