Template talk:Edibility

From Stardew Valley Wiki
Jump to navigation Jump to search
This talk page is for discussing Template:Edibility.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

In-game tooltips do not match actual values

I was working out calculations for edibility of silver and gold items based on the base edibility value when I got stuck because the values I was getting based on the game's code wasn't matching what the game's tooltip was saying. After losing plenty of health and energy and then eating some foods, I realized it was because the tooltips are incorrect. The actual values are slightly higher than what the tooltips say.

Here's how the actual values are calculated:

quality: 0 = normal, 1 = silver, 2 = gold

energy = ceiling(base_edibility * 2.5) + (quality * base_edibility)
health = round(energy * 0.45)
OR
health = round(ceiling(base_edibility * 2.5) + (quality * base_edibility) * 0.45)

note: round is a normal round, not ceiling or floor

I haven't found yet where the tooltip numbers are calculated or defined. For now I'm having the template display the actual calculations instead of the tooltip numbers. --Samutz (talk) 13:34, 6 April 2016 (EDT)

I think actual healing is cast to int...
 energy = (int)ceiling(base_edibility * 2.5) + quality * base_edibility
 health = (int)(energy * 0.45)
Tooltip uses a 0.4 multiplier rather than 0.45 and casts to int before displaying.
 energy = (int)ceiling(base_edibility * 2.5) + quality * base_edibility
 health = (int)(energy * 0.4)

--BryghtShadow (talk) 04:08, 11 April 2016 (EDT)

Those are indeed the implemented formulas. The actual value is computed in StardewValley.Game1:doneEating(). The tooltip value is computed in StardewValley.Menus.IClickableMenu:drawHoverText(), search for healAmountToDisplay. --Lilly (talk) 22:09, 6 January 2017 (UTC)

Change in default values

I changed the default meaning of the "quality" parameter for this template as part of the changes I just made. Up until now, the default value of quality was normal and normal was always forcibly included, even if for example quality=silver was set (i.e., the displayed values would be normal and silver). This is completely different from every other quality-related template, plus the implicit need to use all of quality, iridium, and hide simultaneously to control the template is much too awkward.

With my edit, it's now consistent with a bunch of other templates (Qualityprice, EdibilityGrid, Infobox, etc.). The default value is now quality=true meaning Normal, Silver, Gold. And specifying quality=silver means just Silver is displayed.

Besides consistency, etc., the reason I'm pushing this change now is that Edibility isn't widely used and only one (already-made and no-side-effect) edit is required anywhere else on the wiki to support this change. I think the new features will expand its future usage, so it's better to get this quirk fixed now while it's easy to do. Nebulous Maestress (talk) 00:45, 4 September 2020 (UTC)

Format without "Energy" and "Health" texts

Just a quick thought: it could be considered to add a non-grid format (that is, fully vertical) without Energy and Health texts (and links), to look like the "Restores" column of the Template:RecipeRow. For instance it could be used on the tables of Tapper and Heavy Tapper, maybe also Keg#Products, Preserves Jar#Products and Oil Maker#Products, as there is only one output quality in all those cases. Usage of Edibility template (instead of strings, Health and Energy templates separately) allows proper sorting. -- Charly (talk) 03:31, 19 November 2021 (UTC)

Well, rather than change 12 templates I've implemented a "quick-fix", adding data-sort-values to the larger tables. The small tables aren't sortable (and really don't need to be). I'll keep it in mind for a future update, though, it's not a bad idea. margotbean (talk) 17:46, 19 November 2021 (UTC)
Yes agreed, I thought about the data-sort-value option too, and especially the large Keg table besides Tappers ones, and yes it was more of an idea; I'm unsure what would be the best implementation. -- Charly (talk) 18:23, 19 November 2021 (UTC)