Document berry yield
fix wording
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#ifndef GUARD_BERRY_H
|
#ifndef GUARD_BERRY_H
|
||||||
#define GUARD_BERRY_H
|
#define GUARD_BERRY_H
|
||||||
|
|
||||||
|
#define NUM_BERRY_STAGES 4
|
||||||
|
|
||||||
void ClearEnigmaBerries(void);
|
void ClearEnigmaBerries(void);
|
||||||
void SetEnigmaBerry(u8 *src);
|
void SetEnigmaBerry(u8 *src);
|
||||||
bool32 IsEnigmaBerryValid(void);
|
bool32 IsEnigmaBerryValid(void);
|
||||||
|
|||||||
+13
-3
@@ -1200,6 +1200,15 @@ static u8 GetNumStagesWateredByBerryTreeId(u8 id)
|
|||||||
return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id));
|
return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Berries can be watered at 4 stages of growth. This function is likely meant
|
||||||
|
// to divide the berry yield range equally into quartiles. If you watered the
|
||||||
|
// tree n times, your yield is a random number in the nth quartile.
|
||||||
|
//
|
||||||
|
// However, this function actually skews towards higher berry yields, because
|
||||||
|
// it rounds `extraYield` to the nearest whole number.
|
||||||
|
//
|
||||||
|
// See resulting yields: https://pastebin.com/RLGnP9Ng, and
|
||||||
|
// bug fix: https://pastebin.com/cDjnUWL0.
|
||||||
static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
|
static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
|
||||||
{
|
{
|
||||||
u32 randMin;
|
u32 randMin;
|
||||||
@@ -1215,10 +1224,11 @@ static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
|
|||||||
randMax = (max - min) * (water);
|
randMax = (max - min) * (water);
|
||||||
rand = randMin + Random() % (randMax - randMin + 1);
|
rand = randMin + Random() % (randMax - randMin + 1);
|
||||||
|
|
||||||
if ((rand & 3) > 1)
|
// Round upwards
|
||||||
extraYield = rand / 4 + 1;
|
if ((rand % NUM_BERRY_STAGES) >= NUM_BERRY_STAGES / 2)
|
||||||
|
extraYield = rand / NUM_BERRY_STAGES + 1;
|
||||||
else
|
else
|
||||||
extraYield = rand / 4;
|
extraYield = rand / NUM_BERRY_STAGES;
|
||||||
return extraYield + min;
|
return extraYield + min;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user