diff --git a/src/battle_main.c b/src/battle_main.c index 67f2cf1737..99ab2a87a1 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4914,6 +4914,7 @@ static void TurnValuesCleanUp(bool8 var0) else { memset(&gProtectStructs[i], 0, sizeof(struct ProtectStruct)); + memset(&gQueuedStatBoosts[i], 0, sizeof(gQueuedStatBoosts)); if (gDisableStructs[i].isFirstTurn) gDisableStructs[i].isFirstTurn--; diff --git a/test/battle/ability/opportunist.c b/test/battle/ability/opportunist.c index 79c6649f59..60e127c708 100644 --- a/test/battle/ability/opportunist.c +++ b/test/battle/ability/opportunist.c @@ -101,6 +101,24 @@ DOUBLE_BATTLE_TEST("Opportunist raises Attack only once when partner has Intimid } } +SINGLE_BATTLE_TEST("Opportunist does not accumulate opposing mon's stat changes") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_ESPATHRA) { Ability(ABILITY_OPPORTUNIST); } + } WHEN { + TURN { MOVE(player, MOVE_SWORDS_DANCE); } + TURN { MOVE(player, MOVE_SWORDS_DANCE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SWORDS_DANCE, player); + ABILITY_POPUP(opponent, ABILITY_OPPORTUNIST); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SWORDS_DANCE, player); + ABILITY_POPUP(opponent, ABILITY_OPPORTUNIST); + } THEN { + EXPECT_EQ(opponent->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 4); + } +} + TO_DO_BATTLE_TEST("Opportunist doesn't copy ally stat increases"); TO_DO_BATTLE_TEST("Opportunist doesn't copy foe stat increases gained via Opportunist"); TO_DO_BATTLE_TEST("Opportunist copies foe stat increased gained via Swagger and Flatter");