///<inheritdoc/>
        protected override void AdjustQualitiesAccordingToArchetype(CharacterTraits traits)
        {
            while (StrongPoints.Count < 4)
            {
                int randomTraitIndex = RandomValueGenerator.GenerateIntWithMaxValue(CharacterTraits.GetPersonalQualitiesCount() - 1);

                var property = traits.GetQualityPropertyByIndex(randomTraitIndex);

                if (property == null || StrongPoints.Contains(property.Name) || WeakPoints.Contains(property.Name))
                {
                    continue;
                }

                property.SetValue(traits, RandomValueGenerator.GenerateStrongAttributeValue());

                StrongPoints.Add(property.Name);
            }

            var weakPoints = traits.GetPersonalQualitiesValues().Where(quality => quality.Value <= 20).ToList();

            WeakPoints.AddRange(weakPoints.Select(x => x.Key).Take(2));

            while (WeakPoints.Count < 2)
            {
                int randomTraitIndex = RandomValueGenerator.GenerateIntWithMaxValue(CharacterTraits.GetPersonalQualitiesCount() - 1);

                var property = traits.GetQualityPropertyByIndex(randomTraitIndex);

                if (property == null || StrongPoints.Contains(property.Name) || WeakPoints.Contains(property.Name))
                {
                    continue;
                }

                property.SetValue(traits, RandomValueGenerator.GenerateWeakAttributeValue());

                WeakPoints.Add(property.Name);
            }
        }
示例#2
0
        /// <summary>
        /// Adds 1 to 4 additional strong points
        /// </summary>
        /// <param name="traits"></param>
        protected void AddRandomStrongPoint(CharacterTraits traits)
        {
            int numberOfStrongPoints  = 4;
            int demographicPercentage = RandomValueGenerator.GeneratePercentileIntegerValue();

            if (demographicPercentage > int.Parse(TraitDistribution.StrongPointTier1) &&
                demographicPercentage <= int.Parse(TraitDistribution.StrongPointTier2))
            {
                numberOfStrongPoints = 5;
            }

            if (demographicPercentage > int.Parse(TraitDistribution.StrongPointTier2) &&
                demographicPercentage <= int.Parse(TraitDistribution.StrongPointTier3))
            {
                numberOfStrongPoints = 6;
            }
            if (demographicPercentage > int.Parse(TraitDistribution.StrongPointTier3))
            {
                numberOfStrongPoints = 7;
            }

            while (StrongPoints.Count < numberOfStrongPoints)
            {
                int randomTraitIndex = RandomValueGenerator.GenerateIntWithMaxValue(CharacterTraits.GetPersonalQualitiesCount() - 1);

                var property = traits.GetQualityPropertyByIndex(randomTraitIndex);

                if (property == null || StrongPoints.Contains(property.Name) || WeakPoints.Contains(property.Name))
                {
                    continue;
                }

                property.SetValue(traits, RandomValueGenerator.GenerateStrongAttributeValue());

                StrongPoints.Add(property.Name);
            }
        }