예제 #1
0
        private Dictionary<string, Skill> AddMonsterSkillRanks(Race race, Dictionary<string, Stat> stats, Dictionary<string, Skill> skills)
        {
            var monsterSkills = collectionsSelector.SelectFrom(TableNameConstants.Set.Collection.ClassSkills, race.BaseRace);
            var monsterHitDice = adjustmentsSelector.SelectFrom(TableNameConstants.Set.Adjustments.MonsterHitDice);

            foreach (var monsterSkill in monsterSkills)
            {
                if (skills.ContainsKey(monsterSkill) == false)
                {
                    var selection = skillSelector.SelectFor(monsterSkill);

                    if (stats.ContainsKey(selection.BaseStatName) == false)
                        continue;

                    skills[monsterSkill] = new Skill(monsterSkill, stats[selection.BaseStatName], 0);
                }

                skills[monsterSkill].RankCap += monsterHitDice[race.BaseRace] + 3;
                skills[monsterSkill].ClassSkill = true;
            }

            var intelligenceSkillBonus = Math.Max(1, 2 + stats[StatConstants.Intelligence].Bonus);
            var points = (monsterHitDice[race.BaseRace] + 3) * intelligenceSkillBonus;
            var validMonsterSkills = FilterOutInvalidSkills(monsterSkills, skills);

            while (points-- > 0 && validMonsterSkills.Any())
            {
                var skill = collectionsSelector.SelectRandomFrom(validMonsterSkills);
                skills[skill].Ranks++;
                validMonsterSkills = FilterOutInvalidSkills(monsterSkills, skills);
            }

            return skills;
        }
        public void AllImmutableRequirementsMet()
        {
            selection.RequiredBaseAttack = 2;

            selection.RequiredStats["stat"] = 16;
            stats["stat"] = new Stat("stat");
            stats["stat"].Value = 16;
            stats["other stat"] = new Stat("other stat");
            stats["other stat"].Value = 15;

            selection.RequiredSkillRanks["class skill"] = 5;
            selection.RequiredSkillRanks["cross-class skill"] = 5;
            skills["class skill"] = new Skill("class skill", stats["stat"], 10);
            skills["class skill"].Ranks = 10;
            skills["class skill"].ClassSkill = false;
            skills["other class skill"] = new Skill("other class skill", stats["stat"], 10);
            skills["other class skill"].Ranks = 9;
            skills["other class skill"].ClassSkill = false;
            skills["cross-class skill"] = new Skill("cross-class skill", stats["stat"], 10);
            skills["cross-class skill"].Ranks = 5;
            skills["cross-class skill"].ClassSkill = true;
            skills["other cross-class skill"] = new Skill("other cross-class skill", stats["stat"], 10);
            skills["other cross-class skill"].Ranks = 4;
            skills["other cross-class skill"].ClassSkill = true;

            selection.RequiredCharacterClasses["class name"] = 1;
            characterClass.Name = "class name";
            characterClass.Level = 1;

            var met = selection.ImmutableRequirementsMet(2, stats, skills, characterClass);
            Assert.That(met, Is.True);
        }
        public void ApplyFeatThatGrantSkillBonusesToSkills()
        {
            var skills = new Dictionary<string, Skill>();
            var baseStat = new Stat("base stat");

            skills["skill 1"] = new Skill("skill 1", baseStat, 1);
            skills["skill 1"].Bonus = 1;
            skills["skill 2"] = new Skill("skill 2", baseStat, 1);
            skills["skill 2"].Bonus = 2;
            skills["skill 3"] = new Skill("skill 3", baseStat, 1);
            skills["skill 3"].Bonus = 3;
            skills["skill 4"] = new Skill("skill 4", baseStat, 1);
            skills["skill 4"].Bonus = 4;
            mockSkillsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats)).Returns(skills);

            var feats = new List<Feat>();
            feats.Add(new Feat());
            feats.Add(new Feat());
            feats.Add(new Feat());
            feats[0].Name = "feat1";
            feats[0].Power = 1;
            feats[1].Name = "feat2";
            feats[1].Power = 2;
            feats[2].Name = "feat3";
            feats[2].Power = 3;

            mockFeatsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats, skills, baseAttack)).Returns(feats);

            var featGrantingSkillBonuses = new[] { "feat3", "feat1" };
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.FeatGroups, FeatConstants.SkillBonus))
                .Returns(featGrantingSkillBonuses);

            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.SkillGroups, "feat1")).Returns(new[] { "skill 1" });
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.SkillGroups, "feat3")).Returns(new[] { "skill 2", "skill 4" });

            var ability = abilitiesGenerator.GenerateWith(characterClass, race, stats, baseAttack);
            Assert.That(ability.Skills["skill 1"].Bonus, Is.EqualTo(2));
            Assert.That(ability.Skills["skill 2"].Bonus, Is.EqualTo(5));
            Assert.That(ability.Skills["skill 3"].Bonus, Is.EqualTo(3));
            Assert.That(ability.Skills["skill 4"].Bonus, Is.EqualTo(7));
        }
        public void CircumstantialBonusIsNotOverwritten()
        {
            var skills = new Dictionary<string, Skill>();
            var baseStat = new Stat("base stat");

            skills["skill 1"] = new Skill("skill 1", baseStat, 1);
            skills["skill 1"].Bonus = 1;
            skills["skill 2"] = new Skill("skill 2", baseStat, 1);
            skills["skill 2"].Bonus = 2;
            mockSkillsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats)).Returns(skills);

            var feats = new List<Feat>();
            feats.Add(new Feat());
            feats.Add(new Feat());
            feats[0].Name = "feat1";
            feats[0].Foci = new[] { "skill 1 (with qualifiers)", "skill 2" };
            feats[0].Power = 1;
            feats[1].Name = "feat2";
            feats[1].Foci = new[] { "skill 1" };
            feats[1].Power = 1;

            mockFeatsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats, skills, baseAttack)).Returns(feats);

            var featGrantingSkillBonuses = new[] { "feat1", "feat2" };
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.FeatGroups, FeatConstants.SkillBonus))
                .Returns(featGrantingSkillBonuses);

            var ability = abilitiesGenerator.GenerateWith(characterClass, race, stats, baseAttack);
            Assert.That(ability.Skills["skill 1"].CircumstantialBonus, Is.True);
            Assert.That(ability.Skills["skill 2"].CircumstantialBonus, Is.False);
        }
        public void OnlyApplySkillFeatToSkillsIfSkillFocusIsPurelySkill()
        {
            var skills = new Dictionary<string, Skill>();
            var baseStat = new Stat("base stat");

            skills["skill 1"] = new Skill("skill 1", baseStat, 1);
            skills["skill 1"].Bonus = 1;
            mockSkillsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats)).Returns(skills);

            var feats = new List<Feat>();
            feats.Add(new Feat());
            feats[0].Name = "feat1";
            feats[0].Foci = new[] { "skill 1 (with qualifiers)", "non-skill focus" };
            feats[0].Power = 1;

            var featGrantingSkillBonuses = new[] { "feat2", "feat1" };
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.FeatGroups, FeatConstants.SkillBonus))
                .Returns(featGrantingSkillBonuses);

            mockFeatsGenerator.Setup(g => g.GenerateWith(characterClass, race, stats, skills, baseAttack)).Returns(feats);

            var ability = abilitiesGenerator.GenerateWith(characterClass, race, stats, baseAttack);
            Assert.That(ability.Skills["skill 1"].Bonus, Is.EqualTo(1));
        }
예제 #6
0
 public void Setup()
 {
     baseStat = new Stat("base stat");
     skill = new Skill("skill name", baseStat, 90210);
 }
        public void AnyRequiredSkillWithSufficientRanksMeetRequirement()
        {
            selection.RequiredSkillRanks["skill"] = 5;
            selection.RequiredSkillRanks["other skill"] = 1;
            skills["skill"] = new Skill("skill", stats["stat"], 10);
            skills["skill"].Ranks = 4;
            skills["skill"].ClassSkill = true;
            skills["other skill"] = new Skill("other skill", stats["stat"], 10);
            skills["other skill"].Ranks = 1;
            skills["other skill"].ClassSkill = true;

            var met = selection.ImmutableRequirementsMet(1, stats, skills, characterClass);
            Assert.That(met, Is.True);
        }
        public void SkillRequirementsWithCrossClassSkillNotMet()
        {
            selection.RequiredSkillRanks["skill"] = 5;
            skills["skill"] = new Skill("skill", stats["stat"], 10);
            skills["skill"].Ranks = 9;
            skills["skill"].ClassSkill = false;
            skills["other skill"] = new Skill("other skill", stats["stat"], 10);
            skills["other skill"].Ranks = 10;
            skills["other skill"].ClassSkill = false;

            var met = selection.ImmutableRequirementsMet(1, stats, skills, characterClass);
            Assert.That(met, Is.False);
        }
        public void MeetSkillRequirementOf0Ranks()
        {
            selection.RequiredSkillRanks["skill"] = 0;
            skills["skill"] = new Skill("skill", stats["stat"], 10);
            skills["skill"].ClassSkill = false;

            var met = selection.ImmutableRequirementsMet(1, stats, skills, characterClass);
            Assert.That(met, Is.True);
        }
예제 #10
0
        private Dictionary<string, Skill> InitializeSkills(Dictionary<string, Stat> stats, IEnumerable<string> classSkills, IEnumerable<string> crossClassSkills, CharacterClass characterClass)
        {
            var skills = new Dictionary<string, Skill>();
            var allSkillNames = classSkills.Union(crossClassSkills);

            foreach (var skillName in allSkillNames)
            {
                var skillSelection = skillSelector.SelectFor(skillName);
                if (stats.ContainsKey(skillSelection.BaseStatName) == false)
                    continue;

                skills[skillName] = new Skill(skillName, stats[skillSelection.BaseStatName], characterClass.Level + 3);
                skills[skillName].ClassSkill = classSkills.Contains(skillName);
            }

            return skills;
        }
예제 #11
0
        public void IfNoWorkingSkillFoci_ReturnNoFocus()
        {
            focusTypes["focus type"] = new[] { "skill 1" };
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.SkillGroups, GroupConstants.Skills)).Returns(new[] { "skill 1", "skill 2" });

            var stat = new Stat("stat");
            skills["skill 2"] = new Skill("skill 2", stat, 1);

            var focus = featFocusGenerator.GenerateFrom("featId", "focus type", skills, requiredFeats, otherFeats, characterClass);
            Assert.That(focus, Is.EqualTo(FeatConstants.Foci.All));
        }
예제 #12
0
        public void IfAvailableFociFromSkillsContainsSkills_OnlyUseProvidedSkills()
        {
            focusTypes["focus type"] = new[] { "skill 1", "skill 2" };
            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Set.Collection.SkillGroups, GroupConstants.Skills)).Returns(new[] { "skill 1", "skill 2", "skill 3" });

            var stat = new Stat("stat");
            skills["skill 2"] = new Skill("skill 2", stat, 1);
            skills["skill 3"] = new Skill("skill 3", stat, 1);

            var focus = featFocusGenerator.GenerateFrom("featToFill", "focus type", skills);
            Assert.That(focus, Is.EqualTo("skill 2"));
        }