Egg cycle length fix (#5828)

Co-authored-by: Hedara <hedara90@gmail.com>
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
hedara90 2024-12-20 11:23:51 +01:00 committed by GitHub
parent 4ac9dea30e
commit e579333427
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -55,7 +55,7 @@
#define P_SHOW_TERA_TYPE GEN_8 // Since Gen 9, the Tera Type is shown on the summary screen. #define P_SHOW_TERA_TYPE GEN_8 // Since Gen 9, the Tera Type is shown on the summary screen.
#define P_TM_LITERACY GEN_LATEST // Since Gen 6, TM illiterate Pokémon can learn TMs that teach moves that are in their level-up learnsets. #define P_TM_LITERACY GEN_LATEST // Since Gen 6, TM illiterate Pokémon can learn TMs that teach moves that are in their level-up learnsets.
#define P_CAN_FORGET_HIDDEN_MOVE FALSE // If TRUE, Pokémon can forget any move, even if it is a Hidden Move. #define P_CAN_FORGET_HIDDEN_MOVE FALSE // If TRUE, Pokémon can forget any move, even if it is a Hidden Move.
#define P_EGG_CYCLE_LENGTH GEN_LATEST // Since Gen 8, egg cycles take half as many steps as before. #define P_EGG_CYCLE_LENGTH GEN_LATEST // Since Gen 8, egg cycles take half as many steps as before. Previous Gens have some varied step counts around 255.
#define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny. #define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny.
#define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny #define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny
#define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla. #define P_SHOW_DYNAMIC_TYPES FALSE // If TRUE, all moves with dynamic type changes will be reflected as their current type in battle/summary screens instead of just select ones like in vanilla.

View file

@ -815,8 +815,7 @@ struct DayCare
{ {
struct DaycareMon mons[DAYCARE_MON_COUNT]; struct DaycareMon mons[DAYCARE_MON_COUNT];
u32 offspringPersonality; u32 offspringPersonality;
u8 stepCounter; u32 stepCounter;
//u8 padding[3];
}; };
struct LilycoveLadyQuiz struct LilycoveLadyQuiz

View file

@ -1154,11 +1154,17 @@ static bool8 TryProduceOrHatchEgg(struct DayCare *daycare)
} }
// Try to hatch Egg // Try to hatch Egg
if (++daycare->stepCounter == ((P_EGG_CYCLE_LENGTH >= GEN_8) ? 127 : 255)) daycare->stepCounter++;
if (((P_EGG_CYCLE_LENGTH <= GEN_3 || P_EGG_CYCLE_LENGTH == GEN_7) && daycare->stepCounter >= 256)
|| (P_EGG_CYCLE_LENGTH == GEN_4 && daycare->stepCounter >= 255)
|| ((P_EGG_CYCLE_LENGTH == GEN_5 || P_EGG_CYCLE_LENGTH == GEN_6) && daycare->stepCounter >= 257)
|| (P_EGG_CYCLE_LENGTH >= GEN_8 && daycare->stepCounter >= 128))
{ {
u32 eggCycles; u32 eggCycles;
u8 toSub = GetEggCyclesToSubtract(); u8 toSub = GetEggCyclesToSubtract();
daycare->stepCounter = 0;
for (i = 0; i < gPlayerPartyCount; i++) for (i = 0; i < gPlayerPartyCount; i++)
{ {
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))