Example #1
0
        public void ChoosesSkillsBasedOnTheStrategyRecommendation()
        {
            var strategy = new WeightedOptionTable <string>();

            strategy.AddEntry("Climb", 20);

            distributor.AssignSkillPoints(skills, strategy, 1, 1);
            Assert.Equal(1, skills.GetSkill("Climb").Ranks);
        }
Example #2
0
        public void SettingAProfessionsSkillAsClassSkillSetsAllProfessionsSkills()
        {
            _skillList.Add(new Skill("Profession (Bouncer)", AbilityScoreTypes.Intelligence, false));
            _skillList.Add(new Skill("Profession (Turnip Farmer)", AbilityScoreTypes.Intelligence, false));
            var ranks = new SkillRanks(_skillList, new AbilityScores());

            ranks.SetClassSkill("Profession");
            Assert.True(ranks.GetSkill("Profession (Bouncer)").ClassSkill);
            Assert.True(ranks.GetSkill("Profession (Turnip Farmer)").ClassSkill);
        }
Example #3
0
        public void SettingACraftSkillAsClassSkillSetsAllCraftSkills()
        {
            _skillList.Add(new Skill("Craft (Shoes)", AbilityScoreTypes.Intelligence, false));
            _skillList.Add(new Skill("Craft (Jewelry)", AbilityScoreTypes.Intelligence, false));
            var ranks = new SkillRanks(_skillList, new AbilityScores());

            ranks.SetClassSkill("Craft");
            Assert.True(ranks.GetSkill("Craft (Shoes)").ClassSkill);
            Assert.True(ranks.GetSkill("Craft (Jewelry)").ClassSkill);
        }
Example #4
0
        public void SettingAPerformSkillAsClassSkillSetsAllPerformSkills()
        {
            _skillList.Add(new Skill("Perform (Debate)", AbilityScoreTypes.Intelligence, false));
            _skillList.Add(new Skill("Perform (Art)", AbilityScoreTypes.Intelligence, false));
            var ranks = new SkillRanks(_skillList, new AbilityScores());

            ranks.SetClassSkill("Perform");
            Assert.True(ranks.GetSkill("Perform (Debate)").ClassSkill);
            Assert.True(ranks.GetSkill("Perform (Art)").ClassSkill);
        }
Example #5
0
        private CharacterSkill ChooseSkill(SkillRanks skills, WeightedOptionTable <string> preferredSkills, int maxLevel)
        {
            if (!preferredSkills.IsEmpty)
            {
                var option = preferredSkills.ChooseRandomly();
                var skill  = skills.GetSkill(option);

                if (skill.Ranks < maxLevel)
                {
                    return(skill);
                }
                else
                {
                    preferredSkills.Disable(option);
                }
            }
            else
            {
                // no preferred skills so just pick class skills
                var skill = skills.GetSkills().Where(
                    x => x.ClassSkill &&
                    x.Ranks < maxLevel
                    ).ToList().ChooseOne();

                // Background skills require special attention
                // In general just take one background skill
                if (skill.Skill.IsBackgroundSkill)
                {
                    if (skill.Ranks > 0 || skills.GetSkills().Where(x => x.Skill.IsBackgroundSkill).All(x => x.Ranks == 0))
                    {
                        return(skill);
                    }
                }
                else
                {
                    return(skill);
                }
            }
            return(null);
        }
Example #6
0
        private void AssignClassSkill(SkillRanks skillRanks, CharacterStrategy strategy)
        {
            var chooseSkill = classSkillOptions.ChooseOne();

            skillRanks.GetSkill(chooseSkill).ClassSkill = true;
        }