From fa995894b76f4264df48dfa58f425cf12e8a9e7c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 27 Nov 2021 20:46:19 -0300 Subject: [PATCH] Added Nature evolution methods --- include/constants/pokemon.h | 2 ++ src/data/pokemon/evolution.h | 4 +-- src/pokemon.c | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 957274517..bfe461c2f 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -346,6 +346,8 @@ #define EVO_LEVEL_DARK_TYPE_MON_IN_PARTY 30 // Pokémon reaches the specified level with a Dark Type Pokémon in party #define EVO_TRADE_SPECIFIC_MON 31 // Pokémon is traded for a specified Pokémon #define EVO_SPECIFIC_MAP 32 // Pokémon levels up on specified map +#define EVO_LEVEL_NATURE_AMPED 33 // Pokémon reaches the specified level, it has a Hardy, Brave, Adamant, Naughty, Docile, Impish, Lax, Hasty, Jolly, Naive, Rash, Sassy, or Quirky nature. +#define EVO_LEVEL_NATURE_LOW_KEY 34 // Pokémon reaches the specified level, it has a Lonely, Bold, Relaxed, Timid, Serious, Modest, Mild, Quiet, Bashful, Calm, Gentle, or Careful nature. #define EVOS_PER_MON 10 diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index bc7cce52c..b431b88a3 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -471,8 +471,8 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = {EVO_ITEM, ITEM_NONE, SPECIES_APPLETUN}}, [SPECIES_SILICOBRA] = {{EVO_LEVEL, 36, SPECIES_SANDACONDA}}, [SPECIES_ARROKUDA] = {{EVO_LEVEL, 26, SPECIES_BARRASKEWDA}}, - [SPECIES_TOXEL] = {{EVO_LEVEL, 30, SPECIES_TOXTRICITY}, - {EVO_LEVEL, 30, SPECIES_TOXTRICITY_LOW_KEY}}, + [SPECIES_TOXEL] = {{EVO_LEVEL_NATURE_AMPED, 30, SPECIES_TOXTRICITY}, + {EVO_LEVEL_NATURE_LOW_KEY, 30, SPECIES_TOXTRICITY_LOW_KEY}}, [SPECIES_SIZZLIPEDE] = {{EVO_LEVEL, 28, SPECIES_CENTISKORCH}}, [SPECIES_CLOBBOPUS] = {{EVO_MOVE, MOVE_TAUNT, SPECIES_GRAPPLOCT}}, [SPECIES_SINISTEA] = {{EVO_ITEM, ITEM_NONE, SPECIES_POLTEAGEIST}}, diff --git a/src/pokemon.c b/src/pokemon.c index 189fccdea..bf9e7a04d 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6529,6 +6529,56 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, u if (currentMap == gEvolutionTable[species][i].param) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; + case EVO_LEVEL_NATURE_AMPED: + if (gEvolutionTable[species][i].param <= level) + { + u8 nature = GetNature(mon); + #ifdef GBA_PRINTF + mgba_printf(MGBA_LOG_DEBUG, "nat = %d", nature); + #endif + switch (nature) + { + case NATURE_HARDY: + case NATURE_BRAVE: + case NATURE_ADAMANT: + case NATURE_NAUGHTY: + case NATURE_DOCILE: + case NATURE_IMPISH: + case NATURE_LAX: + case NATURE_HASTY: + case NATURE_JOLLY: + case NATURE_NAIVE: + case NATURE_RASH: + case NATURE_SASSY: + case NATURE_QUIRKY: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; + } + } + break; + case EVO_LEVEL_NATURE_LOW_KEY: + if (gEvolutionTable[species][i].param <= level) + { + u8 nature = GetNature(mon); + switch (nature) + { + case NATURE_LONELY: + case NATURE_BOLD: + case NATURE_RELAXED: + case NATURE_TIMID: + case NATURE_SERIOUS: + case NATURE_MODEST: + case NATURE_MILD: + case NATURE_QUIET: + case NATURE_BASHFUL: + case NATURE_CALM: + case NATURE_GENTLE: + case NATURE_CAREFUL: + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; + } + } + break; } } break;