public void StartGame() { try { Log("Game " + this.Id + " has started"); // Get disadvantaged players List <CharacterEnum> disadvantaged = UserDict.Keys.ToList().Where(c => c != CharacterEnum.AMARU).ToList().GetRange(AmaruConstants.NUM_PLAYER - AmaruConstants.NUM_DISADVANTAGED, AmaruConstants.NUM_DISADVANTAGED); // Init Players foreach (CharacterEnum c in UserDict.Keys) // Default draw { UserDict[c].SetPlayer(new Player(c, AmaruConstants.GAME_PREFIX + Id), this); } UserDict.Add(CharacterEnum.AMARU, new AIUserExperimental("AI_" + AmaruConstants.GAME_PREFIX + Id)); UserDict[CharacterEnum.AMARU].SetPlayer(new AmaruPlayer(AmaruConstants.GAME_PREFIX + Id), this); // Draw cards foreach (CharacterEnum c in UserDict.Keys) // Default draw { UserDict[c].Player.Draw(AmaruConstants.INITIAL_HAND_SIZE); } foreach (CharacterEnum c in disadvantaged) // Extra draw for disadvantaged { UserDict[c].Player.Draw(AmaruConstants.INITIAL_HAND_BONUS); } // Send GameInitMessage to Users foreach (CharacterEnum target in UserDict.Keys) { Dictionary <CharacterEnum, EnemyInfo> enemies = new Dictionary <CharacterEnum, EnemyInfo>(); OwnInfo own = UserDict[target].Player.AsOwn; foreach (CharacterEnum c in CharacterManager.Instance.Others(target)) { enemies.Add(c, UserDict[c].Player.AsEnemy); } UserDict[target].Write(new GameInitMessage(enemies, own, _turnList)); } // Start turn StartTurn(); } catch (Exception e) { LogException(e); throw e; } // Start running this.Run(); }
public GameInitMessage(Dictionary <CharacterEnum, EnemyInfo> enemyDict, OwnInfo own, List <CharacterEnum> order) { this.EnemyDict = enemyDict; this.Own = own; this.Order = order; }