From 5ac19e429f186f5f14d793fec698e62c33fc1a19 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 16 Jul 2024 13:59:20 -0400 Subject: [PATCH 01/13] Fixed non-regional forms breeding incorrectly- --- include/constants/regions.h | 19 +++++++++++++++++++ include/pokemon.h | 3 +++ src/daycare.c | 21 ++++++++++++++------- src/pokemon.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 include/constants/regions.h diff --git a/include/constants/regions.h b/include/constants/regions.h new file mode 100644 index 000000000000..9ce490b840b0 --- /dev/null +++ b/include/constants/regions.h @@ -0,0 +1,19 @@ +#ifndef GUARD_CONSTANTS_REGIONS_H +#define GUARD_CONSTANTS_REGIONS_H + +// Core-series regions +#define REGION_KANTO 0 +#define REGION_JOHTO 1 +#define REGION_HOENN 2 +#define REGION_SINNOH 3 +#define REGION_UNOVA 4 +#define REGION_KALOS 5 +#define REGION_ALOLA 6 +#define REGION_GALAR 7 +#define REGION_HISUI 8 +#define REGION_PALDEA 9 + +// TODO: Since there's no current multi-region support, we have this constant for the purposes of regional form comparisons. +#define REGION_CURRENT REGION_HOENN + +#endif // GUARD_CONSTANTS_REGIONS_H diff --git a/include/pokemon.h b/include/pokemon.h index a4a7ad47a006..231b70b912c6 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -3,6 +3,7 @@ #include "sprite.h" #include "constants/items.h" +#include "constants/regions.h" #include "constants/region_map_sections.h" #include "constants/map_groups.h" #include "contest_effect.h" @@ -804,5 +805,7 @@ u16 GetSpeciesPreEvolution(u16 species); void HealPokemon(struct Pokemon *mon); void HealBoxPokemon(struct BoxPokemon *boxMon); const u8 *GetMoveName(u16 moveId); +u16 GetRegionalForm(u32 species, u32 region); +bool32 IsSpeciesForeignRegionalForm(u32 species); #endif // GUARD_POKEMON_H diff --git a/src/daycare.c b/src/daycare.c index d007de359ded..6fb0d3f9ed93 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1039,7 +1039,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent u16 i; u16 species[DAYCARE_MON_COUNT]; u16 eggSpecies, parentSpecies; - bool8 hasMotherEverstone, hasFatherEverstone; + bool32 hasMotherEverstone, hasFatherEverstone, motherIsForeign, fatherIsForeign; + bool32 motherEggSpecies, fatherEggSpecies; for (i = 0; i < DAYCARE_MON_COUNT; i++) { @@ -1056,15 +1057,21 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent } } + motherEggSpecies = GetEggSpecies(species[parentSlots[0]]); + fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]); hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; - - if (hasMotherEverstone) - parentSpecies = species[parentSlots[0]]; - else if (hasFatherEverstone && GET_BASE_SPECIES_ID(GetEggSpecies(species[parentSlots[0]])) == GET_BASE_SPECIES_ID(GetEggSpecies(species[parentSlots[1]]))) - parentSpecies = species[parentSlots[1]]; + motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies); + fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies); + + if (motherIsForeign && hasMotherEverstone) + parentSpecies = motherEggSpecies; + else if (fatherIsForeign && hasFatherEverstone && GET_BASE_SPECIES_ID(motherEggSpecies) == GET_BASE_SPECIES_ID(fatherEggSpecies)) + parentSpecies = fatherEggSpecies; + else if (motherIsForeign) + parentSpecies = GetRegionalForm(motherEggSpecies, REGION_CURRENT); else - parentSpecies = GET_BASE_SPECIES_ID(GetEggSpecies(species[parentSlots[0]])); + parentSpecies = motherEggSpecies; eggSpecies = GetEggSpecies(parentSpecies); diff --git a/src/pokemon.c b/src/pokemon.c index 240dab132286..7d4b227792c9 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -52,6 +52,7 @@ #include "constants/items.h" #include "constants/layouts.h" #include "constants/moves.h" +#include "constants/regions.h" #include "constants/songs.h" #include "constants/trainers.h" #include "constants/union_room.h" @@ -6573,3 +6574,33 @@ const u8 *GetMoveName(u16 moveId) { return gMovesInfo[moveId].name; } + +u16 GetRegionalForm(u32 species, u32 region) +{ + u32 formId = 0; + u32 foundSpecies = 0; + + if (GetSpeciesFormTable(species) != NULL) + { + for (formId = 0; GetSpeciesFormTable(species)[formId] != FORM_SPECIES_END; formId++) + { + foundSpecies = GetSpeciesFormTable(species)[formId]; + if ((gSpeciesInfo[foundSpecies].isAlolanForm && region == REGION_ALOLA) + || (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR) + || (gSpeciesInfo[foundSpecies].isHisuianForm && region == REGION_HISUI) + || (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR)) + return foundSpecies; + } + } + return species; +} + +bool32 IsSpeciesForeignRegionalForm(u32 species) +{ + if ((gSpeciesInfo[species].isAlolanForm && REGION_CURRENT != REGION_ALOLA) + || (gSpeciesInfo[species].isGalarianForm && REGION_CURRENT != REGION_GALAR) + || (gSpeciesInfo[species].isHisuianForm && REGION_CURRENT != REGION_HISUI) + || (gSpeciesInfo[species].isGalarianForm && REGION_CURRENT != REGION_GALAR)) + return TRUE; + return FALSE; +} From 5c3ef5af9316b4078256a9169f29303845151eb7 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 16 Jul 2024 14:16:23 -0400 Subject: [PATCH 02/13] Fixed Paldean form check --- src/pokemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 7d4b227792c9..11a66ccfb9ce 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6588,7 +6588,7 @@ u16 GetRegionalForm(u32 species, u32 region) if ((gSpeciesInfo[foundSpecies].isAlolanForm && region == REGION_ALOLA) || (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR) || (gSpeciesInfo[foundSpecies].isHisuianForm && region == REGION_HISUI) - || (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR)) + || (gSpeciesInfo[foundSpecies].isPaldeanForm && region == REGION_PALDEA)) return foundSpecies; } } @@ -6600,7 +6600,7 @@ bool32 IsSpeciesForeignRegionalForm(u32 species) if ((gSpeciesInfo[species].isAlolanForm && REGION_CURRENT != REGION_ALOLA) || (gSpeciesInfo[species].isGalarianForm && REGION_CURRENT != REGION_GALAR) || (gSpeciesInfo[species].isHisuianForm && REGION_CURRENT != REGION_HISUI) - || (gSpeciesInfo[species].isGalarianForm && REGION_CURRENT != REGION_GALAR)) + || (gSpeciesInfo[species].isPaldeanForm && REGION_CURRENT != REGION_PALDEA)) return TRUE; return FALSE; } From 9f2e70240254f8e71359c3a42808c0eac3324d29 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 16 Jul 2024 14:21:14 -0400 Subject: [PATCH 03/13] Region argument for IsSpeciesForeignRegionalForm --- include/pokemon.h | 2 +- src/daycare.c | 4 ++-- src/pokemon.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 231b70b912c6..353578fb5f5b 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -806,6 +806,6 @@ void HealPokemon(struct Pokemon *mon); void HealBoxPokemon(struct BoxPokemon *boxMon); const u8 *GetMoveName(u16 moveId); u16 GetRegionalForm(u32 species, u32 region); -bool32 IsSpeciesForeignRegionalForm(u32 species); +bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion); #endif // GUARD_POKEMON_H diff --git a/src/daycare.c b/src/daycare.c index 6fb0d3f9ed93..ce9799550284 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1061,8 +1061,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]); hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; - motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies); - fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies); + motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT); + fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT); if (motherIsForeign && hasMotherEverstone) parentSpecies = motherEggSpecies; diff --git a/src/pokemon.c b/src/pokemon.c index 11a66ccfb9ce..67bb5cce3a1e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6595,12 +6595,12 @@ u16 GetRegionalForm(u32 species, u32 region) return species; } -bool32 IsSpeciesForeignRegionalForm(u32 species) +bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion) { - if ((gSpeciesInfo[species].isAlolanForm && REGION_CURRENT != REGION_ALOLA) - || (gSpeciesInfo[species].isGalarianForm && REGION_CURRENT != REGION_GALAR) - || (gSpeciesInfo[species].isHisuianForm && REGION_CURRENT != REGION_HISUI) - || (gSpeciesInfo[species].isPaldeanForm && REGION_CURRENT != REGION_PALDEA)) + if ((gSpeciesInfo[species].isAlolanForm && currentRegion != REGION_ALOLA) + || (gSpeciesInfo[species].isGalarianForm && currentRegion != REGION_GALAR) + || (gSpeciesInfo[species].isHisuianForm && currentRegion != REGION_HISUI) + || (gSpeciesInfo[species].isPaldeanForm && currentRegion != REGION_PALDEA)) return TRUE; return FALSE; } From 982bcd5281c59f0202896d9e4a767e3dad5b604b Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 15:57:06 -0300 Subject: [PATCH 04/13] Daycare tests --- include/daycare.h | 1 + src/daycare.c | 5 +++- test/daycare.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 test/daycare.c diff --git a/include/daycare.h b/include/daycare.h index 4d5b470f8b3e..37a325d6556c 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -34,5 +34,6 @@ void ShowDaycareLevelMenu(void); void ChooseSendDaycareMon(void); u8 GetEggMovesBySpecies(u16 species, u16 *eggMoves); bool8 SpeciesCanLearnEggMove(u16 species, u16 move); +void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycareMon); #endif // GUARD_DAYCARE_H diff --git a/src/daycare.c b/src/daycare.c index 22c438d5ab01..2fdbe3c7ef1d 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -244,7 +244,7 @@ static void TransferEggMoves(void) } } -static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycareMon) +void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycareMon) { if (MonHasMail(mon)) { @@ -1062,6 +1062,9 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) u8 parentSlots[DAYCARE_MON_COUNT] = {0}; bool8 isEgg; + if (GetDaycareCompatibilityScore(daycare) == PARENTS_INCOMPATIBLE) + return; + species = DetermineEggSpeciesAndParentSlots(daycare, parentSlots); if (P_INCENSE_BREEDING < GEN_9) AlterEggSpeciesWithIncenseItem(&species, daycare); diff --git a/test/daycare.c b/test/daycare.c new file mode 100644 index 000000000000..20af0fb5017c --- /dev/null +++ b/test/daycare.c @@ -0,0 +1,66 @@ +#include "global.h" +#include "daycare.h" +#include "event_data.h" +#include "malloc.h" +#include "party_menu.h" +#include "test/overworld_script.h" +#include "test/test.h" + +// We don't run the StoreSelectedPokemonInDaycare special because it relies on calling the +// party select screen and the GetCursorSelectionMonId function, so we store directly to the struct. +#define STORE_IN_DAYCARE_AND_GET_EGG() \ + StorePokemonInDaycare(&gPlayerParty[0], &gSaveBlock1Ptr->daycare.mons[0]); \ + StorePokemonInDaycare(&gPlayerParty[0], &gSaveBlock1Ptr->daycare.mons[1]); \ + RUN_OVERWORLD_SCRIPT( special GiveEggFromDaycare; ); + +TEST("Daycare Pokémon generate Eggs of the lowest member of the evolutionary family") +{ + ASSUME(P_FAMILY_PIKACHU == TRUE); + ASSUME(P_GEN_2_CROSS_EVOS == TRUE); + + ZeroPlayerPartyMons(); + RUN_OVERWORLD_SCRIPT( + givemon SPECIES_PIKACHU, 100, gender=MON_MALE; + givemon SPECIES_PIKACHU, 100, gender=MON_FEMALE; + ); + STORE_IN_DAYCARE_AND_GET_EGG(); + + EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_PICHU); +} + +TEST("Daycare Pokémon offspring species is based off the mother's species") +{ + u32 offspring = 0; + ASSUME(P_FAMILY_PIKACHU == TRUE); + ASSUME(P_GEN_2_CROSS_EVOS == TRUE); + ASSUME(P_FAMILY_RIOLU == TRUE); + + ZeroPlayerPartyMons(); + PARAMETRIZE { offspring = SPECIES_RIOLU; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PIKACHU, 100, gender=MON_MALE; givemon SPECIES_LUCARIO, 100, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_PICHU; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PIKACHU, 100, gender=MON_FEMALE; givemon SPECIES_LUCARIO, 100, gender=MON_MALE;); } + STORE_IN_DAYCARE_AND_GET_EGG(); + + EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); +} + +TEST("Daycare Pokémon can breed with Ditto if they don't belong to the Ditto or No Eggs Discovered group") +{ + u32 j = 0; + u32 parentSpecies = 0; + + ZeroPlayerPartyMons(); + for (j = 1; j < NUM_SPECIES; j++) + PARAMETRIZE { parentSpecies = j; } + VarSet(VAR_TEMP_C, parentSpecies); + RUN_OVERWORLD_SCRIPT( + givemon SPECIES_DITTO, 100; givemon VAR_TEMP_C, 100; + ); + STORE_IN_DAYCARE_AND_GET_EGG(); + + if (gSpeciesInfo[parentSpecies].eggGroups[0] != EGG_GROUP_NO_EGGS_DISCOVERED + && gSpeciesInfo[parentSpecies].eggGroups[0] != EGG_GROUP_DITTO) + EXPECT_NE(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); + else + EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); + +} From 1814960df32e7be1bf440e76deb18365b945a2ab Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 16:44:03 -0300 Subject: [PATCH 05/13] Regional form tests --- include/pokemon.h | 2 +- src/daycare.c | 4 ++-- src/pokemon.c | 27 +++++++++++++++++---------- test/daycare.c | 23 +++++++++++++++++++++++ 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 0d27d5cb1b2c..40de3f023ef2 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -911,7 +911,7 @@ const u8 *GetMoveAnimationScript(u16 moveId); void UpdateDaysPassedSinceFormChange(u16 days); void TrySetDayLimitToFormChange(struct Pokemon *mon); u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler); -u16 GetRegionalForm(u32 species, u32 region); +u32 GetRegionalForm(u32 species, u32 region); bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion); #endif // GUARD_POKEMON_H diff --git a/src/daycare.c b/src/daycare.c index 2fdbe3c7ef1d..d479954aa0d5 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1002,8 +1002,8 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent motherEggSpecies = GetEggSpecies(species[parentSlots[0]]); fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]); - hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; - hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; + hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[0]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; + hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[1]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT); fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT); diff --git a/src/pokemon.c b/src/pokemon.c index ab6a397be762..ac5459340735 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6979,22 +6979,29 @@ u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler) return gMovesInfo[move].type; } -u16 GetRegionalForm(u32 species, u32 region) +u32 GetRegionalForm(u32 species, u32 region) { u32 formId = 0; - u32 foundSpecies = 0; + u32 firstFoundSpecies = 0; + const u16 *formTable = GetSpeciesFormTable(species); - if (GetSpeciesFormTable(species) != NULL) + if (formTable != NULL) { - for (formId = 0; GetSpeciesFormTable(species)[formId] != FORM_SPECIES_END; formId++) + for (formId = 0; formTable[formId] != FORM_SPECIES_END; formId++) { - foundSpecies = GetSpeciesFormTable(species)[formId]; - if ((gSpeciesInfo[foundSpecies].isAlolanForm && region == REGION_ALOLA) - || (gSpeciesInfo[foundSpecies].isGalarianForm && region == REGION_GALAR) - || (gSpeciesInfo[foundSpecies].isHisuianForm && region == REGION_HISUI) - || (gSpeciesInfo[foundSpecies].isPaldeanForm && region == REGION_PALDEA)) - return foundSpecies; + if (firstFoundSpecies == 0) + firstFoundSpecies = formTable[formId]; + + if ((gSpeciesInfo[formTable[formId]].isAlolanForm && region == REGION_ALOLA) + || (gSpeciesInfo[formTable[formId]].isGalarianForm && region == REGION_GALAR) + || (gSpeciesInfo[formTable[formId]].isHisuianForm && region == REGION_HISUI) + || (gSpeciesInfo[formTable[formId]].isPaldeanForm && region == REGION_PALDEA)) + { + return formTable[formId]; + } } + if (firstFoundSpecies != 0) + return firstFoundSpecies; } return species; } diff --git a/test/daycare.c b/test/daycare.c index 20af0fb5017c..7dc6a6d78964 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -64,3 +64,26 @@ TEST("Daycare Pokémon can breed with Ditto if they don't belong to the Ditto or EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); } + +TEST("Daycare Pokémon with regional forms give the correct offspring") +{ + u32 offspring = 0; + ASSUME(P_FAMILY_MEOWTH == TRUE); + ASSUME(P_ALOLAN_FORMS == TRUE); + ASSUME(P_GALARIAN_FORMS == TRUE); + ASSUME(REGION_CURRENT == REGION_HOENN); + + ZeroPlayerPartyMons(); + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + // Cases provided by cawtds + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + //PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + STORE_IN_DAYCARE_AND_GET_EGG(); + + EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); +} From 54cddb12e6fb79f061a4ee6039267d4d0827dd2e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 17:02:01 -0300 Subject: [PATCH 06/13] Finally fixed it --- src/daycare.c | 4 ++-- test/daycare.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/daycare.c b/src/daycare.c index d479954aa0d5..7f154b96eceb 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1007,9 +1007,9 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT); fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT); - if (motherIsForeign && hasMotherEverstone) + if (hasMotherEverstone) parentSpecies = motherEggSpecies; - else if (fatherIsForeign && hasFatherEverstone && GET_BASE_SPECIES_ID(motherEggSpecies) == GET_BASE_SPECIES_ID(fatherEggSpecies)) + else if (fatherIsForeign && hasFatherEverstone) parentSpecies = fatherEggSpecies; else if (motherIsForeign) parentSpecies = GetRegionalForm(motherEggSpecies, REGION_CURRENT); diff --git a/test/daycare.c b/test/daycare.c index 7dc6a6d78964..19957e7ba700 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -82,7 +82,7 @@ TEST("Daycare Pokémon with regional forms give the correct offspring") PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } - //PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } STORE_IN_DAYCARE_AND_GET_EGG(); EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); From 74fea0d520bed742d0254818cc9cba8ccb55417e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 17:03:52 -0300 Subject: [PATCH 07/13] Regions to enum --- include/constants/regions.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/include/constants/regions.h b/include/constants/regions.h index 9ce490b840b0..e943c80a6f16 100644 --- a/include/constants/regions.h +++ b/include/constants/regions.h @@ -2,16 +2,20 @@ #define GUARD_CONSTANTS_REGIONS_H // Core-series regions -#define REGION_KANTO 0 -#define REGION_JOHTO 1 -#define REGION_HOENN 2 -#define REGION_SINNOH 3 -#define REGION_UNOVA 4 -#define REGION_KALOS 5 -#define REGION_ALOLA 6 -#define REGION_GALAR 7 -#define REGION_HISUI 8 -#define REGION_PALDEA 9 +enum Region +{ + REGION_KANTO, + REGION_JOHTO, + REGION_HOENN, + REGION_SINNOH, + REGION_UNOVA, + REGION_KALOS, + REGION_ALOLA, + REGION_GALAR, + REGION_HISUI, + REGION_PALDEA, + REGION_COUNT, +} // TODO: Since there's no current multi-region support, we have this constant for the purposes of regional form comparisons. #define REGION_CURRENT REGION_HOENN From 96b58c024c4742f542eff60f3cefbfa850d33136 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 17:05:29 -0300 Subject: [PATCH 08/13] oops --- include/constants/regions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/regions.h b/include/constants/regions.h index e943c80a6f16..9e2122b9ea9b 100644 --- a/include/constants/regions.h +++ b/include/constants/regions.h @@ -15,7 +15,7 @@ enum Region REGION_HISUI, REGION_PALDEA, REGION_COUNT, -} +}; // TODO: Since there's no current multi-region support, we have this constant for the purposes of regional form comparisons. #define REGION_CURRENT REGION_HOENN From bcccbaf073435573b832f2eeb0d57f0731839c9d Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Tue, 31 Dec 2024 17:14:01 -0300 Subject: [PATCH 09/13] REGION_CURRENT to inline function --- include/constants/regions.h | 3 --- include/regions.h | 12 ++++++++++++ src/daycare.c | 14 ++++++++------ test/daycare.c | 3 ++- 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 include/regions.h diff --git a/include/constants/regions.h b/include/constants/regions.h index 9e2122b9ea9b..c81ecc5eac23 100644 --- a/include/constants/regions.h +++ b/include/constants/regions.h @@ -17,7 +17,4 @@ enum Region REGION_COUNT, }; -// TODO: Since there's no current multi-region support, we have this constant for the purposes of regional form comparisons. -#define REGION_CURRENT REGION_HOENN - #endif // GUARD_CONSTANTS_REGIONS_H diff --git a/include/regions.h b/include/regions.h new file mode 100644 index 000000000000..2f44896ea2b0 --- /dev/null +++ b/include/regions.h @@ -0,0 +1,12 @@ +#ifndef GUARD_REGIONS_H +#define GUARD_REGIONS_H + +#include "constants/regions.h" + +static inline u32 GetCurrentRegion(void) +{ + // TODO: Since there's no current multi-region support, we have this constant for the purposes of regional form comparisons. + return REGION_HOENN; +} + +#endif // GUARD_REGIONS_H diff --git a/src/daycare.c b/src/daycare.c index 7f154b96eceb..1bdca7119385 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -21,6 +21,7 @@ #include "list_menu.h" #include "overworld.h" #include "item.h" +#include "regions.h" #include "constants/form_change_types.h" #include "constants/items.h" #include "constants/hold_effects.h" @@ -979,11 +980,12 @@ STATIC_ASSERT(P_SCATTERBUG_LINE_FORM_BREED == SPECIES_SCATTERBUG_ICY_SNOW || (P_ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parentSlots) { - u16 i; - u16 species[DAYCARE_MON_COUNT]; - u16 eggSpecies, parentSpecies; + u32 i; + u32 species[DAYCARE_MON_COUNT]; + u32 eggSpecies, parentSpecies; bool32 hasMotherEverstone, hasFatherEverstone, motherIsForeign, fatherIsForeign; bool32 motherEggSpecies, fatherEggSpecies; + u32 currentRegion = GetCurrentRegion(); for (i = 0; i < DAYCARE_MON_COUNT; i++) { @@ -1004,15 +1006,15 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent fatherEggSpecies = GetEggSpecies(species[parentSlots[1]]); hasMotherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[0]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; hasFatherEverstone = ItemId_GetHoldEffect(GetBoxMonData(&daycare->mons[parentSlots[1]].mon, MON_DATA_HELD_ITEM)) == HOLD_EFFECT_PREVENT_EVOLVE; - motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, REGION_CURRENT); - fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, REGION_CURRENT); + motherIsForeign = IsSpeciesForeignRegionalForm(motherEggSpecies, currentRegion); + fatherIsForeign = IsSpeciesForeignRegionalForm(fatherEggSpecies, currentRegion); if (hasMotherEverstone) parentSpecies = motherEggSpecies; else if (fatherIsForeign && hasFatherEverstone) parentSpecies = fatherEggSpecies; else if (motherIsForeign) - parentSpecies = GetRegionalForm(motherEggSpecies, REGION_CURRENT); + parentSpecies = GetRegionalForm(motherEggSpecies, currentRegion); else parentSpecies = motherEggSpecies; diff --git a/test/daycare.c b/test/daycare.c index 19957e7ba700..c03a9191992b 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -3,6 +3,7 @@ #include "event_data.h" #include "malloc.h" #include "party_menu.h" +#include "regions.h" #include "test/overworld_script.h" #include "test/test.h" @@ -71,7 +72,7 @@ TEST("Daycare Pokémon with regional forms give the correct offspring") ASSUME(P_FAMILY_MEOWTH == TRUE); ASSUME(P_ALOLAN_FORMS == TRUE); ASSUME(P_GALARIAN_FORMS == TRUE); - ASSUME(REGION_CURRENT == REGION_HOENN); + ASSUME(GetCurrentRegion() == REGION_HOENN); ZeroPlayerPartyMons(); PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } From 040cf998bbda8555e81a064ac1524aa529d533a9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 1 Jan 2025 13:14:06 -0300 Subject: [PATCH 10/13] Consolidated function and adjusted names --- include/constants/regions.h | 2 +- include/pokemon.h | 2 +- src/daycare.c | 2 +- src/pokemon.c | 32 ++++++++++++++++++++------------ test/daycare.c | 9 ++++----- 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/include/constants/regions.h b/include/constants/regions.h index c81ecc5eac23..2157a074039f 100644 --- a/include/constants/regions.h +++ b/include/constants/regions.h @@ -14,7 +14,7 @@ enum Region REGION_GALAR, REGION_HISUI, REGION_PALDEA, - REGION_COUNT, + REGIONS_COUNT, }; #endif // GUARD_CONSTANTS_REGIONS_H diff --git a/include/pokemon.h b/include/pokemon.h index 40de3f023ef2..1fcd45979dc2 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -911,7 +911,7 @@ const u8 *GetMoveAnimationScript(u16 moveId); void UpdateDaysPassedSinceFormChange(u16 days); void TrySetDayLimitToFormChange(struct Pokemon *mon); u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler); -u32 GetRegionalForm(u32 species, u32 region); +u32 GetRegionalFormByRegion(u32 species, u32 region); bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion); #endif // GUARD_POKEMON_H diff --git a/src/daycare.c b/src/daycare.c index 1bdca7119385..49fce40c0a3f 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1014,7 +1014,7 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent else if (fatherIsForeign && hasFatherEverstone) parentSpecies = fatherEggSpecies; else if (motherIsForeign) - parentSpecies = GetRegionalForm(motherEggSpecies, currentRegion); + parentSpecies = GetRegionalFormByRegion(motherEggSpecies, currentRegion); else parentSpecies = motherEggSpecies; diff --git a/src/pokemon.c b/src/pokemon.c index ac5459340735..241923b1dfe4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6979,7 +6979,19 @@ u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler) return gMovesInfo[move].type; } -u32 GetRegionalForm(u32 species, u32 region) +bool32 IsSpeciesRegionalFormFromRegion(u32 species, u32 region) +{ + switch (region) + { + case REGION_ALOLA: return gSpeciesInfo[species].isAlolanForm; + case REGION_GALAR: return gSpeciesInfo[species].isGalarianForm; + case REGION_HISUI: return gSpeciesInfo[species].isHisuianForm; + case REGION_PALDEA: return gSpeciesInfo[species].isPaldeanForm; + default: return FALSE; + } +} + +u32 GetRegionalFormByRegion(u32 species, u32 region) { u32 formId = 0; u32 firstFoundSpecies = 0; @@ -6992,13 +7004,8 @@ u32 GetRegionalForm(u32 species, u32 region) if (firstFoundSpecies == 0) firstFoundSpecies = formTable[formId]; - if ((gSpeciesInfo[formTable[formId]].isAlolanForm && region == REGION_ALOLA) - || (gSpeciesInfo[formTable[formId]].isGalarianForm && region == REGION_GALAR) - || (gSpeciesInfo[formTable[formId]].isHisuianForm && region == REGION_HISUI) - || (gSpeciesInfo[formTable[formId]].isPaldeanForm && region == REGION_PALDEA)) - { + if (IsSpeciesRegionalFormFromRegion(formTable[formId], region)) return formTable[formId]; - } } if (firstFoundSpecies != 0) return firstFoundSpecies; @@ -7008,10 +7015,11 @@ u32 GetRegionalForm(u32 species, u32 region) bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion) { - if ((gSpeciesInfo[species].isAlolanForm && currentRegion != REGION_ALOLA) - || (gSpeciesInfo[species].isGalarianForm && currentRegion != REGION_GALAR) - || (gSpeciesInfo[species].isHisuianForm && currentRegion != REGION_HISUI) - || (gSpeciesInfo[species].isPaldeanForm && currentRegion != REGION_PALDEA)) - return TRUE; + u32 i; + for (i = 0; i < REGIONS_COUNT; i++) + { + if (IsSpeciesRegionalFormFromRegion(species, i) && currentRegion != i) + return TRUE; + } return FALSE; } diff --git a/test/daycare.c b/test/daycare.c index c03a9191992b..360e266a863f 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -14,7 +14,7 @@ StorePokemonInDaycare(&gPlayerParty[0], &gSaveBlock1Ptr->daycare.mons[1]); \ RUN_OVERWORLD_SCRIPT( special GiveEggFromDaycare; ); -TEST("Daycare Pokémon generate Eggs of the lowest member of the evolutionary family") +TEST("(Daycare) Pokémon generate Eggs of the lowest member of the evolutionary family") { ASSUME(P_FAMILY_PIKACHU == TRUE); ASSUME(P_GEN_2_CROSS_EVOS == TRUE); @@ -29,7 +29,7 @@ TEST("Daycare Pokémon generate Eggs of the lowest member of the evolutionary fa EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_PICHU); } -TEST("Daycare Pokémon offspring species is based off the mother's species") +TEST("(Daycare) Pokémon offspring species is based off the mother's species") { u32 offspring = 0; ASSUME(P_FAMILY_PIKACHU == TRUE); @@ -44,7 +44,7 @@ TEST("Daycare Pokémon offspring species is based off the mother's species") EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); } -TEST("Daycare Pokémon can breed with Ditto if they don't belong to the Ditto or No Eggs Discovered group") +TEST("(Daycare) Pokémon can breed with Ditto if they don't belong to the Ditto or No Eggs Discovered group") { u32 j = 0; u32 parentSpecies = 0; @@ -63,10 +63,9 @@ TEST("Daycare Pokémon can breed with Ditto if they don't belong to the Ditto or EXPECT_NE(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); else EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); - } -TEST("Daycare Pokémon with regional forms give the correct offspring") +TEST("(Daycare) Pokémon with regional forms give the correct offspring") { u32 offspring = 0; ASSUME(P_FAMILY_MEOWTH == TRUE); From 4950a34a94e6f6fa0d977d3bf75772263da2f773 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 1 Jan 2025 13:29:01 -0300 Subject: [PATCH 11/13] Added Shellos test to make sure that other forms don't get broken --- test/daycare.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/daycare.c b/test/daycare.c index 360e266a863f..7befaeefdfb9 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -65,6 +65,26 @@ TEST("(Daycare) Pokémon can breed with Ditto if they don't belong to the Ditto EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), SPECIES_NONE); } +TEST("(Daycare) Shellos' form is always based on the mother's form") +{ + u32 offspring = 0; + ASSUME(P_FAMILY_MEOWTH == TRUE); + ASSUME(P_ALOLAN_FORMS == TRUE); + ASSUME(P_GALARIAN_FORMS == TRUE); + ASSUME(GetCurrentRegion() == REGION_GALAR); + + ZeroPlayerPartyMons(); + PARAMETRIZE { offspring = SPECIES_SHELLOS_WEST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_EAST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_WEST, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_SHELLOS_WEST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_EAST, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_SHELLOS_WEST, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_SHELLOS_WEST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_EAST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_WEST, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_SHELLOS_EAST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_WEST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_EAST, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_SHELLOS_EAST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_WEST, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_SHELLOS_EAST, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_SHELLOS_EAST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_WEST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_EAST, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + STORE_IN_DAYCARE_AND_GET_EGG(); + + EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); +} + TEST("(Daycare) Pokémon with regional forms give the correct offspring") { u32 offspring = 0; From a37c9596ba0d685ab11502879a742da3fe68d46e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 1 Jan 2025 15:29:06 -0300 Subject: [PATCH 12/13] Fixed mix of logic of regular vs regional forms. Added Alola/Galar tests --- src/pokemon.c | 24 +++++++++++++++++++++++- test/daycare.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 241923b1dfe4..a74b20da7951 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6979,6 +6979,14 @@ u32 CheckDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler) return gMovesInfo[move].type; } +bool32 IsSpeciesRegionalForm(u32 species) +{ + return gSpeciesInfo[species].isAlolanForm + || gSpeciesInfo[species].isGalarianForm + || gSpeciesInfo[species].isHisuianForm + || gSpeciesInfo[species].isPaldeanForm; +} + bool32 IsSpeciesRegionalFormFromRegion(u32 species, u32 region) { switch (region) @@ -6991,6 +6999,18 @@ bool32 IsSpeciesRegionalFormFromRegion(u32 species, u32 region) } } +bool32 SpeciesHasRegionalForm(u32 species) +{ + u32 formId; + const u16 *formTable = GetSpeciesFormTable(species); + for (formId = 0; formTable != NULL && formTable[formId] != FORM_SPECIES_END; formId++) + { + if (IsSpeciesRegionalForm(formTable[formId])) + return TRUE; + } + return FALSE; +} + u32 GetRegionalFormByRegion(u32 species, u32 region) { u32 formId = 0; @@ -7018,7 +7038,9 @@ bool32 IsSpeciesForeignRegionalForm(u32 species, u32 currentRegion) u32 i; for (i = 0; i < REGIONS_COUNT; i++) { - if (IsSpeciesRegionalFormFromRegion(species, i) && currentRegion != i) + if (currentRegion != i && IsSpeciesRegionalFormFromRegion(species, i)) + return TRUE; + else if (currentRegion == i && SpeciesHasRegionalForm(species) && !IsSpeciesRegionalFormFromRegion(species, i)) return TRUE; } return FALSE; diff --git a/test/daycare.c b/test/daycare.c index 7befaeefdfb9..0ebc10201902 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -71,7 +71,6 @@ TEST("(Daycare) Shellos' form is always based on the mother's form") ASSUME(P_FAMILY_MEOWTH == TRUE); ASSUME(P_ALOLAN_FORMS == TRUE); ASSUME(P_GALARIAN_FORMS == TRUE); - ASSUME(GetCurrentRegion() == REGION_GALAR); ZeroPlayerPartyMons(); PARAMETRIZE { offspring = SPECIES_SHELLOS_WEST; RUN_OVERWORLD_SCRIPT(givemon SPECIES_SHELLOS_EAST, 1, gender=MON_MALE; givemon SPECIES_SHELLOS_WEST, 1, gender=MON_FEMALE;); } @@ -91,18 +90,43 @@ TEST("(Daycare) Pokémon with regional forms give the correct offspring") ASSUME(P_FAMILY_MEOWTH == TRUE); ASSUME(P_ALOLAN_FORMS == TRUE); ASSUME(P_GALARIAN_FORMS == TRUE); - ASSUME(GetCurrentRegion() == REGION_HOENN); ZeroPlayerPartyMons(); + + ASSUME(GetCurrentRegion() == REGION_HOENN); PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - // Cases provided by cawtds PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + /* + // Tests for species bred in Alola. Manually tested, as we don't have any Alola maps. + ASSUME(GetCurrentRegion() == REGION_ALOLA); + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + // Tests for species bred in Galar. Manually tested, as we don't have any Galar maps. + ASSUME(GetCurrentRegion() == REGION_GALAR); + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + */ STORE_IN_DAYCARE_AND_GET_EGG(); EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring); From 00c4c692558e5a516b6159f881aa175dfb203895 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 3 Jan 2025 14:05:19 -0300 Subject: [PATCH 13/13] Adjusted test --- include/constants/regions.h | 1 + test/daycare.c | 68 ++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/include/constants/regions.h b/include/constants/regions.h index 2157a074039f..3f7397ced6d5 100644 --- a/include/constants/regions.h +++ b/include/constants/regions.h @@ -4,6 +4,7 @@ // Core-series regions enum Region { + REGION_NONE, REGION_KANTO, REGION_JOHTO, REGION_HOENN, diff --git a/test/daycare.c b/test/daycare.c index 0ebc10201902..1740cc22f5fb 100644 --- a/test/daycare.c +++ b/test/daycare.c @@ -86,47 +86,45 @@ TEST("(Daycare) Shellos' form is always based on the mother's form") TEST("(Daycare) Pokémon with regional forms give the correct offspring") { - u32 offspring = 0; + u32 offspring = 0, region = 0; ASSUME(P_FAMILY_MEOWTH == TRUE); ASSUME(P_ALOLAN_FORMS == TRUE); ASSUME(P_GALARIAN_FORMS == TRUE); ZeroPlayerPartyMons(); - ASSUME(GetCurrentRegion() == REGION_HOENN); - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - /* - // Tests for species bred in Alola. Manually tested, as we don't have any Alola maps. - ASSUME(GetCurrentRegion() == REGION_ALOLA); - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - // Tests for species bred in Galar. Manually tested, as we don't have any Galar maps. - ASSUME(GetCurrentRegion() == REGION_GALAR); - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } - */ + region = GetCurrentRegion(); + if (region == REGION_ALOLA) { + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + } else if (region == REGION_GALAR) { + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + } else { + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_ALOLA; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_ALOLA, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_MEOWTH, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_DIGLETT, 1, gender=MON_MALE; givemon SPECIES_MEOWTH_GALAR, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH_GALAR; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERRSERKER, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + PARAMETRIZE { offspring = SPECIES_MEOWTH; RUN_OVERWORLD_SCRIPT(givemon SPECIES_PERSIAN_ALOLA, 1, gender=MON_MALE, item=ITEM_EVERSTONE; givemon SPECIES_PERSIAN, 1, gender=MON_FEMALE, item=ITEM_EVERSTONE;); } + } STORE_IN_DAYCARE_AND_GET_EGG(); EXPECT_EQ(GetMonData(&gPlayerParty[0], MON_DATA_SPECIES), offspring);