mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-15 16:12:12 +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_GALARIAN_FORM (1 << 4)
|
||||||
#define FLAG_HISUIAN_FORM (1 << 5)
|
#define FLAG_HISUIAN_FORM (1 << 5)
|
||||||
#define FLAG_GENDER_DIFFERENCE (1 << 6)
|
#define FLAG_GENDER_DIFFERENCE (1 << 6)
|
||||||
|
#define FLAG_ALL_PERFECT_IVS (1 << 7)
|
||||||
|
|
||||||
#define LEGENDARY_PERFECT_IV_COUNT 3
|
#define LEGENDARY_PERFECT_IV_COUNT 3
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ struct BaseStats
|
|||||||
u8 safariZoneFleeRate;
|
u8 safariZoneFleeRate;
|
||||||
u8 bodyColor : 7;
|
u8 bodyColor : 7;
|
||||||
u8 noFlip : 1;
|
u8 noFlip : 1;
|
||||||
u8 flags;
|
u16 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "constants/battle_config.h"
|
#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;
|
iv = (value & (MAX_IV_MASK << 10)) >> 10;
|
||||||
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
|
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
|
||||||
|
|
||||||
#if P_LEGENDARY_PERFECT_IVS >= GEN_6
|
if (gBaseStats[species].flags & FLAG_ALL_PERFECT_IVS)
|
||||||
if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
|
{
|
||||||
|
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;
|
availableIVs[i] = i;
|
||||||
// Initialize a list of IV indices.
|
}
|
||||||
for (i = 0; i < NUM_STATS; i++)
|
|
||||||
{
|
|
||||||
availableIVs[i] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select the 3 IVs that will be perfected.
|
// Select the 3 IVs that will be perfected.
|
||||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
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);
|
case STAT_HP:
|
||||||
selectedIvs[i] = availableIVs[index];
|
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
|
||||||
RemoveIVIndexFromList(availableIVs, index);
|
break;
|
||||||
}
|
case STAT_ATK:
|
||||||
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
|
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
|
||||||
{
|
break;
|
||||||
switch (selectedIvs[i])
|
case STAT_DEF:
|
||||||
{
|
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
|
||||||
case STAT_HP:
|
break;
|
||||||
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
|
case STAT_SPEED:
|
||||||
break;
|
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
|
||||||
case STAT_ATK:
|
break;
|
||||||
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
|
case STAT_SPATK:
|
||||||
break;
|
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
|
||||||
case STAT_DEF:
|
break;
|
||||||
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
|
case STAT_SPDEF:
|
||||||
break;
|
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
|
||||||
case STAT_SPEED:
|
break;
|
||||||
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])
|
if (gBaseStats[species].abilities[1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user