Applied review changes

This commit is contained in:
LOuroboros 2023-01-08 19:50:27 -03:00
parent f1ca254c28
commit c32f584940
2 changed files with 7 additions and 5 deletions

View File

@ -204,6 +204,6 @@ bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag);
u32 GetBattlerFriendshipScore(u8 battlerId); u32 GetBattlerFriendshipScore(u8 battlerId);
u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc); u32 CountBattlerStatIncreases(u8 battlerId, bool32 countEvasionAcc);
bool32 IsMyceliumMightOnField(void); bool32 IsMyceliumMightOnField(void);
void ChangeTypeBasedOnTerrain(u8 battlerId); bool8 ChangeTypeBasedOnTerrain(u8 battlerId);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -2069,7 +2069,7 @@ u32 GetBattlerFriendshipScore(u8 battlerId)
static void TryToRevertMimicry(void) static void TryToRevertMimicry(void)
{ {
u8 i; u32 i;
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
@ -4295,7 +4295,7 @@ static u8 ForewarnChooseMove(u32 battler)
Free(data); Free(data);
} }
void ChangeTypeBasedOnTerrain(u8 battlerId) bool8 ChangeTypeBasedOnTerrain(u8 battlerId)
{ {
u8 battlerType; u8 battlerType;
u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY; u16 terrainFlags = VarGet(VAR_TERRAIN) & STATUS_FIELD_TERRAIN_ANY;
@ -4312,9 +4312,11 @@ void ChangeTypeBasedOnTerrain(u8 battlerId)
else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN)
battlerType = TYPE_PSYCHIC; battlerType = TYPE_PSYCHIC;
else // failsafe else // failsafe
battlerType = gSpeciesInfo[battlerId].type1; return FALSE;
SET_BATTLER_TYPE(battlerId, battlerType); SET_BATTLER_TYPE(battlerId, battlerType);
PREPARE_TYPE_BUFFER(gBattleTextBuff1, battlerType); PREPARE_TYPE_BUFFER(gBattleTextBuff1, battlerType);
return TRUE;
} }
u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg) u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg)
@ -6206,7 +6208,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
switch (GetBattlerAbility(battler)) switch (GetBattlerAbility(battler))
{ {
case ABILITY_MIMICRY: case ABILITY_MIMICRY:
if (!gSpecialStatuses[battler].terrainAbilityDone) if (!gSpecialStatuses[battler].terrainAbilityDone && ChangeTypeBasedOnTerrain(battler))
{ {
gSpecialStatuses[battler].terrainAbilityDone = TRUE; gSpecialStatuses[battler].terrainAbilityDone = TRUE;
ChangeTypeBasedOnTerrain(battler); ChangeTypeBasedOnTerrain(battler);