This talk page is for discussing Farming.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

Deluxe Fertilizer Table

I'm testing the formulas given for crop quality chance for my own personal Stardew Valley spreadsheet. The values in the table for Deluxe fertilizer do not match the formulas given for calculating the chance. The values begin to diverge for me most notably at farming level 3. I calculate 16% Iridium, 27% Gold, 39% Silver, and 18% Regular. Starting with Iridium and working down to regular, I'm curious how the table gets 21% for Regular using the formulas given.

Also in the text below the Deluxe Fertilizer table, it says that Silver is the minimum quality when using Deluxe fertilizer, which is not displayed by the formulas.

Can anyone help me out?

--APost-It (talk) 23:25, 6 September 2021 (UTC)

Hello APost-It! Unfortunately, the user who added that table went inactive a while ago. Their comment when editing the page also got truncated, but it said something about how there may be rounding errors. So, if you have more correct numbers and would like to update the page, please do so! Thank you! margotbean (talk) 19:04, 7 September 2021 (UTC)
Thanks for the response! Yeah I can try to edit it. I wanted to double check if the in-game formulas are correct as stated on the page, but I'm not sure how to go about doing that. If they are, I can share what I have. APost-It (talk) 01:36, 8 September 2021 (UTC)
I added a code reference (it should have been done long ago, I'm so glad you asked about this subject!) -- the formula can be found in StardewValley.Crop::harvest. For your convenience, I believe the relevant portion, copied from the v1.5 code, is:
		double chanceForGoldQuality = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)fertilizerQualityLevel * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01;
		double chanceForSilverQuality = Math.Min(0.75, chanceForGoldQuality * 2.0);
		if (fertilizerQualityLevel >= 3 && r.NextDouble() < chanceForGoldQuality / 2.0)
		{
			cropQuality = 4;
		}
		else if (r.NextDouble() < chanceForGoldQuality)
		{
			cropQuality = 2;
		}
		else if (r.NextDouble() < chanceForSilverQuality || fertilizerQualityLevel >= 3)
		{
			cropQuality = 1;
		}
Let me know if you have further questions! margotbean (talk) 18:02, 8 September 2021 (UTC)

So would the formula for actual chances be something like this:

iridium: gold chance / 2

true gold chance: gold chance * (1 - iridium chance)

silver chance: min( (gold chance * 2) * (1 - true gold chance) * (1 - iridium chance) )

normal: 1 - iridium chance - true gold chance - silver chance

LahaiRoi (talk) 13:49, 10 September 2021 (UTC)

Here are the numbers I'm getting:

LahaiRoi (talk) 14:32, 10 September 2021 (UTC)

I've looked at this for half an hour now, and I'm simply not qualified to say whether your calculations are correct. The table on the page under "Complete Formula" is correct, except for the "+ 0.01" added to the end of gold chance. I don't know where that comes from.
I don't see the accounting for silver being capped at 75% in your formulas. It may be there, I just don't seem to see it.
Your formulas for iridium & true gold seem correct to me, but I get lost at silver, to be honest. Your formula seems to be saying silver = the chance for iridium * true chance for gold * chance for iridium (again). Either I'm showing my weakness at probabilities, or helping you refine your calculations, I hope it's the latter. Either way, I think I may have given as much help as I'm capable.
Take another look, and if you think you're right, and have accounted for silver being capped at 75%, then go ahead and proceed to change the numbers in the table. If you think further discussion with me would help, please don't hesitate! I would like to be of more help, if possible! margotbean (talk) 16:47, 10 September 2021 (UTC)
Oh sorry I fixed the formula I wrote up there for silver. Its gold chance times two, not divided.
The 0.01 is actually in the code you posted above. So it is correct if we are basing it on that.
As for the 75% capped yes I did account for it by doing the following: If the sum of true gold chance and silver chance is greater than 1, then silver chance is set to 1 - true gold chance. Otherwise it is 0.75.
If you'd like to take a look at the sheet, heres the link (you'll have to remove the spaces): docs. google. com/spreadsheets/d/1_qFcwcRTiyfqGdm5LMmG-8MI3woqKowvu-1utmuYe4M/edit?usp=sharing

LahaiRoi (talk) 17:18, 10 September 2021 (UTC)

Return to "Farming" page.