static void PickAdvancement(Character result, Dice dice) { result.UnusedAdvances -= 1; if (result.UnusedEdges < 0) result.UnusedEdges += 1; else if (result.UnusedSkills < 0) result.UnusedSkills += 2; //pay back the skill point loan else if (result.UnusedSmartSkills < 0) result.UnusedSmartSkills += 2; //pay back the skill point loan else { switch (dice.Next(5)) { case 0: result.UnusedEdges += 1; break; case 1: //increase a high skill { var table = new Table<Skill>(); foreach (var skill in result.Skills) { if (skill.Trait >= result.GetAttribute(skill.Attribute) && skill.Trait < 12) table.Add(skill, skill.Trait.Score); } if (table.Count == 0) goto case 2; table.RandomChoose(dice).Trait += 1; break; } case 2: //increase a low skill { var table = new Table<Skill>(); foreach (var skill in result.Skills) { if (skill.Trait < result.GetAttribute(skill.Attribute) && skill.Trait < 12) table.Add(skill, skill.Trait.Score); } if (table.Count >= 2) goto case 3; table.RandomPick(dice).Trait += 1; table.RandomPick(dice).Trait += 1; //use Pick so we get 2 different skills break; } case 3: //add a new skill { var table = new Table<Skill>(); foreach (var skill in result.Skills) { if (skill.Trait == 0) table.Add(skill, result.GetAttribute(skill.Attribute).Score); } if (table.Count == 0) break; //really? table.RandomChoose(dice).Trait = 4; break; } case 4: result.UnusedAttributes += 1; break; } } }