diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 5e3463e677..a44a7c8e0a 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -1,14 +1,21 @@ #ifndef GUARD_CONFIG_POKEMON_H #define GUARD_CONFIG_POKEMON_H +// Species data settings #define P_UPDATED_TYPES GEN_LATEST // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. #define P_UPDATED_STATS GEN_LATEST // Since Gen 6, Pokémon stats are updated with each passing generation. #define P_UPDATED_ABILITIES GEN_LATEST // Since Gen 6, certain Pokémon have their abilities changed. #define P_UPDATED_EGG_GROUPS GEN_LATEST // Since Gen 8, certain Pokémon have gained new egg groups. + +// Breeding settings +#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. +#define P_INCENSE_BREEDING GEN_LATEST // Since Gen 9, cross-generation Baby Pokémon don't require Incense being held by the parents to be obtained via breeding. +#define P_EGG_HATCH_LEVEL GEN_LATEST // Since Gen 4, Pokémon will hatch from eggs at level 1 instead of 5. + +// Other settings #define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. #define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. #define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone. -#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. #define P_HIPPO_GENDER_DIFF_ICONS TRUE // If TRUE, will give Hippopotas and Hippowdon custom icons for their female forms. // Flag settings diff --git a/include/constants/daycare.h b/include/constants/daycare.h index 9af7e6f79c..ac48e4f716 100644 --- a/include/constants/daycare.h +++ b/include/constants/daycare.h @@ -14,7 +14,11 @@ #define DAYCARE_TWO_MONS 3 #define INHERITED_IV_COUNT 3 +#if P_EGG_HATCH_LEVEL >= GEN_4 +#define EGG_HATCH_LEVEL 1 +#else #define EGG_HATCH_LEVEL 5 +#endif #define EGG_GENDER_MALE 0x8000 // used to create a male egg from a female-only parent species (e.g. Nidoran) #define DAYCARE_LEVEL_MENU_EXIT 5 diff --git a/src/daycare.c b/src/daycare.c index a8bdfa0ede..06f11ba9cf 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -742,55 +742,66 @@ void RejectEggFromDayCare(void) RemoveEggFromDayCare(&gSaveBlock1Ptr->daycare); } +static const struct { + u16 currSpecies; + u16 item; + u16 babySpecies; +} IncenseBabyTable[][3] = +{ + // Regular offspring, Item, Incense Offspring + { SPECIES_WOBBUFFET, ITEM_LAX_INCENSE, SPECIES_WYNAUT }, + { SPECIES_MARILL, ITEM_SEA_INCENSE, SPECIES_AZURILL }, + { SPECIES_SNORLAX, ITEM_FULL_INCENSE, SPECIES_MUNCHLAX }, + { SPECIES_CHANSEY, ITEM_LUCK_INCENSE, SPECIES_HAPPINY }, + { SPECIES_MR_MIME, ITEM_ODD_INCENSE, SPECIES_MIME_JR }, + { SPECIES_CHIMECHO, ITEM_PURE_INCENSE, SPECIES_CHINGLING }, + { SPECIES_SUDOWOODO, ITEM_ROCK_INCENSE, SPECIES_BONSLY }, + { SPECIES_ROSELIA, ITEM_ROSE_INCENSE, SPECIES_BUDEW }, + { SPECIES_MANTINE, ITEM_WAVE_INCENSE, SPECIES_MANTYKE }, +}; + static void AlterEggSpeciesWithIncenseItem(u16 *species, struct DayCare *daycare) { + u32 i; u16 motherItem, fatherItem; motherItem = GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM); fatherItem = GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM); - if (*species == SPECIES_WYNAUT && motherItem != ITEM_LAX_INCENSE && fatherItem != ITEM_LAX_INCENSE) - *species = SPECIES_WOBBUFFET; - else if (*species == SPECIES_AZURILL && motherItem != ITEM_SEA_INCENSE && fatherItem != ITEM_SEA_INCENSE) - *species = SPECIES_MARILL; - #ifdef SPECIES_MUNCHLAX - else if (*species == SPECIES_MUNCHLAX && motherItem != ITEM_FULL_INCENSE && fatherItem != ITEM_FULL_INCENSE) - *species = SPECIES_SNORLAX; - #endif - #ifdef SPECIES_HAPPINY - else if (*species == SPECIES_HAPPINY && motherItem != ITEM_LUCK_INCENSE && fatherItem != ITEM_LUCK_INCENSE) - *species = SPECIES_CHANSEY; - #endif - #ifdef SPECIES_MIME_JR - else if (*species == SPECIES_MIME_JR && motherItem != ITEM_ODD_INCENSE && fatherItem != ITEM_ODD_INCENSE) - *species = SPECIES_MR_MIME; - #endif - #ifdef SPECIES_CHINGLING - else if (*species == SPECIES_CHINGLING && motherItem != ITEM_PURE_INCENSE && fatherItem != ITEM_PURE_INCENSE) - *species = SPECIES_CHIMECHO; - #endif - #ifdef SPECIES_BONSLY - else if (*species == SPECIES_BONSLY && motherItem != ITEM_ROCK_INCENSE && fatherItem != ITEM_ROCK_INCENSE) - *species = SPECIES_SUDOWOODO; - #endif - #ifdef SPECIES_BUDEW - else if (*species == SPECIES_BUDEW && motherItem != ITEM_ROSE_INCENSE && fatherItem != ITEM_ROSE_INCENSE) - *species = SPECIES_ROSELIA; - #endif - #ifdef SPECIES_MANTYKE - else if (*species == SPECIES_MANTYKE && motherItem != ITEM_WAVE_INCENSE && fatherItem != ITEM_WAVE_INCENSE) - *species = SPECIES_MANTINE; - #endif + for (i = 0; i < ARRAY_COUNT(IncenseBabyTable); i++) + { + if (IncenseBabyTable[i]->babySpecies == *species && motherItem != IncenseBabyTable[i]->item && fatherItem != IncenseBabyTable[i]->item) + { + *species = IncenseBabyTable[i]->currSpecies; + break; + } + } } -static void GiveVoltTackleIfLightBall(struct Pokemon *mon, struct DayCare *daycare) +static const struct { + u16 offspring; + u16 item; + u16 move; +} BreedingSpecialMoveItemTable[][3] = { + // Offspring, Item, Move + { SPECIES_PICHU, ITEM_LIGHT_BALL, MOVE_VOLT_TACKLE }, +}; + +static void GiveMoveIfItem(struct Pokemon *mon, struct DayCare *daycare) +{ + u16 i, species = GetMonData(mon, MON_DATA_SPECIES); u32 motherItem = GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM); u32 fatherItem = GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM); - if (motherItem == ITEM_LIGHT_BALL || fatherItem == ITEM_LIGHT_BALL) + for (i = 0; i < ARRAY_COUNT(BreedingSpecialMoveItemTable); i++) { - if (GiveMoveToMon(mon, MOVE_VOLT_TACKLE) == MON_HAS_MAX_MOVES) - DeleteFirstMoveAndGiveMoveToMon(mon, MOVE_VOLT_TACKLE); + if (BreedingSpecialMoveItemTable[i]->offspring == species + && (motherItem == BreedingSpecialMoveItemTable[i]->item || + fatherItem == BreedingSpecialMoveItemTable[i]->item)) + { + if (GiveMoveToMon(mon, BreedingSpecialMoveItemTable[i]->move) == MON_HAS_MAX_MOVES) + DeleteFirstMoveAndGiveMoveToMon(mon, BreedingSpecialMoveItemTable[i]->move); + } } } @@ -856,13 +867,14 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) bool8 isEgg; species = DetermineEggSpeciesAndParentSlots(daycare, parentSlots); +#if P_INCENSE_BREEDING < GEN_9 AlterEggSpeciesWithIncenseItem(&species, daycare); +#endif SetInitialEggData(&egg, species, daycare); InheritIVs(&egg, daycare); BuildEggMoveset(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); - if (species == SPECIES_PICHU) - GiveVoltTackleIfLightBall(&egg, daycare); + GiveMoveIfItem(&egg, daycare); isEgg = TRUE; SetMonData(&egg, MON_DATA_IS_EGG, &isEgg);