Changes

Jump to navigation Jump to search
Added information on ore and stones dropping from rocks.
Line 180: Line 180:     
Due to the interaction between the different checks it is hypothetically possible for the chance for one of these to be found increasing to decrease the chance of finding others. This is observed with the increasing chance to find ore reducing the chance to find mystic stones and gem nodes, and after a high enough level, also reducing the chance to find diamonds and gem stones; this also reduces the chance of finding dark grey rocks and rocks. Additionally, the increase in chance of finding these valuable items due to luck or mining level reduces the chance of finding dark grey rocks and rocks, but does not parasitically affect each other, e.g. a higher daily luck will increase your chance of finding diamonds, gems, mystic stones and gem nodes, and will decrease the chance of finding dark grey rocks and normal rocks.
 
Due to the interaction between the different checks it is hypothetically possible for the chance for one of these to be found increasing to decrease the chance of finding others. This is observed with the increasing chance to find ore reducing the chance to find mystic stones and gem nodes, and after a high enough level, also reducing the chance to find diamonds and gem stones; this also reduces the chance of finding dark grey rocks and rocks. Additionally, the increase in chance of finding these valuable items due to luck or mining level reduces the chance of finding dark grey rocks and rocks, but does not parasitically affect each other, e.g. a higher daily luck will increase your chance of finding diamonds, gems, mystic stones and gem nodes, and will decrease the chance of finding dark grey rocks and normal rocks.
 +
 +
===Ores From Rocks===
 +
If a normal rock is generated, there is still a chance to obtain ore from it. There are 4 different rocks which can be generated, which have an equal chance. When the rock is broken, the code in <code>StardewValley.Locations.MineShaft::checkStoneForItems</code> will potentially call <code>StardewValley.Locations.MineShaft::getOreIndexForLevel</code> to have ore drop. The key parts of the code are<ref name="stoneDrop" />:
 +
<syntaxhighlight lang="C#">
 +
    double chanceModifier = who.DailyLuck / 2.0 + (double)who.MiningLevel * 0.005 + (double)who.LuckLevel * 0.001;
 +
double oreModifier = ((tileIndexOfStone == 40 || tileIndexOfStone == 42) ? 1.2 : 0.8);
 +
    if (r.NextDouble() < 0.05 * (1.0 + chanceModifier) * oreModifier) {
 +
if (r.NextDouble() < 0.25 * (double)((!who.professions.Contains(21)) ? 1 : 2)) {
 +
Game1.createObjectDebris(382, x, y, who.UniqueMultiplayerID, this); //coal
 +
}
 +
Game1.createObjectDebris(this.getOreIndexForLevel(this.mineLevel, r), x, y, who.UniqueMultiplayerID, this);//ore
 +
} else if (r.NextDouble() < 0.5) {
 +
Game1.createDebris(14, x, y, 1, this);
 +
}
 +
</syntaxhighlight>
 +
 +
This results in a chance to find ore of 5.1% at worst, and 5.7% at best; with a corresponding 47.45% to 47.15% chance to obtain stone.
 +
 +
Then inside <code>StardewValley.Locations.MineShaft::getOreIndexForLevel</code>, the following code is run to obtain the ore<ref name="oreIndex" />: 
 +
<syntaxhighlight lang="C#">
 +
if (r.NextDouble() < 0.01 + (double)((float)(mineLevel - 120) / 2000f)) {
 +
return 386; //Iridium
 +
}
 +
if (!(r.NextDouble() < 0.75)) {
 +
if (!(r.NextDouble() < 0.75)) {
 +
return 378; //Copper
 +
}
 +
return 380; //Iron
 +
}
 +
return 384; //Gold
 +
</syntaxhighlight>
 +
The chance to obtain iridium ore starts at 1.05% at floor 1, and increases linearly to 100% at floor 1980. When combined with the chance to get ore, this starts at an overall chance to get iridum ore from rocks on floor 1 betwen 0.0536% and 0.060%. In the event it is not iridium, then there is a 75% chance for it to be gold, an 18.75% chance for it to be iron, and a 6.25% chance for it to be copper.
    
===Links to Desmos Graphs===
 
===Links to Desmos Graphs===
Line 205: Line 237:  
<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>
 +
<ref name="stoneDrop">See <samp>MineShaft::checkStoneForItems</samp> in the game code.</ref>
 +
<ref name="oreIndex">See <samp>MineShaft::getOreIndexForLevel</samp> in the game code.</ref>
 
</references>
 
</references>
    
[[Category:Game mechanics]]
 
[[Category:Game mechanics]]
84

edits

Navigation menu