Tweak IV generation slightly (#4876)

With HQ_RANDOM on, this means that the generator now only consumes one RNG output when generating IVs.
Without HQ_RANDOM on, IV generation should be unchanged.
This commit is contained in:
tertu 2024-07-31 12:51:47 -05:00 committed by GitHub
parent 3372503430
commit 05ff7cef1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1206,7 +1206,8 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
else
{
u32 iv;
value = Random();
u32 ivRandom = Random32();
value = (u16)ivRandom;
iv = value & MAX_IV_MASK;
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
@ -1215,7 +1216,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
iv = (value & (MAX_IV_MASK << 10)) >> 10;
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
value = Random();
value = (u16)(ivRandom >> 16);
iv = value & MAX_IV_MASK;
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);