public TalentSet(List <ExportEntry> allPowers) { int numPassives = 0; for (int i = 0; i < 6; i++) { var talent = new Talent(allPowers.PullFirstItem()); int retry = allPowers.Count; while (retry > 0 && Powers.Any(x => x.BasePower.InstancedFullPath == talent.BasePower.InstancedFullPath)) { allPowers.Add(talent.PowerExport); talent = new Talent(allPowers.PullFirstItem()); retry--; if (retry <= 0) { IsBaseValid = false; return; } } if (talent.BasePower.ObjectName.Name.Contains("Passive")) { numPassives++; if (numPassives > 3) { // We must ensure there is not a class full of passives // or the evolutions will not have a solution // only doing half allows us to give the evolution solution finder // a better chance at a quick solution IsBaseValid = false; return; } } Powers.Add(talent); } IsBaseValid = true; }