From c4c802162ef8d99d656d084fcf66c74b7c270480 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 25 Nov 2020 00:53:53 -0300 Subject: [PATCH] A few more evo related changes. -EVO_MAP -> EVO_MAPSEC -Introduced a new EVO_SPECIFIC_MAP method. Its name is self-explanatory. (Thanks to Pyredrid!) -Changed the maps where Eevee can evolve into Leafeon and Glaceon to make use of it. --- include/constants/pokemon.h | 3 ++- include/pokemon.h | 1 + src/data/pokemon/evolution.h | 12 ++++++------ src/pokemon.c | 8 +++++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 28eb3701ea..4b9b14da55 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -296,13 +296,14 @@ #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_MAP 25 // Pokémon levels up on specified map +#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 #define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level while it's raining #define EVO_SPECIFIC_MON_IN_PARTY 29 // Pokémon levels up with a specified Pokémon in party #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 EVOS_PER_MON 10 diff --git a/include/pokemon.h b/include/pokemon.h index 49d277735a..f00008d954 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -5,6 +5,7 @@ #include "sprite.h" #include "constants/region_map_sections.h" #include "constants/pokemon_config.h" +#include "constants/map_groups.h" struct PokemonSubstruct0 { diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index caffc7bf0e..5b18eeb42d 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -61,7 +61,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = {EVO_TRADE_ITEM, ITEM_NONE,/*ITEM_KINGS_ROCK*/ SPECIES_SLOWKING}}, [SPECIES_SLOWBRO] = {{EVO_MEGA_EVOLUTION, ITEM_NONE,/*ITEM_SLOWBRONITE*/ SPECIES_SLOWBRO_MEGA}}, [SPECIES_MAGNEMITE] = {{EVO_LEVEL, 30, SPECIES_MAGNETON}}, - [SPECIES_MAGNETON] = {{EVO_MAP, MAPSEC_NEW_MAUVILLE, SPECIES_MAGNEZONE}, + [SPECIES_MAGNETON] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_MAGNEZONE}, {EVO_ITEM, ITEM_NONE,/*ITEM_THUNDER_STONE*/ SPECIES_MAGNEZONE}}, [SPECIES_DODUO] = {{EVO_LEVEL, 31, SPECIES_DODRIO}}, [SPECIES_SEEL] = {{EVO_LEVEL, 34, SPECIES_DEWGONG}}, @@ -100,9 +100,9 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = {EVO_ITEM, ITEM_NONE,/*ITEM_FIRE_STONE*/ SPECIES_FLAREON}, {EVO_FRIENDSHIP_DAY, 0, SPECIES_ESPEON}, {EVO_FRIENDSHIP_NIGHT, 0, SPECIES_UMBREON}, - {EVO_MAP, MAPSEC_PETALBURG_WOODS, SPECIES_LEAFEON}, + {EVO_SPECIFIC_MAP, MAP_PETALBURG_WOODS, SPECIES_LEAFEON}, {EVO_ITEM, ITEM_NONE,/*ITEM_LEAF_STONE*/ SPECIES_LEAFEON}, - {EVO_MAP, MAPSEC_SHOAL_CAVE, SPECIES_GLACEON}, + {EVO_SPECIFIC_MAP, MAP_SHOAL_CAVE_LOW_TIDE_ICE_ROOM, SPECIES_GLACEON}, {EVO_ITEM, ITEM_NONE,/*ITEM_ICE_STONE*/ SPECIES_GLACEON}, {EVO_MOVE_TYPE, TYPE_FAIRY, SPECIES_SYLVEON}}, [SPECIES_PORYGON] = {{EVO_TRADE_ITEM, ITEM_NONE,/*ITEM_UP_GRADE*/ SPECIES_PORYGON2}}, @@ -195,7 +195,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_WAILMER] = {{EVO_LEVEL, 40, SPECIES_WAILORD}}, [SPECIES_SKITTY] = {{EVO_ITEM, ITEM_NONE,/*ITEM_MOON_STONE*/ SPECIES_DELCATTY}}, [SPECIES_BALTOY] = {{EVO_LEVEL, 36, SPECIES_CLAYDOL}}, - [SPECIES_NOSEPASS] = {{EVO_MAP, MAPSEC_NEW_MAUVILLE, SPECIES_PROBOPASS}}, + [SPECIES_NOSEPASS] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_PROBOPASS}}, [SPECIES_SABLEYE] = {{EVO_MEGA_EVOLUTION, ITEM_NONE,/*ITEM_SABLENITE*/ SPECIES_SABLEYE_MEGA}}, [SPECIES_BARBOACH] = {{EVO_LEVEL, 30, SPECIES_WHISCASH}}, [SPECIES_CORPHISH] = {{EVO_LEVEL, 30, SPECIES_CRAWDAUNT}}, @@ -425,9 +425,9 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_TRUMBEAK] = {{EVO_LEVEL, 28, SPECIES_TOUCANNON}}, [SPECIES_YUNGOOS] = {{EVO_LEVEL_DAY, 20, SPECIES_GUMSHOOS}}, [SPECIES_GRUBBIN] = {{EVO_LEVEL, 20, SPECIES_CHARJABUG}}, - [SPECIES_CHARJABUG] = {{EVO_MAP, MAPSEC_NEW_MAUVILLE, SPECIES_VIKAVOLT}, + [SPECIES_CHARJABUG] = {{EVO_MAPSEC, MAPSEC_NEW_MAUVILLE, SPECIES_VIKAVOLT}, {EVO_ITEM, ITEM_NONE,/*ITEM_THUNDER_STONE*/ SPECIES_VIKAVOLT}}, - [SPECIES_CRABRAWLER] = {{EVO_MAP, 67, SPECIES_CRABOMINABLE}}, + [SPECIES_CRABRAWLER] = {{EVO_MAPSEC, 67, SPECIES_CRABOMINABLE}}, [SPECIES_CUTIEFLY] = {{EVO_LEVEL, 25, SPECIES_RIBOMBEE}}, [SPECIES_ROCKRUFF] = {{EVO_LEVEL_DAY, 25, SPECIES_LYCANROC}, {EVO_LEVEL_NIGHT, 25, SPECIES_LYCANROC_MIDNIGHT}}, diff --git a/src/pokemon.c b/src/pokemon.c index e0e65d50ae..943a64e263 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5969,6 +5969,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u u8 beauty = GetMonData(mon, MON_DATA_BEAUTY, 0); u16 upperPersonality = personality >> 16; u8 holdEffect; + u16 currentMap; if (heldItem == ITEM_ENIGMA_BERRY) holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; @@ -6122,10 +6123,15 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u if (j == WEATHER_RAIN || j == WEATHER_RAIN_THUNDERSTORM || j == WEATHER_DOWNPOUR) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; - case EVO_MAP: + case EVO_MAPSEC: if (gMapHeader.regionMapSectionId == gEvolutionTable[species][i].param) targetSpecies = gEvolutionTable[species][i].targetSpecies; break; + case EVO_SPECIFIC_MAP: + currentMap = ((gSaveBlock1Ptr->location.mapGroup) << 8 | gSaveBlock1Ptr->location.mapNum); + if (currentMap == gEvolutionTable[species][i].param) + targetSpecies = gEvolutionTable[species][i].targetSpecies; + break; } } break;