Random Pyramid Encounter fixes (#4326)
This commit is contained in:
commit
e1f6480e32
1 changed files with 20 additions and 12 deletions
|
@ -1401,27 +1401,32 @@ void GenerateBattlePyramidWildMon(void)
|
|||
|
||||
if (reqs->nMoves != 0)
|
||||
moves = AllocZeroed(sizeof(u16) * reqs->nMoves);
|
||||
|
||||
|
||||
if (reqs->nAbilities != 0)
|
||||
abilities = AllocZeroed(sizeof(u16) * reqs->nAbilities);
|
||||
|
||||
if (round >= TOTAL_PYRAMID_ROUNDS)
|
||||
round = TOTAL_PYRAMID_ROUNDS - 1;
|
||||
|
||||
|
||||
id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1; // index in table (0-11) -> higher index is lower probability
|
||||
bstLim = 450 + (25*round) + (5*id); // higher BST limit for 'rarer' wild mon rolls
|
||||
|
||||
while (1)
|
||||
{
|
||||
species = Random() % FORMS_START;
|
||||
species = Random() % NUM_SPECIES;
|
||||
|
||||
// check if base species
|
||||
if (GET_BASE_SPECIES_ID(species) != species)
|
||||
continue;
|
||||
|
||||
// check type
|
||||
if (reqs->type != TYPE_MYSTERY && gSpeciesInfo[species].types[0] != reqs->type && gSpeciesInfo[species].types[1] != reqs->type)
|
||||
continue;
|
||||
|
||||
|
||||
// check base stat total
|
||||
if (GetTotalBaseStat(species) > bstLim)
|
||||
continue;
|
||||
|
||||
|
||||
// check moves
|
||||
if (reqs->nMoves != 0)
|
||||
{
|
||||
|
@ -1438,7 +1443,7 @@ void GenerateBattlePyramidWildMon(void)
|
|||
if (moveCount == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// check abilities
|
||||
if (reqs->nAbilities != 0)
|
||||
{
|
||||
|
@ -1460,9 +1465,9 @@ void GenerateBattlePyramidWildMon(void)
|
|||
continue;
|
||||
}
|
||||
// check evos
|
||||
if (reqs->evoItems[0] != 0 && !CheckBattlePyramidEvoRequirement(species, reqs->evoItems, reqs->nEvoItems))
|
||||
if (reqs->evoItems != NULL && !CheckBattlePyramidEvoRequirement(species, reqs->evoItems, reqs->nEvoItems))
|
||||
continue;
|
||||
|
||||
|
||||
// we found a species we can use!
|
||||
break;
|
||||
}
|
||||
|
@ -1471,7 +1476,7 @@ void GenerateBattlePyramidWildMon(void)
|
|||
SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &species);
|
||||
StringCopy(name, GetSpeciesName(species));
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name);
|
||||
|
||||
|
||||
// set level
|
||||
if (lvl != FRONTIER_LVL_50)
|
||||
{
|
||||
|
@ -1507,7 +1512,7 @@ void GenerateBattlePyramidWildMon(void)
|
|||
}
|
||||
Free(moves);
|
||||
}
|
||||
|
||||
|
||||
// Initialize a random ability num
|
||||
if (gSpeciesInfo[species].abilities[1])
|
||||
{
|
||||
|
@ -1519,7 +1524,7 @@ void GenerateBattlePyramidWildMon(void)
|
|||
i = 0;
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
|
||||
}
|
||||
|
||||
|
||||
// Try to replace with desired ability
|
||||
if (abilities != NULL)
|
||||
{
|
||||
|
@ -1533,12 +1538,15 @@ void GenerateBattlePyramidWildMon(void)
|
|||
{
|
||||
// Set this ability num
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (id >= NUM_ABILITY_SLOTS - 1)
|
||||
break;
|
||||
}
|
||||
Free(abilities);
|
||||
}
|
||||
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[gSaveBlock2Ptr->frontier.lvlMode] >= 140)
|
||||
{
|
||||
id = (Random() % 17) + 15;
|
||||
|
|
Loading…
Reference in a new issue