public override void Apply(ImperaPlus.Domain.User user, Game game)
 {
     // Do not modify anything
 }
 public override void Apply(ImperaPlus.Domain.User user, Game game)
 {
     this.ApplyMap(user, game, game.Map);
 }
        private void ApplyMap(Domain.User user, Game game, Map map)
        {
            if (game.State == GameState.Ended)
            {
                return;
            }

            var visibleCountries = new List<Country>();

            var player = game.Teams.SelectMany(x => x.Players).FirstOrDefault(x => x.UserId == user.Id);
            if (player != null)
            {
                var team = game.Teams.First(x => x.Players.Any(p => p.Id == player.Id));

                var mapTemplate = this.MapTemplateProvider.GetTemplate(game.MapTemplate);
                var countryDict = map.Countries.ToDictionary(x => x.Identifier);

                foreach (var country in map.Countries)
                {
                    if (country.TeamId == team.Id // Country belongs to player's team
                    || mapTemplate
                            .GetConnectedCountries(country.Identifier)
                            .Select(x => countryDict[x])
                            .Any(x => x.TeamId == team.Id)) // Country is connected to a country which belongs to player's team
                    {
                        visibleCountries.Add(country);
                    }
                }
            }

            map.Countries = visibleCountries.ToArray();
        }
 public abstract void Apply(ImperaPlus.Domain.User user, Game game);