private WeightedOptionTable <string> GetSkillTable(SkillRanks skills, CharacterStrategy strategy) { if (strategy.FavoredSkills.IsEmpty) { return(skills.GetSkills().Select(x => x.Name).CreateFlatTable()); } else { return(strategy.FavoredSkills); } }
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); }
private void UpdateSkills(SkillRanks skillRanks, int bardLevel) { foreach (var skill in skillRanks.GetSkills()) { if (bardLevel >= 10) { skill.CanUseWithoutTraining(); } if (bardLevel >= 16) { skill.ClassSkill = true; } } }
public void IfAssigningToClassSkillsOnlyUseOneCraftSkill() { var strategy = new WeightedOptionTable <string>(); //Set Knowledge (Arcana) as a class skill availableSkills.Add(new Skill("Craft (Pottery)", AbilityScoreTypes.Intelligence, false)); availableSkills.Add(new Skill("Craft (Jewelry)", AbilityScoreTypes.Intelligence, false)); //Assign two points, should go all to one skill for (int i = 0; i < 1000; i++) { var skillRanks = new SkillRanks(availableSkills, new AbilityScores()); skillRanks.SetClassSkill("Craft (Pottery)"); skillRanks.SetClassSkill("Craft (Jewelry)"); distributor.AssignSkillPoints(skillRanks, strategy, 2, 2); Assert.True(skillRanks.GetSkills().Any(x => x.Ranks == 2)); } }