Talk:Iridium Ore

From Stardew Valley Wiki
Jump to: navigation, search
This talk page is for discussing Iridium Ore.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

I'm pretty sure I've seen Iridium Deposits within levels 110-120 of the mine, just that they're super rare. I went there to farm Iridium before I found out where the skull dungeon was and before I unlocked the Quarry. --WalkingCasino (talk) 04:43, 2 March 2016 (EST)

Node Chance

At level 120 and greater, the chances of each single iridium node spawning is 1% + ((mineLevel - 120) / 2000), where mineLevel is the current level number you are on.

Assuming this is obtained from code-diving, this needs to be changed to point out that level 1 in the Skull Cavern is mineLevel 121, and so in the context of the Skull Cavern the formula should instead be 1% + (Skull Cavern Level / 2000) Nazgutek (talk) 09:33, 11 July 2018 (BST)

Further digging into the v1.06 code dump shows the above formula is in fact used when breaking a stone to determine if any ore is obtained Nazgutek (talk) 09:26, 12 July 2018 (BST)
OK, so the code for populateLevel() has two separate ore spawning routines. The first, chooseStoneType, is invoked as part of placing stones on the level, and is the only place I've found that increases ore chances with increasing mineLevel values. The second, tryToAddOreClumps() invokes getAppropriateOre.
First up is chooseStoneType. For all levels except every tenth mineshaft level, the code scans every tile in the level, and if the chance for stone succeeds (10% to 30% determined at the start of populateLevel()) it does some other spawning logic before falling into a call to chooseStoneType.
chanceForOre = 2% plus 0.05% per SkullCavernLevel plus 0.1% per SkullCavernLevel past 130
If the SkullCavernLevel is not a multiple of 5 and the chanceForOre succeeds, the following chances are tested in order:
IridiumBoost = 0.01% per SkullCavernLevel past 130, or at least 0.4%
chanceForIridium = (0.03% + IridiumBoost) per SkullCavernLevel
chanceForGold = 1% plus 0.05% per SkullCavernLevel
chanceForIron = 10% plus 0.5% per SkullCavernLevel, maximum 50%
tryToAddOreClumps() will pick a random tile and if it can have ore, will call getAppropriateOre, which can pick iridium 2% of the time but only in the Skull Cavern. Given how most tiles won't be floor, the chances are slim that this routine will spawn iridium.
Well, that turned into a deep rabbit hole Nazgutek (talk) 09:26, 12 July 2018 (BST)
Quite a rabbit hole! It seems you've done a good bit of code digging, but I'm a bit concerned that you used v1.06 for this? The code has changed quite a bit since then (although I can't say if this particular code was affected). The current release version is 1.2.33 and beta is 1.3.24. You can use ILSpy or DotPeek to decompile the current version, and verify your findings. I can change the equation on the page per your first suggestion. margotbean (talk) 18:33, 12 July 2018 (BST)
I'm expecting large changes with the multiplayer code base, what with numerous mentions of refactoring and rewriting. Once the beta finishes, I'll see about getting a decompile done and hope deobfuscation won't be needed. Nazgutek (talk) 20:00, 12 July 2018 (BST)