Ejemplo n.º 1
0
            public string Translate(IReadOnlyList <int> values)
            {
                if (_valueIndices.Count != values.Count)
                {
                    throw new ArgumentException("Number of values must match number of value indices");
                }

                var firstMatch = _valueIndices
                                 .EquiZip(values, (i, v) => _affix.QueryModsSingleValue(i, v))
                                 .Aggregate((a, ms) => a.Intersect(ms))
                                 .FirstOrDefault();

                if (firstMatch == null)
                {
                    return(null);
                }

                var idValueDict = _valueIndices
                                  .Select(i => firstMatch.Stats[i].Id)
                                  .EquiZip(values, Tuple.Create)
                                  .ToDictionary(t => t.Item1, t => t.Item2);

                return(_statTranslator.GetTranslations(idValueDict).First());
            }