@@ -261,6 +261,7 @@ export class Game<State extends BaseState> {
261261 const forfeitPlayer = this . onForfeitPlayer ?.( player , ctx ) ;
262262 if ( forfeitPlayer ?. success === false ) return forfeitPlayer ;
263263 player . out = true ;
264+ this . log . push ( { action : staffAction ? 'dq' : 'forfeit' , turn : player . turn , time : new Date ( ) , ctx : null } ) ;
264265 return {
265266 success : true ,
266267 data : {
@@ -317,7 +318,7 @@ export class Game<State extends BaseState> {
317318 }
318319
319320 // Only gets next turn. No side effects.
320- next ( current = this . turn ) : State [ 'turn' ] {
321+ getNext ( current = this . turn ) : State [ 'turn' ] {
321322 const baseIndex = this . turns . indexOf ( current ! ) ;
322323 return this . turns [ ( baseIndex + 1 ) % this . turns . length ] ;
323324 }
@@ -326,7 +327,7 @@ export class Game<State extends BaseState> {
326327 nextPlayer ( ) : State [ 'turn' ] | null {
327328 let current = this . turn ;
328329 do {
329- current = this . next ( current ) ;
330+ current = this . getNext ( current ) ;
330331 const currentPlayer = this . players [ current ] ;
331332 if ( ! currentPlayer ) throw new Error ( `Could not find ${ current } in ${ Object . keys ( this . players ) } from ${ this . turns } ` ) ;
332333 if ( currentPlayer . out ) continue ;
@@ -337,6 +338,7 @@ export class Game<State extends BaseState> {
337338 this . setTimer ( 'Next turn' ) ;
338339 return current ;
339340 }
341+ this . log . push ( { action : 'skip' , turn : current , time : new Date ( ) , ctx : null } ) ;
340342 } while ( current !== this . turn ) ;
341343 this . clearTimer ( ) ;
342344 return null ;
@@ -388,6 +390,7 @@ export class Game<State extends BaseState> {
388390 created : this . createdAt ,
389391 started : this . startedAt ! ,
390392 ended : this . endedAt ! ,
393+ winCtx : 'winCtx' in this ? this . winCtx : null ,
391394 } ;
392395 uploadGame ( model ) . catch ( err => {
393396 log ( err ) ;
0 commit comments