diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 3d8d7fd48..b2b08d249 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -9,6 +9,7 @@ #define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. #define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone. #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_SHINY_BASE_CHANCE GEN_LATEST // Since Gen 6, the base chances of encountering a Shiny Pokémon was raised to 1/4096. This config adds an extra roll to the calculation, which effectively does the same thing. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 514c2bd26..006e2a703 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -350,8 +350,7 @@ #define SPECIES_FLAG_HISUIAN_FORM (1 << 6) #define SPECIES_FLAG_GENDER_DIFFERENCE (1 << 7) #define SPECIES_FLAG_ALL_PERFECT_IVS (1 << 8) -#define SPECIES_FLAG_SHINY_LOCKED (1 << 9) -#define SPECIES_FLAG_CANNOT_BE_TRADED (1 << 10) +#define SPECIES_FLAG_CANNOT_BE_TRADED (1 << 9) #define LEGENDARY_PERFECT_IV_COUNT 3 diff --git a/src/pokemon.c b/src/pokemon.c index 5b5410a91..b21c9939c 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3460,16 +3460,32 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, | (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[3] << 24); - if (gBaseStats[species].flags & SPECIES_FLAG_SHINY_LOCKED) +#if P_FLAG_FORCE_NO_SHINY != 0 + if (FlagGet(P_FLAG_FORCE_NO_SHINY)) { while (GET_SHINY_VALUE(value, personality) < SHINY_ODDS) - { personality = Random32(); - } } +#endif +#if P_FLAG_FORCE_SHINY != 0 + #if P_FLAG_FORCE_NO_SHINY != 0 else + #endif + if (FlagGet(P_FLAG_FORCE_SHINY)) { + while (GET_SHINY_VALUE(value, personality) >= SHINY_ODDS) + personality = Random32(); + } +#endif +#if P_FLAG_FORCE_SHINY != 0 || P_FLAG_FORCE_NO_SHINY != 0 + else +#endif + { + #if P_SHINY_BASE_CHANCE >= GEN_6 + u32 totalRerolls = 1; + #else u32 totalRerolls = 0; + #endif if (CheckBagHasItem(ITEM_SHINY_CHARM, 1)) totalRerolls += I_SHINY_CHARM_REROLLS; if (LURE_STEP_COUNT != 0)