mirror of
https://github.com/pret/pokeemerald.git
synced 2026-09-30 22:07:24 -05:00
Fix rerolls overwriting Fixed Personality (#6774)
This commit is contained in:
@@ -1105,7 +1105,7 @@ void CreateMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFix
|
||||
void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
||||
{
|
||||
u8 speciesName[POKEMON_NAME_LENGTH + 1];
|
||||
u32 personality;
|
||||
u32 personality = Random32();
|
||||
u32 value;
|
||||
u16 checksum;
|
||||
u8 i;
|
||||
@@ -1115,11 +1115,6 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
|
||||
ZeroBoxMonData(boxMon);
|
||||
|
||||
if (hasFixedPersonality)
|
||||
personality = fixedPersonality;
|
||||
else
|
||||
personality = Random32();
|
||||
|
||||
// Determine original trainer ID
|
||||
if (otIdType == OT_ID_RANDOM_NO_SHINY)
|
||||
{
|
||||
@@ -1129,7 +1124,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
else if (otIdType == OT_ID_PRESET)
|
||||
{
|
||||
value = fixedOtId;
|
||||
isShiny = GET_SHINY_VALUE(value, personality) < SHINY_ODDS;
|
||||
isShiny = GET_SHINY_VALUE(value, hasFixedPersonality ? fixedPersonality : personality) < SHINY_ODDS;
|
||||
}
|
||||
else // Player is the OT
|
||||
{
|
||||
@@ -1175,6 +1170,9 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
isShiny = GET_SHINY_VALUE(value, personality) < SHINY_ODDS;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFixedPersonality)
|
||||
personality = fixedPersonality;
|
||||
|
||||
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||
SetBoxMonData(boxMon, MON_DATA_OT_ID, &value);
|
||||
|
||||
Reference in New Issue
Block a user