summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-12-11 21:23:48 -0500
committerGitHub <noreply@github.com>2020-12-11 21:23:48 -0500
commit25282fbaa85f45dca79e38cc512b09549e2fed90 (patch)
tree67e0b468b26911f5d09baca0a9eeae63e458813a /src
parent628ade247b21793f524d2b741aede9ce2a1c1c2a (diff)
parent76e40fe2dd9e3d68ff5211617ffda4bc7d4faa81 (diff)
Merge pull request #1264 from ExpoSeed/patch-2
Fix incorrect bug description
Diffstat (limited to 'src')
-rw-r--r--src/daycare.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/daycare.c b/src/daycare.c
index fd6ed3a50..d849b39f3 100644
--- a/src/daycare.c
+++ b/src/daycare.c
@@ -547,13 +547,17 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare)
for (i = 0; i < INHERITED_IV_COUNT; i++)
{
// Randomly pick an IV from the available list and stop from being chosen again.
- selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)];
- // BUG: Instead of removing the IV that was just picked (like in RS and FRLG), this
+ // BUG: Instead of removing the IV that was just picked, this
// removes position 0 (HP) then position 1 (DEF), then position 2. This is why HP and DEF
// have a lower chance to be inherited in Emerald and why the IV picked for inheritance can
- // be repeated. Uncomment the inline comment and remove the existing expression to get the
- // intended behavior and to match the other Gen 3 games.
- RemoveIVIndexFromList(availableIVs, i /*selectedIvs[i]*/);
+ // be repeated. Amusingly, FRLG and RS also got this wrong. They remove selectedIvs[i], which
+ // is not an index! This means that it can sometimes remove the wrong stat. To fix, delete
+ // the following two lines and uncomment the rest of the block.
+ selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)];
+ RemoveIVIndexFromList(availableIVs, i);
+ // u8 index = Random() % (NUM_STATS - i);
+ // selectedIvs[i] = availableIVs[index];
+ // RemoveIVIndexFromList(availableIVs, index);
}
// Determine which parent each of the selected IVs should inherit from.