Skip to content

Commit

Permalink
Egg cycle length fix (#5828)
Browse files Browse the repository at this point in the history
Co-authored-by: Hedara <[email protected]>
Co-authored-by: Bassoonian <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 4ac9dea commit e579333
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/config/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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_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_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.
Expand Down
3 changes: 1 addition & 2 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,7 @@ struct DayCare
{
struct DaycareMon mons[DAYCARE_MON_COUNT];
u32 offspringPersonality;
u8 stepCounter;
//u8 padding[3];
u32 stepCounter;
};

struct LilycoveLadyQuiz
Expand Down
8 changes: 7 additions & 1 deletion src/daycare.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,11 +1154,17 @@ static bool8 TryProduceOrHatchEgg(struct DayCare *daycare)
}

// 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;
u8 toSub = GetEggCyclesToSubtract();

daycare->stepCounter = 0;

for (i = 0; i < gPlayerPartyCount; i++)
{
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
Expand Down

0 comments on commit e579333

Please sign in to comment.