public void GetPersonalQualitiesValues_NormalCharacterCreation_29QualitiesExpected() { //Arrange CharacterTraits traits = new CharacterTraits("Fred Flintstone", Sex.Male); //Act var list = traits.GetPersonalQualitiesValues(); //Assert Assert.AreEqual(list.Count, CharacterTraits.GetPersonalQualitiesCount()); }
public void New_WithValidArguments_ClassInstantiated() { //ACT CharacterTraits traits = new CharacterTraits("Sterling Archer", Sex.Male, Orientation.Bisexual); var emotions = traits.GetEmotionalStateValues(); var qualities = traits.GetPersonalQualitiesValues(); traits.SetQualityAttributeByName("Adaptiveness", 99); traits.ResetEmotions(); Assert.AreEqual(qualities.Count, CharacterTraits.GetPersonalQualitiesCount()); Assert.AreEqual(emotions.Count, CharacterTraits.GetEmotionalStatesCount()); Assert.AreEqual(traits.Sex, Sex.Male); Assert.AreEqual(traits.Orientation, Orientation.Bisexual); Assert.AreNotEqual(traits.InternalId, String.Empty); }
///<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); } }
/// <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); } }