diff --git a/src/battle_util.c b/src/battle_util.c index 08deb4fb5900..77b02637d414 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1029,11 +1029,20 @@ void MarkBattlerReceivedLinkData(u32 battler) const u8* CancelMultiTurnMoves(u32 battler) { const u8 *result = NULL; - gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS); - gBattleMons[battler].status2 &= ~(STATUS2_LOCK_CONFUSE); gBattleMons[battler].status2 &= ~(STATUS2_UPROAR); gBattleMons[battler].status2 &= ~(STATUS2_BIDE); + if (B_RAMPAGE_CANCELLING < GEN_5) + { + gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS); + gBattleMons[battler].status2 &= ~(STATUS2_LOCK_CONFUSE); + } + else if (!(gBattleMons[battler].status2 & STATUS2_LOCK_CONFUSE) + || ((gBattleMons[battler].status2 & STATUS2_LOCK_CONFUSE) > STATUS2_LOCK_CONFUSE_TURN(1))) + { + gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS); + } + // Clear battler's semi-invulnerable bits if they are not held by Sky Drop. if (!(gStatuses3[battler] & STATUS3_SKY_DROPPED)) gStatuses3[battler] &= ~(STATUS3_SEMI_INVULNERABLE); diff --git a/test/battle/move_effect_secondary/thrash.c b/test/battle/move_effect_secondary/thrash.c index 5ceb56f6dc4c..83a49554d741 100644 --- a/test/battle/move_effect_secondary/thrash.c +++ b/test/battle/move_effect_secondary/thrash.c @@ -46,7 +46,6 @@ SINGLE_BATTLE_TEST("Thrash confuses the user after it finishes") SINGLE_BATTLE_TEST("Thrash does not confuse the user if it is canceled on turn 1 of 3") { GIVEN { - ASSUME(B_RAMPAGE_CANCELLING >= GEN_5); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -61,7 +60,6 @@ SINGLE_BATTLE_TEST("Thrash does not confuse the user if it is canceled on turn 1 SINGLE_BATTLE_TEST("Thrash does not confuse the user if it is canceled on turn 2 of 3") { GIVEN { - ASSUME(B_RAMPAGE_CANCELLING >= GEN_5); PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } WHEN { @@ -73,9 +71,8 @@ SINGLE_BATTLE_TEST("Thrash does not confuse the user if it is canceled on turn 2 } } -SINGLE_BATTLE_TEST("Thrash confuses the user if it is canceled on turn 3 of 3") +SINGLE_BATTLE_TEST("Thrash confuses the user if it is canceled on turn 3 of 3, Protect") { - KNOWN_FAILING; GIVEN { ASSUME(B_RAMPAGE_CANCELLING >= GEN_5); PLAYER(SPECIES_WOBBUFFET); @@ -89,6 +86,22 @@ SINGLE_BATTLE_TEST("Thrash confuses the user if it is canceled on turn 3 of 3") } } +SINGLE_BATTLE_TEST("Thrash confuses the user if it is canceled on turn 3 of 3, Immunity") +{ + GIVEN { + ASSUME(B_RAMPAGE_CANCELLING >= GEN_5); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_GENGAR); + } WHEN { + TURN { MOVE(player, MOVE_THRASH); } + TURN { SKIP_TURN(player); } + TURN { SWITCH(opponent, 1); SKIP_TURN(player); } + } SCENE { + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, player); + } +} + SINGLE_BATTLE_TEST("Petal Dance does not lock mons that copy the move with Dancer") { GIVEN {