diff --git a/include/constants/pokemon_config.h b/include/constants/pokemon_config.h index c6e6a269f7..6d45eb9be8 100644 --- a/include/constants/pokemon_config.h +++ b/include/constants/pokemon_config.h @@ -16,6 +16,7 @@ #define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation. #define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed. Requires BATTLE_ENGINE for Gen4+ abilities. #define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups. +#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. #ifndef ITEM_EXPANSION //Item Definitions for gEvolutionTable diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 1d5fcc05b8..d77b98a56a 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -8,6 +8,7 @@ #include "evolution_scene.h" #include "evolution_graphics.h" #include "gpu_regs.h" +#include "item.h" #include "link.h" #include "link_rfu.h" #include "m4a.h" @@ -548,7 +549,9 @@ static void CB2_TradeEvolutionSceneUpdate(void) static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) { u32 data = 0; - if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE) + u16 ball = ITEM_POKE_BALL; + if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE + && (P_SHEDINJA_BALL == GEN_3 || CheckBagHasItem(ball, 1))) { s32 i; struct Pokemon* shedinja = &gPlayerParty[gPlayerPartyCount]; @@ -559,6 +562,11 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); + + #if P_SHEDINJA_BALL >= GEN_4 + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball); + RemoveBagItem(ball, 1); + #endif for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++) SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data);