Flag to allow certain species to always have perfect IVs (like Partner Pikachu and Eevee)

This commit is contained in:
Eduardo Quezada 2022-09-04 19:41:01 -03:00
parent 1ba46e0b01
commit 74c3fdfba7
3 changed files with 50 additions and 40 deletions

View File

@ -350,6 +350,7 @@
#define FLAG_GALARIAN_FORM (1 << 4)
#define FLAG_HISUIAN_FORM (1 << 5)
#define FLAG_GENDER_DIFFERENCE (1 << 6)
#define FLAG_ALL_PERFECT_IVS (1 << 7)
#define LEGENDARY_PERFECT_IV_COUNT 3

View File

@ -323,7 +323,7 @@ struct BaseStats
u8 safariZoneFleeRate;
u8 bodyColor : 7;
u8 noFlip : 1;
u8 flags;
u16 flags;
};
#include "constants/battle_config.h"

View File

@ -3370,8 +3370,18 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
iv = (value & (MAX_IV_MASK << 10)) >> 10;
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
if (gBaseStats[species].flags & FLAG_ALL_PERFECT_IVS)
{
iv = MAX_PER_STAT_IVS;
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
}
#if P_LEGENDARY_PERFECT_IVS >= GEN_6
if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
else if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
{
iv = MAX_PER_STAT_IVS;
// Initialize a list of IV indices.
@ -3413,7 +3423,6 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
}
}
#endif
}
if (gBaseStats[species].abilities[1])