Changes

Jump to navigation Jump to search
m
Removed stuff, and fixed up some formatting/placement
Line 1: Line 1: −
{{Stub|Need info about how charts were generated, more supporting evidence for percentages and claims about luck}}
   
Small minable stones and ores can appear as random stones throughout the floor, or rarely as small clumps. These have different distributions<ref name="populateLevel" /><ref name="chooseStoneType" />.
 
Small minable stones and ores can appear as random stones throughout the floor, or rarely as small clumps. These have different distributions<ref name="populateLevel" /><ref name="chooseStoneType" />.
 
On average there will be less than 0.67 small resource clumps on each floor with neutral luck, and less than 1 for the largest possible luck. These clumps have a 25% chance to be a dark grey rock (stone ore), a 1.5% chance to be iridium, and a 73.5% chance to be gold.
 
On average there will be less than 0.67 small resource clumps on each floor with neutral luck, and less than 1 for the largest possible luck. These clumps have a 25% chance to be a dark grey rock (stone ore), a 1.5% chance to be iridium, and a 73.5% chance to be gold.
Line 60: Line 59:  
The probability to get each ore (from a random stone) is therefore:
 
The probability to get each ore (from a random stone) is therefore:
 
     iridium = chanceForOre*chanceForIridium
 
     iridium = chanceForOre*chanceForIridium
    gold = chanceForOre*(1-chanceForIridium)*chanceForGold
+
      gold = chanceForOre*(1-chanceForIridium)*chanceForGold
    iron = chanceForOre*(1-chanceForIridium)*(1-chanceForGold)*chanceForIron
+
      iron = chanceForOre*(1-chanceForIridium)*(1-chanceForGold)*chanceForIron
    copper = chanceForOre*(1-chanceForIridium)*(1-chanceForGold)*(1-chanceForIron)
+
    copper = chanceForOre*(1-chanceForIridium)*(1-chanceForGold)*(1-chanceForIron)
    
These probabilities are defined in the following code:
 
These probabilities are defined in the following code:
 
+
<syntaxhighlight lang="C#">
 
     double iridiumBoost = 0.0;
 
     double iridiumBoost = 0.0;
 
     if (this.mineLevel >= 130) {
 
     if (this.mineLevel >= 130) {
Line 76: Line 75:  
     double chanceForIridium = (double)Math.Min(100, skullCavernMineLevel) * (0.0003 + iridiumBoost);
 
     double chanceForIridium = (double)Math.Min(100, skullCavernMineLevel) * (0.0003 + iridiumBoost);
 
     double chanceForGold = 0.01 + (double)(this.mineLevel - Math.Min(150, skullCavernMineLevel)) * 0.0005;
 
     double chanceForGold = 0.01 + (double)(this.mineLevel - Math.Min(150, skullCavernMineLevel)) * 0.0005;
     double chanceForIron = Math.Min(0.5, 0.1 + (double)(this.mineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005);
+
     double chanceForIron = Math.Min(0.5, 0.1 + (double)(this.mineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005);</syntaxhighlight>
    
The chance to find iridium relies upon an iridiumBoost variable which is split into four regions, floors 0-10, where there is no boost; floors 10 to 50, where the boost increases from 0 to 0.004; floors 50 to 99 where the boost remains constant at 0.004; and floor 100 and up, where there is a discontinuity with the boost jumping to <code>0.004 + 0.000001 * skullCavernMineLevel</code> (an increase of 0.0001).
 
The chance to find iridium relies upon an iridiumBoost variable which is split into four regions, floors 0-10, where there is no boost; floors 10 to 50, where the boost increases from 0 to 0.004; floors 50 to 99 where the boost remains constant at 0.004; and floor 100 and up, where there is a discontinuity with the boost jumping to <code>0.004 + 0.000001 * skullCavernMineLevel</code> (an increase of 0.0001).
Line 87: Line 86:  
However, if it does not pass the ore chance check (this means the final chances for these will need <code>1-chanceForOre</code> included), it moves on to gemstone ores, dark grey rocks (stone ore), purple stones and mystic stones.
 
However, if it does not pass the ore chance check (this means the final chances for these will need <code>1-chanceForOre</code> included), it moves on to gemstone ores, dark grey rocks (stone ore), purple stones and mystic stones.
 
This is done in the following complex code (some unneeded sections related to coloured rocks have been removed, and additional comments added):
 
This is done in the following complex code (some unneeded sections related to coloured rocks have been removed, and additional comments added):
 +
<syntaxhighlight lang="C#">
 
     double averageDailyLuck = Game1.player.team.AverageDailyLuck(Game1.currentLocation);
 
     double averageDailyLuck = Game1.player.team.AverageDailyLuck(Game1.currentLocation);
 
     double averageMiningLevel = Game1.player.team.AverageSkillLevel(3, Game1.currentLocation);
 
     double averageMiningLevel = Game1.player.team.AverageSkillLevel(3, Game1.currentLocation);
 
     double chanceModifier = averageDailyLuck + averageMiningLevel * 0.005;
 
     double chanceModifier = averageDailyLuck + averageMiningLevel * 0.005;
     if (this.mineLevel > 50 && this.mineRandom.NextDouble() < 0.00025 + (double)this.mineLevel / 120000.0 + 0.0005 * chanceModifier / 2.0) { //diamond
+
    // Diamond node.
 +
     if (this.mineLevel > 50 && this.mineRandom.NextDouble() < 0.00025 + (double)this.mineLevel / 120000.0 + 0.0005 * chanceModifier / 2.0) {
 
         whichStone = 2;
 
         whichStone = 2;
 
         stoneHealth = 10;
 
         stoneHealth = 10;
 
     }
 
     }
     else if (gemStoneChance != 0.0 && this.mineRandom.NextDouble() < gemStoneChance + gemStoneChance * chanceModifier + (double)this.mineLevel / 24000.0) { //gemstones
+
    // Gem stone nodes.
 +
     else if (gemStoneChance != 0.0 && this.mineRandom.NextDouble() < gemStoneChance + gemStoneChance * chanceModifier + (double)this.mineLevel / 24000.0) {
 
         return new Object(tile, this.getRandomGemRichStoneForThisLevel(this.mineLevel), "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false) {
 
         return new Object(tile, this.getRandomGemRichStoneForThisLevel(this.mineLevel), "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false) {
 
             MinutesUntilReady = 5
 
             MinutesUntilReady = 5
 
         };
 
         };
 
     }
 
     }
     if (this.mineRandom.NextDouble() < chanceForPurpleStone / 2.0 + chanceForPurpleStone * averageMiningLevel * 0.008 + chanceForPurpleStone * (averageDailyLuck / 2.0)) { //gem node
+
    // gem node (purple rocks).
 +
     if (this.mineRandom.NextDouble() < chanceForPurpleStone / 2.0 + chanceForPurpleStone * averageMiningLevel * 0.008 + chanceForPurpleStone * (averageDailyLuck / 2.0)) {
 
         whichStone = 44;
 
         whichStone = 44;
 
     }
 
     }
     if (this.mineLevel > 100 && this.mineRandom.NextDouble() < chanceForMysticStone + chanceForMysticStone * averageMiningLevel * 0.008 + chanceForMysticStone * (averageDailyLuck / 2.0)) { //mystic stone
+
    // Mystic stones.
 +
     if (this.mineLevel > 100 && this.mineRandom.NextDouble() < chanceForMysticStone + chanceForMysticStone * averageMiningLevel * 0.008 + chanceForMysticStone * (averageDailyLuck / 2.0)) {
 
         whichStone = 46;
 
         whichStone = 46;
 
     }
 
     }
 
     whichStone += whichStone % 2;
 
     whichStone += whichStone % 2;
     if (this.mineRandom.NextDouble() < 0.1 && this.getMineArea() != 40) { //dark grey rock (stone ore)
+
    // Dark grey rock (stone ore).
 +
     if (this.mineRandom.NextDouble() < 0.1 && this.getMineArea() != 40) {
 
         return new Object(tile, (this.mineRandom.NextDouble() < 0.5) ? 668 : 670, "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false)
 
         return new Object(tile, (this.mineRandom.NextDouble() < 0.5) ? 668 : 670, "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false)
 
         {
 
         {
Line 115: Line 120:  
     return new Object(tile, whichStone, "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false) {
 
     return new Object(tile, whichStone, "Stone", canBeSetDown: true, canBeGrabbed: false, isHoedirt: false, isSpawnedObject: false) {
 
         MinutesUntilReady = stoneHealth
 
         MinutesUntilReady = stoneHealth
     };
+
     };</syntaxhighlight>
    
[[File:Skull Cavern Diamond.png|300px|thumb|right|Changing distribution of diamond nodes with floor, luck and mining level]]
 
[[File:Skull Cavern Diamond.png|300px|thumb|right|Changing distribution of diamond nodes with floor, luck and mining level]]
Line 144: Line 149:  
     return rock
 
     return rock
   −
[[File:Skull Cavern Gem.png|300px|thumb|right|Changing distribution of gemstone nodes with floor with neutral base luck, the special charm and level 10 mining.]]
  −
[[File:Skull Cavern GemNodes.png|300px|thumb|right|Changing distribution of gem nodes with floor luck and mining level.]]
   
However the use of diamondCheck twice means you cannot just use the chance for it twice, as it will either pass both times or fail both times, making calculations of chances more complex.
 
However the use of diamondCheck twice means you cannot just use the chance for it twice, as it will either pass both times or fail both times, making calculations of chances more complex.
 
The simplest to understand is the gemstone ore.
 
The simplest to understand is the gemstone ore.
Line 152: Line 155:  
Additionally, this returns a random gem using the function <code>MineShaft::getRandomGemRichStoneForThisLevel</code><ref name="whichGem" />.
 
Additionally, this returns a random gem using the function <code>MineShaft::getRandomGemRichStoneForThisLevel</code><ref name="whichGem" />.
 
This relies upon the code:
 
This relies upon the code:
 +
<syntaxhighlight lang="C#">
 
     int whichGem = this.mineRandom.Next(59, 70);
 
     int whichGem = this.mineRandom.Next(59, 70);
     whichGem += whichGem % 2;
+
     whichGem += whichGem % 2;</syntaxhighlight>
 +
[[File:Skull Cavern Gem.png|300px|thumb|right|Changing distribution of gemstone nodes with floor with neutral base luck, the special charm and level 10 mining.]]
 
Which will randomly select an integer in the range [59,70), and then add 1 if it is odd.
 
Which will randomly select an integer in the range [59,70), and then add 1 if it is odd.
 
This has the effect of randomly selecting an even integer from 60 to 70 inclusive, with the integers from 60 to 68 inclusive having an equal likelihood and 70 being half as likely.
 
This has the effect of randomly selecting an even integer from 60 to 70 inclusive, with the integers from 60 to 68 inclusive having an equal likelihood and 70 being half as likely.
This is because the mineRandom.Next(a,b) will return an integer greater than or equal to a and less than b, from internally generating a random number from 0 to 1, scaling it and offsetting it to be a random decimal number from 59 to 70, and then rounding down. This means that the range 59 to just below 61 will round to 59 or 60, which is then both forced to 60; while the numbers from 69 to 70 will round to 69 and then be converted to 70, meaning 70 has half the range. This means that the chance for jade (from 70) will be:
+
This is because the mineRandom.Next(a,b) will return an integer greater than or equal to a and less than b, from internally generating a random number from 0 to 1, scaling it and offsetting it to be a random decimal number from 59 to 70, and then rounding down. This means that the range 59 to just below 61 will round to 59 or 60, which is then both forced to 60; while the numbers from 69 to 70 will round to 69 and then be converted to 70, meaning 70 has half the range. This means that the chance for jade (from 70) will be one 11th of the chance to obtain a gem, and the other gems (emerald, aquamarine, ruby, amethyst & topaz) will be double that:
    (1-chanceForOre)*(1-chanceForDiamond)*chanceForGem/11
+
      jade = (1-chanceForOre)*(1-chanceForDiamond)*chanceForGem/11
And the chance for the other gems (emerald, aquamarine, ruby, amethyst & topaz) will be:
+
      other = (1-chanceForOre)*(1-chanceForDiamond)*chanceForGem*2/11
    (1-chanceForOre)*(1-chanceForDiamond)*chanceForGem*2/11
+
[[File:Skull Cavern GemNodes.png|300px|thumb|right|Changing distribution of gem nodes with floor luck and mining level.]]
 
The chance to not be a gem stone ore, and be some other option (other than diamond) relies upon either passing the diamond check, or failing the diamond check and failing the gemstone check. This chance is equal to:
 
The chance to not be a gem stone ore, and be some other option (other than diamond) relies upon either passing the diamond check, or failing the diamond check and failing the gemstone check. This chance is equal to:
 
     chanceForDiamond+(1-chanceForDiamond)*(1-chanceForGem) = 1-(1-chanceForDiamond)*chanceForGem
 
     chanceForDiamond+(1-chanceForDiamond)*(1-chanceForGem) = 1-(1-chanceForDiamond)*chanceForGem
 
Then going through each return statement we have the final chances being:
 
Then going through each return statement we have the final chances being:
    stone = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*chanceForStone
+
      stone = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*chanceForStone
    mystic = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*(1-chanceForStone)*chanceForMystic
+
    mystic = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*(1-chanceForStone)*chanceForMystic
    purple = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*(1-chanceForStone)*(1-chanceForMystic)*chanceForPurple
+
    purple = (1-chanceForOre)*(1-(1-chanceForDiamond)*chanceForGem)*(1-chanceForStone)*(1-chanceForMystic)*chanceForPurple
 
The next one to consider is is Diamond. As passing the diamond check skips the gem stone ore check, so it cannot be included in the chance. To be a diamond, it must pass the diamond check, which skips the gem check, and it must fail every other check. This gives:
 
The next one to consider is is Diamond. As passing the diamond check skips the gem stone ore check, so it cannot be included in the chance. To be a diamond, it must pass the diamond check, which skips the gem check, and it must fail every other check. This gives:
 
     diamond = (1-chanceForOre)*(chanceForDiamond)*(1-chanceForPurple)*(1-chanceForMystic)*(1-chanceForStone)
 
     diamond = (1-chanceForOre)*(chanceForDiamond)*(1-chanceForPurple)*(1-chanceForMystic)*(1-chanceForStone)
 +
While calculated in quite a different way, the chance to find a diamond node is quite comparable to the chance to find a node of another gem type.
 
And finally, the only other option is a normal rock. This could be calculated as whatever is left over, but for completeness, it must fail every check.
 
And finally, the only other option is a normal rock. This could be calculated as whatever is left over, but for completeness, it must fail every check.
    rock = (1-chanceForOre)*(1-chanceForDiamond)*(1-chanceForGem)*(1-chanceForPurple)*(1-chanceForMystic)*(1-chanceForStone)
+
      rock = (1-chanceForOre)*(1-chanceForDiamond)*(1-chanceForGem)*(1-chanceForPurple)*(1-chanceForMystic)*(1-chanceForStone)
    
===Links to Desmos Graphs===
 
===Links to Desmos Graphs===
You can access an interactive graph on Desmos, which can be presented in a variety of ways.<br />
+
You can access an interactive graph on Desmos via the links below, with the links having a some options preselected.
To see the metal ores: https://www.desmos.com/calculator/uwi9hfdjvv <br />
+
{| class="wikitable"
To see the gemstones, gem nodes, dark grey rocks (stone ore) and mystic stones with a daily luck of 0.025 (neutral with special charm) and mining level 10 (Note, for easy of viewing some of these have been scaled): https://www.desmos.com/calculator/iopaqgwsvs </br>
+
! Desmos Link !! Description
To see the effect of daily luck (including special charm) on the chance, relative to the chance at a daily luck of 0.025, with mining level 10 and floor 100: https://www.desmos.com/calculator/ngyjsb1b0m <br />
+
|-
To see the effect of mining level (including buffs) on the chance, relative to a mining level of 10, with a luck of 0.025 and floor 100: https://www.desmos.com/calculator/72efyqudvu
+
| https://www.desmos.com/calculator/uwi9hfdjvv || Metal ores vs floor
 
+
|-
These include sliders for mining level, daily luck and floor which you can adjust to shift the references above.
+
| https://www.desmos.com/calculator/iopaqgwsvs || Gemstones, gem nodes, dark grey rocks (stone ore) and mystic stones vs floor.<br />''Note that some values have been scaled to keep it on the same graph.''
 
+
|-
 +
| https://www.desmos.com/calculator/ngyjsb1b0m || The effect of daily luck (including special charm) on the chance normalised to their reference value
 +
|-
 +
| https://www.desmos.com/calculator/72efyqudvu || The effect of mining level (including buffs) on the chance, normalised to their reference value
 +
|}
 +
When not being used as the x axis, the values of daily luck, mining level and floor are controlled by a variable in the left pane and are used to calculate a reference. Initially these are set to floor 100, a daily luck of 0.025 (average daily luck with special charm) and a mining level of 10.
    
==References==
 
==References==
Line 186: Line 197:  
<ref name="adjustChances">See <samp>MineShaft::adjustLevelChances</samp> in the game code.</ref>
 
<ref name="adjustChances">See <samp>MineShaft::adjustLevelChances</samp> in the game code.</ref>
 
<ref name="oreClumps">See <samp>MineShaft::tryToAddOreClumps</samp> in the game code.</ref>
 
<ref name="oreClumps">See <samp>MineShaft::tryToAddOreClumps</samp> in the game code.</ref>
<ref name="dailyLuck">See <samp>FarmerTeam::AverageDailyLuck</samp> in the game code.</ref>
+
<ref name="dailyLuck">See <samp>FarmerTeam::AverageDailyLuck</samp> and <samp>Game1::_newDayAfterFade</samp> in the game code.</ref>
 
<ref name="whichOre">See <samp>FarmerTeam::getAppropriateOre</samp> in the game code.</ref>
 
<ref name="whichOre">See <samp>FarmerTeam::getAppropriateOre</samp> in the game code.</ref>
 
<ref name="chooseStoneType">See <samp>MineShaft::chooseStoneType</samp> in the game code.</ref>
 
<ref name="chooseStoneType">See <samp>MineShaft::chooseStoneType</samp> in the game code.</ref>
 
<ref name="whichGem">See <samp>MineShaft::getRandomGemRichStoneForThisLevel</samp> in the game code.</ref>
 
<ref name="whichGem">See <samp>MineShaft::getRandomGemRichStoneForThisLevel</samp> in the game code.</ref>
 
</references>
 
</references>
73

edits

Navigation menu