Talk:Luck

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

Luck Value

Would love further explanation of how much "+1 Luck" stat modifies the Luck value. It's a bit confusing how the buffs correlate to the specific Luck value, eg. does +1 Luck equate to the next tier on the Fortune Telling show? Zonesville (talk) 17:32, 18 May 2021 (UTC)

This talk page could be useful: Talk:Luck. Horizon98 (talk) 18:00, 18 May 2021 (UTC)
Oh man what a rookie mistake, I didn't know which wiki I was on. Appreciate the link, feel free to delete! Zonesville (talk) 14:07, 18 May 2021 (UTC)

Play Luck not took into account on dayUpdate?

I'm not an advanced expert about the game code, but I don't get why player luck would not be taken into account in FarmAnimal::dayUpdate (which is called by AnimalHouse::DayUpdate and Farm::DayUpdate, which are called by Game1::_newDayAfterFade in foreach (GameLocation location2 in locations))

Extract of FarmAnimal::dayUpdate code:

float num3 = ((&.op_Implicit((&)(object)happiness) > 200) ? ((float)(int)&.op_Implicit((&)(object)happiness) * 1.5f) : ((float)((&.op_Implicit((&)(object)happiness) <= 100) ? (&.op_Implicit((&)(object)happiness) - 100) : 0)));
if (((&)(object)type).get_Value().Equals("Duck") && random.NextDouble() < (double)((float)&.op_Implicit((&)(object)friendshipTowardFarmer) + num3) / 4750.0 + Game1.player.team.AverageDailyLuck() + Game1.player.team.AverageLuckLevel() * 0.01)
{
	num2 = &.op_Implicit((&)(object)deluxeProduceIndex);
}
else if (((&)(object)type).get_Value().Equals("Rabbit") && random.NextDouble() < (double)((float)&.op_Implicit((&)(object)friendshipTowardFarmer) + num3) / 5000.0 + Game1.player.team.AverageDailyLuck() + Game1.player.team.AverageLuckLevel() * 0.02)
{
	num2 = &.op_Implicit((&)(object)deluxeProduceIndex);
}

(NetFieldBase specifications replaced with & for readability)

Game1.player.team.AverageLuckLevel() appears on both formula. Why and more importantly how would it be neutralized?

FarmerTeam::AverageLuckLevel just compute the average LuckLevel of Game1.getOnlineFarmers() and Farmer::LuckLevel is just a get/set (get is luckLevel + addedLuckLevel, the first being as a skill and the second one obtained from buffs).

-- Charly (talk) 21:34, 15 November 2021 (UTC)

Because no luck buffs are active when the player sleeps, which is when the code executes. margotbean (talk) 21:38, 15 November 2021 (UTC)
Fair point, player.dayupdate() calling Farmer::ClearBuffs happens before locations update in Game1::_newDayAfterFade. -- Charly (talk) 21:46, 15 November 2021 (UTC)
As of version 1.5.4, I believe the luck buff from the Lucky Ring can affect animal drops. In Farmer::dayupdate, right after the ClearBuffs call, there's the following code snippet:
if (leftRing.Value != null)
{
	leftRing.Value.onDayUpdate(this, base.currentLocation);
}
if (rightRing.Value != null)
{
	rightRing.Value.onDayUpdate(this, base.currentLocation);
}
The onDayUpdate method in Ring.cs calls the onEquip if the ring is item number 859, which corresponds to the Lucky Ring. So, the luck buff should be re-applied right after it's removed, and as far as I can tell the buff should now affect Rabbit's Feet and Duck Feathers. Mydan123 (talk) 02:48, 2 August 2023 (UTC)
Interesting... I will try to make time to step through the code and verify whether or not this is true. Thank you for pointing this out!! margotbean (talk) 21:11, 2 August 2023 (UTC)
Just so you don't think I've forgot about this, it appears to work that way in v1.5, but I want to hold off changing multiple pages on the wiki until I can verify if it works the same in v1.6. I spent 3 hours researching another issue today alone, so please be patient! And thanks again for reporting this!! margotbean (talk) 00:07, 9 August 2023 (UTC)

I feel there should more detail on how luck is calculated

This line of code appears to be responsible for determining the days luck:

   Game1.player.team.sharedDailyLuck.Value = Math.Min(0.100000001490116, (double) Game1.random.Next(-100, 101) / 1000.0); 

So it seems there are only 200 different possible luck values. Making the chance of a true neutral event 1/200 rather than effectively 0 (if it were Random.NextDouble).

Also, there is little explanation on luck buffs? No code references either, making that section entirely useless. Anikyte (talk) 21:36, 20 May 2022

The page doesn't say the chance of a true neutral event is 0, but the fortune teller does say "it's rare". You are free to write up an explanation of how luck is calculated, though I would put the first draft here on the talk page or in your user space. Be sure to cite that code reference by class and method. If you can find the code reference for food buffs, please feel free to add it to the page. And please remember to sign your comments with four tildes ~~~~. Thanks, margotbean (talk) 18:22, 21 May 2022 (UTC)

How to structure the Luck page for easier understanding

I recently made a "bold" edit to Luck in order to rearrange some sections for clarity -- it was reverted due to duplicate section headers. The original, unmodified section headers are as follows:

1 Daily Luck
  1.1 Daily Luck Effects
2 Luck Buffs

My prior proposed change was as follows:

1 Daily Luck
2 Luck Buffs
3 Luck Effects
  3.1 Daily luck
  3.2 Luck buff
  3.3 Both

My new proposed change is:

1 Daily Luck
2 Luck Buffs
3 Luck Effects
  3.1 Daily Luck Effects
  3.2 Luck Buffs Effects
  3.3 Shared Effects

I'd specifically be interested to hear from Margotbean to see if this resolves your concern or if you have more context to share. Thanks! Cooperka (talk) 15:28, 11 April 2023 (UTC)

Hello Cooperka! That change would take care of the duplicate headings, but several pages on the wiki link to "Daily Luck" or "Luck Buffs" to explain the effect of luck on a particular thing or situation. So, it would be better to keep the effects of Daily Luck under the "Daily Luck" heading. I think it would be better to add a heading "Luck Buff Effects", and keep the sections separate. I also think it would be better to keep the "Special Charm" section as well, even if it repeats info that's under "Daily Luck". It's a matter of what links to the sections, and what info readers are expecting when they click one of those links. margotbean (talk) 19:49, 11 April 2023 (UTC)
Ah I see, thanks for that explanation! It's a tricky situation to preserve existing links. Agreed also about keeping the Special Charm section. Hm...
As it is, this page seems extremely hard to read and understand due to the Daily Luck section explaining everything in one list (including shared effects) followed by the Luck Buffs section describing only things that are untrue about daily luck for luck buffs... it's hard to even explain the current structure because it's so convoluted. As a player I want to understand at a glance which kind of luck matters for a given activity. How would you feel about keeping the "exclusive" effects in each of the original sections as you suggested, and adding a new section for Shared Effects? It could look like this:
1 Daily Luck
  1.1 Daily Luck Effects
  "daily luck exclusively affects X, and also shares some effects with luck buffs, described below in #Shared_Effects"
2 Luck Buffs
  2.1 Luck Buff Effects
  "luck buffs exclusively affect X, and also share some effects with daily luck, described below in #Shared_Effects"
3 Shared Effects
(followed of course by the other sections like Special Charm.) Thoughts? Cooperka (talk) 21:32, 11 April 2023 (UTC)
Honestly, to me that sounds really convoluted. The page evolved to what it is because people didn't understand the differences between what the two types of luck affected, and they seemed quite happy with the current format. I'm open to input from other readers. margotbean (talk) 21:42, 11 April 2023 (UTC)
Will wait for more input from others! In the meantime I'll apply the other minor improvements to the page. Cooperka (talk) 22:39, 11 April 2023 (UTC)

New TV display for extremely good luck?

While playing, I've encountered this TV screen as when watching the Fortune Teller (note the extra starry background): 20240415114726 1.jpg

Is this display shown when the daily luck is especially good?

Also, want to tell that the text is identical to the regular best luck text: "The spirits are very happy today! They will do their best to shower everyone with good fortune." BidBux (talk) 13:24, 15 April 2024 (UTC)

Okay, it appears that there are two new TV screens for the Fortune Teller in the cases of best and worst possible daily luck, or so I've been told. So far I've only encountered the best luck screen. Someone should update the table with those new sprites. (BidBux (talk) 05:11, 16 April 2024 (UTC))
Alright, I have discovered the worst luck screen too now. Here's how it looks: Fortune Teller worst luck screenshot.jpg
Would really be great if someone could turn these into proper GIFs and put them into the page. (BidBux (talk) 11:01, 18 April 2024 (UTC))