Talk:Crates

From Terraria Wiki
Jump to navigation Jump to search

Usage question

Do Sonar Potions and Fishing Potions (or boosting fishing power) help find these? I want to know if I should combine all three fishing-related buffs or not. --Macks2008 (talk) 14:29, 29 January 2015 (UTC)

I'm not sure how old your I haven't noticed any increased chance to catch crates using any potion besides the Crate Potion. However, when using the Sonar Potion, you can ignore non-crate bites in order to save bait. The Fishing Potion (or increasing fishing power) will also decrease the rate at which your bait is consumed. --ValornTheRed (talk) 19:10, 4 July 2015 (UTC)

"Portal" Reference

The page as quoted, "It's improbable to be a reference, but the crate's sprite resembles Weighted Storage Cubes from Portal franchise." However I feel this is a bit misleading and very unlikely to be reference nor does it assist in the article in any form. They're crates, box shaped by nature, and the sprites do not, to me, resemble anything close to the portal cubes outside of minor details of them being box shaped, with a few styles being similar. Should this information be left in? I have nothing against the trivia bit afterwards indicating it to be used for adventure maps, etc. Kalbintion (talk) 02:20, 21 July 2015 (UTC)

A lot of trivia is added by anonymous users, and is often questionable. You won't get into any trouble for removing nonsensical trivia; go ahead. As for the bit about its application in maps, a lot of things can be used creatively in maps. Unless there were to be a guide page for making maps, that info doesn't really belong on the wiki. –KM100 (talk) 02:27, 21 July 2015 (UTC)

Merging all the crates

i feel as if the crates should be merged into 1 page, this one, Crates, the page may have the loading features of the fishing page, but it may fit.

Luigirox901 (talk) 00:32, 26 November 2015 (UTC)

Probability

The sentence reads:
E.g with a Fishing Power of 100 in a Corrupted Biome the probabilities would be: Golden Crate: 6,57%; Corrupt Crate: 8,90%; Iron Crate: 28,37%; Wooden Crate: 56,16%
Speaking for those who never studied probability (or have forgotten because they never needed it), nor looked at the code... what in the world does 6,57% mean? At first I thought that comma was meant to be a decimal. If it's not, can we explain this in a way that a 12-grader would understand? -- Ferretwings (talk) 16:12, 19 July 2016 (UTC)

Sorry, I just confused both signs, i have corrected it. Flisch42 (talk) 18:25, 19 July 2016 (UTC)
Oh good. :) I was feeling really dumb, trying to figure it out. Now I fee confident again about my math skills, lol! Thanks for fixing it. :) -- Ferretwings (talk) 19:17, 19 July 2016 (UTC)

crate probability wrong?

I was looking for source online and found the one by Pryaxis on github. Looking at projectile.fishingcheck() the probability for crates seem to be different there. If this source is accurate the information on this page is wrong, can anyone confirm the accuracy of this source?

DJIKhaos (talk) 23:05, 25 July 2019 (UTC)

I have taken a look, too, and luckily, crates are handled near the top of the function, so it is comparatively easy to determine the chances (assuming a fishing power of 100; in any of the special biomes, taking Corruption as an example here):
Golden Crate: [math]\displaystyle{ \frac{1}{10} }[/math][1][math]\displaystyle{ * \biggl( \Bigl(\frac{2}{45} * \frac{1}{45}\Bigr) }[/math][2][math]\displaystyle{ + \Bigl(\frac{2}{45} * \frac{44}{45}\Bigr) }[/math][3][math]\displaystyle{ + \Bigl(\frac{43}{45} * \frac{1}{45}\Bigr) }[/math][4][math]\displaystyle{ \biggr) = \frac{133}{20250} \approx 6.5679 \times 10^{-3} \approx 0.657\% }[/math]


Corrupt Crate (or any other biome crate): [math]\displaystyle{ \frac{1}{10} }[/math][1][math]\displaystyle{ * \Bigl(\frac{43}{45} * \frac{44}{45}\Bigr) }[/math][5][math]\displaystyle{ * \frac{2}{21} }[/math][6][math]\displaystyle{ \approx 8.8983 \times 10^{-3} \approx 0.898\% }[/math]


Iron Crate: [math]\displaystyle{ \frac{1}{10} }[/math][1][math]\displaystyle{ * \Bigl(\frac{43}{45} * \frac{44}{45}\Bigr) }[/math][5][math]\displaystyle{ * \frac{19}{21} }[/math][7][math]\displaystyle{ * \frac{1}{3} }[/math][8][math]\displaystyle{ \approx 0.028178 \approx 2.818\% }[/math]


Wooden Crate: [math]\displaystyle{ \frac{1}{10} }[/math][1][math]\displaystyle{ * \Bigl(\frac{43}{45} * \frac{44}{45}\Bigr) }[/math][5][math]\displaystyle{ * \frac{19}{21} }[/math][7][math]\displaystyle{ * \frac{2}{3} }[/math][8][math]\displaystyle{ \approx 0.056356 \approx 5.636\% }[/math]
  1. 1.0 1.1 1.2 1.3 Main.rand.Next(100)<num19, num19 being 10 without a Crate Potion
  2. flag6 | flag7 with flag6=true and flag7=true
  3. flag6 | flag7 with flag6=true and flag7=false
  4. flag6 | flag7 with flag6=false and flag7=true
  5. 5.0 5.1 5.2 flag6 | flag7 with flag6=false and flag7=false
  6. flag5
  7. 7.0 7.1 !flag5, failing the biome crate roll
  8. 8.0 8.1 !flag4
  9. For Iron and Wooden Crates caught in a biome that does not qualify for a biome crate, the [math]\displaystyle{ * \frac{19}{21} }[/math] part is simply dropped from the calculation, because flag5 is never being considered due to the second parts of those conditions (the biome checks) always evaluating to false.
    With a Crate Potion, num19 is set to 20 instead of 10, so the initial [math]\displaystyle{ \frac{1}{10} }[/math] is doubled to [math]\displaystyle{ \frac{2}{10} }[/math], effectively doubling all chances.
    Little disclaimer just in case: All of this is taken from the Desktop version Desktop 1.3.5.3 source code, Terraria.Projectile.FishingCheck(), as you said. I have absolutely no idea about other versions or platforms. I have tested these chances extensively using an emulator of the fishing algorithm.
    --Rye Greenwood (talk) 00:05, 3 December 2019 (UTC)


    Can you please explain how you got 2/45 as probability for flag6 and copy paste the entire line in which 'maxValue4' is calculated?
    DJIKhaos (talk) 13:29, 4 December 2019 (UTC)
    flag6 is set to true if Main.rand.next(num17) returns 0. The probability of that event is [math]\displaystyle{ \frac{1}{num17} }[/math], obviously. num17 is [math]\displaystyle{ 150 * 15 / num6 }[/math], with num6 being the fishing power (int num6 = Main.player[owner].FishingLevel(); (yes, it is altered later on, but that does not matter since we assume a lake of ≥300 tiles)), so in our example 100.
    [math]\displaystyle{ \begin{align} P(flag6) & = \frac{1}{num17} \qquad\qquad |\ num17 = 150*15/num6 \\ & = \frac{1}{150*15/num6} \qquad\qquad |\ num6 = 100 \\ & = \frac{1}{150*15/100} \\ & = \frac{1}{22.5} \\ P(flag6) & = \frac{2}{45} \end{align} }[/math]
    I don't see any variable named maxValue4 in FishingCheck(), so I'm not sure what you're referring to there.
    --Rye Greenwood (talk) 23:49, 4 December 2019 (UTC)


    The line I'd like to see then is the one where num17 is calculated. Can you please copy paste that one line.
    DJIKhaos (talk) 23:53, 4 December 2019 (UTC)
    After reading your first message again, I realized we're using different decompilations of the game... So no surprise the variable names are different.
    num17 is calculated like this: int num17 = 150 * 15 / num6;
    --Rye Greenwood (talk) 00:33, 5 December 2019 (UTC)


    notice the type of num17, we're dealing with integer division here.
    DJIKhaos (talk) 00:37, 5 December 2019 (UTC)

    ──────────────────────────────────────────────────────────────────────────────────────────────────── Oh, you're completely right! Apologies! Let me update the calculations then:

    Golden Crate: [math]\displaystyle{ \frac{1}{10}* \biggl( \Bigl(\frac{1}{22} * \frac{1}{45}\Bigr) + \Bigl(\frac{1}{22} * \frac{44}{45}\Bigr) + \Bigl(\frac{21}{22} * \frac{1}{45}\Bigr) \biggr) = \frac{1}{150} \approx 6.6667 \times 10^{-3} \approx 0.667\% }[/math]

    Corrupt Crate (or any other biome crate): [math]\displaystyle{ \frac{1}{10}* \Bigl(\frac{21}{22} * \frac{44}{45}\Bigr) * \frac{1}{10} = \frac{7}{750} \approx 9.3333 \times 10^{-3} \approx 0.933\% }[/math]

    Iron Crate: [math]\displaystyle{ \frac{1}{10}* \Bigl(\frac{21}{22} * \frac{44}{45}\Bigr) * \frac{9}{10} * \frac{1}{3} = \frac{7}{250} = 0.028 = 2.8\% }[/math]

    Wooden Crate: [math]\displaystyle{ \frac{1}{10}* \Bigl(\frac{21}{22} * \frac{44}{45}\Bigr) * \frac{9}{10} * \frac{2}{3} = \frac{7}{125} = 0.056 = 5.6\% }[/math]

    Thank you very much! I will go ahead and update the page.

    --Rye Greenwood (talk) 01:05, 5 December 2019 (UTC)


    No problem. In C# int/int is generally integer division. Also if you think it's relevant information for either here or bait (or fishing) master bait sustain with crate potion, tackle box and high test fishing line starts at 76 fishing power, without tackle box it's 87, without high test fishing line it's 98 and without either it's 119. without crate potion isn't that interesting as it's 251 with both.
    DJIKhaos (talk) 02:04, 5 December 2019 (UTC)
    to clarify that's assuming nothing is being skipped with a sonar potion
    DJIKhaos (talk) 02:14, 5 December 2019 (UTC)
    Hmm. Am I right in getting the sense that a function of crate probabilities against fishing power would be almost impossible to write out? --MentalMouse42 (talk) 16:05, 5 December 2019 (UTC)

    ──────────────────────────────────────────────────────────────────────────────────────────────────── Great idea! Actually, that's not impossible at all, luckily! It just gets a little long:

    ([math]\displaystyle{ fp }[/math]: fishing power)

    Starting with the chances of the flags; they can be described as follows:

    flag4: [math]\displaystyle{ \Bigl( \frac{1}{\lfloor 300/fp \rfloor} \leq \frac{1}{3} \Bigr) }[/math]

    !flag4: [math]\displaystyle{ \Bigl(1 - \frac{1}{\lfloor 300/fp \rfloor} \geq \frac{2}{3} \Bigr) }[/math]

    flag5: [math]\displaystyle{ \Bigl( \frac{1}{\lfloor 1050/fp \rfloor} \leq \frac{1}{4} \Bigr) }[/math]

    !flag5: [math]\displaystyle{ \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \geq \frac{3}{4} \Bigr) }[/math]

    flag6: [math]\displaystyle{ \Bigl( \frac{1}{\lfloor 2250/fp \rfloor} \leq \frac{1}{5} \Bigr) }[/math]

    !flag6: [math]\displaystyle{ \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) }[/math]

    flag7: [math]\displaystyle{ \Bigl( \frac{1}{\lfloor 4500/fp \rfloor} \leq \frac{1}{6} \Bigr) }[/math]

    !flag7: [math]\displaystyle{ \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr) }[/math]


    Inserting that into the formulas of the crate chances:

    Golden Crate: [math]\displaystyle{ P(gc) = \frac{1}{10}* \biggl( \Bigl(\Bigl( \frac{1}{\lfloor 2250/fp \rfloor} \leq \frac{1}{5} \Bigr) * \Bigl( \frac{1}{\lfloor 4500/fp \rfloor} \leq \frac{1}{6} \Bigr)\Bigr) + \Bigl(\Bigl( \frac{1}{\lfloor 2250/fp \rfloor} \leq \frac{1}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) + \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl( \frac{1}{\lfloor 4500/fp \rfloor} \leq \frac{1}{6} \Bigr)\Bigr) \biggr) }[/math]

    Biome Crate: [math]\displaystyle{ P(bc) = \frac{1}{10}* \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) * \Bigl( \frac{1}{\lfloor 1050/fp \rfloor} \leq \frac{1}{4} \Bigr) }[/math]

    Iron Crate (if fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(ic) = \frac{1}{10}* \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \geq \frac{3}{4} \Bigr) * \Bigl(\frac{1}{\lfloor 300/fp \rfloor} \leq \frac{1}{3} \Bigr) }[/math]

    Iron Crate (if not fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(ic) = \frac{1}{10}* \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) * \Bigl(\frac{1}{\lfloor 300/fp \rfloor} \leq \frac{1}{3} \Bigr) }[/math]

    Wooden Crate (if fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(wc) = \frac{1}{10}* \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \geq \frac{3}{4} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 300/fp \rfloor} \geq \frac{2}{3} \Bigr) }[/math]

    Wooden Crate (if not fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(wc) = \frac{1}{10}* \Bigl(\Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor} \geq \frac{4}{5} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor} \geq \frac{5}{6} \Bigr)\Bigr) * \Bigl(1 - \frac{1}{\lfloor 300/fp \rfloor} \geq \frac{2}{3} \Bigr) }[/math]

    Please excuse the mathematically incorrect notation with these inequations in the middle, but they're there to show that a case differentiation is necessary. Depending on the fishing power, different formulas apply.

    For the final functions, it is necessary to assert we are fishing in a lake of ≥300 tiles (it just gets too long if we want to make that variable, too) and have a fishing power >0, of course.

    Golden Crate: [math]\displaystyle{ P(gc) = \begin{cases} golden_1(fp), & \text{if } fp \leq 450 \\ golden_2(fp), & \text{if } 450 \lt fp \leq 750 \\ golden_3(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  10. [math]\displaystyle{ golden_1(fp) = \frac{1}{10}* \biggl( \frac{1}{\lfloor 2250/fp \rfloor} * \frac{1}{\lfloor 4500/fp \rfloor} + \frac{1}{\lfloor 2250/fp \rfloor} * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) + \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \frac{1}{\lfloor 4500/fp \rfloor}\biggr) }[/math]

    [math]\displaystyle{ golden_2(fp) = \frac{1}{10}* \biggl( \frac{1}{5} * \frac{1}{\lfloor 4500/fp \rfloor} + \frac{1}{5} * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) + \Bigl(1 - \frac{1}{5}\Bigr) * \frac{1}{\lfloor 4500/fp \rfloor}\biggr) }[/math]

    [math]\displaystyle{ golden_3(fp) = \frac{1}{10}* \biggl( \frac{1}{5} * \frac{1}{6} + \frac{1}{5} * \Bigl(1 - \frac{1}{6}\Bigr) + \Bigl(1 - \frac{1}{5}\Bigr) * \frac{1}{6}\biggr) }[/math]

  11. Biome Crate: [math]\displaystyle{ P(bc) = \begin{cases} biome_1(fp), & \text{if } fp \leq 262 \\ biome_2(fp), & \text{if } 263 \leq fp \leq 450 \\ biome_3(fp), & \text{if } 450 \lt fp \leq 750 \\ biome_4(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  12. [math]\displaystyle{ biome_1(fp) = \frac{1}{10}* \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{\lfloor 1050/fp \rfloor} }[/math]

    [math]\displaystyle{ biome_2(fp) = \frac{1}{10}* \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{4} }[/math]

    [math]\displaystyle{ biome_3(fp) = \frac{1}{10}* \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{4} }[/math]

    [math]\displaystyle{ biome_4(fp) = \frac{1}{10}* \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{6}\Bigr) * \frac{1}{4} }[/math]

  13. Iron Crate (if fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(ic_1) = \begin{cases} iron_1(fp), & \text{if } fp \leq 100 \\ iron_2(fp), & \text{if } 100 \lt fp \leq 262 \\ iron_3(fp), & \text{if } 263 \leq fp \leq 450 \\ iron_4(fp), & \text{if } 450 \lt fp \leq 750 \\ iron_5(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  14. [math]\displaystyle{ iron_1(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \Bigr) * \frac{1}{\lfloor 300/fp \rfloor} }[/math]

    [math]\displaystyle{ iron_2(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_3(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_4(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_5(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{6}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \frac{1}{3} }[/math]

  15. Iron Crate (if not fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(ic_2) = \begin{cases} iron_1(fp), & \text{if } fp \leq 100 \\ iron_2(fp), & \text{if } 100 \lt fp \leq 262 \\ iron_3(fp), & \text{if } 263 \leq fp \leq 450 \\ iron_4(fp), & \text{if } 450 \lt fp \leq 750 \\ iron_5(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  16. [math]\displaystyle{ iron_1(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{\lfloor 300/fp \rfloor} }[/math]

    [math]\displaystyle{ iron_2(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_3(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_4(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \frac{1}{3} }[/math]

    [math]\displaystyle{ iron_5(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{6}\Bigr) * \frac{1}{3} }[/math]

  17. Wooden Crate (if fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(wc_1) = \begin{cases} wooden_1(fp), & \text{if } fp \leq 100 \\ wooden_2(fp), & \text{if } 100 \lt fp \leq 262 \\ wooden_3(fp), & \text{if } 263 \leq fp \leq 450 \\ wooden_4(fp), & \text{if } 450 \lt fp \leq 750 \\ wooden_5(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  18. [math]\displaystyle{ wooden_1(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \Bigr) * \Bigl(1 - \frac{1}{\lfloor 300/fp \rfloor}\Bigr) }[/math]

    [math]\displaystyle{ wooden_2(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 1050/fp \rfloor} \Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_3(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_4(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_5(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{6}\Bigr) * \Bigl(1 - \frac{1}{4} \Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

  19. Wooden Crate (if not fishing in Corruption, Crimson, Hallow, Jungle, Dungeon, or sky level): [math]\displaystyle{ P(wc_2) = \begin{cases} wooden_1(fp), & \text{if } fp \leq 100 \\ wooden_2(fp), & \text{if } 100 \lt fp \leq 262 \\ wooden_3(fp), & \text{if } 263 \leq fp \leq 450 \\ wooden_4(fp), & \text{if } 450 \lt fp \leq 750 \\ wooden_5(fp), & \text{if } 750 \lt fp \end{cases} }[/math]

  20. [math]\displaystyle{ wooden_1(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 300/fp \rfloor}\Bigr) }[/math]

    [math]\displaystyle{ wooden_2(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_3(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{\lfloor 2250/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_4(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{\lfloor 4500/fp \rfloor}\Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]

    [math]\displaystyle{ wooden_5(fp) = \frac{1}{10} * \Bigl(1 - \frac{1}{5}\Bigr) * \Bigl(1 - \frac{1}{6}\Bigr) * \Bigl(1 - \frac{1}{3}\Bigr) }[/math]


  21. That's it! With these functions, it is possible to calculate the different crate catch chances for any given fishing power. If the Crate Potion buff is active, simply change the [math]\displaystyle{ \frac{1}{10} }[/math] at the beginning of every function to [math]\displaystyle{ \frac{1}{5} }[/math].

    Plotting these functions revealed some very interesting mechanics (here are just some examples I found particularly surprising):

    • With a fishing power of 1, the chance to catch a Wooden Crate is 10% and to catch all other crate types nearly 0%.
    • As fishing power increases, the chance for Golden Crates increases steadily up to the maximum of 750 (after which all chances stagnate; you can see in the functions that they're just constant at that point). The chance for Wooden Crates decreases steadily. However, the chances for the other two types fluctuate quite a bit.
    • The highest chance to catch an Iron Crate is with 76 fishing power, to catch a Wooden Crate is with 1 fishing power, to catch a Biome Crate is with 211 fishing power, and to catch a Golden Crate is with >750 fishing power (within the bounds of possibly attainable fishing power that would be 282).

    I really recommend you to take a look at these functions, too; the integer division has an interesting effect. Here are the functions in a form that dynamic geometry applications should accept (well, at least GeoGebra does):

  22. golden(x) = 1 / 10 (1 / floor(2250 / x) 1 / floor(4500 / x) + 1 / floor(2250 / x) (1 - 1 / floor(4500 / x)) + (1 - 1 / floor(2250 / x)) 1 / floor(4500 / x))
    golden1(x) = golden(x), 0 < x ≤ 100
    golden2(x) = golden(x), 100 ≤ x ≤ 262
    golden3(x) = golden(x), 263 ≤ x ≤ 450
    golden4(x) = 1 / 10 (1 / 5 * 1 / floor(4500 / x) + 1 / 5 (1 - 1 / floor(4500 / x)) + (1 - 1 / 5) * 1 / floor(4500 / x)), 450 ≤ x ≤ 750
    golden5(x) = 1 / 10 (1 / 5 * 1 / 6 + 1 / 5 (1 - 1 / 6) + (1 - 1 / 5) * 1 / 6), 750 ≤ x
    
    
    biome(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) 1 / floor(1050 / x)
    biome1(x) = biome(x), 0 < x ≤ 100
    biome2(x) = biome(x), 100 ≤ x ≤ 262
    biome3(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) 1 / 4, 263 ≤ x ≤ 450
    biome4(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / floor(4500 / x)) 1 / 4, 450 ≤ x ≤ 750
    biome5(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / 6) 1 / 4, 750 ≤ x
    
    
    iron(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / floor(1050 / x)) 1 / floor(300 / x)
    iron1(x) = iron(x), 0 < x ≤ 100
    iron2(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / floor(1050 / x)) 1 / 3, 100 ≤ x ≤ 262
    iron3(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / 4) 1 / 3, 263 ≤ x ≤ 450
    iron4(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / floor(4500 / x)) (1 - 1 / 4) 1 / 3, 450 ≤ x ≤ 750
    iron5(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / 6) (1 - 1 / 4) 1 / 3, 750 ≤ x
    
    ironb(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) 1 / floor(300 / x)
    ironb1 (x) = ironb(x) = 0 < x ≤ 100
    ironb2(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) 1 / 3, 100 ≤ x ≤ 262
    ironb3(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) 1 / 3), 263 ≤ x ≤ 450
    ironb4(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / floor(4500 / x)) 1 / 3, 450 ≤ x ≤ 750
    ironb5(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / 6) 1 / 3, 750 ≤ x
    
    
    wooden(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / floor(1050 / x)) (1 - 1 / floor(300 / x))
    wooden1(x) = wooden(x), 0 < x ≤ 100
    wooden2(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / floor(1050 / x)) (1 - 1 / 3), 100 ≤ x ≤ 262
    wooden3(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / 4) (1 - 1 / 3), 263 ≤ x ≤ 450
    wooden4(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / floor(4500 / x)) (1 - 1 / 4) (1 - 1 / 3), 450 ≤ x ≤ 750
    wooden5(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / 6) (1 - 1 / 4) (1 - 1 / 3), 750 ≤ x
    
    woodenb(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / floor(300 / x))
    woodenb1(x) = woodenb(x), 0 < x ≤ 100
    woodenb2(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / 3), 100 ≤ x ≤ 262
    woodenb3(x) = 1 / 10 (1 - 1 / floor(2250 / x)) (1 - 1 / floor(4500 / x)) (1 - 1 / 3), 263 ≤ x ≤ 450
    woodenb4(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / floor(4500 / x)) (1 - 1 / 3), 450 ≤ x ≤ 750
    woodenb5(x) = 1 / 10 (1 - 1 / 5) (1 - 1 / 6) (1 - 1 / 3), 750 ≤ x
    

    (Hide the base functions; the ones without a number at the end of their name. They do not represent accurate probabilities.)

  23. Please let me know if something is unclear or I've made a mistake.

    --Rye Greenwood (talk) 02:05, 6 December 2019 (UTC)

    You took "nearly impossible" as a challenge, didn't you? "It just gets a little long", oy gevalt!  ;-)
    Initial thoughts:
    • At least some of those groups of equations look like they're segments of a line; they might be easier to grasp if they were in a more switch/case like format.
    • The flags you describe as "chances", but it's not clear if/where randomness appears or what it applies to. Also simplifying the inequalities (e.g., flag4: fp/100 ≤ 1) would make them much easier to read. (I think we can take fp > 0 as a prerequisite.)
    • For display to normal readers (that is, the topic page), I suspect the graphs themselves would be much more understandable and practical than the series of equations, especially if integer division is putting kinks in the lines. Offhand, ISTM that the way to go would be separate graphs for the "biome crates" and "no biome crates" cases, each with a stacked plot showing the types accumulating vertically as fishing power increases horizontally.
    * I might have more thoughts later, right now I'm barely through my morning coffee.
    * Thanks for your efforts!
    --MentalMouse42 (talk) 12:40, 6 December 2019 (UTC)
    ETA: Whoops on the idea of simplifying formulas; looking back, I'm seeing that most of what I thought were brackets are floors, which make things different. Looks more and more like those graphs are the way to go. --MentalMouse42 (talk) 23:35, 6 December 2019 (UTC)
    OK, I think I've got a handle on it now. Five regimes, three of which can actually see play, and you're pro-rating between various flags that choose among different curves. I can't see where the biome/no-biome distinction appears in the late equations. And I still think graphs are likely to be more useful. I may need to poke into this graphing site of yours, but I can already get the feeling it doesn't like Firefox very much. --MentalMouse42 (talk) 02:54, 7 December 2019 (UTC)
    Well, after reading that last post of yours, I couldn't resist! To be honest, I didn't expect to get a result like this – being able to compute the probability of catching a specific type of crate with any given fishing power –, so I'm quite happy with it.
    Thanks for your feedback! Regarding the flags: The item that is caught during the fishing process is determined by a number of booleans, e.g.:
    caughtItemID = ((flag6 | flag7) ? 2336 : ((flag5 && Main.player[owner].ZoneCorrupt) ? 3203 : ...
    
    These flags are assigned true with a specific probability, expressed in the code like this (extracting only flag6 and flag7 as an example here):
    	int num17 = 150 * 15 / num6; // num6 is fishing power
    	int num18 = 150 * 30 / num6;
    	// these two following ifs are the caps that require us to do the case differentiation, by the way
    	if (num17 < 5)
    	{
    		num17 = 5;
    	}
    	if (num18 < 6)
    	{
    		num18 = 6;
    	}
    	bool flag6 = false;
    	bool flag7 = false;
    	if (Main.rand.Next(num17) == 0)
    	{
    		flag6 = true;
    	}
    	if (Main.rand.Next(num18) == 0)
    	{
    		flag7 = true;
    	}
    
    Generate a random integer between 0 and a variable that depends on the fishing power, and set the flag to true if that integer equals 0. Therefore, the probability of that flag being true is 1/num17 or 1/num18 for flag6 and flag7 in this case, respectively.


    I agree the graphs are important for visualization, but I'm not sure in what way they could be integrated best. I was thinking about simply taking a screenshot and uploading that as an image file, but displaying data in images is generally frowned upon (partly because they are so static and hard to update). We could also render the graphs with the Graph MediaWiki extension, but I think that's blocked by Gamepedia.
    --Rye Greenwood (talk) 23:39, 8 December 2019 (UTC)
    I think image-file graphs would at least be an interim step pending a suitable extension. I just glanced at Minecraft's Experience page, and yep, the graphs there are .PNG.
    ETA: Also it looks to me like each flag's probability just progresses to a maximum probability and then pins there. If so, the equations could be greatly simplified by defining variables accordingly.
    --MentalMouse42 (talk) 00:06, 9 December 2019 (UTC)

    ──────────────────────────────────────────────────────────────────────────────────────────────────── So I've totally forgotten about this in the last five months, but finally remembered today and made a plot of the graphs:

    Crate catch chances graphs.svg

    Thoughts? (I chose SVG, not PNG, because that allows zooming in without losing quality.)

    --Rye Greenwood (talk) 11:49, 10 April 2020 (UTC)

    Belatedly: Those graphs look good, though of course now they may need to be updated for 1.4 --MentalMouse42 (talk) 14:01, 17 May 2020 (UTC)

    New Crates on 1.4

    I've merged a couple of previously-unsigned comments into this new section. --MentalMouse42 (talk) 20:18, 18 May 2020 (UTC)

    (Pearlwood Crate and Mythril Crate) I found both them on caverns layer. There were Mushroom, Dirt, Stone and Ice biomes around. Not sure about biome trigger — Preceding unsigned comment added by 09:37, 2020 May 17 (talk • contribs) at Elder Axe

    (Frozen crates) they exist — Preceding unsigned comment added by 13:45, 2020 May 18 (talk • contribs) at Ampls

    Elder Axe, were you in Hardmode? If so, then at a guess, the Pearlwood is Hallow (or perhaps a hardmode substitute for Wood), and Mythril is a Hardmode non-biome crate. --MentalMouse42 (talk) 20:18, 18 May 2020 (UTC)

    Ore Inside 1.4 Sky Crates

    I have been opening a pile of Sky Crates in Journey mode 1.4 and have found gold ore, tungsten ore, lead ore, silver ore, iron ore. I think the item has changed if someone can confirm; if so, the text saying ores are only in Wooden and Pearlwood creates needs to be updated. I'm not sure if other biome crates can have ore; the Iron Crate did not.

    We already knew the metal distributions had changed; I think we'll need a source diver to get all the new contents lists. --MentalMouse42 (talk) 03:52, 21 May 2020 (UTC)

    Can the pre-hardmode Crates still have new items if opened in Hardmode?

    The respective pages and notes here still say that Crimson/Corrupt crates (and the normally inaccessible Hallowed crate) can have Cursed Flames/Ichor/Crystals in Hardmode. Izzit so? --MentalMouse42 (talk) 22:12, 22 May 2020 (UTC)

    The 1.4.4 Ore/Bar Distribution is Incorrect;

    Hey there! Ore and Bar drops (at least for biome crates; I'm unsure which others) were reduced in 1.4.4. As best as I can tell from the source code (line 8183 of Player.cs), the new stack range for ores is 20 to 35 (int stack34 = Main.rand.Next(20, 36)). The code is laid out pretty confusingly, so I'm unsure if this applies to any crates besides the biome ones. I'm not an expert programmer, and Terraria's source code can be quite hard to interpret. Also, other ore distributions for other chests could also be wrong, I haven't checked all crate types but I could do so soon. For added confirmation, I got this screenshot.

    Proof of New Ore Distribution.png

    This also applies to bars. I was able to get only 7 bars from a Sky Crate, and so far as I can tell from the code (line 8217 of Player.cs, int num25 = Main.rand.Next(6, 17)), the bar drop distribution is 6-16.

    I'm not a wiki editor, so I'm not sure of the right way to go about editing all this for the pages (Especially given how Terraria has different versions!). I just happened to stumble across this and wanted to share. I am 90% sure that the new Ore Distributions for ore in biome chests is 20-35 and bars is 6-16, and I am 100% sure that the old Ore Distributions are wrong, so I think that for the time being someone should update them to at least more accurately reflect the ingame drops. Hopefully this is helpful!

    MingCat (talk) 23:05, 2 March 2023 (UTC)
    

    EDIT: Looks like hardmode bar drops also have a 50% chance to have 1 subtracted from their stack size? (Line 8242 of Player.cs. num25 -= Main.rand.Next(2)). This is really confusing to me because it's so small that I can't even guess why it exists, but I guess for hardmode bars the range is technically 5-16.

    Hi, thank you for this! I also checked the code and can confirm your findings. As for the Hardmode bars, my guess is that they're supposed to be rarer, so there's a chance that they're less abundant. Then again, they are twice as likely to be dropped as pre-Hardmode bars, so it doesn't really have that much of an effect... --Rye Greenwood (talk) 17:44, 8 March 2023 (UTC)