Mac The TV can't say the luck is perfectly neutral after getting the lucky charm

CandyNim

Tiller
Bug: When your daily luck is exactly 0, there is a special message on the tv ("This is rare. The spirits feel absolutely neutral today"). This message, however, can only occur before you get the lucky charm.
Reproduction steps: The seed 38800 on new rng has -0.025 daily luck on day 1 and the seed 55600 on new rng has -0.025 daily luck on day 2 with zero steps. Load in, spawn in the lucky charm, and notice that there's no absolutely neutral message.

Code analysis: Farmer.DailyLuck is stored as a double, and it's defined as "this.team.sharedDailyLuck.Value + (double)(this.hasSpecialCharm ? 0.025f : 0f)". TV.getFortuneForecast uses "who.DailyLuck == 0.0" to give the special message. The problem lies in the fact that the 0.025 is passed in as a float value, instead of a double. This means that while sharedDailyLuck.Value can be -0.0250000000000000013878 (the closest double value to -0.025), the hasSpecialCharm float value will be 0.0250000003725290298462 and when added together instead of getting exactly 0 (as you need for the tv message) you'll instead get 0.0000000003725 as your DailyLuck, thus making it not pass the check.

Suggested Solution: Make that 0.025f be a 0.025d instead. You could also probably change some precisions to floats or have the tv check that it's between like -0.00001 and 0.00001 but the first suggestion feels the most simple.

(Attached is a save file with exactly -0.025 daily luck + 0.025 from the lucky charm = should be exactly 0, and you can see it doesn't have the special message)
 

Attachments

Top