Jump to content

Elin:Code Analysis/Fishing: Difference between revisions

Fix variable name to specify +1 additional fish.
(Fix variable name to specify it's one additional fish.)
(Fix variable name to specify +1 additional fish.)
Line 123: Line 123:
==== Checking the Chance to Increase the Number of Fish ====
==== Checking the Chance to Increase the Number of Fish ====


The '''additionalFishChance''' value is then compared to a random number generated by the <code>rnd(100)</code> function. The value of <code>rnd(100)</code> generates a random number between '''0''' and '''99''' (inclusive).
The '''chanceForOneMoreFish''' value is then compared to a random number generated by the <code>rnd(100)</code> function. The value of <code>rnd(100)</code> generates a random number between '''0''' and '''99''' (inclusive).


If the value of '''additionalFishChance''' is greater than or equal to the random number, the number of fish will increase by '''1'''.
If the value of '''chanceForOneMoreFish''' is greater than or equal to the random number, the number of fish will increase by '''1'''.


This check is done with:
This check is done with:


<pre>
<pre>
if (additionalFishChance >= rnd(100))
if (chanceForOneMoreFish >= rnd(100))
</pre>
</pre>


Line 136: Line 136:
* If the random number is '''greater than 50''', the number of fish will remain the same.
* If the random number is '''greater than 50''', the number of fish will remain the same.


Thus, the probability of increasing the number of fish is '''50%''' (because '''additionalFishChance = 50''' ).
Thus, the probability of increasing the number of fish is '''50%''' (because '''chanceForOneMoreFish = 50''' ).


==== Example with Land Feats ====
==== Example with Land Feats ====
133

edits