From fb69d97b24209cb7828a49b29ab1fb30c9baa02f Mon Sep 17 00:00:00 2001 From: SphericalIce Date: Thu, 7 Jan 2021 21:11:45 +0000 Subject: [PATCH 1/3] Use the constant for the max total of EVs --- src/field_specials.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field_specials.c b/src/field_specials.c index 51030a387..1863a462c 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1414,7 +1414,7 @@ void GiveLeadMonEffortRibbon(void) bool8 Special_AreLeadMonEVsMaxedOut(void) { - if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= 510) + if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= MAX_TOTAL_EVS) { return TRUE; } From 3c2a33b9b25b3bba33c29a10e66d5256b10c537d Mon Sep 17 00:00:00 2001 From: SphericalIce Date: Thu, 7 Jan 2021 22:13:14 +0000 Subject: [PATCH 2/3] Use constants for max IVs & the random IV generation flag --- include/constants/pokemon.h | 3 + src/battle_controllers.c | 2 +- src/battle_dome.c | 2 +- src/battle_main.c | 8 +- src/battle_tower.c | 10 +- src/data/battle_frontier/trainer_hill.h | 690 ++++++++++++------------ src/daycare.c | 4 +- src/egg_hatch.c | 2 +- src/field_specials.c | 2 +- src/frontier_util.c | 48 +- src/pokemon.c | 32 +- src/script_pokemon_util.c | 4 +- src/trade.c | 4 +- 13 files changed, 407 insertions(+), 404 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index bac914fec..d4f6e5684 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -232,6 +232,9 @@ #define STATUS_PRIMARY_POKERUS 6 #define STATUS_PRIMARY_FAINTED 7 +#define MAX_PER_STAT_IVS 31 +#define MAX_IV_MASK 31 +#define USE_RANDOM_IVS (MAX_PER_STAT_IVS + 1) #define MAX_PER_STAT_EVS 255 #define MAX_TOTAL_EVS 510 #define EV_ITEM_RAISE_LIMIT 100 diff --git a/src/battle_controllers.c b/src/battle_controllers.c index a95bb2f6a..297a8b577 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -64,7 +64,7 @@ void SetUpBattleVarsAndBirchZigzagoon(void) if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE) { ZeroEnemyPartyMons(); - CreateMon(&gEnemyParty[0], SPECIES_ZIGZAGOON, 2, 32, 0, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&gEnemyParty[0], SPECIES_ZIGZAGOON, 2, USE_RANDOM_IVS, 0, 0, OT_ID_PLAYER_ID, 0); i = 0; SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &i); } diff --git a/src/battle_dome.c b/src/battle_dome.c index 0d1bee8cf..780721768 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2875,7 +2875,7 @@ static u8 GetDomeTrainerMonIvs(u16 trainerId) else if (trainerId <= FRONTIER_TRAINER_TESS) // 200 - 219 fixedIv = 21; else // 220+ (- 299) - fixedIv = 31; + fixedIv = MAX_PER_STAT_IVS; return fixedIv; } diff --git a/src/battle_main.c b/src/battle_main.c index 29a8f560a..df56dccf9 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1969,7 +1969,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir nameHash += gSpeciesNames[partyData[i].species][j]; personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); break; } @@ -1981,7 +1981,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir nameHash += gSpeciesNames[partyData[i].species][j]; personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); for (j = 0; j < MAX_MON_MOVES; j++) @@ -1999,7 +1999,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir nameHash += gSpeciesNames[partyData[i].species][j]; personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); @@ -2013,7 +2013,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir nameHash += gSpeciesNames[partyData[i].species][j]; personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); diff --git a/src/battle_tower.c b/src/battle_tower.c index ee75feeb4..218c3ef70 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -775,7 +775,7 @@ struct { { .species = SPECIES_METANG, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .level = 42, .nature = NATURE_BRAVE, .evs = {0, 252, 252, 0, 6, 0}, @@ -783,7 +783,7 @@ struct }, { .species = SPECIES_SKARMORY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .level = 43, .nature = NATURE_IMPISH, .evs = {252, 0, 0, 0, 6, 252}, @@ -791,7 +791,7 @@ struct }, { .species = SPECIES_AGGRON, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .level = 44, .nature = NATURE_ADAMANT, .evs = {0, 252, 0, 0, 252, 6}, @@ -1854,7 +1854,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) } else { - fixedIV = 31; + fixedIV = MAX_PER_STAT_IVS; } level = SetFacilityPtrsGetLevel(); @@ -3295,7 +3295,7 @@ static u8 GetFrontierTrainerFixedIvs(u16 trainerId) else if (trainerId <= FRONTIER_TRAINER_TESS) // 200 - 219 fixedIv = 21; else // 220+ (- 299) - fixedIv = 31; + fixedIv = MAX_PER_STAT_IVS; return fixedIv; } diff --git a/src/data/battle_frontier/trainer_hill.h b/src/data/battle_frontier/trainer_hill.h index 1b41024d0..d8bd57576 100644 --- a/src/data/battle_frontier/trainer_hill.h +++ b/src/data/battle_frontier/trainer_hill.h @@ -1244,12 +1244,12 @@ static const struct TrHillFloor sDataTagNormal_Floors[] = .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xCB, .nickname = _("SKITTY"), @@ -2717,11 +2717,11 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .spAttackEV = 255, .otId = TRAINER_HILL_OTID, .hpIV = 30, - .attackIV = 31, + .attackIV = MAX_PER_STAT_IVS, .defenseIV = 30, - .speedIV = 31, + .speedIV = MAX_PER_STAT_IVS, .spAttackIV = 30, - .spDefenseIV = 31, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x202, .nickname = _("UNOWN"), @@ -2738,11 +2738,11 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .spAttackEV = 255, .otId = TRAINER_HILL_OTID, .hpIV = 30, - .attackIV = 31, - .defenseIV = 31, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, .speedIV = 30, .spAttackIV = 30, - .spDefenseIV = 31, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x10001, .nickname = _("UNOWN"), @@ -2921,11 +2921,11 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .spAttackEV = 255, .otId = TRAINER_HILL_OTID, .hpIV = 30, - .attackIV = 31, + .attackIV = MAX_PER_STAT_IVS, .defenseIV = 30, .speedIV = 30, .spAttackIV = 30, - .spDefenseIV = 31, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x302, .nickname = _("UNOWN"), @@ -2941,10 +2941,10 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .hpEV = 255, .attackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, + .hpIV = MAX_PER_STAT_IVS, .attackIV = 30, - .defenseIV = 31, - .speedIV = 31, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, .spAttackIV = 30, .spDefenseIV = 30, .abilityNum = 0, @@ -2962,12 +2962,12 @@ static const struct TrHillFloor sDataTagVariety_Floors[] = { .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, .defenseIV = 30, .speedIV = 30, - .spAttackIV = 31, - .spDefenseIV = 31, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x301, .nickname = _("UNOWN"), @@ -3820,12 +3820,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x32, .nickname = _("SMOOCHUM"), @@ -3842,12 +3842,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xC8, .nickname = _("AZURILL"), @@ -3864,12 +3864,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x0, .nickname = _("ELEKID"), @@ -3886,12 +3886,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x0, .nickname = _("CLEFFA"), @@ -3908,12 +3908,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .defenseEV = 130, .spDefenseEV = 130, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x84, .nickname = _("WYNAUT"), @@ -3930,12 +3930,12 @@ static const struct TrHillFloor sDataTagUnique_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xF, .nickname = _("MAGBY"), @@ -4319,12 +4319,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .defenseEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x35, .nickname = _("SNORLAX"), @@ -4341,12 +4341,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("MILTANK"), @@ -4363,12 +4363,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spAttackEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x7F, .nickname = _("URSARING"), @@ -4385,12 +4385,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x80, .nickname = _("SLAKING"), @@ -4407,12 +4407,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("KANGASKHAN"), @@ -4429,12 +4429,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x80, .nickname = _("ZANGOOSE"), @@ -4464,12 +4464,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 110, .spAttackEV = 200, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0xF, .nickname = _("SLOWKING"), @@ -4486,12 +4486,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x28, .nickname = _("ESPEON"), @@ -4508,12 +4508,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0xF, .nickname = _("STARMIE"), @@ -4530,12 +4530,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xF, .nickname = _("GENGAR"), @@ -4552,12 +4552,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xF, .nickname = _("GARDEVOIR"), @@ -4574,12 +4574,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xF, .nickname = _("ALAKAZAM"), @@ -4641,12 +4641,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("SWELLOW"), @@ -4663,12 +4663,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("MACHAMP"), @@ -4685,12 +4685,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("URSARING"), @@ -4707,12 +4707,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x80, .nickname = _("KINGLER"), @@ -4729,12 +4729,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .defenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x80, .nickname = _("TYRANITAR"), @@ -4751,12 +4751,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x80, .nickname = _("DRAGONITE"), @@ -4786,12 +4786,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xA, .nickname = _("JOLTEON"), @@ -4808,12 +4808,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xA, .nickname = _("ALAKAZAM"), @@ -4830,12 +4830,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0xA, .nickname = _("STARMIE"), @@ -4852,12 +4852,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x82, .nickname = _("DUSCLOPS"), @@ -4874,12 +4874,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xD2, .nickname = _("NINETALES"), @@ -4896,12 +4896,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x85, .nickname = _("BANETTE"), @@ -4963,12 +4963,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 130, .spDefenseEV = 130, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x94, .nickname = _("WOBBUFFET"), @@ -4985,12 +4985,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 130, .spDefenseEV = 130, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x85, .nickname = _("EXPLOUD"), @@ -5007,12 +5007,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 130, .spDefenseEV = 130, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x0, .nickname = _("CROBAT"), @@ -5029,12 +5029,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 252, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0xD, .nickname = _("DUGTRIO"), @@ -5051,12 +5051,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 252, .spAttackEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x5, .nickname = _("ELECTRODE"), @@ -5073,12 +5073,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spDefenseEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x14, .nickname = _("GENGAR"), @@ -5108,12 +5108,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 130, .spDefenseEV = 130, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x82, .nickname = _("LAPRAS"), @@ -5130,12 +5130,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 6, .speedEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x8A, .nickname = _("ABSOL"), @@ -5152,12 +5152,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .spAttackEV = 6, .spDefenseEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x0, .nickname = _("ALTARIA"), @@ -5174,12 +5174,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 252, .spAttackEV = 6, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x14, .nickname = _("DEWGONG"), @@ -5196,12 +5196,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .spAttackEV = 6, .spDefenseEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0x14, .nickname = _("POLITOED"), @@ -5218,12 +5218,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 6, .spDefenseEV = 252, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0x17, .nickname = _("MAROWAK"), @@ -5285,12 +5285,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 200, .spDefenseEV = 200, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("FORRETRESS"), @@ -5306,12 +5306,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 1, .personality = 0xC, .nickname = _("ELECTRODE"), @@ -5327,12 +5327,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x7F, .nickname = _("EXEGGUTOR"), @@ -5349,12 +5349,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 200, .spDefenseEV = 200, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x93, .nickname = _("DUSCLOPS"), @@ -5370,12 +5370,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0xF, .nickname = _("NINETALES"), @@ -5391,12 +5391,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .hpEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x96, .nickname = _("BANETTE"), @@ -5425,12 +5425,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x95, .nickname = _("SALAMENCE"), @@ -5446,12 +5446,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .speedEV = 255, .spAttackEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x8C, .nickname = _("GENGAR"), @@ -5467,12 +5467,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("GYARADOS"), @@ -5488,12 +5488,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .attackEV = 255, .speedEV = 255, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x3, .nickname = _("GENGAR"), @@ -5510,12 +5510,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 200, .spDefenseEV = 200, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x14, .nickname = _("DUSCLOPS"), @@ -5532,12 +5532,12 @@ static const struct TrHillFloor sDataTagExpert_Floors[] = { .defenseEV = 180, .spDefenseEV = 150, .otId = TRAINER_HILL_OTID, - .hpIV = 31, - .attackIV = 31, - .defenseIV = 31, - .speedIV = 31, - .spAttackIV = 31, - .spDefenseIV = 31, + .hpIV = MAX_PER_STAT_IVS, + .attackIV = MAX_PER_STAT_IVS, + .defenseIV = MAX_PER_STAT_IVS, + .speedIV = MAX_PER_STAT_IVS, + .spAttackIV = MAX_PER_STAT_IVS, + .spDefenseIV = MAX_PER_STAT_IVS, .abilityNum = 0, .personality = 0x85, .nickname = _("MISDREAVUS"), diff --git a/src/daycare.c b/src/daycare.c index 511fa0551..2a1efefcc 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -838,7 +838,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation) u8 metLocation; u8 isEgg; - CreateMon(mon, species, EGG_HATCH_LEVEL, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); + CreateMon(mon, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); metLevel = 0; ball = ITEM_POKE_BALL; language = LANGUAGE_JAPANESE; @@ -865,7 +865,7 @@ static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare * u8 language; personality = daycare->offspringPersonality; - CreateMon(mon, species, EGG_HATCH_LEVEL, 32, TRUE, personality, OT_ID_PLAYER_ID, 0); + CreateMon(mon, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0); metLevel = 0; ball = ITEM_POKE_BALL; language = LANGUAGE_JAPANESE; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index f90441b68..4e050ce62 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -322,7 +322,7 @@ static void CreateHatchedMon(struct Pokemon *egg, struct Pokemon *temp) pokerus = GetMonData(egg, MON_DATA_POKERUS); obedience = GetMonData(egg, MON_DATA_OBEDIENCE); - CreateMon(temp, species, EGG_HATCH_LEVEL, 32, TRUE, personality, OT_ID_PLAYER_ID, 0); + CreateMon(temp, species, EGG_HATCH_LEVEL, USE_RANDOM_IVS, TRUE, personality, OT_ID_PLAYER_ID, 0); for (i = 0; i < MAX_MON_MOVES; i++) { diff --git a/src/field_specials.c b/src/field_specials.c index 1863a462c..a6831ec5b 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1449,7 +1449,7 @@ void SetShoalItemFlag(u16 unused) void PutZigzagoonInPlayerParty(void) { u16 monData; - CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); monData = TRUE; SetMonData(&gPlayerParty[0], MON_DATA_ABILITY_NUM, &monData); monData = MOVE_TACKLE; diff --git a/src/frontier_util.c b/src/frontier_util.c index 5955d9bf7..db5f86aef 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -129,7 +129,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_RAIKOU, .heldItem = ITEM_LUM_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MODEST, .evs = {158, 0, 252, 100, 0, 0}, .moves = {MOVE_THUNDERBOLT, MOVE_CALM_MIND, MOVE_REFLECT, MOVE_REST}, @@ -137,7 +137,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_LATIOS, .heldItem = ITEM_BRIGHT_POWDER, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MODEST, .evs = {252, 0, 252, 6, 0, 0}, .moves = {MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_RECOVER, MOVE_DRAGON_CLAW}, @@ -145,7 +145,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SNORLAX, .heldItem = ITEM_CHESTO_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_ADAMANT, .evs = {252, 252, 0, 0, 6, 0}, .moves = {MOVE_CURSE, MOVE_RETURN, MOVE_REST, MOVE_SHADOW_BALL}, @@ -186,7 +186,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SWAMPERT, .heldItem = ITEM_LEFTOVERS, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BRAVE, .evs = {252, 252, 6, 0, 0, 0}, .moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_MIRROR_COAT}, @@ -194,7 +194,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_METAGROSS, .heldItem = ITEM_QUICK_CLAW, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BRAVE, .evs = {252, 252, 6, 0, 0, 0}, .moves = {MOVE_PSYCHIC, MOVE_METEOR_MASH, MOVE_EARTHQUAKE, MOVE_PROTECT}, @@ -202,7 +202,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_LATIAS, .heldItem = ITEM_CHESTO_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MODEST, .evs = {252, 0, 252, 6, 0, 0}, .moves = {MOVE_THUNDERBOLT, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_REST}, @@ -243,7 +243,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_ARCANINE, .heldItem = ITEM_WHITE_HERB, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_HASTY, .evs = {6, 252, 252, 0, 0, 0}, .moves = {MOVE_OVERHEAT, MOVE_EXTREME_SPEED, MOVE_ROAR, MOVE_PROTECT}, @@ -251,7 +251,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SLAKING, .heldItem = ITEM_SCOPE_LENS, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_HARDY, .evs = {6, 252, 0, 252, 0, 0}, .moves = {MOVE_HYPER_BEAM, MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_YAWN}, @@ -259,7 +259,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SUICUNE, .heldItem = ITEM_KINGS_ROCK, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_HASTY, .evs = {252, 0, 252, 6, 0, 0}, .moves = {MOVE_BLIZZARD, MOVE_SURF, MOVE_BITE, MOVE_CALM_MIND}, @@ -300,7 +300,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_UMBREON, .heldItem = ITEM_CHESTO_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_CALM, .evs = {252, 0, 0, 0, 252, 6}, .moves = {MOVE_DOUBLE_EDGE, MOVE_CONFUSE_RAY, MOVE_REST, MOVE_PSYCHIC}, @@ -308,7 +308,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_GENGAR, .heldItem = ITEM_LEFTOVERS, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MODEST, .evs = {252, 0, 252, 0, 6, 0}, .moves = {MOVE_PSYCHIC, MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_DESTINY_BOND}, @@ -316,7 +316,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_BRELOOM, .heldItem = ITEM_LUM_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_JOLLY, .evs = {6, 252, 0, 252, 0, 0}, .moves = {MOVE_SPORE, MOVE_FOCUS_PUNCH, MOVE_GIGA_DRAIN, MOVE_HEADBUTT}, @@ -331,7 +331,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_METANG, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BRAVE, .evs = {0, 252, 252, 0, 6, 0}, .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW}, @@ -339,7 +339,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SKARMORY, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_IMPISH, .evs = {252, 0, 0, 0, 6, 252}, .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING}, @@ -347,7 +347,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_AGGRON, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_ADAMANT, .evs = {0, 252, 0, 0, 252, 6}, .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW}, @@ -357,7 +357,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_METANG, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BRAVE, .evs = {0, 252, 252, 0, 6, 0}, .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW}, @@ -365,7 +365,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SKARMORY, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_IMPISH, .evs = {252, 0, 0, 0, 6, 252}, .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING}, @@ -373,7 +373,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_AGGRON, .heldItem = ITEM_SITRUS_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_ADAMANT, .evs = {0, 252, 0, 0, 252, 6}, .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW}, @@ -414,7 +414,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_SEVIPER, .heldItem = ITEM_FOCUS_BAND, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BOLD, .evs = {252, 0, 0, 0, 252, 6}, .moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_SLUDGE_BOMB, MOVE_GIGA_DRAIN}, @@ -422,7 +422,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_STEELIX, .heldItem = ITEM_BRIGHT_POWDER, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_BRAVE, .evs = {252, 0, 0, 0, 6, 252}, .moves = {MOVE_EARTHQUAKE, MOVE_ROCK_SLIDE, MOVE_EXPLOSION, MOVE_SCREECH}, @@ -430,7 +430,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_GYARADOS, .heldItem = ITEM_CHESTO_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_ADAMANT, .evs = {252, 6, 0, 0, 0, 252}, .moves = {MOVE_DRAGON_DANCE, MOVE_RETURN, MOVE_ROAR, MOVE_REST}, @@ -471,7 +471,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_ARTICUNO, .heldItem = ITEM_SCOPE_LENS, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MILD, .evs = {6, 0, 252, 252, 0, 0}, .moves = {MOVE_BLIZZARD, MOVE_WATER_PULSE, MOVE_AERIAL_ACE, MOVE_REFLECT}, @@ -479,7 +479,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_ZAPDOS, .heldItem = ITEM_LUM_BERRY, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MILD, .evs = {6, 0, 252, 252, 0, 0}, .moves = {MOVE_THUNDER, MOVE_DETECT, MOVE_DRILL_PECK, MOVE_LIGHT_SCREEN}, @@ -487,7 +487,7 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZ { .species = SPECIES_MOLTRES, .heldItem = ITEM_BRIGHT_POWDER, - .fixedIV = 31, + .fixedIV = MAX_PER_STAT_IVS, .nature = NATURE_MILD, .evs = {6, 0, 252, 252, 0, 0}, .moves = {MOVE_FIRE_BLAST, MOVE_HYPER_BEAM, MOVE_AERIAL_ACE, MOVE_SAFEGUARD}, diff --git a/src/pokemon.c b/src/pokemon.c index b5eee16b2..e3d5dfd97 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2247,7 +2247,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, SetBoxMonData(boxMon, MON_DATA_POKEBALL, &value); SetBoxMonData(boxMon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender); - if (fixedIV < 32) + if (fixedIV < USE_RANDOM_IVS) { SetBoxMonData(boxMon, MON_DATA_HP_IV, &fixedIV); SetBoxMonData(boxMon, MON_DATA_ATK_IV, &fixedIV); @@ -2261,20 +2261,20 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, u32 iv; value = Random(); - iv = value & 0x1F; + iv = value & MAX_IV_MASK; SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); - iv = (value & 0x3E0) >> 5; + iv = (value & (MAX_IV_MASK << 5)) >> 5; SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); - iv = (value & 0x7C00) >> 10; + iv = (value & (MAX_IV_MASK << 10)) >> 10; SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); value = Random(); - iv = value & 0x1F; + iv = value & MAX_IV_MASK; SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); - iv = (value & 0x3E0) >> 5; + iv = (value & (MAX_IV_MASK << 5)) >> 5; SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); - iv = (value & 0x7C00) >> 10; + iv = (value & (MAX_IV_MASK << 10)) >> 10; SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); } @@ -2342,7 +2342,7 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level) personality = Random32(); } while (GetGenderFromSpeciesAndPersonality(species, personality) != MON_MALE); - CreateMon(mon, species, level, 32, 1, personality, OT_ID_PRESET, otId); + CreateMon(mon, species, level, USE_RANDOM_IVS, 1, personality, OT_ID_PRESET, otId); } void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality) @@ -2524,7 +2524,7 @@ void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 m CreateMon(mon, src->party[monId].species, GetFrontierEnemyMonLevel(src->lvlMode - 1), - 0x1F, + MAX_PER_STAT_IVS, TRUE, personality, OT_ID_PRESET, @@ -2761,7 +2761,7 @@ void CreateObedientEnemyMon(void) s32 itemId = gSpecialVar_0x8006; ZeroEnemyPartyMons(); - CreateObedientMon(&gEnemyParty[0], species, level, 32, 0, 0, 0, 0); + CreateObedientMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0); if (itemId) { u8 heldItem[2]; @@ -4314,12 +4314,12 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_IVS: { u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - substruct3->hpIV = ivs & 0x1F; - substruct3->attackIV = (ivs >> 5) & 0x1F; - substruct3->defenseIV = (ivs >> 10) & 0x1F; - substruct3->speedIV = (ivs >> 15) & 0x1F; - substruct3->spAttackIV = (ivs >> 20) & 0x1F; - substruct3->spDefenseIV = (ivs >> 25) & 0x1F; + substruct3->hpIV = ivs & MAX_PER_STAT_IVS; + substruct3->attackIV = (ivs >> 5) & MAX_PER_STAT_IVS; + substruct3->defenseIV = (ivs >> 10) & MAX_PER_STAT_IVS; + substruct3->speedIV = (ivs >> 15) & MAX_PER_STAT_IVS; + substruct3->spAttackIV = (ivs >> 20) & MAX_PER_STAT_IVS; + substruct3->spDefenseIV = (ivs >> 25) & MAX_PER_STAT_IVS; break; } default: diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index c9a2127ac..ad1a55230 100755 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -66,7 +66,7 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u u8 heldItem[2]; struct Pokemon mon; - CreateMon(&mon, species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&mon, species, level, USE_RANDOM_IVS, 0, 0, OT_ID_PLAYER_ID, 0); heldItem[0] = item; heldItem[1] = item >> 8; SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem); @@ -139,7 +139,7 @@ void CreateScriptedWildMon(u16 species, u8 level, u16 item) u8 heldItem[2]; ZeroEnemyPartyMons(); - CreateMon(&gEnemyParty[0], species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, OT_ID_PLAYER_ID, 0); if (item) { heldItem[0] = item; diff --git a/src/trade.c b/src/trade.c index 6696c23eb..96099cb74 100644 --- a/src/trade.c +++ b/src/trade.c @@ -379,7 +379,7 @@ static void CB2_CreateTradeMenu(void) for (i = 0; i < PARTY_SIZE; i++) { - CreateMon(&gEnemyParty[i], SPECIES_NONE, 0, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); + CreateMon(&gEnemyParty[i], SPECIES_NONE, 0, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); } PrintTradeMessage(TRADE_MSG_STANDBY); @@ -4436,7 +4436,7 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade) u8 isMail; struct Pokemon *pokemon = &gEnemyParty[0]; - CreateMon(pokemon, inGameTrade->species, level, 32, TRUE, inGameTrade->personality, OT_ID_PRESET, inGameTrade->otId); + CreateMon(pokemon, inGameTrade->species, level, USE_RANDOM_IVS, TRUE, inGameTrade->personality, OT_ID_PRESET, inGameTrade->otId); SetMonData(pokemon, MON_DATA_HP_IV, &inGameTrade->ivs[0]); SetMonData(pokemon, MON_DATA_ATK_IV, &inGameTrade->ivs[1]); From f02afc134b206b82bd5c73885d0ee9d8855df90a Mon Sep 17 00:00:00 2001 From: SphericalIce Date: Thu, 7 Jan 2021 22:34:57 +0000 Subject: [PATCH 3/3] Use the correct constant for max-IV masks --- src/pokemon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index e3d5dfd97..5bccef907 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4314,12 +4314,12 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_IVS: { u32 ivs = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - substruct3->hpIV = ivs & MAX_PER_STAT_IVS; - substruct3->attackIV = (ivs >> 5) & MAX_PER_STAT_IVS; - substruct3->defenseIV = (ivs >> 10) & MAX_PER_STAT_IVS; - substruct3->speedIV = (ivs >> 15) & MAX_PER_STAT_IVS; - substruct3->spAttackIV = (ivs >> 20) & MAX_PER_STAT_IVS; - substruct3->spDefenseIV = (ivs >> 25) & MAX_PER_STAT_IVS; + substruct3->hpIV = ivs & MAX_IV_MASK; + substruct3->attackIV = (ivs >> 5) & MAX_IV_MASK; + substruct3->defenseIV = (ivs >> 10) & MAX_IV_MASK; + substruct3->speedIV = (ivs >> 15) & MAX_IV_MASK; + substruct3->spAttackIV = (ivs >> 20) & MAX_IV_MASK; + substruct3->spDefenseIV = (ivs >> 25) & MAX_IV_MASK; break; } default: