142
edits
(Add fishing speed calculations.) |
m (Add fish success calculation.) |
||
| Line 231: | Line 231: | ||
* '''fishingLevel''': Your current fishing skill level. | * '''fishingLevel''': Your current fishing skill level. | ||
* '''rnd''': A random number between '''0''' and the value passed into the function. | * '''rnd''': A random number between '''0''' and the value passed into the function. | ||
* '''Clamp''': Ensures the value stays between '''5''' (hardest) and '''10''' (easiest). | * '''Clamp''': Ensures the value stays between '''5''' (hardest threshold to surpass) and '''10''' (easiest threshold to surpass). | ||
The actual success logic occurs as follows: | |||
<pre> | |||
if (hit > rnd(successThreshold)) { | |||
hit = 100; | |||
progress = MaxProgress; | |||
} | |||
</pre> | |||
* '''hit''': Tracks the current number of attempts. The fish is caught if ''hit'' exceeds the random roll of the successThreshold. | |||
* '''progress''': Automatically completes when success occurs. | |||
====Example==== | ====Example==== | ||
If your fishing level is ''' | If your fishing level is '''20''', the calculation proceeds as follows: | ||
# <code>rnd( | # <code>rnd(20 + 1)</code> generates a random number between '''0''' and '''20'''. | ||
# This random number is divided by '''10''' and subtracted from '''10'''. | # This random number is divided by '''10''' and subtracted from '''10'''. | ||
# The | # The result is clamped to the range '''[5, 10]''', determining the successThreshold. | ||
For example: | For example: | ||
* If <code>rnd( | * If <code>rnd(21) = 10</code>, the calculation is: | ||
<pre>successThreshold = Mathf.Clamp(10 - ( | <pre>successThreshold = Mathf.Clamp(10 - (10 / 10), 5, 10) = 9</pre> | ||
A random roll of <code>rnd(9)</code> determines the threshold. If ''hit > rnd(9)'', the fish is caught. | |||
====Success Threshold Table==== | ====Success Threshold Table==== | ||
| Line 286: | Line 296: | ||
* '''fishingLevel''': Your current fishing skill level. | * '''fishingLevel''': Your current fishing skill level. | ||
* '''rnd''': A random number between '''0''' and the value passed into the function. | * '''rnd''': A random number between '''0''' and the value passed into the function. | ||
* '''Clamp''': Ensures the value stays between '''2''' (easiest reset) and '''10''' (hardest reset). | * '''Clamp''': Ensures the value stays between '''2''' (easiest threshold to reset) and '''10''' (hardest threshold to reset). | ||
If <code>rnd(resetThreshold)</code> equals '''0''', and ''progress >= 10'', the ''hit'' counter resets to '''0'''. | If <code>rnd(resetThreshold)</code> equals '''0''', and ''progress >= 10'', the ''hit'' counter resets to '''0'''. | ||
| Line 292: | Line 302: | ||
====Example==== | ====Example==== | ||
If your fishing level is ''' | If your fishing level is '''30''', the calculation proceeds as follows: | ||
# <code>rnd( | # <code>rnd(30 + 1)</code> generates a random number between '''0''' and '''30'''. | ||
# This random number is divided by '''5''' and subtracted from '''10'''. | # This random number is divided by '''5''' and subtracted from '''10'''. | ||
# The | # The result is clamped to the range '''[2, 10]''', determining the resetThreshold. | ||
For example: | For example: | ||
* If <code>rnd( | * If <code>rnd(31) = 10</code>, the calculation is: | ||
<pre>resetThreshold = Mathf.Clamp(10 - (10 / 5), 2, 10) = 8</pre> | <pre>resetThreshold = Mathf.Clamp(10 - (10 / 5), 2, 10) = 8</pre> | ||
A second random roll, <code>rnd(8)</code>, is performed. If the result is '''0''', the ''hit'' counter resets. | A second random roll, <code>rnd(8)</code>, is performed. If the result is '''0''', the ''hit'' counter resets. | ||
edits