mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
Flag to allow certain species to always have perfect IVs (like Partner Pikachu and Eevee)
This commit is contained in:
parent
1ba46e0b01
commit
74c3fdfba7
@ -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
|
||||
|
||||
|
@ -323,7 +323,7 @@ struct BaseStats
|
||||
u8 safariZoneFleeRate;
|
||||
u8 bodyColor : 7;
|
||||
u8 noFlip : 1;
|
||||
u8 flags;
|
||||
u16 flags;
|
||||
};
|
||||
|
||||
#include "constants/battle_config.h"
|
||||
|
@ -3370,50 +3370,59 @@ 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 P_LEGENDARY_PERFECT_IVS >= GEN_6
|
||||
if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
|
||||
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
|
||||
else if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
|
||||
{
|
||||
iv = MAX_PER_STAT_IVS;
|
||||
// Initialize a list of IV indices.
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
iv = MAX_PER_STAT_IVS;
|
||||
// Initialize a list of IV indices.
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
availableIVs[i] = i;
|
||||
}
|
||||
availableIVs[i] = i;
|
||||
}
|
||||
|
||||
// Select the 3 IVs that will be perfected.
|
||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
||||
// Select the 3 IVs that will be perfected.
|
||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
||||
{
|
||||
u8 index = Random() % (NUM_STATS - i);
|
||||
selectedIvs[i] = availableIVs[index];
|
||||
RemoveIVIndexFromList(availableIVs, index);
|
||||
}
|
||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
||||
{
|
||||
switch (selectedIvs[i])
|
||||
{
|
||||
u8 index = Random() % (NUM_STATS - i);
|
||||
selectedIvs[i] = availableIVs[index];
|
||||
RemoveIVIndexFromList(availableIVs, index);
|
||||
}
|
||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
||||
{
|
||||
switch (selectedIvs[i])
|
||||
{
|
||||
case STAT_HP:
|
||||
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
|
||||
break;
|
||||
case STAT_ATK:
|
||||
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
|
||||
break;
|
||||
case STAT_DEF:
|
||||
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
|
||||
break;
|
||||
case STAT_SPEED:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
|
||||
break;
|
||||
case STAT_SPATK:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
|
||||
break;
|
||||
case STAT_SPDEF:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
|
||||
break;
|
||||
}
|
||||
case STAT_HP:
|
||||
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
|
||||
break;
|
||||
case STAT_ATK:
|
||||
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
|
||||
break;
|
||||
case STAT_DEF:
|
||||
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
|
||||
break;
|
||||
case STAT_SPEED:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
|
||||
break;
|
||||
case STAT_SPATK:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
|
||||
break;
|
||||
case STAT_SPDEF:
|
||||
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gBaseStats[species].abilities[1])
|
||||
|
Loading…
Reference in New Issue
Block a user