Fix give daycare egg option giving buggy eggs (#3335)

This commit is contained in:
DizzyEggg 2023-09-22 17:20:00 +02:00 committed by GitHub
parent f564d4492b
commit 662dd7d2c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 26 deletions

View File

@ -143,4 +143,28 @@ DebugScript_HatchAnEgg_Text_EmptyParty::
DebugScript_HatchAnEgg_Text_NotAnEgg:: DebugScript_HatchAnEgg_Text_NotAnEgg::
.string "That's not a Pokémon Egg.$" .string "That's not a Pokémon Egg.$"
DebugScript_ZeroDaycareMons::
msgbox DebugText_DaycareNoPokemon, MSGBOX_DEFAULT
releaseall
end
DebugScript_OneDaycareMons::
msgbox DebugText_DaycareOnePokemon, MSGBOX_DEFAULT
releaseall
end
DebugScript_DaycareMonsNotCompatible::
msgbox DebugText_DaycarePokemonNotCompatible, MSGBOX_DEFAULT
releaseall
end
DebugText_DaycareNoPokemon:
.string "You have no Pokémon at Daycare.$"
DebugText_DaycareOnePokemon:
.string "You have only one Pokémon at Daycare.$"
DebugText_DaycarePokemonNotCompatible:
.string "Your Pokémon at Daycare can't\nhave babies together!$"
.endif .endif

View File

@ -14,6 +14,7 @@ u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest);
u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest); u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest);
u8 CountPokemonInDaycare(struct DayCare *daycare); u8 CountPokemonInDaycare(struct DayCare *daycare);
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail); void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDaycareMail *mixMail);
s8 Daycare_FindEmptySpot(struct DayCare *daycare);
void StoreSelectedPokemonInDaycare(void); void StoreSelectedPokemonInDaycare(void);
u16 TakePokemonFromDaycare(void); u16 TakePokemonFromDaycare(void);
void GetDaycareCost(void); void GetDaycareCost(void);
@ -26,6 +27,7 @@ bool8 ShouldEggHatch(void);
u16 GetSelectedMonNicknameAndSpecies(void); u16 GetSelectedMonNicknameAndSpecies(void);
void GetDaycareMonNicknames(void); void GetDaycareMonNicknames(void);
u8 GetDaycareState(void); u8 GetDaycareState(void);
u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
void SetDaycareCompatibilityString(void); void SetDaycareCompatibilityString(void);
bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio); bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio);
void ShowDaycareLevelMenu(void); void ShowDaycareLevelMenu(void);

View File

@ -32,7 +32,6 @@ extern const struct Evolution gEvolutionTable[][EVOS_PER_MON];
static void ClearDaycareMonMail(struct DaycareMail *mail); static void ClearDaycareMonMail(struct DaycareMail *mail);
static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare); static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare);
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
static void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y); static void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y);
static u8 ModifyBreedingScoreForOvalCharm(u8 score); static u8 ModifyBreedingScoreForOvalCharm(u8 score);
static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves); static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves);
@ -151,7 +150,7 @@ void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDay
mixMail->numDaycareMons = numDaycareMons; mixMail->numDaycareMons = numDaycareMons;
} }
static s8 Daycare_FindEmptySpot(struct DayCare *daycare) s8 Daycare_FindEmptySpot(struct DayCare *daycare)
{ {
u8 i; u8 i;
@ -1230,7 +1229,7 @@ static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2)
return FALSE; return FALSE;
} }
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
{ {
u32 i; u32 i;
u16 eggGroups[DAYCARE_MON_COUNT][EGG_GROUPS_PER_MON]; u16 eggGroups[DAYCARE_MON_COUNT][EGG_GROUPS_PER_MON];

View File

@ -372,24 +372,27 @@ static void DebugAction_Sound_MUS(u8 taskId);
static void DebugAction_Sound_MUS_SelectId(u8 taskId); static void DebugAction_Sound_MUS_SelectId(u8 taskId);
extern u8 Debug_FlagsNotSetOverworldConfigMessage[]; extern const u8 Debug_FlagsNotSetOverworldConfigMessage[];
extern u8 Debug_FlagsNotSetBattleConfigMessage[]; extern const u8 Debug_FlagsNotSetBattleConfigMessage[];
extern u8 Debug_Script_1[]; extern const u8 Debug_Script_1[];
extern u8 Debug_Script_2[]; extern const u8 Debug_Script_2[];
extern u8 Debug_Script_3[]; extern const u8 Debug_Script_3[];
extern u8 Debug_Script_4[]; extern const u8 Debug_Script_4[];
extern u8 Debug_Script_5[]; extern const u8 Debug_Script_5[];
extern u8 Debug_Script_6[]; extern const u8 Debug_Script_6[];
extern u8 Debug_Script_7[]; extern const u8 Debug_Script_7[];
extern u8 Debug_Script_8[]; extern const u8 Debug_Script_8[];
extern const u8 DebugScript_DaycareMonsNotCompatible[];
extern const u8 DebugScript_OneDaycareMons[];
extern const u8 DebugScript_ZeroDaycareMons[];
extern u8 Debug_ShowFieldMessageStringVar4[]; extern const u8 Debug_ShowFieldMessageStringVar4[];
extern u8 Debug_CheatStart[]; extern const u8 Debug_CheatStart[];
extern u8 Debug_HatchAnEgg[]; extern const u8 Debug_HatchAnEgg[];
extern u8 PlayersHouse_2F_EventScript_SetWallClock[]; extern const u8 PlayersHouse_2F_EventScript_SetWallClock[];
extern u8 PlayersHouse_2F_EventScript_CheckWallClock[]; extern const u8 PlayersHouse_2F_EventScript_CheckWallClock[];
extern u8 Debug_CheckSaveBlock[]; extern const u8 Debug_CheckSaveBlock[];
extern u8 Debug_BoxFilledMessage[]; extern const u8 Debug_BoxFilledMessage[];
#include "data/map_group_count.h" #include "data/map_group_count.h"
@ -3467,7 +3470,15 @@ static void DebugAction_Give_MaxBattlePoints(u8 taskId)
static void DebugAction_Give_DayCareEgg(u8 taskId) static void DebugAction_Give_DayCareEgg(u8 taskId)
{ {
TriggerPendingDaycareEgg(); s32 emptySlot = Daycare_FindEmptySpot(&gSaveBlock1Ptr->daycare);
if (emptySlot == 0) // no daycare mons
Debug_DestroyMenu_Full_Script(taskId, DebugScript_ZeroDaycareMons);
else if (emptySlot == 1) // 1 daycare mon
Debug_DestroyMenu_Full_Script(taskId, DebugScript_OneDaycareMons);
else if (GetDaycareCompatibilityScore(&gSaveBlock1Ptr->daycare) == PARENTS_INCOMPATIBLE) // not compatible parents
Debug_DestroyMenu_Full_Script(taskId, DebugScript_DaycareMonsNotCompatible);
else // 2 pokemon which can have a pokemon baby together
TriggerPendingDaycareEgg();
} }
// ******************************* // *******************************