internal GameState(BasePlayer player, BasePlayer opponent, GameBoard board = null, int turnNumber = 0, BasePlayer currentPlayer = null) { this.Player = player; this.Opponent = opponent; this.Board = board ?? new GameBoard(); this.TurnNumber = turnNumber; this.CurrentPlayer = currentPlayer ?? (GameEngine.Random.Next(0, 2) % 2 == 0 ? this.Player : this.Opponent); }
/// <summary> /// Initialize the game engine /// </summary> /// <param name="player">Player 1</param> /// <param name="opponent">Player 2 (the opponent)</param> /// <param name="board">The current game board</param> /// <param name="turnNumber">The current turn number</param> /// <param name="currentPlayer">The current player</param> /// <param name="randomSeed">The random seed to use</param> public static void Initialize(BasePlayer player, BasePlayer opponent, GameBoard board = null, int turnNumber = 0, BasePlayer currentPlayer = null, int randomSeed = 0) { Random = randomSeed != 0 ? new Random(randomSeed) : new Random(); GameEventManager.Initialize(); Deathrattles = new Dictionary<BaseCard, List<BaseDeathrattle>>(); GameState = new GameState(player, opponent, board, turnNumber, currentPlayer); DeadCardsThisTurn = new List<BaseCard>(); DeadPlayersThisTurn = new List<BasePlayer>(); }