diff --git a/include/battle_util.h b/include/battle_util.h index ec8c03a6bd..71d81ce3bb 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -267,6 +267,7 @@ bool32 CanGetFrostbite(u32 battler); bool32 CanBeConfused(u32 battler); bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag); u32 GetBattlerAffectionHearts(u32 battler); +void TryToRevertMimicryAndFlags(void); u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc); bool32 ChangeTypeBasedOnTerrain(u32 battler); void RemoveConfusionStatus(u32 battler); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7212560ebd..11bf05fb0f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8655,6 +8655,7 @@ static void RemoveAllTerrains(void) break; } gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain + TryToRevertMimicryAndFlags(); } #define DEFOG_CLEAR(status, structField, battlescript, move)\ diff --git a/src/battle_util.c b/src/battle_util.c index 3ee127f389..de0d3e7cc6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1612,7 +1612,7 @@ u32 GetBattlerAffectionHearts(u32 battler) return GetMonAffectionHearts(&party[gBattlerPartyIndexes[battler]]); } -static void TryToRevertMimicryAndFlags(void) +void TryToRevertMimicryAndFlags(void) { u32 i; diff --git a/test/battle/move_effect/hit_set_remove_terrain.c b/test/battle/move_effect/hit_set_remove_terrain.c index 549b6bf04f..1efb939c34 100644 --- a/test/battle/move_effect/hit_set_remove_terrain.c +++ b/test/battle/move_effect/hit_set_remove_terrain.c @@ -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ā€¦"); + } +}