Ejemplo n.º 1
0
        private List <MingwenInfo> SuggestedMingwens(MingwenColor color, AttributeDependency attributeDependency)
        {
            var mingwens             = new List <MingwenInfo>();
            var currentColorMingwens = Elements.Values.Where(m => color == m.Color).ToList();

            foreach (var mingwen in currentColorMingwens)
            {
                mingwen.UpdateScore(attributeDependency);
            }

            var         orderedMingwens = currentColorMingwens.OrderByDescending(m => m.Score).ToList();
            MingwenInfo first           = null;

            foreach (var mingwen in orderedMingwens)
            {
                if (mingwens.Count < MaxMingwenPerUnit &&
                    (null == first && mingwen.Score > ScoreMin ||
                     null != first && (mingwen.Score > ScoreAdvanced ||
                                       mingwen.Score > ScoreMin && first.Score - mingwen.Score < ScoreDiffLess ||
                                       mingwen.Score > ScoreMid && first.Score - mingwen.Score < ScoreDiffMore)))
                {
                    var current = mingwen.Clone();
                    mingwens.Add(current);
                    if (null == first)
                    {
                        first = current;
                    }
                }
            }

            return(mingwens);
        }
Ejemplo n.º 2
0
        public MingwenUnit SuggestedMingwenUnit(AttributeDependency attributeDependency)
        {
            var unit = new MingwenUnit(Level);

            foreach (var color in unit.Elements.Keys)
            {
                unit.Elements[color].AddRange(SuggestedMingwens(color, attributeDependency));
            }

            return(unit);
        }
Ejemplo n.º 3
0
        public void UpdateScore(AttributeDependency attributeDependency)
        {
            Score = 0;
            var    attibuteCount             = 0;
            var    preferSingleAttribute     = false;
            double preferSingleAttributeRate = 1;

            foreach (var attibute in Attributes)
            {
                var rate = attributeDependency.GetDependencyRate(attibute.Name);
                Score += rate * attibute.Rate;
                preferSingleAttribute = rate > RateNormalMax;
                if (rate > RateNormalEx)
                {
                    preferSingleAttributeRate = 1.2;
                }
                attibuteCount++;
            }

            if (Score > 0)
            {
                if (attibuteCount == 1)
                {
                    if (preferSingleAttribute)
                    {
                        Score *= preferSingleAttributeRate;
                    }
                }
                else
                {
                    var multipleAttibuteRateBase = 1 + 0.7 * (attibuteCount - 1) / attibuteCount;
                    var multipleAttibuteRate     =
                        multipleAttibuteRateBase * (1 - (multipleAttibuteRateBase - 1) / 1.9);
                    if (multipleAttibuteRate > 1)
                    {
                        Score *= multipleAttibuteRate;
                    }
                }
            }
        }