public ICollection <OutputLogError> UpdateMatchGameStateMessage_Diff(GameStateMessageResult gsm) { // Happens when game disconnected and outputlog starts with data from a previous log if (currentGameProgress == null) { return(new OutputLogError[0]); } Errors = new List <OutputLogError>(); this.gsm = gsm; if (currentGameProgress.CurrentTurn == 0) { // Still mulliganing and the library is reinitialized each time... currentGameProgress.InitPlayerLibrary(gsm.Raw.gameStateMessage.zones); } // Set the turn number var turnInfo = gsm.Raw.gameStateMessage?.turnInfo; if (turnInfo?.turnNumber != null) { currentGameProgress.CurrentTurn = turnInfo.turnNumber; if (turnInfo.turnNumber == 1 && turnInfo.activePlayer > 0) { currentGameProgress.FirstTurn = turnInfo.activePlayer == currentGameProgress.SystemSeatId ? FirstTurnEnum.Play : FirstTurnEnum.Draw; } } // Protection if (gsm.Raw?.gameStateMessage?.annotations != null) { RecordIdsChanged(); AnalyzeCardsMovements(); } DiscoverGameObjects(); // This requires the CardTransfersByTurn to be set for this message DetectMulligans(); // This requires the RecordIdsChanged DetectOpponentCards(); return(Errors); }
public ICollection <OutputLogError> UpdateMatchGameStateMessage_Diff(GameStateMessageResult gsm) { // Happens when game disconnected and outputlog starts with data from a previous log if (currentGameProgress == null) { return(new OutputLogError[0]); } Errors = new List <OutputLogError>(); this.gsm = gsm; if (currentGameProgress.CurrentTurn == 0) { // Still mulliganing and the library is reinitialized each time... currentGameProgress.InitPlayerLibrary(gsm.Raw.gameStateMessage.zones); } // Set the turn number var turnInfo = gsm.Raw.gameStateMessage?.turnInfo; if (turnInfo?.turnNumber != null) { currentGameProgress.CurrentTurn = turnInfo.turnNumber; } //if (gsm.Timestamp == 636922646535459255) // System.Diagnostics.Debugger.Break(); //if (gsm.Timestamp == 636896160671918127) // System.Diagnostics.Debugger.Break(); // Protection if (gsm.Raw?.gameStateMessage?.annotations != null) { RecordIdsChanged(); AnalyzeCardsMovements(); } DiscoverGameObjects(); // This requires the CardTransfersByTurn to be set for this message DetectMulligans(); // This requires the RecordIdsChanged DetectOpponentCards(); return(Errors); }