diff --git a/src/battle_main.c b/src/battle_main.c index 61e61aeb34..bc3c9bdd1e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3259,6 +3259,9 @@ void SwitchInClearSetData(u32 battler) gCurrentMove = MOVE_NONE; gBattleStruct->arenaTurnCounter = 0xFF; + // Restore struct member so replacement does not miss timing + gSpecialStatuses[battler].switchInAbilityDone = FALSE; + // Reset damage to prevent things like red card activating if the switched-in mon is holding it gSpecialStatuses[battler].physicalDmg = 0; gSpecialStatuses[battler].specialDmg = 0; diff --git a/test/battle/ability/intimidate.c b/test/battle/ability/intimidate.c index 6aea91de25..1923a5fe27 100644 --- a/test/battle/ability/intimidate.c +++ b/test/battle/ability/intimidate.c @@ -375,3 +375,18 @@ DOUBLE_BATTLE_TEST("Intimidate will correctly decrease the attack of the second ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); } } + +SINGLE_BATTLE_TEST("Intimdate does not lose timing after mega evolution and switch out by a hit escape move") +{ + GIVEN { + ASSUME(gMovesInfo[MOVE_U_TURN].effect == EFFECT_HIT_ESCAPE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_MANECTRIC) { Item(ITEM_MANECTITE); } + OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); } + } WHEN { + TURN { MOVE(opponent, MOVE_U_TURN, gimmick: GIMMICK_MEGA); SEND_OUT(opponent, 1); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_INTIMIDATE); + ABILITY_POPUP(opponent, ABILITY_INTIMIDATE); + } +}