コード例 #1
0
        public CutYourLosses()
        {
            var strength = new AbilityPrerequisite(new Dictionary <Attributes, int> {
                { Attributes.Strength, 13 }
            });
            var acrobatics = new SkillRankPrerequisite(Skills.Acrobatics, 1);

            Prerequisite = new ComplexPrerequisite(strength, acrobatics);
        }
コード例 #2
0
        public void IfSkillCannotBeFoundThrowException()
        {
            var bob       = CharacterTestTemplates.AverageBob();
            var configure = new MemoryStore();

            configure.SetValue("name", "Some Missing Skill");
            configure.SetValue("minimum", 10);
            var thrw = new SkillRankPrerequisite(configure);

            Assert.Throws(typeof(StatisticNotFoundException), () => thrw.IsQualified(bob.Components));
        }
コード例 #3
0
        public void FailsIfCharacterDoesNotHaveEnoughRanksInSkill()
        {
            var bob = CharacterTestTemplates.AverageBob().WithSkills();

            var configureFail = new MemoryStore();

            configureFail.SetValue("name", "Climb");
            configureFail.SetValue("minimum", 5);
            var fail = new SkillRankPrerequisite(configureFail);

            Assert.False(fail.IsQualified(bob.Components));
        }
コード例 #4
0
        public void PassesIfCharacterHasEnoughRanksInSkill()
        {
            var bob = CharacterTestTemplates.AverageBob().WithSkills();

            bob.SkillRanks.GetSkill("Perception").AddRank();
            bob.SkillRanks.GetSkill("Perception").AddRank();
            bob.SkillRanks.GetSkill("Perception").AddRank();

            var configurePass = new MemoryStore();

            configurePass.SetValue("name", "Perception");
            configurePass.SetValue("minimum", 3);
            var pass = new SkillRankPrerequisite(configurePass);

            Assert.True(pass.IsQualified(bob.Components));
        }
コード例 #5
0
        /// <summary>
        /// Parses the yaml and find prerequisites
        /// </summary>
        /// <param name="yaml">Yaml Node to parse </param>
        private void ParseYaml(YamlNodeWrapper yaml)
        {
            foreach (var prereq in yaml.Children())
            {
                Prerequisite newreq = null;

                // TODO: This seems clunky and weird
                foreach (var key in this.prerequisiteKeyNames)
                {
                    var val = prereq.GetStringOptional(key);
                    if (val != null)
                    {
                        switch (key)
                        {
                        case "ability":
                            newreq = new AbilityPrerequisite(val);
                            break;

                        case "baseattackbonus":
                            newreq = new BaseAttackBonusPrerequisite(val);
                            break;

                        case "casterlevel":
                            newreq = new CasterLevelPrerequisite(val);
                            break;

                        case "classfeature":
                            newreq = new ClassFeaturePrerequisite(val);
                            break;

                        case "classlevel":
                            newreq = new ClassLevelPrerequisite(val);
                            break;

                        case "feat":
                            newreq = new FeatPrerequisite(val);
                            break;

                        case "proficiency":
                            newreq = new ProficiencyPrerequisite(val);
                            break;

                        case "race":
                            newreq = new RacePrerequisite(val);
                            break;

                        case "skillranks":
                            newreq = new SkillRankPrerequisite(val);
                            break;
                        }

                        break;
                    }
                }

                if (newreq != null)
                {
                    this.Add(newreq);
                }
            }
        }