{%hackmd @cimeesia/ByJDnGiCo %} # Breaking down the maths behind the Cooking system [TOC] ## Intro Have you come up a thought that when you were seeing the Strength that showed on the Dish list and wondering... > "Why the final number/Strength is always not the same as the one preview showed nor I thought ?" > [name=Sia] Or maybe you just wonder how does the maths works ? Anyway, in this article, I'm going to share what I know to you. By the way, the dish I'm going to use to be our example is ==Fancy Apple Curry==. :::info The content in article has been updated to the game version `1.1.0`. -- 2 Feb 2024 ::: ## Necessary info for Cooking So the first thing is the info about the Dish I'm going to make. I will list all necessary info below. ### Bonus from account progression So, yea, these are needed. | Bonus | % | | --------------------:| ---:| | Map Bonus | 20 | | Dish Level Bonus | 58 | :::success - Dish Level Bonus is not a calculable linger line/curve that allowed us to extrapolate, instead, game dev actually [hard-coded](https://en.wikipedia.org/wiki/Hard_coding) the bonus rate for each level. - And Dish Level Bonus of Fancy Apple Curry at Lv.29 is 58%. ::: ### LUT for Quantity Bonus This is a Look-up table for the Bonus from Quantity of Ingredient. Be careful, it only considers base Ingredients of the dish ! | quantity of<br />base Ingredients | Bonus | |:---------------------------------:| ------:| | 7~9 | ==6%== | | 14~16 | 11% | | 22~26 | 17% | | 30~38 | 25% | | 53~55 | 35% | | 62~77 | 48% | :::success The rate of Quantity Bonus is also hard-coded, so ... yea... ::: ### All Ingredients I threw into pots This is going to cook a Fancy Apple Curry. <table class='ingredients'> <thead> <tr> <th colspan=>Ingredients</th> <th>Qty.</th> <th>Strength<br />(per 1)</th> <th>Strength<br /> Subtotal</th> </tr> </thead> <tbody> <tr> <th colspan='4'>Base Ingredients</th> </tr> <tr> <td>Fancy Apple</td> <td>7</td> <td>90</td> <td>630</td> </tr> <tr> <th colspan='4'>Additional Ingredients</th> </tr> <tr> <td>Fancy Apple</td> <td>2</td> <td>90</td> <td>180</td> </tr> <tr> <td>Fiery Herb</td> <td>7</td> <td>130</td> <td>910</td> </tr> <tr> <td>Bean Sausage</td> <td>4</td> <td>103</td> <td>412</td> </tr> <tr> <td>Moomoo Milk</td> <td>10</td> <td>98</td> <td>980</td> </tr> <tr> <td>Honey</td> <td>14</td> <td>101</td> <td>1414</td> </tr> <tr> <td>Warming Ginger</td> <td>10</td> <td>109</td> <td>1090</td> </tr> <tr> <td>Soothing Cacao</td> <td>5</td> <td>151</td> <td>755</td> </tr> </tbody> </table> ## Base Ingredients' Strength ### BIS & AIS So, the first thing I want to do is, give "Base Ingredients' Strength" and "Additional Ingredients' Strength" an abbreviation for each, **BIS & AIS**, so the article would not mess up by these terms. So, after some easy elementary-school-like maths, we can know that BIS is $630$. and AIS is $5741$. ### QBBIS Okey, now before we start to calcualte the first thing that will be used later -- QBBIS -- we have a new thing that needs to be introduced before we start, that is "Quantity Bonus" As you saw in [#LUT for Quantity Bonu](/#LUT-for-Quantity-Bonus), it tells you that how many Ingredients a dish needed would give the different bonus for its Finished dish. Not to worry, it just a look-up table. And let's see QBBIS' formula: QBBIS = Quantity of Ingredient × Strength of single Ingredient × Quantity Bonus We do not only know that $7$ Apples is going to be base Ingredients, but also we know that the single Apple's Strength is $90$. After we checked the LUT for QB, we learnt that we can have $6%$ Bonus. Now we can get what is the QBBIS. $7 × 90 × (1 + 6\%) = 667.8$ But havn't done yet, you know ~~-- these game devs somehow hate the decimal --~~ we have to round it. Here, they use **Rounding half up**. $⌈ 667.8 ⌉ = 668$ ### LBBIS Nice, and lets get into another parameter -- Level-benefited QBBIS -- a number multiply **Dish Level Bonus** with QBBIS. I will give it an another abbreviation call **LBBIS**. So, LBBIS's formula is here: QBBIS × Dish Level Bonus and of course, result with **rounding half up**. $668 × 58\% = 387.44$ $⌈ 387.44 ⌉ = 387$ Nice, the most important 2 numbers we have got now, let's move to the next part. ## Maths: Preview Strength ![Dishs List](https://hackmd.io/_uploads/BJxWo8VHT.png) As title said, in this part, we are going to calculate the Preview Strength that you may be able to see in the top-right corner of every dish. And that is really easy, the formula is ... just QBBIS plus LBBIS... $668 + 387 = 1055$ Okay, it is just that simple, next section :D ## Maths: Strength showed during Cooking ![Cooking](https://hackmd.io/_uploads/B1fkXwES6.png) After learnt AIS, I believe some of people have already guessed its usage. Yep, we are going to calculate the numbers you saw while Cooking prgoress. When we are cooking, we can see that there are many steam cloud keeps coming out of the pot. Inside the steam cloud, you can see those Ingredients and their Strength number. Every pulse will add 6 Strength of Ingredients into the dish you are making. And yes! That is exact AIS. So let's skip forward some progress a bit, once all ingredients are added, what number will be ? It's maths time. :::info By the way, this is NOT the final Strength that will transfer to Snorlax. ::: So the formula is quite simple as well: Strength showed during Cooking = AIS + LBBIS $5741 + 387 = 6128$ ## Maths: Final Strength ![Final Strength](https://hackmd.io/_uploads/rkbT7D4BT.png) So, this one probably doesn't need to explain too much, the only thing that is new and not-so-new is Map Bonus, so let's go straight to the formula: (AIS + QBBIS + LBBIS) × Map Bonus $( 5741 + 668 + 387 ) × ( 1 + 20\% ) = 8155.2$ Hold on, haven't done yet. Althought it is not Extra Tasty in today's lesson, but we cannot ignore it if that happens. The reason we have to hold a bit here because the rate of Extra Tasty has to be calculated **before** the rounding. ### Normally (Not Sunday nor Extra Tasty) $8155.2$ is ready to do rounding straightly, they use **Rounding down**, unlike those parameter we seen previously. $⌊ 8155.2 ⌋ = 8,155$ Finally, we got the number we want now. ### Extra Tasty but not on Sunday Extra Tasty on weekdays and Saturday is giving $×2$ Strength. So it will become...: $⌊ 8155.2 × 2 ⌋ = ⌊ 16,310.4 ⌋ = 16,310$ ### Extra Tasty on Sunday And, Extra Tasty on Sunday is $×3$. $⌊ 8155.2 × 3 ⌋ = ⌊ 24,465.6 ⌋ = 24,465$ ## Thanks for reading Now you have learnt that how to calculate the Strength that comes from a Dish :D And thanks to [wikiwiki.jp](https://wikiwiki.jp/poke_sleep/%E6%96%99%E7%90%86) amd [RaenonX](https://pks.raenonx.cc/), they taught me well. -- Sia, 2023 Nov 29 <style> .CodeMirror>*{ font-size: 18px !important; font-family: 'Cascadia Code', monospace; font-weight: 300; } /* table */ table.ingredients{ border-collapse: collapse; width: fit-content !important; } .ingredients tbody th[colspan='4']:nth-child(1){ font-size: 1.5em; } .ingredients thead th, .ingredients tbody td{ text-align: right; } </style>