add shiny chaining
This commit is contained in:
parent
8010facac5
commit
608dd9ddc5
3 changed files with 19 additions and 7 deletions
|
@ -1382,7 +1382,7 @@
|
||||||
#define FLAG_NURSE_UNION_ROOM_REMINDER (SYSTEM_FLAGS + 0x20)
|
#define FLAG_NURSE_UNION_ROOM_REMINDER (SYSTEM_FLAGS + 0x20)
|
||||||
|
|
||||||
#define FLAG_SYS_DEXNAV_SEARCH (SYSTEM_FLAGS + 0x21)
|
#define FLAG_SYS_DEXNAV_SEARCH (SYSTEM_FLAGS + 0x21)
|
||||||
#define FLAG_UNUSED_0x882 (SYSTEM_FLAGS + 0x22) // Unused Flag
|
#define FLAG_SHINY_CREATION (SYSTEM_FLAGS + 0x22) // force creation of a shiny mon
|
||||||
#define FLAG_UNUSED_0x883 (SYSTEM_FLAGS + 0x23) // Unused Flag
|
#define FLAG_UNUSED_0x883 (SYSTEM_FLAGS + 0x23) // Unused Flag
|
||||||
#define FLAG_UNUSED_0x884 (SYSTEM_FLAGS + 0x24) // Unused Flag
|
#define FLAG_UNUSED_0x884 (SYSTEM_FLAGS + 0x24) // Unused Flag
|
||||||
#define FLAG_UNUSED_0x885 (SYSTEM_FLAGS + 0x25) // Unused Flag
|
#define FLAG_UNUSED_0x885 (SYSTEM_FLAGS + 0x25) // Unused Flag
|
||||||
|
|
|
@ -1215,6 +1215,9 @@ static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityN
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 perfectIv = 31;
|
u8 perfectIv = 31;
|
||||||
|
|
||||||
|
if (DexNavTryMakeShinyMon())
|
||||||
|
FlagSet(FLAG_SHINY_CREATION); // just easier this way
|
||||||
|
|
||||||
CreateWildMon(species, level); // shiny rate bonus handled in CreateBoxMon
|
CreateWildMon(species, level); // shiny rate bonus handled in CreateBoxMon
|
||||||
|
|
||||||
//Pick potential unique ivs to set to 31
|
//Pick potential unique ivs to set to 31
|
||||||
|
@ -1239,6 +1242,7 @@ static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityN
|
||||||
SetMonMoveSlot(mon, moves[i], i);
|
SetMonMoveSlot(mon, moves[i], i);
|
||||||
|
|
||||||
CalculateMonStats(mon);
|
CalculateMonStats(mon);
|
||||||
|
FlagClear(FLAG_SHINY_CREATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets a random level of the species based on map data.
|
// gets a random level of the species based on map data.
|
||||||
|
|
|
@ -2179,8 +2179,6 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||||
else
|
else
|
||||||
personality = Random32();
|
personality = Random32();
|
||||||
|
|
||||||
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
|
||||||
|
|
||||||
//Determine original trainer ID
|
//Determine original trainer ID
|
||||||
if (otIdType == OT_ID_RANDOM_NO_SHINY) //Pokemon cannot be shiny
|
if (otIdType == OT_ID_RANDOM_NO_SHINY) //Pokemon cannot be shiny
|
||||||
{
|
{
|
||||||
|
@ -2198,11 +2196,21 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||||
else //Player is the OT
|
else //Player is the OT
|
||||||
{
|
{
|
||||||
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 (FlagGet(FLAG_SHINY_CREATION))
|
||||||
|
{
|
||||||
|
u8 nature = personality % NUM_NATURES; // keep current nature
|
||||||
|
do {
|
||||||
|
personality = Random32();
|
||||||
|
personality = ((((Random() % SHINY_ODDS) ^ (HIHALF(value) ^ LOHALF(value))) ^ LOHALF(personality)) << 16) | LOHALF(personality);
|
||||||
|
} while (nature != GetNatureFromPersonality(personality));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||||
SetBoxMonData(boxMon, MON_DATA_OT_ID, &value);
|
SetBoxMonData(boxMon, MON_DATA_OT_ID, &value);
|
||||||
|
|
||||||
checksum = CalculateBoxMonChecksum(boxMon);
|
checksum = CalculateBoxMonChecksum(boxMon);
|
||||||
|
|
Loading…
Reference in a new issue