Jump to content

Elin:Code Analysis/Fishing: Difference between revisions

Removed fishing dependent probability calculations
(Removed fishing dependent probability calculations)
Line 473: Line 473:
==== Conditional Rolls: Rare Items and Rewards ====
==== Conditional Rolls: Rare Items and Rewards ====


This section determines whether a rare item or reward is generated. The outermost condition checks if a random roll succeeds. If the condition is met, nested conditions evaluate the type of item to generate.
This section determines whether a rare item or reward is generated. The outermost condition checks whether the current character is the PC (Player Character) or, if not, whether a random roll succeeds with a probability of 1/20. If the condition is met, nested conditions evaluate the type of item to generate.


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
if (rnd(20) == 0)
if (c.IsPC || rnd(20) == 0)
{
    // Logic for rare item generation
}
</syntaxhighlight>
</syntaxhighlight>


* '''Condition''': Pass a random roll: <code>rnd(20) == 0</code>.
* '''Condition''':  
** If the current character is the PC (<code>c.IsPC</code> evaluates to true), the roll succeeds automatically.
** If the current character is not the PC, the roll succeeds if <code>rnd(20) == 0</code>.
* '''Probability for non-PC characters''': <code>1 / 20</code> (~5%).


If this condition is satisfied, the following rolls determine the item generated:
If this condition is satisfied, the following rolls determine the item generated:
Line 495: Line 501:


* '''Condition''': The item is generated if <code>rnd(30) == 0</code>.
* '''Condition''': The item is generated if <code>rnd(30) == 0</code>.
* '''Probability''': <code>1 / 30</code>, or approximately 3.33%.
* '''Independent Probability''': <code>1 / 30</code>, or approximately 3.33%.


If this condition is satisfied, the Ancient Book is created as the reward.
If this condition is satisfied, the Ancient Book is created as the reward.
Line 511: Line 517:


* '''Condition''': The item is generated if <code>rnd(35) == 0</code>.
* '''Condition''': The item is generated if <code>rnd(35) == 0</code>.
* '''Probability''': <code>1 / 35</code> (~2.86%).
* '''Independent Probability''': <code>1 / 35</code> (~2.86%).


If this condition is satisfied, a Platinum Coin is created as the reward.
If this condition is satisfied, a Platinum Coin is created as the reward.
Line 527: Line 533:


* '''Condition''': The item is generated if <code>rnd(2) == 0</code>, replacing the Platinum Coin.
* '''Condition''': The item is generated if <code>rnd(2) == 0</code>, replacing the Platinum Coin.
* '''Probability''': <code>1 / 2</code> (50%), but it depends on the successful Platinum Coin roll.
* '''Independent Probability''': <code>1 / 2</code> (50%), but it depends on the successful Platinum Coin roll.
* '''Dependent Probability''': <code>1 / (20 * 35 * 2)</code> (~0.071%).
** Calculated as:
*** Rare Item Roll: <code>1 / 20</code> (5%).
*** Platinum Coin Roll: <code>1 / 35</code> (~2.86%).
*** Scratch Card Roll: <code>1 / 2</code> (50%).


If this condition is satisfied, the Scratch Card replaces the Platinum Coin as the reward.
If this condition is satisfied, the Scratch Card replaces the Platinum Coin as the reward.
Line 548: Line 549:


* '''Condition''': The item is generated if <code>rnd(3) == 0</code>, replacing the Platinum Coin.
* '''Condition''': The item is generated if <code>rnd(3) == 0</code>, replacing the Platinum Coin.
* '''Probability''': <code>1 / 3</code> (~33.33%), but it depends on the successful Platinum Coin roll.
* '''Independent Probability''': <code>1 / 3</code> (~33.33%), but it depends on the successful Platinum Coin roll.
* '''Dependent Probability''': <code>1 / (20 * 35 * 3)</code> (~0.048%).
** Calculated as:
*** Rare Item Roll: <code>1 / 20</code> (5%).
*** Platinum Coin Roll: <code>1 / 35</code> (~2.86%).
*** Casino Coin Roll: <code>1 / 3</code> (~33.33%).


If this condition is satisfied, the Casino Coin replaces the Platinum Coin as the reward.
If this condition is satisfied, the Casino Coin replaces the Platinum Coin as the reward.
Line 569: Line 565:


* '''Condition''': The item is generated if <code>rnd(3) == 0</code>, replacing the Platinum Coin.
* '''Condition''': The item is generated if <code>rnd(3) == 0</code>, replacing the Platinum Coin.
* '''Probability''': <code>1 / 3</code> (~33.33%), but it depends on the successful Platinum Coin roll.
* '''Independent Probability''': <code>1 / 3</code> (~33.33%), but it depends on the successful Platinum Coin roll.
* '''Dependent Probability''': <code>1 / (20 * 35 * 3)</code> (~0.048%).
** Calculated as:
*** Rare Item Roll: <code>1 / 20</code> (5%).
*** Platinum Coin Roll: <code>1 / 35</code> (~2.86%).
*** Strange Coin Roll: <code>1 / 3</code> (~33.33%).


If this condition is satisfied, the Strange Coin replaces the Platinum Coin as the reward.
If this condition is satisfied, the Strange Coin replaces the Platinum Coin as the reward.
Line 597: Line 588:


* '''Condition''': A statue is generated if <code>rnd(50) == 0</code>.
* '''Condition''': A statue is generated if <code>rnd(50) == 0</code>.
* '''Probability''': <code>1 / 50</code> (2%), but it depends on the successful Platinum Coin roll.
* '''Independent Probability''': <code>1 / 50</code> (2%), but it depends on the successful Platinum Coin roll.
* '''Dependent Probability''': <code>1 / (20 * 35 * 50)</code> (~0.00286%).
** Calculated as:
*** Rare Item Roll: <code>1 / 20</code> (5%).
*** Platinum Coin Roll: <code>1 / 35</code> (~2.86%).
*** Statue Roll: <code>1 / 50</code> (2%).


If this condition is satisfied, one of the following statues is randomly selected:
If this condition is satisfied, one of the following statues is randomly selected:
Line 614: Line 600:


Each statue has an equal probability of being selected from the pool of seven statues.
Each statue has an equal probability of being selected from the pool of seven statues.
* '''Probability of a Specific Statue''': <code>1 / 7</code> (~14.29%) of the statue roll.
* '''Independent Probability of a Specific Statue''': <code>1 / 7</code> (~14.29%) of the statue roll.
* '''Dependent Probability for a Specific Statue''': <code>1 / (20 * 35 * 50 * 7)</code> (~0.00041%).


===== Small Medal =====
===== Small Medal =====
Line 631: Line 616:
** The first roll succeeds if <code>rnd(40) == 0</code> (2.5%).
** The first roll succeeds if <code>rnd(40) == 0</code> (2.5%).
** The second roll succeeds if <code>rnd(40) < fishingLevel / 3 + 10</code>.
** The second roll succeeds if <code>rnd(40) < fishingLevel / 3 + 10</code>.
* '''Probability''':
* '''Independent Probability''':
** The first roll has a fixed probability: <code>1 / 40</code> (2.5%).
** The first roll has a fixed probability: <code>1 / 40</code> (2.5%).
** The second roll's probability depends on the player's fishing level:
** The second roll's probability depends on the player's fishing level:
Line 641: Line 626:
*** <code>fishingLevel >= 90</code>.
*** <code>fishingLevel >= 90</code>.
** At <code>fishingLevel = 90</code>, the threshold becomes <code>90 / 3 + 10 = 40</code>, ensuring consistent success.
** At <code>fishingLevel = 90</code>, the threshold becomes <code>90 / 3 + 10 = 40</code>, ensuring consistent success.
* '''Dependent Probability''':
** Combined probability: <code>(1 / 20) * (1 / 40) * (fishingLevel-dependent threshold)</code>.
** Example for Fishing Level 10:
*** Threshold: <code>10 / 3 + 10 = ~13.33</code>.
*** Second roll succeeds if <code>rnd(40) < 13</code>, or <code>13 / 40</code> (32.5%).
*** Combined Probability: <code>(1 / 20) * (1 / 40) * (13 / 40)</code> (~0.01625%).


==== Junk Items ====
==== Junk Items ====
142

edits