private void UpdateCreatureSkills(Creature creature)
        {
            foreach (var skill in creature.Skills)
            {
                skill.Ranks = 0;
            }

            creature.Skills = skillsGenerator.ApplySkillPointsAsRanks(creature.Skills, creature.HitPoints, creature.Type, creature.Abilities, true);
        }
Beispiel #2
0
        private IEnumerable <Skill> UpdateCreatureSkills(Creature creature, CreatureType animalCreatureType, HitPoints animalHitPoints, CreatureDataSelection animalData)
        {
            var animalSkills = skillsGenerator.GenerateFor(
                animalHitPoints,
                AnimalSpecies,
                animalCreatureType,
                creature.Abilities,
                creature.CanUseEquipment,
                animalData.Size,
                false);

            var newCap = creature.HitPoints.RoundedHitDiceQuantity + 3;

            if (LycanthropeSpecies.Contains("Afflicted"))
            {
                var controlShape = new Skill(
                    SkillConstants.Special.ControlShape,
                    creature.Abilities[AbilityConstants.Wisdom],
                    animalHitPoints.RoundedHitDiceQuantity);
                controlShape.ClassSkill = true;

                animalSkills = animalSkills.Union(new[] { controlShape });

                foreach (var animalSkill in animalSkills)
                {
                    animalSkill.Ranks = 0;
                }

                animalSkills = skillsGenerator.ApplySkillPointsAsRanks(
                    animalSkills,
                    animalHitPoints,
                    animalCreatureType,
                    creature.Abilities,
                    false);
            }

            foreach (var creatureSkill in creature.Skills)
            {
                creatureSkill.RankCap = newCap;
            }

            foreach (var animalSkill in animalSkills)
            {
                animalSkill.RankCap = newCap;

                var creatureSkill = creature.Skills.FirstOrDefault(s => s.Key == animalSkill.Key);
                if (creatureSkill != null)
                {
                    creatureSkill.Ranks      += animalSkill.Ranks;
                    creatureSkill.ClassSkill |= animalSkill.ClassSkill;

                    foreach (var bonus in animalSkill.Bonuses)
                    {
                        creatureSkill.AddBonus(bonus.Value, bonus.Condition);
                    }
                }
                else
                {
                    creature.Skills = creature.Skills.Union(new[] { animalSkill });
                }
            }

            return(animalSkills);
        }