boardgamers / gaia-engine

Javascript engine for project gaia
MIT License
13 stars 6 forks source link

Rework the flow. #84

Closed coyotte508 closed 6 years ago

coyotte508 commented 6 years ago

Also:

The main change is that subPhase is not stored in engine. When we need to ask the player for a tech tile we do this.processNextMove(SubPhase.TechTile). Same for other subphases. This avoids spreading the code around / having to stop the function. When needing to ask for some input from the player in the middle of a function, we can. This will be useful for taklons & the brainstore.

The income / gaia phase now happens player by player, for example player 2 doesn't receive income until player 1 makes their income actions. Maybe it was already the case, I'm not sure.

The move history is also stored in engine. There's a newTurn variable added in engine. It tells the UI whether to append a move in the current line or the next line. Currently the UI has to guess, and is not always correct.

turnOrder after the setup phase always indicates the order of players to play in the round. In the leech, income & gaia phases, tempTurnOrder is used but turnOrder stays the same. It also helps the UI, now it doesn't have to juggle between the two.