From b53c913558c5c454922a29c12cd864822b5da3dc Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sat, 29 Apr 2023 18:16:36 +0200 Subject: [PATCH 1/5] Manually port daycare expansion to modern standards --- include/config/pokemon.h | 13 +++-- src/daycare.c | 108 ++++++++++++++++++++++++++------------- 2 files changed, 82 insertions(+), 39 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 1cde573c96..6247217465 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -8,10 +8,15 @@ #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. -#define P_BALL_INHERITING GEN_LATEST // Since Gen 6, Eggs from the Daycare will inherit the Poké Ball from their mother. From Gen7 onwards, the father can pass it down as well, as long as it's of the same species as the mother. +#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. +#define P_BALL_INHERITING GEN_LATEST // Since Gen 6, Eggs from the Daycare will inherit the Poké Ball from their mother. From Gen 7 onwards, the father can pass it down as well, as long as it's of the same species as the mother. +#define P_TM_INHERITANCE GEN_LATEST // Since Gen 6, the father no longer passes down TMs to the baby. +#define P_MOTHER_EGG_MOVE_INHERITANCE GEN_LATEST // Since Gen 6, the mother can also pass down Egg Moves. +#define P_NATURE_INHERITANCE GEN_LATEST // In Gen 3, Everstone grants Ditto and mothers a 50% chance to pass on Nature. Since Gen 4, anyone can pass on nature. Since Gen 5, the chance is 100%. +#define P_ABILITY_INHERITANCE GEN_LATEST // TODO: In B2W2, a female Pokémon has an 80% chance of passing down their ability if bred with a male. Since Gen 6, the chance is 80% for normal ability and 60% for Hidden Ability, and anyone can pass down their abilities if bred with Ditto. NOTE: BW's effect: 60% chance to pass down HA and random for normal ability has been omitted. +#define P_EGG_MOVE_TRANSFER GEN_LATEST // TODO: Starting in Gen 8, if two Pokémon of the same species are together in the Daycare, one knows an Egg Move, and the other has an empty slot, the other Pokémon will receive the Egg Move in the empty slot. // Species-specific 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. diff --git a/src/daycare.c b/src/daycare.c index 803c0cacf9..3feabe9ba9 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -21,11 +21,14 @@ #include "overworld.h" #include "item.h" #include "constants/items.h" +#include "constants/hold_effects.h" #include "constants/moves.h" #include "constants/region_map_sections.h" extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; +#define IS_DITTO(species) (gBaseStats[species].eggGroup1 == EGG_GROUP_DITTO || gBaseStats[species].eggGroup2 == EGG_GROUP_DITTO) + static void ClearDaycareMonMail(struct DaycareMail *mail); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); static u8 GetDaycareCompatibilityScore(struct DayCare *daycare); @@ -425,43 +428,29 @@ static u16 GetEggSpecies(u16 species) static s32 GetParentToInheritNature(struct DayCare *daycare) { - u32 species[DAYCARE_MON_COUNT]; - s32 i; - s32 dittoCount; - s32 parent = -1; + u32 i; + u8 numWithEverstone = 0; + s32 slot = -1; - // search for female gender for (i = 0; i < DAYCARE_MON_COUNT; i++) { - if (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE) - parent = i; + if (ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE + #if P_NATURE_INHERITANCE == GEN_3 + && (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE || IS_DITTO(GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES))) + #endif + ) { + slot = i; + numWithEverstone++; + } } - // search for ditto - for (dittoCount = 0, i = 0; i < DAYCARE_MON_COUNT; i++) - { - species[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES); - if (species[i] == SPECIES_DITTO) - dittoCount++, parent = i; - } - - // coin flip on ...two Dittos - if (dittoCount == DAYCARE_MON_COUNT) - { - if (Random() >= USHRT_MAX / 2) - parent = 0; - else - parent = 1; - } - - // Don't inherit nature if not holding Everstone - if (GetBoxMonData(&daycare->mons[parent].mon, MON_DATA_HELD_ITEM) != ITEM_EVERSTONE - || Random() >= USHRT_MAX / 2) - { - return -1; - } - - return parent; + if (numWithEverstone >= DAYCARE_MON_COUNT) + return Random() & 1; +#if P_NATURE_INHERITANCE > GEN_4 + return slot; +#else + return Random() & 1 ? slot : -1; +#endif } static void _TriggerPendingDaycareEgg(struct DayCare *daycare) @@ -541,7 +530,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) { u16 motherItem = GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM); u16 fatherItem = GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM); - u8 i; + u8 i, start; u8 selectedIvs[5]; u8 availableIVs[NUM_STATS]; u8 whichParents[5]; @@ -557,8 +546,33 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) availableIVs[i] = i; } + start = 0; + if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM && + ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) + { + whichParents[0] = Random() % DAYCARE_MON_COUNT; + selectedIvs[0] = ItemId_GetSecondaryId( + GetBoxMonData(&daycare->mons[whichParents[0]].mon, MON_DATA_HELD_ITEM)); + RemoveIVIndexFromList(availableIVs, selectedIvs[0]); + start++; + } + else if (ItemId_GetHoldEffect(motherItem) == HOLD_EFFECT_POWER_ITEM) + { + whichParents[0] = 0; + selectedIvs[0] = ItemId_GetSecondaryId(motherItem); + RemoveIVIndexFromList(availableIVs, selectedIvs[0]); + start++; + } + else if (ItemId_GetHoldEffect(fatherItem) == HOLD_EFFECT_POWER_ITEM) + { + whichParents[0] = 1; + selectedIvs[0] = ItemId_GetSecondaryId(fatherItem); + RemoveIVIndexFromList(availableIVs, selectedIvs[0]); + start++; + } + // Select which IVs that will be inherited. - for (i = 0; i < howManyIVs; i++) + for (i = start; i < howManyIVs; i++) { // Randomly pick an IV from the available list and stop from being chosen again. // BUG: Instead of removing the IV that was just picked, this @@ -577,7 +591,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) } // Determine which parent each of the selected IVs should inherit from. - for (i = 0; i < howManyIVs; i++) + for (i = start; i < howManyIVs; i++) { whichParents[i] = Random() % DAYCARE_MON_COUNT; } @@ -703,6 +717,28 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru numEggMoves = GetEggMoves(egg, sHatchedEggEggMoves); +#if P_MOTHER_EGG_MOVE_INHERITANCE >= GEN_6 + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (sHatchedEggMotherMoves[i] != MOVE_NONE) + { + for (j = 0; j < numEggMoves; j++) + { + if (sHatchedEggMotherMoves[i] == sHatchedEggEggMoves[j]) + { + if (GiveMoveToMon(egg, sHatchedEggMotherMoves[i]) == MON_HAS_MAX_MOVES) + DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggMotherMoves[i]); + break; + } + } + } + else + { + break; + } + } +#endif + for (i = 0; i < MAX_MON_MOVES; i++) { if (sHatchedEggFatherMoves[i] != MOVE_NONE) @@ -722,6 +758,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru break; } } +#if P_TM_INHERITANCE < GEN_6 for (i = 0; i < MAX_MON_MOVES; i++) { if (sHatchedEggFatherMoves[i] != MOVE_NONE) @@ -737,6 +774,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru } } } +#endif for (i = 0; i < MAX_MON_MOVES; i++) { if (sHatchedEggFatherMoves[i] == MOVE_NONE) From acf4529d8b48587a7033e7cf71251ec8eb97ff06 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 30 Apr 2023 11:25:48 +0200 Subject: [PATCH 2/5] Allow Egg Move transfer for non-eggs --- include/config/pokemon.h | 2 +- include/pokemon.h | 1 + src/daycare.c | 50 ++++++++++++++++++++++++++++++++++++++++ src/pokemon.c | 3 +-- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 6247217465..d6e239515e 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -16,7 +16,7 @@ #define P_MOTHER_EGG_MOVE_INHERITANCE GEN_LATEST // Since Gen 6, the mother can also pass down Egg Moves. #define P_NATURE_INHERITANCE GEN_LATEST // In Gen 3, Everstone grants Ditto and mothers a 50% chance to pass on Nature. Since Gen 4, anyone can pass on nature. Since Gen 5, the chance is 100%. #define P_ABILITY_INHERITANCE GEN_LATEST // TODO: In B2W2, a female Pokémon has an 80% chance of passing down their ability if bred with a male. Since Gen 6, the chance is 80% for normal ability and 60% for Hidden Ability, and anyone can pass down their abilities if bred with Ditto. NOTE: BW's effect: 60% chance to pass down HA and random for normal ability has been omitted. -#define P_EGG_MOVE_TRANSFER GEN_LATEST // TODO: Starting in Gen 8, if two Pokémon of the same species are together in the Daycare, one knows an Egg Move, and the other has an empty slot, the other Pokémon will receive the Egg Move in the empty slot. +#define P_EGG_MOVE_TRANSFER GEN_LATEST // Starting in Gen 8, if two Pokémon of the same species are together in the Daycare, one knows an Egg Move, and the other has an empty slot, the other Pokémon will receive the Egg Move in the empty slot. In Gen 9, if a Pokémon holds a Mirror Herb, it will receive Egg Moves from the other regardless of species. // Species-specific 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. diff --git a/include/pokemon.h b/include/pokemon.h index 581677cae7..2394861060 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -442,6 +442,7 @@ void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest); u8 GetLevelFromMonExp(struct Pokemon *mon); u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon); u16 GiveMoveToMon(struct Pokemon *mon, u16 move); +u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move); void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot); void SetBattleMonMoveSlot(struct BattlePokemon *mon, u16 move, u8 slot); diff --git a/src/daycare.c b/src/daycare.c index 3feabe9ba9..a058ce9052 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -34,6 +34,7 @@ static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare * static u8 GetDaycareCompatibilityScore(struct DayCare *daycare); static void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y); static u8 ModifyBreedingScoreForOvalCharm(u8 score); +static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves); // RAM buffers used to assist with BuildEggMoveset() EWRAM_DATA static u16 sHatchedEggLevelUpMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0}; @@ -164,6 +165,51 @@ static s8 Daycare_FindEmptySpot(struct DayCare *daycare) return -1; } +static void TransferEggMoves(void) +{ + u32 i, j, k, l; + u16 numEggMoves; + struct Pokemon mon; + + for (i = 0; i < DAYCARE_MON_COUNT; i++) + { + if (!GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SANITY_HAS_SPECIES)) + continue; + + // Get list of egg moves for mon + BoxMonToMon(&gSaveBlock1Ptr->daycare.mons[i].mon, &mon); + for (j = 0; j < EGG_MOVES_ARRAY_COUNT; j++) + sHatchedEggEggMoves[j] = MOVE_NONE; + numEggMoves = GetEggMoves(&mon, sHatchedEggEggMoves); + for (j = 0; j < numEggMoves; j++) + { + // Go through other Daycare mons + for (k = 0; k < DAYCARE_MON_COUNT; k++) + { + if (k == i || !GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SANITY_HAS_SPECIES)) + continue; + + // Check if you can inherit from them + if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_SPECIES) != GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SPECIES) + #if P_EGG_MOVE_TRANSFER >= GEN_9 + && GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_HELD_ITEM) != ITEM_MIRROR_HERB + #endif + ) + continue; + + for (l = 0; l < MAX_MON_MOVES; l++) + { + if (GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[k].mon, MON_DATA_MOVE1 + l) != sHatchedEggEggMoves[j]) + continue; + + if (GiveMoveToBoxMon(&gSaveBlock1Ptr->daycare.mons[i].mon, sHatchedEggEggMoves[j]) == MON_HAS_MAX_MOVES) + break; + } + } + } + } +} + static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycareMon) { if (MonHasMail(mon)) @@ -186,6 +232,10 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar ZeroMonData(mon); CompactPartySlots(); CalculatePlayerPartyCount(); + +#if P_EGG_MOVE_TRANSFER >= GEN_8 + TransferEggMoves(); +#endif } static void StorePokemonInEmptyDaycareSlot(struct Pokemon *mon, struct DayCare *daycare) diff --git a/src/pokemon.c b/src/pokemon.c index e82cb98c30..5b83e97488 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -63,7 +63,6 @@ static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 perso static void EncryptBoxMon(struct BoxPokemon *boxMon); static void DecryptBoxMon(struct BoxPokemon *boxMon); static void Task_PlayMapChosenOrBattleBGM(u8 taskId); -static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); static bool8 ShouldSkipFriendshipChange(void); static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv); void TrySpecialOverworldEvo(); @@ -4194,7 +4193,7 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move) return GiveMoveToBoxMon(&mon->box, move); } -static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) +u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) From 21fa91b80b76b8e4b67b8ea0df45c94bc7d078de Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 30 Apr 2023 11:45:24 +0200 Subject: [PATCH 3/5] Add ClearHatchedEggMoves per SBird's suggestion Co-Authored-By: Philipp AUER --- src/daycare.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/daycare.c b/src/daycare.c index a058ce9052..2997578d5f 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -165,6 +165,14 @@ static s8 Daycare_FindEmptySpot(struct DayCare *daycare) return -1; } +static void ClearHatchedEggMoves(void) +{ + u16 i; + + for (i = 0; i < EGG_MOVES_ARRAY_COUNT; i++) + sHatchedEggEggMoves[i] = MOVE_NONE; +} + static void TransferEggMoves(void) { u32 i, j, k, l; @@ -176,10 +184,8 @@ static void TransferEggMoves(void) if (!GetBoxMonData(&gSaveBlock1Ptr->daycare.mons[i].mon, MON_DATA_SANITY_HAS_SPECIES)) continue; - // Get list of egg moves for mon BoxMonToMon(&gSaveBlock1Ptr->daycare.mons[i].mon, &mon); - for (j = 0; j < EGG_MOVES_ARRAY_COUNT; j++) - sHatchedEggEggMoves[j] = MOVE_NONE; + ClearHatchedEggMoves(); numEggMoves = GetEggMoves(&mon, sHatchedEggEggMoves); for (j = 0; j < numEggMoves; j++) { @@ -753,8 +759,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru sHatchedEggFatherMoves[i] = MOVE_NONE; sHatchedEggFinalMoves[i] = MOVE_NONE; } - for (i = 0; i < EGG_MOVES_ARRAY_COUNT; i++) - sHatchedEggEggMoves[i] = MOVE_NONE; + ClearHatchedEggMoves(); for (i = 0; i < EGG_LVL_UP_MOVES_ARRAY_COUNT; i++) sHatchedEggLevelUpMoves[i] = MOVE_NONE; From 8f75844ece7546df6b06db53302685f458c1f8b9 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 30 Apr 2023 12:58:18 +0200 Subject: [PATCH 4/5] Add Ability inheritance --- include/config/pokemon.h | 2 +- src/daycare.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/config/pokemon.h b/include/config/pokemon.h index d6e239515e..a65eddb73c 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -15,7 +15,7 @@ #define P_TM_INHERITANCE GEN_LATEST // Since Gen 6, the father no longer passes down TMs to the baby. #define P_MOTHER_EGG_MOVE_INHERITANCE GEN_LATEST // Since Gen 6, the mother can also pass down Egg Moves. #define P_NATURE_INHERITANCE GEN_LATEST // In Gen 3, Everstone grants Ditto and mothers a 50% chance to pass on Nature. Since Gen 4, anyone can pass on nature. Since Gen 5, the chance is 100%. -#define P_ABILITY_INHERITANCE GEN_LATEST // TODO: In B2W2, a female Pokémon has an 80% chance of passing down their ability if bred with a male. Since Gen 6, the chance is 80% for normal ability and 60% for Hidden Ability, and anyone can pass down their abilities if bred with Ditto. NOTE: BW's effect: 60% chance to pass down HA and random for normal ability has been omitted. +#define P_ABILITY_INHERITANCE GEN_LATEST // In B2W2, a female Pokémon has an 80% chance of passing down their ability if bred with a male. Since Gen 6, the chance is 80% for normal ability and 60% for Hidden Ability, and anyone can pass down their abilities if bred with Ditto. NOTE: BW's effect: 60% chance to pass down HA and random for normal ability has been omitted. #define P_EGG_MOVE_TRANSFER GEN_LATEST // Starting in Gen 8, if two Pokémon of the same species are together in the Daycare, one knows an Egg Move, and the other has an empty slot, the other Pokémon will receive the Egg Move in the empty slot. In Gen 9, if a Pokémon holds a Mirror Herb, it will receive Egg Moves from the other regardless of species. // Species-specific settings diff --git a/src/daycare.c b/src/daycare.c index 2997578d5f..08b9ec23fc 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -712,6 +712,35 @@ static void InheritPokeball(struct Pokemon *egg, struct BoxPokemon *father, stru SetMonData(egg, MON_DATA_POKEBALL, &inheritBall); } +static void InheritAbility(struct Pokemon *egg, struct BoxPokemon *father, struct BoxPokemon *mother) +{ + u8 fatherAbility = GetBoxMonData(father, MON_DATA_ABILITY_NUM); + u8 motherAbility = GetBoxMonData(mother, MON_DATA_ABILITY_NUM); + u8 motherSpecies = GetBoxMonData(mother, MON_DATA_SPECIES); + u8 inheritAbility = motherAbility; + + if (motherSpecies == SPECIES_DITTO) + #if P_ABILITY_INHERITANCE < GEN_6 + return; + #else + inheritAbility = fatherAbility; + #endif + + if (inheritAbility < 2 && (Random() % 10 < 8)) + { + SetMonData(egg, MON_DATA_ABILITY_NUM, &inheritAbility); + } +#if P_ABILITY_INHERITANCE < GEN_6 + else if (Random() % 10 < 8) +#else + else if (Random() % 10 < 6) +#endif + { + // Hidden Abilities have a different chance of being passed down + SetMonData(egg, MON_DATA_ABILITY_NUM, &inheritAbility); + } +} + // Counts the number of egg moves a pokemon learns and stores the moves in // the given array. static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves) @@ -1000,6 +1029,9 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) InheritIVs(&egg, daycare); InheritPokeball(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); BuildEggMoveset(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); +#if P_ABILITY_INHERITANCE >= GEN_8 + InheritAbility(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); +#endif GiveMoveIfItem(&egg, daycare); From f1d60a4a04b13882c91ef2b5a0496119675e246b Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Sun, 30 Apr 2023 22:52:37 +0200 Subject: [PATCH 5/5] Fixed wrong generation in check --- src/daycare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/daycare.c b/src/daycare.c index 08b9ec23fc..31a7bade05 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1029,7 +1029,7 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) InheritIVs(&egg, daycare); InheritPokeball(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); BuildEggMoveset(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); -#if P_ABILITY_INHERITANCE >= GEN_8 +#if P_ABILITY_INHERITANCE >= GEN_6 InheritAbility(&egg, &daycare->mons[parentSlots[1]].mon, &daycare->mons[parentSlots[0]].mon); #endif