Make related func names more concise

This commit is contained in:
Abaresk
2022-10-12 04:35:23 +00:00
parent 11e3f03bd8
commit af081b08ee
+9 -8
View File
@@ -481,7 +481,7 @@ static bool8 DoMassOutbreakEncounterTest(void)
return FALSE; return FALSE;
} }
static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate) static bool8 EncounterOddsCheck(u16 encounterRate)
{ {
if (Random() % MAX_ENCOUNTER_RATE < encounterRate) if (Random() % MAX_ENCOUNTER_RATE < encounterRate)
return TRUE; return TRUE;
@@ -489,7 +489,8 @@ static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate)
return FALSE; 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; encounterRate *= 16;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) 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) if (encounterRate > MAX_ENCOUNTER_RATE)
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 // 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(); headerId = GetBattlePikeWildMonHeaderId();
if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
return FALSE; return FALSE;
else if (DoWildEncounterRateTest(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE) else if (WildEncounterCheck(gBattlePikeWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
return FALSE; return FALSE;
else if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE) else if (TryGenerateWildMon(gBattlePikeWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
return FALSE; return FALSE;
@@ -570,7 +571,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
headerId = gSaveBlock2Ptr->frontier.curChallengeBattleNum; headerId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
return FALSE; return FALSE;
else if (DoWildEncounterRateTest(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE) else if (WildEncounterCheck(gBattlePyramidWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
return FALSE; return FALSE;
else if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE) else if (TryGenerateWildMon(gBattlePyramidWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE) != TRUE)
return FALSE; return FALSE;
@@ -588,7 +589,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
return FALSE; return FALSE;
else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
return FALSE; return FALSE;
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE) else if (WildEncounterCheck(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE)
return FALSE; return FALSE;
if (TryStartRoamerEncounter() == TRUE) if (TryStartRoamerEncounter() == TRUE)
@@ -627,7 +628,7 @@ bool8 StandardWildEncounter(u16 curMetatileBehavior, u16 prevMetatileBehavior)
return FALSE; return FALSE;
else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile())
return FALSE; return FALSE;
else if (DoWildEncounterRateTest(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE) else if (WildEncounterCheck(gWildMonHeaders[headerId].waterMonsInfo->encounterRate, FALSE) != TRUE)
return FALSE; return FALSE;
if (TryStartRoamerEncounter() == TRUE) if (TryStartRoamerEncounter() == TRUE)
@@ -667,7 +668,7 @@ void RockSmashWildEncounter(void)
{ {
gSpecialVar_Result = FALSE; 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) && TryGenerateWildMon(wildPokemonInfo, WILD_AREA_ROCKS, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
{ {
BattleSetup_StartWildBattle(); BattleSetup_StartWildBattle();