diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2020-08-16 05:59:10 -0400 |
---|---|---|
committer | GriffinR <griffin.g.richards@gmail.com> | 2020-08-16 05:59:10 -0400 |
commit | 65bd2faf9460d4e5986c30e54b283d7674d77c55 (patch) | |
tree | 250c345d17b8d8f910d327d98f577afddfb3a64a /src/wild_encounter.c | |
parent | 2749948eebe65aa8b55738d820e4a0252dd45c1a (diff) | |
parent | 25f45ffa8441b0f0a999355c9755782ccb4809dc (diff) |
Merge branch 'master' of https://github.com/pret/pokeemerald into doc-contest
Diffstat (limited to 'src/wild_encounter.c')
-rw-r--r-- | src/wild_encounter.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 7d20b2476..492a10101 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -185,13 +185,6 @@ static u8 ChooseWildMonIndex_WaterRock(void) return 4; } -enum -{ - OLD_ROD, - GOOD_ROD, - SUPER_ROD -}; - static u8 ChooseWildMonIndex_Fishing(u8 rod) { u8 wildMonIndex = 0; @@ -303,29 +296,27 @@ static u8 PickWildMonNature(void) u8 i; u8 j; struct Pokeblock *safariPokeblock; - u8 natures[25]; + u8 natures[NUM_NATURES]; if (GetSafariZoneFlag() == TRUE && Random() % 100 < 80) { safariPokeblock = SafariZoneGetActivePokeblock(); if (safariPokeblock != NULL) { - for (i = 0; i < 25; i++) + for (i = 0; i < NUM_NATURES; i++) natures[i] = i; - for (i = 0; i < 24; i++) + for (i = 0; i < NUM_NATURES - 1; i++) { - for (j = i + 1; j < 25; j++) + for (j = i + 1; j < NUM_NATURES; j++) { if (Random() & 1) { - u8 temp = natures[i]; - - natures[i] = natures[j]; - natures[j] = temp; + u8 temp; + SWAP(natures[i], natures[j], temp); } } } - for (i = 0; i < 25; i++) + for (i = 0; i < NUM_NATURES; i++) { if (PokeblockGetGain(natures[i], safariPokeblock) > 0) return natures[i]; @@ -337,11 +328,11 @@ static u8 PickWildMonNature(void) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE && Random() % 2 == 0) { - return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % 25; + return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES; } // random nature - return Random() % 25; + return Random() % NUM_NATURES; } static void CreateWildMon(u16 species, u8 level) |