예제 #1
0
        private IEnumerable <Skill> ApplyBonuses(string creature, CreatureType creatureType, IEnumerable <Skill> skills, string size)
        {
            var creatureBonuses = skillSelector.SelectBonusesFor(creature);
            var typeBonuses     = skillSelector.SelectBonusesFor(creatureType.Name);

            var bonuses = creatureBonuses.Union(typeBonuses);

            foreach (var subtype in creatureType.SubTypes)
            {
                var subtypeBonuses = skillSelector.SelectBonusesFor(subtype);
                bonuses = bonuses.Union(subtypeBonuses);
            }

            foreach (var bonus in bonuses)
            {
                var matchingSkills = skills.Where(s => s.IsEqualTo(bonus.Target));

                foreach (var skill in matchingSkills)
                {
                    skill.AddBonus(bonus.Bonus, bonus.Condition);
                }
            }

            skills = ApplyHideSkillSizeModifier(skills, size);

            return(skills);
        }
예제 #2
0
        public void SelectNoSkillBonus()
        {
            var bonusSelections = skillSelector.SelectBonusesFor("creature");

            Assert.That(bonusSelections, Is.Empty);
        }