summaryrefslogtreecommitdiff
path: root/src/wild_encounter.c
diff options
context:
space:
mode:
authorPokeCodec <67983839+PokeCodec@users.noreply.github.com>2020-07-20 17:09:02 -0400
committerGitHub <noreply@github.com>2020-07-20 17:09:02 -0400
commit27ac0109220dcae4bc7d72640429d86a1775263f (patch)
treeebe59d8dc7a12fea83ef65b52fd767c8878e3358 /src/wild_encounter.c
parent1cf2470aac038fce48a5777e36b00554af90d910 (diff)
parent28759f85693f5ad57f5bd2f391d05b43948409b7 (diff)
Merge pull request #1 from pret/master
Upstream
Diffstat (limited to 'src/wild_encounter.c')
-rw-r--r--src/wild_encounter.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/wild_encounter.c b/src/wild_encounter.c
index 7d20b2476..1c4fd24fd 100644
--- a/src/wild_encounter.c
+++ b/src/wild_encounter.c
@@ -303,29 +303,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 +335,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)