From 15aa9099446ab1e4086e08b95da8a0c44c6ecfec Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 14 Mar 2024 18:02:19 -0300 Subject: [PATCH] Updated OW_SYNCHRONIZE_NATURE statement in ScriptGiveMonParameterized (#4271) Fixes an issue where the nature of a Deoxys would be randomized even if one was set at the time of calling givemon or the functions related to it. --- src/script_pokemon_util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index e02da5b06e..a0bc7d8e16 100644 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -299,10 +299,14 @@ u32 ScriptGiveMonParameterized(u16 species, u8 level, u16 item, u8 ball, u8 natu u16 targetSpecies; // check whether to use a specific nature or a random one - if (OW_SYNCHRONIZE_NATURE >= GEN_6 && (gSpeciesInfo[species].eggGroups[0] == EGG_GROUP_NO_EGGS_DISCOVERED || OW_SYNCHRONIZE_NATURE == GEN_7)) - nature = PickWildMonNature(); - else if (nature >= NUM_NATURES) - nature = Random() % NUM_NATURES; + if (nature >= NUM_NATURES) + { + if (OW_SYNCHRONIZE_NATURE >= GEN_6 + && (gSpeciesInfo[species].eggGroups[0] == EGG_GROUP_NO_EGGS_DISCOVERED || OW_SYNCHRONIZE_NATURE == GEN_7)) + nature = PickWildMonNature(); + else + nature = Random() % NUM_NATURES; + } // create a Pokémon with basic data if ((gender == MON_MALE && genderRatio != MON_FEMALE && genderRatio != MON_GENDERLESS)