public static void ConditionnalAdd(List<SkillDetail> list, SkillDetail skill) { if (skill.Modifier != 0) { list.Add(skill); } }
private static List <SkillDetail> Convert(SkillsHelper skills) { var list = new List <SkillDetail>(); SkillDetail.ConditionnalAdd(list, new SkillDetail("Athletics", "Strength", skills.Acrobatics)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Acrobatics", "Dexterity", skills.Acrobatics)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Sleight of hand", "Dexterity", skills.Sleight_of_hand)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Stealth", "Dexterity", skills.Stealth)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Arcana", "Intelligence", skills.Arcana)); SkillDetail.ConditionnalAdd(list, new SkillDetail("History", "Intelligence", skills.History)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Investigation", "Intelligence", skills.Investigation)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Nature", "Intelligence", skills.Nature)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Religion", "Intelligence", skills.Religion)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Animal handling", "Wisdom", skills.Animal_handling)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Insight", "Wisdom", skills.Insight)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Medecine", "Wisdom", skills.Medecine)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Survival", "Wisdom", skills.Survival)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Deception", "Charisma", skills.Deception)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Intimidation", "Charisma", skills.Intimidation)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Performance", "Charisma", skills.Performance)); SkillDetail.ConditionnalAdd(list, new SkillDetail("Persuasion", "Charisma", skills.Persuasion)); return(list); }