Skip to content

Commit

Permalink
fix for speed level of giganotosaur. improved rounding-errors regardi…
Browse files Browse the repository at this point in the history
…ng consider-wild-level-steps. increased possible input-numbers in many controls. added option to disable adjusting imprinting-percentage, for use with mods that alter it to else sometimes impossible values (e.g. 100%). added new species of the DLC Ragnarok.
  • Loading branch information
cadaei committed Jun 15, 2017
1 parent c399e28 commit c8be8bd
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 46 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
<EmbeddedResource Include="uiControls\StatPotentials.resx">
<DependentUpon>StatPotentials.cs</DependentUpon>
</EmbeddedResource>
<None Include="json\classicalFlyers.json">
<None Include="json\classicFlyers.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="json\ocr.json">
Expand Down
1 change: 1 addition & 0 deletions ARKBreedingStats/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace ARKBreedingStats
public int maxBreedingSuggestions = 10;
public bool considerWildLevelSteps = false;
public int wildLevelStep = 5;
public bool adjustToPossibleImprinting = true;
public double imprintingMultiplier = 1;
public double babyCuddleIntervalMultiplier = 1;
public double tamingSpeedMultiplier = 1;
Expand Down
38 changes: 29 additions & 9 deletions ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ public int filterResultsByFixed(int dontFix = -1)
return -1; // -1 is good for this function. A value >=0 means the stat with that index 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, double cuddleIntervalMultiplier, bool considerWildLevelSteps, int wildLevelSteps, out bool imprintingChanged)
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,
bool considerWildLevelSteps, int wildLevelSteps, bool adjustToPossibleImprinting, out bool imprintingChanged)
{
validResults = true;
imprintingChanged = false;
Expand All @@ -192,7 +194,11 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
imprintingBonus = 0;
if (bred)
{
if (Values.V.species[speciesI].breeding != null && Values.V.species[speciesI].breeding.maturationTimeAdjusted > 0)
if (!adjustToPossibleImprinting)
{
imprintingBonus = imprintingBonusRounded;
}
else if (Values.V.species[speciesI].breeding != null && Values.V.species[speciesI].breeding.maturationTimeAdjusted > 0)
{
imprintingBonus = Math.Round(Math.Round(imprintingBonusRounded * Values.V.species[speciesI].breeding.maturationTimeAdjusted / (14400 * cuddleIntervalMultiplier))
* 14400 * cuddleIntervalMultiplier / Values.V.species[speciesI].breeding.maturationTimeAdjusted, 5);
Expand Down Expand Up @@ -296,21 +302,35 @@ public void extractLevels(int speciesI, int level, List<StatIO> statIOs, double
{
// taming bonus is dependant on taming-effectiveness
// get tamingEffectiveness-possibility
tamingEffectiveness = Math.Round((inputValue / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 3, MidpointRounding.AwayFromZero);
tamingEffectiveness = Math.Round((inputValue / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 4);

// calculate rounding-error thresholds. Here it's assumed that the ingame value is maximal 0.6 off of the true value
double tamingEffectivenessMax = Math.Round(((inputValue + (Utils.precision(s) == 3 ? 0.0006 : 0.06)) / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 3, MidpointRounding.AwayFromZero);
double tamingEffectivenessMin = Math.Round(((inputValue - (Utils.precision(s) == 3 ? 0.0006 : 0.06)) / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 3, MidpointRounding.AwayFromZero);
// calculate rounding-error thresholds. Here it's assumed that the displayed ingame value is maximal 0.6 off of the true ingame value
double tamingEffectivenessMax = Math.Round(((inputValue + (Utils.precision(s) == 3 ? 0.0006 : 0.06)) / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 4);
double tamingEffectivenessMin = Math.Round(((inputValue - (Utils.precision(s) == 3 ? 0.0006 : 0.06)) / (1 + Values.V.species[speciesI].stats[s].IncPerTamedLevel * d) - valueWODom) / (valueWODom * Values.V.species[speciesI].stats[s].MultAffinity), 4);

if (tamingEffectivenessMin <= 1 && tamingEffectiveness > 1) tamingEffectiveness = 1;
if (tamingEffectivenessMax >= lowerTEBound)
{
if (tamingEffectivenessMin <= upperTEBound)
{
// test if TE with torpor-level of tamed-creatures results in a valid wild-level
if (considerWildLevelSteps && s != 7 && tamingEffectiveness > 0
&& (int)Math.Ceiling((trueTorporLevel(tamingEffectiveness) + 1) / (1 + tamingEffectiveness / 2)) % wildLevelSteps != 0)
continue;
double ttttt = trueTorporLevel(tamingEffectiveness);
double ttt = (trueTorporLevel(tamingEffectiveness) + 1) / (1 + tamingEffectiveness / 2);
if (considerWildLevelSteps && s != 7 && tamingEffectiveness > 0)
{
int preTameLevelMin = (int)((trueTorporLevel(tamingEffectiveness) + 1) / (1 + tamingEffectivenessMax / 2));
int preTameLevelMax = (int)Math.Ceiling((trueTorporLevel(tamingEffectiveness) + 1) / (1 + tamingEffectivenessMax / 2));
bool validWildLevel = false;
for (int wl = preTameLevelMin; wl <= preTameLevelMax; wl++)
{
if (wl % wildLevelSteps == 0)
{
validWildLevel = true;
break;
}
}
if (!validWildLevel) continue;
}

results[s].Add(new StatResult(w, d, tamingEffectiveness, tamingEffectivenessMin, tamingEffectivenessMax));
}
Expand Down
10 changes: 5 additions & 5 deletions ARKBreedingStats/Form1.Designer.cs

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

15 changes: 10 additions & 5 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ private bool extractLevels(bool autoExtraction = false)
(double)numericUpDownLowerTEffBound.Value / 100, (double)numericUpDownUpperTEffBound.Value / 100,
!radioButtonBred.Checked, radioButtonTamed.Checked, checkBoxJustTamed.Checked, radioButtonBred.Checked,
(double)numericUpDownImprintingBonusExtractor.Value / 100, creatureCollection.imprintingMultiplier, babyCuddleIntervalMultiplier,
creatureCollection.considerWildLevelSteps, creatureCollection.wildLevelStep, out imprintingBonusChanged);
creatureCollection.considerWildLevelSteps, creatureCollection.wildLevelStep, creatureCollection.adjustToPossibleImprinting, out imprintingBonusChanged);

if (radioButtonTamed.Checked)
checkBoxJustTamed.Checked = extractor.justTamed;
Expand Down Expand Up @@ -913,11 +913,12 @@ private void setWildSpeedLevelAccordingToOthers()
{
/*
* wild speed level is wildTotalLevels - determinedWildLevels. sometimes the oxygenlevel cannot be determined
* if TE cannot be determined, speed cannot as well
* if TE cannot be determined and creature is just tamed (so torpor-bug applies), speed cannot as well
*/
bool unique = true;
bool uniqueWildTorporLevel = extractor.lastTEUnique || !extractor.justTamed;
int notDeterminedLevels = statIOs[7].LevelWild;
if (extractor.lastTEUnique)
if (uniqueWildTorporLevel)
{
for (int s = 0; s < 6; s++)
{
Expand All @@ -929,7 +930,7 @@ private void setWildSpeedLevelAccordingToOthers()
else { unique = false; break; }
}
}
if (unique && extractor.lastTEUnique)
if (unique && uniqueWildTorporLevel)
{
// if all other stats are unique, set speedlevel
statIOs[6].LevelWild = Math.Max(0, notDeterminedLevels);
Expand Down Expand Up @@ -3636,6 +3637,9 @@ private bool loadAdditionalValues(string file, bool showResult = false)

private void loadAdditionalValuesToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Additional files have to be located in the exact same folder as the library-file is located.\n"
+ "You may load it from somewhere else, but after reloading the library it will not work if it's not placed in the same folder.\n\n"
+ "(this is to ensure functionality if the library is used by multiple users via a cloud-service.)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Additional values-file (*.json)|*.json";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
Expand All @@ -3660,7 +3664,7 @@ private void updateStatusBar()
+ ", unavailable: " + creatureCollection.creatures.Count(c => c.status == CreatureStatus.Unavailable).ToString()
+ ")" : "")
+ ". v" + Application.ProductVersion + " / values: " + Values.V.version.ToString() +
(creatureCollection.additionalValues.Length > 0 ? ", additional values from " + creatureCollection.additionalValues + " v" + Values.V.modVersion : "");
(creatureCollection.additionalValues.Length > 0 && Values.V.modVersion != null && Values.V.modVersion.ToString().Length > 0 ? ", additional values from " + creatureCollection.additionalValues + " v" + Values.V.modVersion : "");
}

private void toolStripButtonAddNote_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -3732,6 +3736,7 @@ private void nameFixes(CreatureCollection cc)
{
foreach (Creature c in cc.creatures)
{
c.species = c.species.Trim();
if (c.species == "Wooly Rhino")
c.species = "Woolly Rhino";
}
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.23.6")]
[assembly: AssemblyFileVersion("0.23.7")]
1 change: 1 addition & 0 deletions ARKBreedingStats/json/classicFlyers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ver":"1.0.0","species":[{"name":"Argentavis","statsRaw":[null,[750,0.1,0.1],null,null,[350,0.02,0.04,0,0],null,[null,null,0.025],null],"NoImprintingForSpeed":false},{"name":"Lymantria","statsRaw":[null,[180,0.1,0.1],null,null,null,null,[null,null,0.025],null]},{"name":"Pelagornis","statsRaw":[[210,0.2,0.27,0.5,0],[320,0.1,0.1],null,null,[135,0.02,0.04,0,0],null,[null,null,0.025],null],"TamedBaseHealthMultiplier":1,"NoImprintingForSpeed":false},{"name":"Pteranodon","statsRaw":[[210,0.2,0.27,0.5,0],[300,0.1,0.1],null,null,[150,0.02,0.04,0,0],null,[null,null,0.02],null],"TamedBaseHealthMultiplier":1,"NoImprintingForSpeed":false},{"name":"Quetzal","statsRaw":[[1200,0.2,0.27,0.5,0],[750,0.1,0.1],null,null,[780,0.02,0.04,0,0],null,[null,null,0.025],null],"TamedBaseHealthMultiplier":1,"NoImprintingForSpeed":false},{"name":"Tapejara","statsRaw":[null,[450,0.1,0.1],null,null,null,null,[null,null,0.025],null],"NoImprintingForSpeed":false},{"name":"Fire Wyvern","statsRaw":[null,[400,0.1,0.1],null,null,null,null,[null,null,0.025],null],"NoImprintingForSpeed":false},{"name":"Lightning Wyvern","statsRaw":[null,[400,0.1,0.1],null,null,null,null,[null,null,0.025],null],"NoImprintingForSpeed":false},{"name":"Poison Wyvern","statsRaw":[null,[400,0.1,0.1],null,null,null,null,[null,null,0.025],null],"NoImprintingForSpeed":false}]}
1 change: 0 additions & 1 deletion ARKBreedingStats/json/classicalFlyers.json

This file was deleted.

Loading

0 comments on commit c8be8bd

Please sign in to comment.