Difference between revisions of "Talk:Targeted Bait"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Clarified that the third condition guarantees trash.)
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.
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)

Revision as of 16:01, 19 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 unaffected by Targeted Bait.
  • 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)