Skip to content

Commit

Permalink
shouldEndPhase can see the results of onTurnEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
darthfiddler committed Sep 21, 2018
1 parent 2f6042b commit d1a1a8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@ export function FlowWithPhases({
// Update state.
ctx = { ...ctx, turn };

state = { ...state, G, ctx };

// End phase if condition is met.
const endPhaseArg = shouldEndPhase(state);
if (endPhaseArg) {
Expand All @@ -508,12 +510,12 @@ export function FlowWithPhases({

if (endPhase) {
return this.dispatch(
{ ...state, G, ctx },
state,
automaticGameEvent('endPhase', [endPhaseArg], this.playerID)
);
}

return startTurn({ ...state, G, ctx }, conf);
return startTurn(state, conf);
}

function endGameEvent(state, arg) {
Expand Down

0 comments on commit d1a1a8a

Please sign in to comment.