Elin:Code Analysis/Fishing: Difference between revisions

Initial fishing spoiler item probability seciton.
(Update number of fish table.)
(Initial fishing spoiler item probability seciton.)
Line 422: Line 422:
}
}
</syntaxhighlight>
</syntaxhighlight>
=== Chances and Probability ===
Each item or fish has a unique probability of being generated, determined by the following rules and calculations:
==== Initial Roll: Chance to Catch Nothing ====
The first roll determines whether the player catches anything at all. If this roll fails, no item or fish is generated, and the function returns <code>null</code>. The chance to catch nothing is calculated as follows:
<syntaxhighlight lang="csharp">
if (rnd(3 + fishingLevel) == 0)
{
    return null;
}
</syntaxhighlight>
* '''Formula''': <code>rnd(3 + fishingLevel)</code> generates a random number between <code>0</code> and <code>(3 + fishingLevel - 1)</code>, inclusive.
* '''Condition''': If the result is <code>0</code>, the roll fails, and nothing is caught.
==== Probability ====
The probability of catching nothing decreases as the player's fishing level increases:
* '''Maximum Value for the Roll''': <code>3 + fishingLevel</code>, where <code>fishingLevel = c.Evalue(245)</code>.
* '''Chance to Catch Nothing''':
** <code>1 / (3 + fishingLevel)</code>
For example:
* At '''Fishing Level 1''':
** <code>rnd(3 + 1)</code> generates a number between <code>0</code> and <code>3</code>.
** Probability of <code>0</code>: <code>1 / 4</code> (25%).
* At '''Fishing Level 10''':
** <code>rnd(3 + 10)</code> generates a number between <code>0</code> and <code>12</code>.
** Probability of <code>0</code>: <code>1 / 13</code> (~7.69%).
This means that higher fishing levels significantly reduce the chance of failing the roll and increase the likelihood of catching something.


[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
[[Category:EN]]
[[Category:EN]]
142

edits