mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
Make related func names more concise
This commit is contained in:
parent
11e3f03bd8
commit
af081b08ee
@ -481,7 +481,7 @@ static bool8 DoMassOutbreakEncounterTest(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate)
|
||||
static bool8 EncounterOddsCheck(u16 encounterRate)
|
||||
{
|
||||
if (Random() % MAX_ENCOUNTER_RATE < encounterRate)
|
||||
return TRUE;
|
||||
@ -489,7 +489,8 @@ static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
|
||||
// Returns true if it will try to create a wild encounter.
|
||||
static bool8 WildEncounterCheck(u32 encounterRate, bool8 ignoreAbility)
|
||||
{
|
||||
encounterRate *= 16;
|
||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||
@ -515,7 +516,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
|
||||
}
|
||||
if (encounterRate > MAX_ENCOUNTER_RATE)
|
||||
encounterRate = MAX_ENCOUNTER_RATE;
|
||||
return DoWildEncounterRateDiceRoll(encounterRate);
|
||||
return EncounterOddsCheck(encounterRate);
|
||||
}
|
||||
|
||||
// When you first step on a different type of metatile, there's a 40% chance it
|
||||
@ -555,7 +556,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
|
||||
headerId = GetBattlePikeWildMonHeaderId();
|
||||
if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
|
||||
return FALSE;
|
||||
else if (DoWildEncounterRateTest(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
else if (WildEncounterCheck(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
return FALSE;
|
||||
else if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
||||
return FALSE;
|
||||
@ -570,7 +571,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
|
||||
headerId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
||||
if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
|
||||
return FALSE;
|
||||
else if (DoWildEncounterRateTest(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
else if (WildEncounterCheck(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
return FALSE;
|
||||
else if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
|
||||
return FALSE;
|
||||
@ -588,7 +589,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
|
||||
return FALSE;
|
||||
else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
|
||||
return FALSE;
|
||||
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
else if (WildEncounterCheck(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
return FALSE;
|
||||
|
||||
if (TryStartRoamerEncounter() == TRUE)
|
||||
@ -627,7 +628,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
|
||||
return FALSE;
|
||||
else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
|
||||
return FALSE;
|
||||
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
else if (WildEncounterCheck(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE)
|
||||
return FALSE;
|
||||
|
||||
if (TryStartRoamerEncounter() == TRUE)
|
||||
@ -667,7 +668,7 @@ void RockSmashWildEncounter(void)
|
||||
{
|
||||
gSpecialVar_Result = FALSE;
|
||||
}
|
||||
else if (DoWildEncounterRateTest(wildPokemonInfo->encounterRate, TRUE) == TRUE
|
||||
else if (WildEncounterCheck(wildPokemonInfo->encounterRate, TRUE) == TRUE
|
||||
&& TryGenerateWildMon(wildPokemonInfo, WILD_AREA_ROCKS, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
|
||||
{
|
||||
BattleSetup_StartWildBattle();
|
||||
|
Loading…
x
Reference in New Issue
Block a user