Merge pull request #1295 from sphericalice/pokeemerald

Use constants for IV-related values
This commit is contained in:
GriffinR 2021-01-07 18:00:10 -05:00 committed by GitHub
commit 42a0b20e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 408 additions and 405 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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++)
{

View File

@ -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;
}
@ -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;

View File

@ -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},

View File

@ -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_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:

View File

@ -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;

View File

@ -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]);