mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
Implemented Shiny Lock functionality
This commit is contained in:
parent
74c3fdfba7
commit
a4c242f2f8
@ -351,6 +351,7 @@
|
||||
#define FLAG_HISUIAN_FORM (1 << 5)
|
||||
#define FLAG_GENDER_DIFFERENCE (1 << 6)
|
||||
#define FLAG_ALL_PERFECT_IVS (1 << 7)
|
||||
#define FLAG_SHINY_LOCKED (1 << 8)
|
||||
|
||||
#define LEGENDARY_PERFECT_IV_COUNT 3
|
||||
|
||||
|
@ -3301,14 +3301,23 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
}
|
||||
else // Player is the OT
|
||||
{
|
||||
u32 shinyValue;
|
||||
value = gSaveBlock2Ptr->playerTrainerId[0]
|
||||
| (gSaveBlock2Ptr->playerTrainerId[1] << 8)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[2] << 16)
|
||||
| (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;
|
||||
do
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user