-
Notifications
You must be signed in to change notification settings - Fork 707
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
transitioning between stages #447
Comments
IIRC isn't there the possibility to pass a value directly? setActivePlayers({
value: {
...ctx.activePlayers,
[playerID]: 'stage'
}
}) That said, obvious candidates would include:
(Side note: keep meaning to write a test for this, but I think I saw that |
Another idea that's been growing on me is to have a simple All this does is that it removes the player from However, if the stage config contains a I think if we arrange things so that we just have endTurn, endPhase, endStage and setActivePlayers, that would be a nice elegant API. |
Now that I’m working on setStage('main', { moveLimit: 2 }) Otherwise users would only be able to set move limits inside |
Oh, I think that's perfectly ok.
Users can use setStage just to move between stages and setActivePlayers if
they want the more advanced options.
…On Wed, Sep 11, 2019, 12:00 AM Chris Swithinbank ***@***.***> wrote:
Now that I’m working on moveLimit (#452
<#452>), I think setStage
would probably also need a way to set a moveLimit, perhaps via a second
options argument:
setStage('main', { moveLimit: 2 })
Otherwise users would only be able to set move limits inside
setActivePlayers.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#447>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABZULXUFO7HN5EG4K4VX3LQI7ABFANCNFSM4IRLKFHQ>
.
|
I think of
|
@nicolodavis Totally understand. I’ve finished work on |
An example of just how complicated that would be: const turn = {
activePlayers: {
all: true,
moveLimit: 4,
},
moves: {
move: (G, ctx) => {},
changeStage: (G, ctx) => {
ctx.events.setActivePlayers({
value: {
...ctx.activePlayers,
[ctx.playerID]: 'newStage',
},
moveLimit: {
value: {
...Object.keys(ctx._activePlayersMoveLimit).reduce((obj, key) => {
obj[key] =
ctx._activePlayersMoveLimit[key] -
ctx._activePlayersNumMoves[key];
return obj;
}, {}),
[ctx.playerID]: 2,
},
},
});
},
},
}; Whereas const turn = {
activePlayers: {
all: true,
moveLimit: 4,
},
moves: {
move: (G, ctx) => {},
changeStage: (G, ctx) => {
ctx.events.setStage('newStage', { moveLimit: 2 });
},
},
}; |
OK, you've convinced me :) Let's also support an additional argument in |
In the
phases-overhaul
branch, the only way to manipulate a player's stage is thesetActivePlayers
event.For example, to set the current player's stage to 'A', you can do:
However, this has two problems:
It clobbers the state in
activePlayers
(if some other player was in there, they would be removed).It cannot set the stage of the player that made the move (it only works on the "current player").
We could change the semantics of
setActivePlayers
to overcome these, or split it into multiple events that do different things.The text was updated successfully, but these errors were encountered: