Difference between revisions of "Talk:Luck"

From Stardew Valley Wiki
Jump to navigation Jump to search
(+talkheader)
Line 4: Line 4:
 
:This talk page could be useful: [https://stardewcommunitywiki.com/Talk:Luck#Mechanics Talk:Luck]. [[User:Horizon98|Horizon98]] ([[User talk:Horizon98|talk]]) 18:00, 18 May 2021 (UTC)
 
:This talk page could be useful: [https://stardewcommunitywiki.com/Talk:Luck#Mechanics Talk:Luck]. [[User:Horizon98|Horizon98]] ([[User talk: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! [[User:Zonesville|Zonesville]] ([[User talk:Zonesville|talk]]) 14:07, 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! [[User:Zonesville|Zonesville]] ([[User talk: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 <samp>FarmAnimal::dayUpdate</samp> (which is called by <samp>AnimalHouse::DayUpdate</samp> and <samp>Farm::DayUpdate</samp>, which are called by <samp>Game1::_newDayAfterFade</samp> in <samp>foreach (GameLocation location2 in locations)</samp>)
 +
 +
Extract of <samp>FarmAnimal::dayUpdate</samp> code:
 +
 +
<syntaxhighlight lang="C#">
 +
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);
 +
}
 +
</syntaxhighlight>
 +
(<samp>NetFieldBase</samp> specifications replaced with <samp>&</samp> for readability)
 +
 +
<samp>Game1.player.team.AverageLuckLevel()</samp> appears on both formula. Why and more importantly how would it be neutralized?
 +
 +
<samp>FarmerTeam::AverageLuckLevel</samp> just compute the average <samp>LuckLevel</samp> of <samp>Game1.getOnlineFarmers()</samp> and <samp>Farmer::LuckLevel</samp> is just a get/set (get is <samp>luckLevel + addedLuckLevel</samp>, the first being as a skill and the second one obtained from buffs).
 +
 +
-- [[User:Charly|Charly]] ([[User talk:Charly|talk]]) 21:34, 15 November 2021 (UTC)

Revision as of 21:34, 15 November 2021

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)