Changes

832 bytes added ,  02:48, 2 August 2023
→‎Play Luck not took into account on dayUpdate?: : Seems like it now works as of 1.5.4
Line 31: Line 31:  
:Because no luck buffs are active when the player sleeps, which is when the code executes. [[User:Margotbean|margotbean]] ([[User talk:Margotbean|talk]]) 21:38, 15 November 2021 (UTC)
 
:Because no luck buffs are active when the player sleeps, which is when the code executes. [[User:Margotbean|margotbean]] ([[User talk:Margotbean|talk]]) 21:38, 15 November 2021 (UTC)
 
::Fair point, <samp>player.dayupdate()</samp> calling <samp>Farmer::ClearBuffs</samp> happens before locations update in <samp>Game1::_newDayAfterFade</samp>. -- [[User:Charly|Charly]] ([[User talk:Charly|talk]]) 21:46, 15 November 2021 (UTC)
 
::Fair point, <samp>player.dayupdate()</samp> calling <samp>Farmer::ClearBuffs</samp> happens before locations update in <samp>Game1::_newDayAfterFade</samp>. -- [[User:Charly|Charly]] ([[User talk: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 <samp>Farmer::dayupdate</samp>, right after the <samp>ClearBuffs</samp> call, there's the following code snippet: <syntaxhighlight lang="C#">
 +
if (leftRing.Value != null)
 +
{
 +
leftRing.Value.onDayUpdate(this, base.currentLocation);
 +
}
 +
if (rightRing.Value != null)
 +
{
 +
rightRing.Value.onDayUpdate(this, base.currentLocation);
 +
}
 +
</syntaxhighlight> The <samp>onDayUpdate</samp> method in <samp>Ring.cs</samp> calls the <samp>onEquip</samp> 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. [[User:Mydan123|Mydan123]] ([[User talk:Mydan123|talk]]) 02:48, 2 August 2023 (UTC)
    
== I feel there should more detail on how luck is calculated ==
 
== I feel there should more detail on how luck is calculated ==
2

edits