Skip to content

Commit

Permalink
Rampage moves always confuse on final turn (rh-hideout#4722)
Browse files Browse the repository at this point in the history
* rampage moves confuse on the final turn

* fix B_RAMPAGE_CANCELLING < GEN_5

* Remove pointless assumes
  • Loading branch information
Sneed69 authored Jun 5, 2024
1 parent daa6b78 commit 7fd0239
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 17 additions & 4 deletions test/battle/move_effect_secondary/thrash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit 7fd0239

Please sign in to comment.