Skip to content

Commit

Permalink
added babyCuddleIntervalMultiplier to settings. Fix for applying mult…
Browse files Browse the repository at this point in the history
…ipliers if no library was loaded at startup.
  • Loading branch information
cadaei committed Jan 7, 2017
1 parent bc79a80 commit 3970d05
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 161 deletions.
1 change: 1 addition & 0 deletions ARKBreedingStats/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace ARKBreedingStats
public int maxWildLevel = 150;
public int maxBreedingSuggestions = 10;
public double imprintingMultiplier = 1;
public double babyCuddleIntervalMultiplier = 1;
public double tamingSpeedMultiplier = 1;
public double tamingFoodRateMultiplier = 1;
[XmlArray]
Expand Down
13 changes: 8 additions & 5 deletions ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public int filterResultsByFixed(int dontFix = -1)
return -1; // -1 is good for this function. A value >=0 means that stat is faulty
}

public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double lowerTEBound, double upperTEBound, bool autoDetectTamed, bool tamed, bool justTamed, bool bred, double imprintingBonusRounded, double imprintingBonusMultiplier)
public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double lowerTEBound, double upperTEBound, bool autoDetectTamed, bool tamed, bool justTamed, bool bred, double imprintingBonusRounded, double imprintingBonusMultiplier, double cuddleIntervalMultiplier)
{
validResults = true;
if (autoDetectTamed)
Expand All @@ -178,10 +178,11 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
// needed to handle Torpor-bug
this.justTamed = justTamed;

//
if (imprintingBonusRounded == 1)
imprintingBonus = 1;
else if (Values.V.species[speciesI].breeding != null)
imprintingBonus = Math.Round(imprintingBonusRounded * Values.V.species[speciesI].breeding.maturationTimeAdjusted / 14400) * 14400 / Values.V.species[speciesI].breeding.maturationTimeAdjusted;
else if (Values.V.species[speciesI].breeding != null && Values.V.species[speciesI].breeding.maturationTimeAdjusted > 0)
imprintingBonus = Math.Round(imprintingBonusRounded * Values.V.species[speciesI].breeding.maturationTimeAdjusted * cuddleIntervalMultiplier / 14400) * 14400 / (Values.V.species[speciesI].breeding.maturationTimeAdjusted * cuddleIntervalMultiplier);
else
imprintingBonus = 0;
double imprintingMultiplier = (1 + imprintingBonus * imprintingBonusMultiplier * .2);
Expand All @@ -199,21 +200,23 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
runTorporRangeAgain = false;
torporLevelTamingMultMax = 1;
torporLevelTamingMultMin = 1;
if (postTamed && justTamed)
if (postTamed && justTamed && !bred)
{
torporLevelTamingMultMax = (2 + upperTEBound) / (4 + upperTEBound);
torporLevelTamingMultMin = (2 + lowerTEBound) / (4 + lowerTEBound);
}
levelWildFromTorporRange[0] = (int)Math.Round((statIOs[7].Input / imprintingMultiplier - (postTamed ? Values.V.species[speciesI].stats[7].AddWhenTamed : 0) - Values.V.species[speciesI].stats[7].BaseValue) * torporLevelTamingMultMin / (Values.V.species[speciesI].stats[7].BaseValue * Values.V.species[speciesI].stats[7].IncPerWildLevel), 0);
levelWildFromTorporRange[1] = (int)Math.Round((statIOs[7].Input / imprintingMultiplier - (postTamed ? Values.V.species[speciesI].stats[7].AddWhenTamed : 0) - Values.V.species[speciesI].stats[7].BaseValue) * torporLevelTamingMultMax / (Values.V.species[speciesI].stats[7].BaseValue * Values.V.species[speciesI].stats[7].IncPerWildLevel), 0);

// if level of torpor is higher than the total-level, the torporBug displayed a too high torpor. If the user didn't check the justTamed-checkbox, do it for them and recalculate the true torpor-level
if (!runTorporRangeAgain && !justTamed && levelWildFromTorporRange[0] > level)
{
justTamed = true;
this.justTamed = true;
runTorporRangeAgain = true;
}
// if levelWildFromTorporRange[0] > level, then justTamed has to be true, then run the previous calculation again
} while (runTorporRangeAgain);
// if levelWildFromTorporRange[0] > level, then justTamed has to be true, then run the previous calculation again

domFreeMin = 0;
domFreeMax = 0;
Expand Down
26 changes: 14 additions & 12 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,14 @@ private void Form1_Load(object sender, EventArgs e)

if (Values.V.loadValues() && Values.V.speciesNames.Count > 0)
{
creatureCollection.multipliers = Values.V.statMultipliers;
Values.V.applyMultipliersToStats(Values.V.statMultipliers);

// set species comboboxes
updateSpeciesComboboxes();

// load last save file:
if (Properties.Settings.Default.LastSaveFile != "")
loadCollectionFile(Properties.Settings.Default.LastSaveFile);
else
newCollection();

// set species comboboxes
updateSpeciesComboboxes();

for (int s = 0; s < 8; s++)
{
Expand Down Expand Up @@ -226,7 +225,7 @@ private void Form1_Load(object sender, EventArgs e)
//numericUpDownLevel.Value = 189;
//checkBoxAlreadyBred.Checked = true;
//numericUpDownImprintingBonusExtractor.Value = 59;
tabControlMain.SelectedTab = tabPageExtractor;
//tabControlMain.SelectedTab = tabPageExtractor;

if (!Properties.Settings.Default.OCR)
{
Expand Down Expand Up @@ -310,9 +309,10 @@ private bool extractLevels()
Extraction.E.extractLevels(sE, (int)numericUpDownLevel.Value, statIOs,
(double)numericUpDownLowerTEffBound.Value / 100, (double)numericUpDownUpperTEffBound.Value / 100,
checkBoxWildTamedAuto.Checked, radioButtonTamed.Checked, checkBoxJustTamed.Checked, checkBoxAlreadyBred.Checked,
(double)numericUpDownImprintingBonusExtractor.Value / 100, creatureCollection.imprintingMultiplier);
(double)numericUpDownImprintingBonusExtractor.Value / 100, creatureCollection.imprintingMultiplier, creatureCollection.babyCuddleIntervalMultiplier);

checkBoxJustTamed.Checked = Extraction.E.justTamed;
if (!checkBoxAlreadyBred.Checked)
checkBoxJustTamed.Checked = Extraction.E.justTamed;
numericUpDownImprintingBonusExtractor.Value = (decimal)Extraction.E.imprintingBonus * 100;

// remove all results that require a total wild-level higher than the max
Expand Down Expand Up @@ -3022,10 +3022,12 @@ private void showStatsInOverlay()
bool enoughFood;
double te;
TimeSpan duration;
int narcotics, narcoBerries;
Taming.tamingTimes(speciesIndex, (int)wildLevels[0], new List<string>() { foodName }, new List<int>() { foodNeeded }, out foodAmountUsed, out duration, out narcoBerries, out narcotics, out te, out enoughFood);
int narcotics, narcoBerries, bioToxines;
Taming.tamingTimes(speciesIndex, (int)wildLevels[0], new List<string>() { foodName }, new List<int>() { foodNeeded }, out foodAmountUsed, out duration, out narcoBerries, out narcotics, out bioToxines, out te, out enoughFood);
string foodNameDisplay = (foodName == "Kibble" ? Values.V.species[speciesIndex].taming.favoriteKibble + " Egg Kibble" : foodName);
extraText += "\nIt takes " + duration.ToString(@"hh\:mm\:ss") + " to tame the creature with " + foodNeeded + "×" + foodNameDisplay + "\n" + narcoBerries + " Narcoberries or " + narcotics + " Narcotics are needed\nTaming Effectiveness: " + Math.Round(100 * te, 1).ToString() + " % (+" + Math.Floor(wildLevels[0] * te / 2).ToString() + " lvl)";
extraText += "\nIt takes " + duration.ToString(@"hh\:mm\:ss") + " to tame the creature with " + foodNeeded + "×" + foodNameDisplay
+ "\n" + narcoBerries + " Narcoberries or " + narcotics + " Narcotics or " + bioToxines + " Bio Toxines are needed"
+ "\nTaming Effectiveness: " + Math.Round(100 * te, 1).ToString() + " % (+" + Math.Floor(wildLevels[0] * te / 2).ToString() + " lvl)";
}

overlay.setValues(wildLevels, tamedLevels, colors);
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.20.8.1")]
[assembly: AssemblyFileVersion("0.20.8.2")]
Loading

0 comments on commit 3970d05

Please sign in to comment.