private void setParents(int comboIndex)
{
if (comboIndex < 0 || comboIndex > combinedTops[0].Count)
{
pedigreeCreatureBest.Clear();
pedigreeCreatureWorst.Clear();
labelInfo.Visible = false;
labelProbabilityBest.Text = "";
return;
}
Creature crB = new Creature(currentSpecies, "", "", 0, new int[8], null, 100, true);
Creature crW = new Creature(currentSpecies, "", "", 0, new int[8], null, 100, true);
Creature mother = females[combinedTops[0][comboIndex]];
Creature father = males[combinedTops[1][comboIndex]];
crB.Mother = mother;
crB.Father = father;
crW.Mother = mother;
crW.Father = father;
double probabilityBest = 1;
bool totalLevelUnknown = false; // if stats are unknown, total level is as well (==> oxygen, speed)
for (int s = 0; s < 7; s++)
{
crB.levelsWild[s] = Math.Max(mother.levelsWild[s], father.levelsWild[s]);
crB.valuesBreeding[s] = Stats.calculateValue(speciesIndex, s, crB.levelsWild[s], 0, true, 1, 0);
crB.topBreedingStats[s] = (crB.levelsWild[s] == bestLevels[s]);
crW.levelsWild[s] = Math.Min(mother.levelsWild[s], father.levelsWild[s]);
crW.valuesBreeding[s] = Stats.calculateValue(speciesIndex, s, crW.levelsWild[s], 0, true, 1, 0);
crW.topBreedingStats[s] = (crW.levelsWild[s] == bestLevels[s]);
if (crB.levelsWild[s] == -1 || crW.levelsWild[s] == -1)
totalLevelUnknown = true;
if (crB.levelsWild[s] > crW.levelsWild[s])
probabilityBest *= .7;
}
crB.levelsWild[7] = crB.levelsWild.Sum();
crW.levelsWild[7] = crW.levelsWild.Sum();
crB.name = "Best Possible (" + crB.levelHatched + (totalLevelUnknown ? "+" : "") + ")";
crW.name = "Worst Possible (" + crW.levelHatched + (totalLevelUnknown ? "+" : "") + ")";
pedigreeCreatureBest.setCreature(crB);
pedigreeCreatureWorst.setCreature(crW);
labelProbabilityBest.Text = "Probability for this Best Possible outcome: " + Math.Round(100 * probabilityBest, 1).ToString() + "%";
// highlight parents
int hiliId = comboOrder.IndexOf(comboIndex) * 2;
for (int i = 0; i < pcs.Count; i++)
pcs[i].highlight = (i == hiliId || i == hiliId + 1);
}