Changes

m
Line 69: Line 69:  
While looking at the code for ore distribution, I found the ore distribution for iron and copper to be quite strange.
 
While looking at the code for ore distribution, I found the ore distribution for iron and copper to be quite strange.
 
The chance for iron is calculated as:
 
The chance for iron is calculated as:
 +
 
<code>chanceForIron = Math.Min(0.5, 0.1 + (double)(this.mineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005)</code>
 
<code>chanceForIron = Math.Min(0.5, 0.1 + (double)(this.mineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005)</code>
 +
 
But as mineLevel is always 120 more than skullCavernMineLevel, this can be rewritten as:
 
But as mineLevel is always 120 more than skullCavernMineLevel, this can be rewritten as:
 +
 
<code>chanceForIron = Math.Min(0.5, 0.7 + (double)(skullCavernMineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005)</code>
 
<code>chanceForIron = Math.Min(0.5, 0.7 + (double)(skullCavernMineLevel - Math.Min(200, skullCavernMineLevel)) * 0.005)</code>
 +
 
And as the minimum of skullcavernMineLevel and 200 cannot be larger than skullCavernMineLevel, this latter term will always be greater than 0, so this simplifies to:
 
And as the minimum of skullcavernMineLevel and 200 cannot be larger than skullCavernMineLevel, this latter term will always be greater than 0, so this simplifies to:
 +
 
<code>chanceForIron = 0.5</code>
 
<code>chanceForIron = 0.5</code>
Practically this means iron and copper are equally rare. (And the check only occurs after passing an ore check and failing an iridium check and a gold check). But if this was intended, it makes much more sense to just use 0.5. This makes me think it is likely a bug, and that both were meant to use mineLevel (or both were meant to use skullCavernMineLevel)[[User:JackBlack69|JackBlack69]] ([[User talk:JackBlack69|talk]]) 11:35, 18 April 2023 (UTC)
+
 
 +
Practically this means iron and copper are equally rare. (And the check only occurs after passing an ore check and failing an iridium check and a gold check). But if this was intended, it makes much more sense to just use 0.5. This makes me think it is likely a bug, and that both were meant to use mineLevel (or both were meant to use skullCavernMineLevel) [[User:JackBlack69|JackBlack69]] ([[User talk:JackBlack69|talk]]) 11:35, 18 April 2023 (UTC)
70

edits