Consumables: Difference between revisions
imported>Hellion |
imported>Hellion |
||
Line 9: | Line 9: | ||
Each consumable has a range that gets computed from minadv and maxadv (quite possibly a chopped range). The minimum of this range is always an integer. The maximum doesn't have to be. When a food or drink is consumed, the following happens: | Each consumable has a range that gets computed from minadv and maxadv (quite possibly a chopped range). The minimum of this range is always an integer. The maximum doesn't have to be. When a food or drink is consumed, the following happens: | ||
#The game chooses a value between the minimum and (the integer part of) the maximum in a uniformly random fashion. | #The game chooses a value between the minimum and (the integer part of) the maximum in a uniformly random fashion. | ||
# | #One half of the decimal part of the maximum is used as a probability of adding another adventure. (E.g. for a food with a maximum of 28.3, there is a 15% chance (0.3 / 2) of an extra adventure.) | ||
#[[Munchies pill]]s are computed after a value is chosen, but before Milk is computed. | #[[Munchies pill]]s are computed after a value is chosen, but before Milk is computed. | ||
#[[Milk of magnesium]] and [[The Ode to Booze]] are calculated next. | #[[Milk of magnesium]] and [[The Ode to Booze]] are calculated next. |
Revision as of 20:50, 5 August 2010
![]() |
This page is in need of content.
|
Overview
Consumables in KoL are computed very strangely.
Each consumable has a minadv, and a maxadv. These two values are internal to the database. The player never sees these.
- minadv is always an integer.
- maxadv does not necessarily have to be.
Each consumable has a range that gets computed from minadv and maxadv (quite possibly a chopped range). The minimum of this range is always an integer. The maximum doesn't have to be. When a food or drink is consumed, the following happens:
- The game chooses a value between the minimum and (the integer part of) the maximum in a uniformly random fashion.
- One half of the decimal part of the maximum is used as a probability of adding another adventure. (E.g. for a food with a maximum of 28.3, there is a 15% chance (0.3 / 2) of an extra adventure.)
- Munchies pills are computed after a value is chosen, but before Milk is computed.
- Milk of magnesium and The Ode to Booze are calculated next.
- Salty Mouth gets added on next, for applicable drinks.
- Frosty's frosty mug and Ol' Scratch's salad fork are computed after that.
- Finally, the Tuxedo shirt gets added on after everything else, for applicable drinks.
A table of foods with various modifiers active.
A table of boozes with various modifiers active.
Many consumables also have a Size (equal to the fullness/drunkenness of that item) and a Quality (value chosen to make adventure gains better). The S/Q paradigm denotes that a food uses Size and Quality to determine its minadv and maxadv. Most older (NS11) consumables follow S/Q. Size and Quality are very important for crafted consumables, when two craftable things are put together, the Size and Quality values of the two get added together.
For any consumables following S/Q:
- minadv=Size
- maxadv=Size*Quality
Range Chopping
For a Food, if the difference between minadv and maxadv is greater than 7, then a chop is performed from either end of the range. For a Booze, if the difference between minadv and maxadv is greater than 5, a chop is performed. This chop is equal to:
- Food: floor((maxadv-minadv-6)/2) from both sides.
- Booze: floor((maxadv-minadv-4)/2) from both sides.
Consequences
Because of this, a food that has been chopped will always have its unmodified observed range be 6 or 7, due to the following:
- T = top of range, B = bottom of range, M=max, m=min.
- T = M - floor((M-m-6)/2)
- B = m + floor((M-m-6)/2)
- T - B = M - floor((M - m - 6)/2) - m - floor((M - m - 6)/2)
- = M - m - floor(M) + m + 6
- = [M - floor(M)] + 6
- = 6 + (0 or 1)
Similarly, a booze that has been chopped will always have its unmodified observed range be 4 or 5.
What to take away from this: If a food's unmodified observed range is not 6 or 7, then either it has not been chopped, or the food has been messed with in some way by the game designers. Similar logic can be applied for a booze which has a range that is not 4 or 5.
Furthermore, if a food's unmodified observed range is less than 6, and the minimum of the range is not equal to the Size, then the food is messed with. Similarly for a booze's unmodified observed range being less than 4.
Other Consumables
There are also many consumables which do not follow the S/Q pattern. Supernova Champagne is an example. Its range is hardcoded 7-11.0. While that would fit with S=3, Q=5, it does not fit. These types of consumables are assumed to have their minadv and maxadv hardcoded.
Examples of Size and Quality
A Booze example
Size and Quality values are added together for craftable things. Basic booze has S=3 and Q=1, basic fruits have S=1 and Q=1, and cocktail garnishes have Q=3. Therefore, Advanced Cocktails are S=4 and Q=5. Their minadv is 4, and their maxadv is 20. They get chopped by floor(20-4-4)/2 = 6 from both sides, producing the range 10-14.0. So the minimum is 10, and the maximum is 14.0. With no modifiers, this means that all 5 observable values are equally likely to show up, and there will never be an adventure added.
A Food example
Hi meins are S=5 and Q=8.9. Their minadv is 5, and their maxadv is 44.5, they get chopped by floor(44.5-5-6)/2 = 16 from both sides, producing the range 21-28.5. So the minimum is 21, and the maximum is 28.5. With no modifiers, this means that the 8 observable values (21-28) are equally likely to show up. However, there is also a 0.25 probability (25% chance) that an additional adventure will get added on. So 21 will show up 3/32 of the time, 29 will appear 1/32 of the time, and 22-28 will each appear 1/8 of the time.
Modifiers
Munchies pills add adventures to Food in a tiered fashion. If the actual amount that the consumable would give you is in the following ranges, then that's how much Munchies pills will add.
- 1-3 adventures, +3
- 4-6 adventures, +2
- 7+ adventures, +1
Then Milk of magnesium and Ode to Booze are added on. Similar to Munchies Pills, Milk and Ode add adventures in tiers. If the actual amount that the consumable would give you is in the following ranges, then that's how much Milk or Ode will add.
- 1-4 adventures, +1
- 5-7 adventures, +2
- 8-10 adventures, +3
- 11+ adventures, +4
A consequence of this is that for a food like boring spaghetti, which has a range of 4-11, applying Milk of magnesium (with no other modifiers) can give it:
- +1 (if a 4 is rolled)
- +2 (if 5-7 are rolled)
- +3 (if 8-10 are rolled)
- +4 (if an 11 is rolled)
After that, for applicable beers, Salty Mouth gives a 4-6 adventure boost uniform-randomly.
Frosty's frosty mug increases adventures gained from booze by 30%, rounded down. If the booze is a beer, however, adventures are increased by 50%, also rounded down.
Ol' Scratch's salad fork increases adventures gained from food by 30%, rounded up. If the food is a salad, however, adventures are increased by 50%, also rounded up.
Finally, for applicable boozes, the Tuxedo shirt gives a 1-3 adventure boost uniform-randomly.
Example with Modifiers
This example will show how Superhuman Cocktails behave when modified by Ode and Frosty's Mug.
It may be easier to follow along with this example by looking at the table below, since sometimes it is not readily clear why the math works out the way it does.
Superhuman Cocktails are minadv 4, with maxadv 28. This means the chop is floor(28-4-4)/2 = 10. This means that the base range is 14-18.0. The average of this range is 16.0.
Applying Ode to this increases all values of this chopped range by 4, since they're all above 11 (the threshold above which Ode always adds 4 adventures). This makes the range 18-22.0. The average of this range is 20.0.
Finally, drinking with Frosty's Mug increases all values of the range by 30%, but they are floored. This can be seen in the table below. Frosty's Mug acts after everything else, so 18-22 are chosen to be modified.
The average must be calculated by finding the weighted average of each possible value that's produced from the range. The minimum of the range occurs with probability (1/num_values)*(1-chance of adding an adventure), where the chance of adding an adventure is the decimal portion of the max, in this case it is 0.0, since the max is 22.0. The maximum of the range occurs with probability (1/num_values)*(chance of adding an adventure). All other values in the range occur with probability 1/num_values.
- floor(18 * 1.3) = 23, occurs with probability (1/num_values)*(1-chance of adding an adventure) = 20% chance
- floor(19 * 1.3) = 24, occurs with probability (1/num_values) = 20% chance
- floor(20 * 1.3) = 26, occurs with probability (1/num_values) = 20% chance
- floor(21 * 1.3) = 27, occurs with probability (1/num_values) = 20% chance
- floor(22 * 1.3) = 28, occurs with probability (1/num_values)*(chance of adding an adventure) = 20% chance
The weighted average is the sum of each possible value multiplied by its probability of occurring. In this case, the range is 23-38, and the average is 25.6.
It should be noted that if the chance of adding an extra adventure is zero, then all values will occur with probability 1/num_values, where num_values = the number of observable values. If chance of adding an extra adventure is not zero, then num_values is equal to the number of observable values minus one, because the highest value is a special case of getting added when the game chooses the amount of adventures you get from the consumable.
For SHCs with no modifiers (14-18.0), this produces a value for num_values of 5; and for the above example from 24-31, this also produces a num_values of 5, since there are six possible values, but the highest value is a special case of being seen only after the game chooses the maximum value and adds one. Frosty's mug affects the drink's observable values in a predictable way, and that's why there are jumps in the observable values between 24 and 26.
Modifiers | Possible Values | Average | ||||
---|---|---|---|---|---|---|
Chance | 20% | 20% | 20% | 20% | 20% | |
Base | 14 | 15 | 16 | 17 | 18 | 16.00 |
+Ode | 18 | 19 | 20 | 21 | 22 | 20.00 |
+Frosty | 18 | 19 | 20 | 22 | 23 | 20.40 |
+Ode and Frosty | 23 | 24 | 26 | 27 | 28 | 25.60 |
A Food Example
The math is the same idea for Food and Booze alike, here is an example of hi meins. Notice that, like with the Booze example above, there are jumps in the amount of adventures that are observable. So with a Fork, a player will never see an adventure gain of 31 or 35 for a hi mein.
Modifiers | Possible Values | Average | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Chance | 6.25% | 12.5% | 12.5% | 12.5% | 12.5% | 12.5% | 12.5% | 12.5% | 6.25% | |
Base | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 25.00 |
+Munchies | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 26.00 |
+Milk | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 29.00 |
+Fork | 28 | 29 | 30 | 32 | 33 | 34 | 36 | 37 | 38 | 33.00 |
+Munchies and Milk | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 30.00 |
+Milk and Fork | 33 | 34 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 38.12 |
+Munchies, Milk, Fork | 34 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 39.44 |
How to Spade
Many players will only try to find the observed range of a consumable with no modifiers. While this gives a good approximation of what the consumable will do, it does not tell the whole story, due to many consumables not having an integer maxadv value.
In order to properly spade a consumable, all observed values must be recorded, and the frequency of those values must be calculated.
At that point, the middle values of the range will all occur at the same rate, and the bottom and top of the range will occur at rate*(1-chance_of_extra) and rate*(chance_of_extra), respectively. Where chance_of_extra is the decimal portion of maxadv.
Spooky mushrooms are a nice example of this, their observed range is 2-3, however, 3 will be observed 80% of the time, due to the maxadv actually being 2.8, so the range is really 2-2.8.
There are some consumables for which the maxadv cannot be ascertained without using modifiers. Imp Ale is an example of this, the observed range is 1-2, and with no modifiers, a player will see each at 50% likelihood. However, Imp Ale is actually 1-1.5.