Implemented Shiny Lock functionality

This commit is contained in:
Eduardo Quezada 2022-09-04 21:55:59 -03:00
parent 74c3fdfba7
commit a4c242f2f8
2 changed files with 12 additions and 2 deletions

View File

@ -351,6 +351,7 @@
#define FLAG_HISUIAN_FORM (1 << 5) #define FLAG_HISUIAN_FORM (1 << 5)
#define FLAG_GENDER_DIFFERENCE (1 << 6) #define FLAG_GENDER_DIFFERENCE (1 << 6)
#define FLAG_ALL_PERFECT_IVS (1 << 7) #define FLAG_ALL_PERFECT_IVS (1 << 7)
#define FLAG_SHINY_LOCKED (1 << 8)
#define LEGENDARY_PERFECT_IV_COUNT 3 #define LEGENDARY_PERFECT_IV_COUNT 3

View File

@ -3301,14 +3301,23 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
} }
else // Player is the OT else // Player is the OT
{ {
u32 shinyValue;
value = gSaveBlock2Ptr->playerTrainerId[0] value = gSaveBlock2Ptr->playerTrainerId[0]
| (gSaveBlock2Ptr->playerTrainerId[1] << 8) | (gSaveBlock2Ptr->playerTrainerId[1] << 8)
| (gSaveBlock2Ptr->playerTrainerId[2] << 16) | (gSaveBlock2Ptr->playerTrainerId[2] << 16)
| (gSaveBlock2Ptr->playerTrainerId[3] << 24); | (gSaveBlock2Ptr->playerTrainerId[3] << 24);
if (CheckBagHasItem(ITEM_SHINY_CHARM, 1)) if (gBaseStats[species].flags & FLAG_SHINY_LOCKED)
{
do
{
// Choose random personalities until one that results in a non-shiny Pokémon
personality = Random32();
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
} while (shinyValue < SHINY_ODDS);
}
else if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
{ {
u32 shinyValue;
u32 rolls = 0; u32 rolls = 0;
do do
{ {