feat: separate water and rock smash encounter rate checks (#7293)
This commit is contained in:
parent
5a6e7749ab
commit
57dad22ac4
@ -63,9 +63,10 @@ bool8 StandardWildEncounter_Debug(void);
|
||||
u32 CalculateChainFishingShinyRolls(void);
|
||||
void CreateWildMon(u16 species, u8 level);
|
||||
u16 GetCurrentMapWildMonHeaderId(void);
|
||||
u8 ChooseWildMonIndex_Land(void);
|
||||
u8 ChooseWildMonIndex_WaterRock(void);
|
||||
u8 ChooseHiddenMonIndex(void);
|
||||
u32 ChooseWildMonIndex_Land(void);
|
||||
u32 ChooseWildMonIndex_Water(void);
|
||||
u32 ChooseWildMonIndex_Rocks(void);
|
||||
u32 ChooseHiddenMonIndex(void);
|
||||
bool32 MapHasNoEncounterData(void);
|
||||
enum TimeOfDay GetTimeOfDayForEncounters(u32 headerId, enum WildPokemonArea area);
|
||||
|
||||
|
||||
@ -2577,7 +2577,7 @@ bool8 TryFindHiddenPokemon(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
species = gWildMonHeaders[headerId].encounterTypes[timeOfDay].waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
||||
species = gWildMonHeaders[headerId].encounterTypes[timeOfDay].waterMonsInfo->wildPokemon[ChooseWildMonIndex_Water()].species;
|
||||
environment = ENCOUNTER_TYPE_WATER;
|
||||
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ static void FeebasSeedRng(u16 seed)
|
||||
}
|
||||
|
||||
// LAND_WILD_COUNT
|
||||
u8 ChooseWildMonIndex_Land(void)
|
||||
u32 ChooseWildMonIndex_Land(void)
|
||||
{
|
||||
u8 wildMonIndex = 0;
|
||||
bool8 swap = FALSE;
|
||||
@ -218,10 +218,10 @@ u8 ChooseWildMonIndex_Land(void)
|
||||
return wildMonIndex;
|
||||
}
|
||||
|
||||
// ROCK_WILD_COUNT / WATER_WILD_COUNT
|
||||
u8 ChooseWildMonIndex_WaterRock(void)
|
||||
// WATER_WILD_COUNT
|
||||
u32 ChooseWildMonIndex_Water(void)
|
||||
{
|
||||
u8 wildMonIndex = 0;
|
||||
u32 wildMonIndex = 0;
|
||||
bool8 swap = FALSE;
|
||||
u8 rand = Random() % ENCOUNTER_CHANCE_WATER_MONS_TOTAL;
|
||||
|
||||
@ -245,8 +245,35 @@ u8 ChooseWildMonIndex_WaterRock(void)
|
||||
return wildMonIndex;
|
||||
}
|
||||
|
||||
// ROCK_WILD_COUNT
|
||||
u32 ChooseWildMonIndex_Rocks(void)
|
||||
{
|
||||
u32 wildMonIndex = 0;
|
||||
bool8 swap = FALSE;
|
||||
u8 rand = Random() % ENCOUNTER_CHANCE_ROCK_SMASH_MONS_TOTAL;
|
||||
|
||||
if (rand < ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_0)
|
||||
wildMonIndex = 0;
|
||||
else if (rand >= ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_0 && rand < ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_1)
|
||||
wildMonIndex = 1;
|
||||
else if (rand >= ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_1 && rand < ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_2)
|
||||
wildMonIndex = 2;
|
||||
else if (rand >= ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_2 && rand < ENCOUNTER_CHANCE_ROCK_SMASH_MONS_SLOT_3)
|
||||
wildMonIndex = 3;
|
||||
else
|
||||
wildMonIndex = 4;
|
||||
|
||||
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
|
||||
swap = TRUE;
|
||||
|
||||
if (swap)
|
||||
wildMonIndex = 4 - wildMonIndex;
|
||||
|
||||
return wildMonIndex;
|
||||
}
|
||||
|
||||
// FISH_WILD_COUNT
|
||||
static u8 ChooseWildMonIndex_Fishing(u8 rod)
|
||||
static u32 ChooseWildMonIndex_Fishing(u8 rod)
|
||||
{
|
||||
u8 wildMonIndex = 0;
|
||||
bool8 swap = FALSE;
|
||||
@ -411,7 +438,7 @@ enum TimeOfDay GetTimeOfDayForEncounters(u32 headerId, enum WildPokemonArea area
|
||||
}
|
||||
}
|
||||
|
||||
if (wildMonInfo == NULL && !OW_TIME_OF_DAY_DISABLE_FALLBACK)
|
||||
if (wildMonInfo == NULL && !OW_TIME_OF_DAY_DISABLE_FALLBACK)
|
||||
return OW_TIME_OF_DAY_FALLBACK;
|
||||
else
|
||||
return timeOfDay;
|
||||
@ -529,10 +556,10 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, enum
|
||||
if (OW_STORM_DRAIN >= GEN_8 && TRY_GET_ABILITY_INFLUENCED_WILD_MON_INDEX(wildMonInfo->wildPokemon, TYPE_WATER, ABILITY_STORM_DRAIN, &wildMonIndex, WATER_WILD_COUNT))
|
||||
break;
|
||||
|
||||
wildMonIndex = ChooseWildMonIndex_WaterRock();
|
||||
wildMonIndex = ChooseWildMonIndex_Water();
|
||||
break;
|
||||
case WILD_AREA_ROCKS:
|
||||
wildMonIndex = ChooseWildMonIndex_WaterRock();
|
||||
wildMonIndex = ChooseWildMonIndex_Rocks();
|
||||
break;
|
||||
default:
|
||||
case WILD_AREA_FISHING:
|
||||
@ -1007,7 +1034,7 @@ u16 GetLocalWildMon(bool8 *isWaterMon)
|
||||
else if (landMonsInfo == NULL && waterMonsInfo != NULL)
|
||||
{
|
||||
*isWaterMon = TRUE;
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_Water()].species;
|
||||
}
|
||||
// Either land or water Pokémon
|
||||
if ((Random() % 100) < 80)
|
||||
@ -1017,7 +1044,7 @@ u16 GetLocalWildMon(bool8 *isWaterMon)
|
||||
else
|
||||
{
|
||||
*isWaterMon = TRUE;
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_Water()].species;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1033,7 +1060,7 @@ u16 GetLocalWaterMon(void)
|
||||
const struct WildPokemonInfo *waterMonsInfo = gWildMonHeaders[headerId].encounterTypes[timeOfDay].waterMonsInfo;
|
||||
|
||||
if (waterMonsInfo)
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_WaterRock()].species;
|
||||
return waterMonsInfo->wildPokemon[ChooseWildMonIndex_Water()].species;
|
||||
}
|
||||
return SPECIES_NONE;
|
||||
}
|
||||
@ -1226,7 +1253,7 @@ bool8 StandardWildEncounter_Debug(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u8 ChooseHiddenMonIndex(void)
|
||||
u32 ChooseHiddenMonIndex(void)
|
||||
{
|
||||
#ifdef ENCOUNTER_CHANCE_HIDDEN_MONS_TOTAL
|
||||
u8 rand = Random() % ENCOUNTER_CHANCE_HIDDEN_MONS_TOTAL;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user