Elin:Code Analysis/Fishing: Difference between revisions
Jump to navigation
Jump to search
Sakumashiki (talk | contribs) (Created a page about Fishing Analysis) |
(Fix number of fish table and example.) |
||
Line 84: | Line 84: | ||
====Example==== | ====Example==== | ||
If your fishing level is ''' | If your fishing level is '''22''', and the fish LV is determined to be '''1''', the potential number of fish is calculated as: | ||
<pre>rnd( | <pre>rnd(22 / (1 + 10)) + 1</pre> | ||
This simplifies to: | This simplifies to: | ||
<pre>rnd( | <pre>rnd(22 / 11) + 1</pre> | ||
The <code>rnd( | The <code>rnd(2)</code> generates a random number between '''0''' and '''1'''. Adding 1 ensures that you will catch at least '''1''' fish, and the number of fish can either be '''1''' or '''2''', depending on the random result. | ||
====Number of Fish Table==== | ====Number of Fish Table==== | ||
Line 100: | Line 100: | ||
!Fish LV!!Minimum Fishing Level for 2 Fish!!Minimum Fishing Level for 3 Fish | !Fish LV!!Minimum Fishing Level for 2 Fish!!Minimum Fishing Level for 3 Fish | ||
|- | |- | ||
|1|| | |1||22||33 | ||
|- | |- | ||
|5|| | |5||30||45 | ||
|- | |- | ||
|10|| | |10||40||60 | ||
|- | |- | ||
|15|| | |15||50||75 | ||
|- | |- | ||
|20|| | |20||60||90 | ||
|- | |- | ||
|25|| | |25||70||105 | ||
|- | |- | ||
|30|| | |30||80||120 | ||
|- | |- | ||
|35|| | |35||90||135 | ||
|- | |- | ||
|40|| | |40||100||150 | ||
|} | |} | ||
Revision as of 06:54, 24 November 2024
Calculations
Fish LV
The formula to calculate the fish LV that can be caught based on your fishing level:
fishLV = rnd(fishingLevel * 2) + 1
- fishingLevel: Your current fishing skill level.
- rnd: A random number between 0 and the value passed into the function.
Example
If your fishing level is 3, the potential fish LV is calculated as:
rnd(3 * 2) + 1
This gives a range of 1 to 6, meaning you can catch fish with LV between 1 and 6.
Fish LV Range Table
Fishing Level | Minimum LV | Maximum LV |
---|---|---|
1 | 1 | 2 |
2 | 1 | 4 |
3 | 1 | 6 |
4 | 1 | 8 |
5 | 1 | 10 |
6 | 1 | 12 |
7 | 1 | 14 |
8 | 1 | 16 |
9 | 1 | 18 |
10 | 1 | 20 |
11 | 1 | 22 |
12 | 1 | 24 |
13 | 1 | 26 |
14 | 1 | 28 |
15 | 1 | 30 |
16 | 1 | 32 |
17 | 1 | 34 |
18 | 1 | 36 |
19 | 1 | 38 |
20 | 1 | 40 |
Code (EA 23.37)
int num3 = EClass.rnd(num * 2) + 1;
thing = ThingGen.Create("fish", -1, num3);
Number of Fish
The formula to calculate the number of fish you can catch based on your fishing level:
numberOfFish = rnd(fishingLevel / (fishLV + 10)) + 1
- fishingLevel: Your current fishing skill level.
- fishLV: The fish LV.
- rnd: A random number between 0 and the value passed into the function.
Example
If your fishing level is 22, and the fish LV is determined to be 1, the potential number of fish is calculated as:
rnd(22 / (1 + 10)) + 1
This simplifies to:
rnd(22 / 11) + 1
The rnd(2)
generates a random number between 0 and 1. Adding 1 ensures that you will catch at least 1 fish, and the number of fish can either be 1 or 2, depending on the random result.
Number of Fish Table
Fish LV | Minimum Fishing Level for 2 Fish | Minimum Fishing Level for 3 Fish |
---|---|---|
1 | 22 | 33 |
5 | 30 | 45 |
10 | 40 | 60 |
15 | 50 | 75 |
20 | 60 | 90 |
25 | 70 | 105 |
30 | 80 | 120 |
35 | 90 | 135 |
40 | 100 | 150 |
Code (EA 23.37)
num2 = EClass.rnd(num / (num3 + 10)) + 1;
int num4 = 5;
if (EClass.Branch != null)
{
num4 += EClass.Branch.Evalue(3604) * 20 + EClass.Branch.Evalue(3706) * 25;
}
if (num4 >= EClass.rnd(100))
{
num2++;
}
if (thing != null)
{
thing.SetNum(num2);
thing.SetBlessedState(BlessedState.Normal);
}