Skip to content

Commit

Permalink
readded mutation-limit for breeding-planner (#723). fix for mutation-…
Browse files Browse the repository at this point in the history
…counter when importing exported creatures (#733). color-regions will be copied over from extractor to tester and vice versa. fixed updating of blueprint-path when loading additional values (prevented species-recognition when importing modded creatures). creature meta-data will not be cleared if species and stat-values are not changed. when importing a creature, the oxygen-value will be used, i.e. the speed-level is available as well. moved color-pick-dialog, so it won't get cut off at the bottom of the screen. added best possible creature via breeding in the breeding planner (#740). Fixed tek rex import species (#731). added sorting of player- and tribe-tables (#744). fix for species when importing with ark-tools.
  • Loading branch information
cadaei committed Jul 22, 2018
1 parent bbe45b7 commit c45dd98
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 98 deletions.
31 changes: 22 additions & 9 deletions ARKBreedingStats/BreedingPlan.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 33 additions & 7 deletions ARKBreedingStats/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ public BreedingPlan()
pedigreeCreatureWorst.IsVirtual = true;
pedigreeCreatureBest.onlyLevels = true;
pedigreeCreatureWorst.onlyLevels = true;
pedigreeCreatureBestPossibleInSpecies.onlyLevels = true;
pedigreeCreatureBest.Clear();
pedigreeCreatureWorst.Clear();
pedigreeCreatureBestPossibleInSpecies.Clear();
pedigreeCreatureBest.HandCursor = false;
pedigreeCreatureWorst.HandCursor = false;
pedigreeCreatureBestPossibleInSpecies.HandCursor = false;

statWeighting = statWeighting1;
breedingPlanNeedsUpdate = false;
Expand Down Expand Up @@ -201,11 +204,11 @@ private void AsyncCalculateBreedingScoresAndDisplayPairs(BreedingMode breedingMo

crCountF = chosenF.Count;
crCountM = chosenM.Count;
//if (nudBPMutationLimit.Value >= 0)
//{
// chosenF = chosenF.Where(c => c.mutationsMaternal + c.mutationsPaternal <= nudBPMutationLimit.Value).ToList();
// chosenM = chosenM.Where(c => c.mutationsMaternal + c.mutationsPaternal <= nudBPMutationLimit.Value).ToList();
//}
if (nudBPMutationLimit.Value >= 0)
{
chosenF = chosenF.Where(c => c.Mutations <= nudBPMutationLimit.Value).ToList();
chosenM = chosenM.Where(c => c.Mutations <= nudBPMutationLimit.Value).ToList();
}
bool creaturesMutationsFilteredOut = (crCountF != chosenF.Count)
|| (crCountM != chosenM.Count);

Expand Down Expand Up @@ -621,7 +624,7 @@ public List<Creature> Creatures

bestLevels.Clear();
for (int s = 0; s < 8; s++)
bestLevels.Add(0);
bestLevels.Add(-1);

foreach (Creature c in value)
{
Expand Down Expand Up @@ -743,7 +746,7 @@ public void setSpecies(string species)
{
for (int i = 0; i < listViewSpeciesBP.Items.Count; i++)
{
if ((string)listViewSpeciesBP.Items[i].Text == species)
if (listViewSpeciesBP.Items[i].Text == species)
{
listViewSpeciesBP.Items[i].Focused = true;
listViewSpeciesBP.Items[i].Selected = true;
Expand All @@ -762,7 +765,30 @@ private void buttonApplyNewWeights_Click(object sender, EventArgs e)
private void listViewSpeciesBP_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewSpeciesBP.SelectedIndices.Count > 0)
{
determineBestBreeding();

if (bestLevels.Count > 6)
{
// display top levels in species
int? levelStep = creatureCollection.getWildLevelStep();
Creature crB = new Creature(currentSpecies, "", "", "", 0, new int[8], null, 100, true, levelStep: levelStep);
crB.name = "Best possible levels (" + currentSpecies + ")";
bool totalLevelUnknown = false;
for (int s = 0; s < 7; s++)
{
crB.levelsWild[s] = bestLevels[s];
crB.valuesBreeding[s] = Stats.calculateValue(speciesIndex, s, crB.levelsWild[s], 0, true, 1, 0);
if (crB.levelsWild[s] == -1)
totalLevelUnknown = true;
crB.topBreedingStats[s] = (crB.levelsWild[s] > 0);
}
crB.levelsWild[7] = crB.levelsWild.Sum();
crB.recalculateCreatureValues(levelStep);
pedigreeCreatureBestPossibleInSpecies.totalLevelUnknown = totalLevelUnknown;
pedigreeCreatureBestPossibleInSpecies.Creature = crB;
}
}
}

private void checkBoxIncludeCooldowneds_CheckedChanged(object sender, EventArgs e)
Expand Down
1 change: 0 additions & 1 deletion ARKBreedingStats/CreatureInfoInput.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 14 additions & 22 deletions ARKBreedingStats/CreatureInfoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public partial class CreatureInfoInput : UserControl
public bool parentListValid;
private int speciesIndex;
private ToolTip tt = new ToolTip();
private bool mutationManuallyChanged;
private bool updateMaturation;
private List<Creature> _females;
private List<Creature> _males;
Expand Down Expand Up @@ -301,21 +300,13 @@ public bool Neutered

public int MutationCounterMother
{
set
{
nudMutationsMother.ValueSave = value;
mutationManuallyChanged = false;
}
set { nudMutationsMother.ValueSave = value; }
get { return (int)nudMutationsMother.Value; }
}

public int MutationCounterFather
{
set
{
nudMutationsFather.ValueSave = value;
mutationManuallyChanged = false;
}
set { nudMutationsFather.ValueSave = value; }
get { return (int)nudMutationsFather.Value; }
}

Expand Down Expand Up @@ -367,17 +358,18 @@ private void parentComboBox_SelectedIndexChanged(object sender, EventArgs e)

private void updateMutations()
{
if (!mutationManuallyChanged)
// it's assumed that if a parent has a higher mutation-count than the current set one, the set one is not valid and will be updated
int mutationsMo = (parentComboBoxMother.SelectedParent != null ? parentComboBoxMother.SelectedParent.Mutations : 0);
int mutationsFa = (parentComboBoxFather.SelectedParent != null ? parentComboBoxFather.SelectedParent.Mutations : 0);

if (mutationsMo > nudMutationsMother.Value)
{
nudMutationsMother.Value = (parentComboBoxMother.SelectedParent != null ? parentComboBoxMother.SelectedParent.Mutations : 0);
nudMutationsFather.Value = (parentComboBoxFather.SelectedParent != null ? parentComboBoxFather.SelectedParent.Mutations : 0);
mutationManuallyChanged = false;
nudMutationsMother.Value = mutationsMo;
}
if (mutationsFa > nudMutationsFather.Value)
{
nudMutationsFather.Value = mutationsFa;
}
}

private void numericUpDownMutations_ValueChanged(object sender, EventArgs e)
{
mutationManuallyChanged = true;
}

private void btnGenerateUniqueName_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -425,8 +417,8 @@ private void setCreatureData(Creature cr)
cr.Father = father;
cr.species = Values.V.species[speciesIndex].name;
cr.sex = sex;
cr.mutationsMaternal = (int)nudMutationsMother.Value;
cr.mutationsPaternal = (int)nudMutationsFather.Value;
cr.mutationsMaternal = MutationCounterMother;
cr.mutationsPaternal = MutationCounterFather;
}

private void textBoxOwner_Leave(object sender, EventArgs e)
Expand Down
4 changes: 1 addition & 3 deletions ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class Extraction
private int[] lowerBoundWilds, lowerBoundDoms, upperBoundDoms; // lower/upper possible Bound of each stat (wild has no upper bound as wild-speed and sometimes oxygen is unknown, and could be up to levelWildSum, so no results could be filtered out)
private int levelsUndeterminedWild = 0, levelsUndeterminedDom = 0;
public int levelWildSum, levelDomSum;
public bool[] activeStats;
public bool lastTEUnique;
private MinMaxDouble imprintingBonusRange;
public IssueNotes.Issue possibleIssues; // possible issues during the extraction, will be shown if extraction failed
Expand All @@ -32,7 +31,6 @@ public Extraction()
lowerBoundWilds = new int[8];
lowerBoundDoms = new int[8];
upperBoundDoms = new int[8];
activeStats = new bool[8];

for (int s = 0; s < 8; s++)
{
Expand Down Expand Up @@ -118,7 +116,7 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
// check all possible level-combinations
for (int s = 0; s < 8; s++)
{
if (stats[s].BaseValue > 0 && activeStats[s]) // if stat is used (oxygen sometimes is not)
if (stats[s].BaseValue > 0 && statIOs[s].Input > 0) // if stat is used (oxygen sometimes is not)
{
statIOs[s].postTame = postTamed;
// double precision makes it necessary to give a bit more tolerance (hence 0.050001 instead of just 0.05 etc.)
Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c45dd98

Please sign in to comment.