Jump to content

Elin:Code Analysis/Fishing: Difference between revisions

m
Fix variable name to specify +1 additional fish.
(Fix variable name to specify +1 additional fish.)
m (Fix variable name to specify +1 additional fish.)
Line 147: Line 147:


Now, you evaluate the land feats:
Now, you evaluate the land feats:
* Starting with '''additionalFishChance = 5''' (the base chance).
* Starting with '''chanceForOneMoreFish = 5''' (the base chance).
* If the land feats are present:
* If the land feats are present:
     * '''Beach (3604)''' adds '''20''' to '''additionalFishChance'''.
     * '''Beach (3604)''' adds '''20''' to '''chanceForOneMoreFish'''.
     * '''Fishing Spot (3706)''' adds '''25''' to '''additionalFishChance'''.
     * '''Fishing Spot (3706)''' adds '''25''' to '''chanceForOneMoreFish'''.


So, the new '''additionalFishChance''' becomes:
So, the new '''chanceForOneMoreFish''' becomes:


<pre>
<pre>
additionalFishChance = 5 + 20 + 25 = 50
chanceForOneMoreFish = 5 + 20 + 25 = 50
</pre>
</pre>


Next, the random chance is checked:
Next, the random chance is checked:


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


If the random number generated by <code>rnd(100)</code> is '''50 or less''', '''numberOfFish''' will increase by 1. This means that if the random number is between '''0 and 50''' (inclusive), you will catch an additional fish, making '''numberOfFish''' increase by 1.
If the random number generated by <code>rnd(100)</code> is '''50 or less''', '''numberOfFish''' will increase by 1. This means that if the random number is between '''0 and 50''' (inclusive), you will catch an additional fish, making '''numberOfFish''' increase by 1.
133

edits