public BaseWinRatesBuilder(IReadOnlyDictionary <int, Hero> heroes, MatchSummaryCollection matches)
        {
            _heroes  = heroes;
            _matches = matches;
            if (heroes.Count == 0)
            {
                _totals = Array.Empty <WinRateBuilder>();
                return;
            }
            int?minHeroId = null;
            int?maxHeroId = null;

            foreach (var hero in heroes.Values)
            {
                if (minHeroId == null || hero.Id < minHeroId)
                {
                    minHeroId = hero.Id;
                }
                if (maxHeroId == null || hero.Id > maxHeroId)
                {
                    maxHeroId = hero.Id;
                }
            }
            _minHeroId = minHeroId ?? 0;
            _totals    = new WinRateBuilder[maxHeroId - minHeroId + 1 ?? 0];
        }
        public MapAdjustmentsBuilder(MatchSummaryCollection matches, IReadOnlyCollection <Hero> heroes, IReadOnlyCollection <Map> maps)
        {
            _matches = matches;
            _heroes  = heroes;
            _maps    = maps;

            int?minHeroId = null;
            int?maxHeroId = null;

            foreach (var hero in heroes)
            {
                if (minHeroId == null || hero.Id < minHeroId)
                {
                    minHeroId = hero.Id;
                }
                if (maxHeroId == null || hero.Id > maxHeroId)
                {
                    maxHeroId = hero.Id;
                }
            }
            _minHeroId    = minHeroId ?? 0;
            _totalsByHero = new WinRateBuilder[maxHeroId - minHeroId + 1 ?? 0];

            int?minMapId = null;
            int?maxMapId = null;

            foreach (var map in maps)
            {
                if (minMapId == null || map.Id < minMapId)
                {
                    minMapId = map.Id;
                }
                if (maxMapId == null || map.Id > maxMapId)
                {
                    maxMapId = map.Id;
                }
            }
            _minMapId           = minMapId ?? 0;
            _totalsByHeroAndMap = new WinRateBuilder[_totalsByHero.Length, maxMapId - minMapId + 1 ?? 0];
        }
Beispiel #3
0
        public HeroAdjustmentsBuilder(MatchSummaryCollection matches, IReadOnlyCollection <Hero> heroes)
        {
            _matches = matches;
            _heroes  = heroes;

            int?minHeroId = null;
            int?maxHeroId = null;

            foreach (var hero in heroes)
            {
                if (minHeroId == null || hero.Id < minHeroId)
                {
                    minHeroId = hero.Id;
                }
                if (maxHeroId == null || hero.Id > maxHeroId)
                {
                    maxHeroId = hero.Id;
                }
            }
            _minHeroId     = minHeroId ?? 0;
            _baseWinRates  = new WinRateBuilder[maxHeroId - minHeroId + 1 ?? 0];
            _allyWinRates  = new WinRateBuilder[_baseWinRates.Length, _baseWinRates.Length];
            _enemyWinRates = new WinRateBuilder[_baseWinRates.Length, _baseWinRates.Length];
        }