-
Notifications
You must be signed in to change notification settings - Fork 715
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
How to create actions for not-current player #132
Comments
I think a combination of a custom turn order, the FlowWithPhases, and some custom logic inside your game could do the trick. Can you show some code? |
I didn't start this action, as I just started to learn the framework there are a lot of changes I'm making every review. This is the code repository: https://github.com/janosimas/dominion The 'normal' turn has two phases, an action phase for playing action cards and a buy phase to buy new cards for your deck. The action cards I'm testing are the more simple ones, draw cards, increase number of actions... If I understand right, I would have to have a phase for each different complex action with different allowed moves. The turn of the player who played the card would end, and would be the turn of the player who should discard, then go back to the player who is playing. How can I change to an specific phase, not just 'flow' to the next? |
Yeah, my initial guess was that you're on a Dominion clone and were speaking about the Militia card. From the source, it looks like returning a phase name from However, the phase framework was (IIRC) made for games like Catan were you have a dedicated setup phase (placing initial houses) and a play phase. I'd personally liked when games are enabled to stick to their terminology, it'll make everything downstream easier to reason about. The game needs to lead the framework to believe that another player is on turn - it does not allow moves from another player other than the current one. This makes problems because in a multiplayer Dominion, each other player could make their move, however the framework currently dictates the next one on turn. That would have to be stretched a bit framework-side, for now I'd stick to a two-player only game. |
The flow of playing Militia would go along the lines:
To keep the notion of a "turn", a kind of "subturn" is necessary. Perhaps a custom flow implementation is in order for this to work properly. I'd very much see this implementation come true, however I'll have no time this WE - busy playing board games ;-) |
Just to add to what @Stefan-Hanke has already addressed here: The game state is managed by a state machine. It can be in one of many phases and the current player can be in one of many states. You can model many turns within a phase (Catan), or many phases within a turn (Dominion). The concept of phase and turn are independent of each other. The framework provides many ways to transition between these states. The easiest way to transition is to use the events:
These transition the game using a round-robin order (when you end the turn, it flows to the "next" player; when you end the phase, it flows to the "next" phase). If you want behavior that's different from this, you need a custom turn order. Stefan's reply above shows you how you can leverage it to implement the Militia card. I do think it would be nice if we can change the current player without ending the turn. I'll add this as a feature request. Also note that the special string |
Closing this in favor of #141 |
Hi, I'm implementing a game to test the framework and it's great
but I'm having some issues...
How can I create a move that another player execute?
Like, force another player to chose and discard a card.
How to create a turn with fixed phases?
phase 1 -> phase 2 -> end turn
I used endPhaseIf in phase 1 and it goes to phase 2
if I use the endTurnIf in phase 2, the next turn is in phase 2, not in phase 1.
The text was updated successfully, but these errors were encountered: