From 03c48b4f3f0998dbe3fc03789d26abe8df6d2f9b Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Thu, 5 May 2022 15:46:53 -0700 Subject: [PATCH] compatibility with evo_battle --- include/constants/pokemon.h | 8 ++++---- src/data/pokemon/evolution.h | 6 +++++- src/pokemon.c | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 2c2c98987d..f4fa1f8003 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -352,9 +352,9 @@ #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 EVO_SCRIPT_TRIGGER_DMG 35 // Pokémon has specified HP below max, then player interacts trigger -#define EVO_DARK_SCROLL 36 // interacts with Scroll of Darkness -#define EVO_WATER_SCROLL 37 // interacts with Scroll of Waters +#define EVO_SCRIPT_TRIGGER_DMG 36 // Pokémon has specified HP below max, then player interacts trigger +#define EVO_DARK_SCROLL 37 // interacts with Scroll of Darkness +#define EVO_WATER_SCROLL 38 // interacts with Scroll of Waters #define EVOS_PER_MON 10 @@ -363,7 +363,7 @@ #define EVO_MODE_TRADE 1 #define EVO_MODE_ITEM_USE 2 #define EVO_MODE_ITEM_CHECK 3 // If an Everstone is being held, still want to show that the stone *could* be used on that Pokémon to evolve -#define EVO_MODE_OVERWORLD_SPECIAL 4 +#define EVO_MODE_OVERWORLD_SPECIAL 5 // Form change types #define FORM_CHANGE_END 0 diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index 475e7fc911..d38b54074a 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -507,7 +507,11 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_PONYTA_GALARIAN] = {{EVO_LEVEL, 40, SPECIES_RAPIDASH_GALARIAN}}, [SPECIES_SLOWPOKE_GALARIAN] = {{EVO_ITEM, ITEM_NONE, SPECIES_SLOWBRO_GALARIAN}, {EVO_ITEM, ITEM_NONE, SPECIES_SLOWKING_GALARIAN}}, - [SPECIES_FARFETCHD_GALARIAN] = {{EVO_LEVEL, 0, SPECIES_SIRFETCHD}}, + #ifdef BATTLE_ENGINE + [SPECIES_FARFETCHD_GALARIAN] = {{EVO_CRITICAL_HITS, 3, SPECIES_SIRFETCHD}}, + #else + [SPECIES_FARFETCHD_GALARIAN] = {{EVO_LEVEL, 0, SPECIES_SIRFETCHD}}, + #endif [SPECIES_MR_MIME_GALARIAN] = {{EVO_LEVEL, 42, SPECIES_MR_RIME}}, [SPECIES_CORSOLA_GALARIAN] = {{EVO_LEVEL, 38, SPECIES_CURSOLA}}, [SPECIES_ZIGZAGOON_GALARIAN] = {{EVO_LEVEL, 20, SPECIES_LINOONE_GALARIAN}}, diff --git a/src/pokemon.c b/src/pokemon.c index 05047caec7..abb7f7e049 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6755,6 +6755,21 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s } } break; + #ifdef BATTLE_ENGINE + // Battle evolution without leveling; party slot is being passed into the evolutionItem arg. + case EVO_MODE_BATTLE_SPECIAL: + for (i = 0; i < EVOS_PER_MON; i++) + { + switch (gEvolutionTable[species][i].method) + { + case EVO_CRITICAL_HITS: + if (gPartyCriticalHits[evolutionItem] >= gEvolutionTable[species][i].param) + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; + } + } + break; + #endif // Overworld evolution without leveling; evolution method is being passed into the evolutionItem arg. case EVO_MODE_OVERWORLD_SPECIAL: for (i = 0; i < EVOS_PER_MON; i++)