reset behavior of activePlayers
See original GitHub issueSpawning off a thread from a previous discussion at #442, which is talking about (among other things) what to do to activePlayers
after it becomes empty (this is a new concept in the phases-overhaul
branch).
Background
activePlayers
is a map that keeps track of all the players that can make a move on the current turn. This is an evolution of the current concept actionPlayers
. It also keeps track of what “stage” each active player is in. A “stage” is analogous to a “phase”, and basically restricts what moves the player in that stage can make. It can be manipulated using something like this:
setActivePlayers({ others: 'discard', once: true });
which does the following things:
- put every player (other than the current player) in
activePlayers
. - sets the stages of those players to
discard
. - allows them to make one move before removing them from
activePlayers
.
This allows implementing cards that allow other players to take an action before reverting back to the current player (the Militia card in Dominion, for example).
Problem
Players are removed from activePlayers
once they make a move. After activePlayers
becomes empty, it is set to null
(which means that only the current player can play, but they are not in any stage).
However, if the currentPlayer
was in a stage to begin with (i.e. activePlayers
was something like { currentPlayer: 'play' }
before setActivePlayers
was called), then this state is lost.
Proposals
-
Reset
activePlayers
to the previous state beforesetActivePlayers
was called once it becomes empty. -
Pass in the state to reset to in the
setActionPlayers
call itself.
Notes
- Both proposals need to clearly define when to trigger the reset behavior. Is it sufficient to just assume that a reset is required when
activePlayers
becomes empty?
Issue Analytics
- State:
- Created 4 years ago
- Comments:28 (28 by maintainers)
That’s a good point. Maybe we should just support
moveLimit: 2
instead of the more verbose version.Yeah, let’s go for the bare minimum since this is a new API and add stuff as we encounter use-cases that are difficult to implement.
I’m working on
setPhase / endPhase
BTW.