From b01f7927cf8ec4aaafec1dde51af702560e468ab Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 19 Jun 2023 16:17:51 -0400 Subject: [PATCH] Fixed Sylveon's evolution method (#3048) --- include/constants/pokemon.h | 2 +- src/data/pokemon/evolution.h | 2 +- src/pokemon.c | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 8e7b585ab..510d48271 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -298,7 +298,7 @@ #define EVO_ITEM_HOLD_DAY 21 // Pokémon levels up, holds specified item at day #define EVO_ITEM_HOLD_NIGHT 22 // Pokémon levels up, holds specified item at night #define EVO_MOVE 23 // Pokémon levels up, knows specified move -#define EVO_MOVE_TYPE 24 // Pokémon levels up, knows move with specified type +#define EVO_FRIENDSHIP_MOVE_TYPE 24 // Pokémon levels up with friendship ≥ 220, knows move with specified type #define EVO_MAPSEC 25 // Pokémon levels up on specified mapsec #define EVO_ITEM_MALE 26 // specified item is used on a male Pokémon #define EVO_ITEM_FEMALE 27 // specified item is used on a female Pokémon diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index a6e4a639b..53745eea5 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -121,7 +121,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = {EVO_ITEM, ITEM_ICE_STONE, SPECIES_GLACEON}, #endif #if P_GEN_6_POKEMON == TRUE - {EVO_MOVE_TYPE, TYPE_FAIRY, SPECIES_SYLVEON} + {EVO_FRIENDSHIP_MOVE_TYPE, TYPE_FAIRY, SPECIES_SYLVEON} #endif }, [SPECIES_PORYGON] = {{EVO_TRADE_ITEM, ITEM_UPGRADE, SPECIES_PORYGON2}, diff --git a/src/pokemon.c b/src/pokemon.c index c02802be2..6d5b3d35e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6501,13 +6501,16 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s if (MonKnowsMove(mon, gEvolutionTable[species][i].param)) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; - case EVO_MOVE_TYPE: - for (j = 0; j < 4; j++) + case EVO_FRIENDSHIP_MOVE_TYPE: + if (friendship >= 220) { - if (gBattleMoves[GetMonData(mon, MON_DATA_MOVE1 + j, NULL)].type == gEvolutionTable[species][i].param) + for (j = 0; j < MAX_MON_MOVES; j++) { - targetSpecies = gEvolutionTable[species][i].targetSpecies; - break; + if (gBattleMoves[GetMonData(mon, MON_DATA_MOVE1 + j, NULL)].type == gEvolutionTable[species][i].param) + { + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; + } } } break;