public Matchup GenerateMatchup(GenerationSettings settings)
        {
            var random = new Random();

            DowMap map = settings.Maps[random.Next(settings.Maps.Count)];

            var info = new GameInfo()
            {
                Options = new GameOptions()
                {
                    Difficulty        = (GameDifficulty)RandomOption(settings.GameDifficultyTickets, random),
                    Speed             = (GameSpeed)RandomOption(settings.GameSpeedTickets, random),
                    ResourceRate      = (GameResourceRate)RandomOption(settings.ResourceRateTickets, random),
                    StartingResources = (GameStartResource)RandomOption(settings.StartResourceTickets, random)
                }
            };

            info.Rules.Add(settings.Rules[random.Next(settings.Rules.Count)]);

            var matchup = new Matchup(map, info);

            if (settings.Teams != null)
            {
                // TODO generate the team compositions
            }

            return(matchup);
        }
 private int MapSort(DowMap a, DowMap b)
 {
     return(a.Players != b.Players
         ? a.Players - b.Players
         : a.Size != b.Size
             ? a.Size - b.Size
             : string.Compare(a.Name, b.Name));
 }
Esempio n. 3
0
 public Matchup(DowMap map, GameInfo info)
 {
     Map      = map;
     GameInfo = info;
 }
Esempio n. 4
0
        public string GetMapImagePath(DowMap map)
        {
            string root = map.Mod.IsVanilla ? filePathProvider.AppDataLocation : filePathProvider.SoulstormLocation;

            return(Path.Combine(root, map.Mod.ModFolder, "data", "scenarios", "mp", map.Image));
        }