public void ReturnIntelligenceResult() { var attributes = new[] { "senses", "42", "9266" }; mockInnerSelector.Setup(s => s.SelectFrom("table name", "name")).Returns(attributes); var result = selector.SelectFrom("table name", "name"); Assert.That(result.Senses, Is.EqualTo("senses")); Assert.That(result.LesserPowersCount, Is.EqualTo(42)); Assert.That(result.GreaterPowersCount, Is.EqualTo(9266)); }
public Intelligence GenerateFor(Item item) { var highStatResult = percentileSelector.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceStrongStats); var highStat = Convert.ToInt32(highStatResult); var intelligence = new Intelligence(); intelligence.Ego += highStat - 10 - highStat % 2; intelligence.Ego += item.Magic.Bonus; foreach (var ability in item.Magic.SpecialAbilities) { intelligence.Ego += ability.BonusEquivalent; } switch (dice.Roll().d3().AsSum()) { case 1: intelligence.CharismaStat = 10; break; case 2: intelligence.IntelligenceStat = 10; break; case 3: intelligence.WisdomStat = 10; break; } intelligence.CharismaStat = SetHighStat(highStat, intelligence.CharismaStat); intelligence.IntelligenceStat = SetHighStat(highStat, intelligence.IntelligenceStat); intelligence.WisdomStat = SetHighStat(highStat, intelligence.WisdomStat); intelligence.Communication = attributesSelector.SelectFrom(TableNameConstants.Collections.Set.IntelligenceCommunication, highStatResult); if (intelligence.Communication.Contains("Speech")) { intelligence.Languages = GenerateLanguages(intelligence.IntelligenceStat); } intelligence.Ego += BoostEgoByCommunication(intelligence.Communication, "Read"); intelligence.Ego += BoostEgoByCommunication(intelligence.Communication, "Read magic"); intelligence.Ego += BoostEgoByCommunication(intelligence.Communication, "Telepathy"); var intelligenceAttributesResult = intelligenceAttributesSelector.SelectFrom(TableNameConstants.Collections.Set.IntelligenceAttributes, highStatResult); intelligence.Senses = intelligenceAttributesResult.Senses; var lesserPowers = GeneratePowers("Lesser", intelligenceAttributesResult.LesserPowersCount); intelligence.Ego += lesserPowers.Count; intelligence.Powers.AddRange(lesserPowers); var greaterPowers = GeneratePowers("Greater", intelligenceAttributesResult.GreaterPowersCount); var roll = dice.Roll().d4().AsSum(); if (roll <= intelligenceAttributesResult.GreaterPowersCount) { greaterPowers.RemoveAt(greaterPowers.Count - 1); intelligence.SpecialPurpose = percentileSelector.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceSpecialPurposes); intelligence.DedicatedPower = percentileSelector.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceDedicatedPowers); intelligence.Ego += 4; } intelligence.Ego += greaterPowers.Count * 2; intelligence.Powers.AddRange(greaterPowers); intelligence.Alignment = GetAlignment(item); intelligence.Personality = percentileSelector.SelectFrom(TableNameConstants.Percentiles.Set.PersonalityTraits); return(intelligence); }