Mimicry updates typing with RemoveAllTerrains() (#5666)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
AERDU 2024-11-17 09:21:01 +00:00 committed by GitHub
parent 8f137b33e4
commit 5388ed0cad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 1 deletions

View file

@ -267,6 +267,7 @@ bool32 CanGetFrostbite(u32 battler);
bool32 CanBeConfused(u32 battler); bool32 CanBeConfused(u32 battler);
bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag); bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag);
u32 GetBattlerAffectionHearts(u32 battler); u32 GetBattlerAffectionHearts(u32 battler);
void TryToRevertMimicryAndFlags(void);
u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc); u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc);
bool32 ChangeTypeBasedOnTerrain(u32 battler); bool32 ChangeTypeBasedOnTerrain(u32 battler);
void RemoveConfusionStatus(u32 battler); void RemoveConfusionStatus(u32 battler);

View file

@ -8655,6 +8655,7 @@ static void RemoveAllTerrains(void)
break; break;
} }
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
TryToRevertMimicryAndFlags();
} }
#define DEFOG_CLEAR(status, structField, battlescript, move)\ #define DEFOG_CLEAR(status, structField, battlescript, move)\

View file

@ -1612,7 +1612,7 @@ u32 GetBattlerAffectionHearts(u32 battler)
return GetMonAffectionHearts(&party[gBattlerPartyIndexes[battler]]); return GetMonAffectionHearts(&party[gBattlerPartyIndexes[battler]]);
} }
static void TryToRevertMimicryAndFlags(void) void TryToRevertMimicryAndFlags(void)
{ {
u32 i; u32 i;

View file

@ -124,3 +124,35 @@ AI_SINGLE_BATTLE_TEST("Ice Spinner can be chosen by the AI regardless if there i
} }
} }
} }
SINGLE_BATTLE_TEST("Steel Roller and Ice Spinner reverts typing on Mimicry users")
{
u32 j;
static const u16 terrainMoves[] =
{
MOVE_ELECTRIC_TERRAIN,
MOVE_PSYCHIC_TERRAIN,
MOVE_GRASSY_TERRAIN,
MOVE_MISTY_TERRAIN,
};
u16 terrainMove = MOVE_NONE;
u16 removeTerrainMove = MOVE_NONE;
for (j = 0; j < ARRAY_COUNT(terrainMoves); j++)
{
PARAMETRIZE { removeTerrainMove = MOVE_STEEL_ROLLER; terrainMove = terrainMoves[j]; }
PARAMETRIZE { removeTerrainMove = MOVE_ICE_SPINNER; terrainMove = terrainMoves[j]; }
}
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_STUNFISK_GALARIAN].types[1] == TYPE_STEEL);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); }
} WHEN {
TURN { MOVE(opponent, terrainMove); MOVE(player, removeTerrainMove); }
TURN { MOVE(player, MOVE_TOXIC); }
} SCENE {
MESSAGE("It doesn't affect Foe Stunfisk…");
}
}