Difference between revisions of "Talk:Targeted Bait"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Clarified that the third condition guarantees trash.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Talkheader}}
 
==Exact Functionality of Targeted Bait==
 
==Exact Functionality of Targeted Bait==
 
In order to clear up some of the misconceptions around Targeted Bait, I've decided to actually spell out exactly how it affects the fish-catching process, which is rather complicated. The relevant code can be found in <samp>GameLocation::GetFishFromLocationData</samp> for the overall loop, and <samp>GameLocation::CheckGenericFishRequirements</samp> for the [[Modding:Fish_data#Spawn_rate|Spawn Rate]] effects.
 
In order to clear up some of the misconceptions around Targeted Bait, I've decided to actually spell out exactly how it affects the fish-catching process, which is rather complicated. The relevant code can be found in <samp>GameLocation::GetFishFromLocationData</samp> for the overall loop, and <samp>GameLocation::CheckGenericFishRequirements</samp> for the [[Modding:Fish_data#Spawn_rate|Spawn Rate]] effects.
 
1) First, the game gets a list of all possible catches for the location. This list is then ordered by ascending precedence, and randomly shuffled within each level of precedence.
 
1) First, the game gets a list of all possible catches for the location. This list is then ordered by ascending precedence, and randomly shuffled within each level of precedence.
 
2) Now, the game iterates over the list of possible catches, checking each Fish in sequence to see if it passes the two associated RNG checks:
 
2) Now, the game iterates over the list of possible catches, checking each Fish in sequence to see if it passes the two associated RNG checks:
:* Locational Chance (specified in <samp>Locations.xnb</samp>) - this is unaffected by Targeted Bait.
+
:* Locational Chance (specified in <samp>Locations.xnb</samp>) - this is multiplied by 1.66 for the Targeted Fish, after it has been modified by any Curiosity Lure, Daily Luck, or Conditional modifiers specified in the location data. This does not include bonuses per Luck level, which are applied after. Any Chance value over 1.0 has no effect, as it simply guarantees the RNG check passing.  
 
:* Spawn Rate (specified in <samp>Fish.xnb</samp>) - this is multiplied by 1.66 for the Targeted Fish, after it has been modified by Fishing Level and after the 0.9 cap. For fish above their Minimum Fishing Zone, this means that final Spawn Rate for targeted fish can be simplified to <code>(Spawn_Multiplier + 0.02 * Fishing_Level) * 1.66</code>. Any Spawn Rate over 1.0 has no effect, as it simply guarantees the RNG check passing.
 
:* Spawn Rate (specified in <samp>Fish.xnb</samp>) - this is multiplied by 1.66 for the Targeted Fish, after it has been modified by Fishing Level and after the 0.9 cap. For fish above their Minimum Fishing Zone, this means that final Spawn Rate for targeted fish can be simplified to <code>(Spawn_Multiplier + 0.02 * Fishing_Level) * 1.66</code>. Any Spawn Rate over 1.0 has no effect, as it simply guarantees the RNG check passing.
 
The game continues iterating over the list, performing these checks on all catches until one of three conditions is met:
 
The game continues iterating over the list, performing these checks on all catches until one of three conditions is met:
Line 13: Line 14:
 
So there are two effects that Targeted Bait has on the catch. If not using Targeted Bait, the game simply returns the first item to pass both checks. See the following code from <samp>GameLocation::GetFishFromLocationData</samp>:
 
So there are two effects that Targeted Bait has on the catch. If not using Targeted Bait, the game simply returns the first item to pass both checks. See the following code from <samp>GameLocation::GetFishFromLocationData</samp>:
 
:<samp>if (baitTargetFish == null || !(fish.QualifiedItemId != baitTargetFish) || targetedBaitTries >= 2) { return fish; }</samp>
 
:<samp>if (baitTargetFish == null || !(fish.QualifiedItemId != baitTargetFish) || targetedBaitTries >= 2) { return fish; }</samp>
 +
 +
:Really excellent analysis! I'm glad we know of the exact effects of targeted bait now. The Lava Eel spawn rates are still slightly alluding though, but it's okay. [[User:User314159|User314159]] ([[User talk:User314159|talk]]) 16:01, 19 April 2024 (UTC)
 +
::Previously, I stated that Targeted Bait had no impact on Locational Chance. This was incorrect, as I failed to check a function defined in <samp>StardewValley.GameData.dll</samp>, outside of the usual game code. Having checked this now, I have updated the overview to include this effect for future reference. This has little effect on most fish, as most fish have a Locational chance of 1, but has a significant impact on Legendaries, Caldera Lava Eels, and Submarine fish. [[User:Sicarious|Sicarious]] ([[User talk:Sicarious|talk]]) 18:11, 23 April 2024 (UTC)
 +
 +
:::Good catch, I didn't check that function either. That explains why the Lava Eel bite rates are so high with Targeted Bait. Also, by the way, the SpecificBaitBuff value in Locations.xnb was only added in 1.6.4, so I wonder if Targeted Bait impacting Locational Chance is new (because it seemed to not impact in 1.6.3 for Legendary Fish, unless I got really unlucky). [[User:User314159|User314159]] ([[User talk:User314159|talk]]) 18:42, 23 April 2024 (UTC)

Latest revision as of 18:42, 23 April 2024

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

Exact Functionality of Targeted Bait

In order to clear up some of the misconceptions around Targeted Bait, I've decided to actually spell out exactly how it affects the fish-catching process, which is rather complicated. The relevant code can be found in GameLocation::GetFishFromLocationData for the overall loop, and GameLocation::CheckGenericFishRequirements for the Spawn Rate effects. 1) First, the game gets a list of all possible catches for the location. This list is then ordered by ascending precedence, and randomly shuffled within each level of precedence. 2) Now, the game iterates over the list of possible catches, checking each Fish in sequence to see if it passes the two associated RNG checks:

  • Locational Chance (specified in Locations.xnb) - this is multiplied by 1.66 for the Targeted Fish, after it has been modified by any Curiosity Lure, Daily Luck, or Conditional modifiers specified in the location data. This does not include bonuses per Luck level, which are applied after. Any Chance value over 1.0 has no effect, as it simply guarantees the RNG check passing.
  • Spawn Rate (specified in Fish.xnb) - this is multiplied by 1.66 for the Targeted Fish, after it has been modified by Fishing Level and after the 0.9 cap. For fish above their Minimum Fishing Zone, this means that final Spawn Rate for targeted fish can be simplified to (Spawn_Multiplier + 0.02 * Fishing_Level) * 1.66. Any Spawn Rate over 1.0 has no effect, as it simply guarantees the RNG check passing.

The game continues iterating over the list, performing these checks on all catches until one of three conditions is met:

  • The Targeted Fish passes both checks. In this case, the Targeted Fish is returned.
  • Three items pass both checks. In this case, the third item (which may or may not be the targeted Fish) is returned.
  • Two full loops of the list are completed without either of the above happening. In this case, the first item to pass both checks is returned.

Due to Trash existing in all locations (see Default in Location.xnb) which has a 1.0 Locational Chance, no Fish.xnb data (causing it to auto-pass the Spawn Rate check unless it's the Fishing Tutorial), and always being in last position due to +2000 Precedenmce, this means that Trash will always pass its checks, on both loops. As this means 2 items are guaranteed to succeed, the only possible way to reach two full loops of the list without 3 items passing is if no items other trash passed their random checks. This means that the third condition is guaranteed to return trash.

So there are two effects that Targeted Bait has on the catch. If not using Targeted Bait, the game simply returns the first item to pass both checks. See the following code from GameLocation::GetFishFromLocationData:

if (baitTargetFish == null || !(fish.QualifiedItemId != baitTargetFish) || targetedBaitTries >= 2) { return fish; }
Really excellent analysis! I'm glad we know of the exact effects of targeted bait now. The Lava Eel spawn rates are still slightly alluding though, but it's okay. User314159 (talk) 16:01, 19 April 2024 (UTC)
Previously, I stated that Targeted Bait had no impact on Locational Chance. This was incorrect, as I failed to check a function defined in StardewValley.GameData.dll, outside of the usual game code. Having checked this now, I have updated the overview to include this effect for future reference. This has little effect on most fish, as most fish have a Locational chance of 1, but has a significant impact on Legendaries, Caldera Lava Eels, and Submarine fish. Sicarious (talk) 18:11, 23 April 2024 (UTC)
Good catch, I didn't check that function either. That explains why the Lava Eel bite rates are so high with Targeted Bait. Also, by the way, the SpecificBaitBuff value in Locations.xnb was only added in 1.6.4, so I wonder if Targeted Bait impacting Locational Chance is new (because it seemed to not impact in 1.6.3 for Legendary Fish, unless I got really unlucky). User314159 (talk) 18:42, 23 April 2024 (UTC)