Jump to content

Elin:Fishing: Difference between revisions

1,207 bytes added ,  23 November 2024
Add initial number of fish calculation.
mNo edit summary
(Add initial number of fish calculation.)
Line 81: Line 81:
== Calculations ==
== Calculations ==


=== Fish ===
=== Fish LV ===


The formula to calculate the range of fish LV that can be caught based on your fishing level:
The formula to calculate the fish LV that can be caught based on your fishing level:


<pre>rnd(fishingLevel * 2) + 1</pre>
<pre>Fish LV = rnd(fishingLevel * 2) + 1</pre>


* '''fishingLevel''': Your current fishing skill level.
* '''fishingLevel''': Your current fishing skill level.
Line 151: Line 151:
int num3 = EClass.rnd(num * 2) + 1;
int num3 = EClass.rnd(num * 2) + 1;
thing = ThingGen.Create("fish", -1, num3);
thing = ThingGen.Create("fish", -1, num3);
</syntaxhighlight>
=== Number of Fish ===
The formula to calculate the number of fish you can catch based on your fishing level:
<pre>Number of Fish = rnd(fishingLevel / (Fish LV + 10)) + 1</pre>
* '''fishingLevel''': Your current fishing skill level.
* '''Fish LV''': The LV range of the fish calculated earlier using <code>rnd(fishingLevel * 2) + 1</code>.
* '''rnd''': A random number between '''0''' and the value passed into the function.
==== Example ====
If your fishing level is '''3''', and the Fish LV is determined to be '''5''', the potential number of fish is calculated as:
<pre>rnd(3 / (5 + 10)) + 1</pre>
This simplifies to:
<pre>rnd(3 / 15) + 1</pre>
The <code>rnd(3 / 15)</code> generates a random number between '''0''' and approximately '''0.2'''. Adding 1 ensures that you will catch at least 1 fish.
==== Code (EA 23.37) ====
<syntaxhighlight lang="c#" line="1">
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);
}
</syntaxhighlight>
</syntaxhighlight>
138

edits