Skip to content

Commit

Permalink
Fixes Pursuit + Emergency Exit causing double switches on the same turn
Browse files Browse the repository at this point in the history
  • Loading branch information
PhallenTree authored Dec 21, 2024
1 parent 6a2a3b2 commit e588268
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3225,6 +3225,9 @@ void SwitchInClearSetData(u32 battler)
gBattleStruct->lastTakenMoveFrom[battler][1] = 0;
gBattleStruct->lastTakenMoveFrom[battler][2] = 0;
gBattleStruct->lastTakenMoveFrom[battler][3] = 0;
gBattleStruct->pursuitTarget = 0;
gBattleStruct->pursuitSwitchByMove = FALSE;
gBattleStruct->pursuitStoredSwitch = 0;
gBattleStruct->lastMoveFailed &= ~(1u << battler);
gBattleStruct->palaceFlags &= ~(1u << battler);
gBattleStruct->boosterEnergyActivates &= ~(1u << battler);
Expand Down
19 changes: 19 additions & 0 deletions test/battle/move_effect/pursuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,4 +610,23 @@ SINGLE_BATTLE_TEST("Pursuit attacks a switching foe and switchin is correctly st
}
}

SINGLE_BATTLE_TEST("Pursuit doesn't cause mon with Emergency Exit to switch twice")
{
GIVEN {
PLAYER(SPECIES_GOLISOPOD) { HP(101); MaxHP(200); Ability(ABILITY_EMERGENCY_EXIT); }
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_VOLTORB);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(player, 1); MOVE(opponent, MOVE_PURSUIT); SEND_OUT(player, 2); }
} SCENE {
SWITCH_OUT_MESSAGE("Golisopod");
ANIMATION(ANIM_TYPE_MOVE, MOVE_PURSUIT, opponent);
ABILITY_POPUP(player, ABILITY_EMERGENCY_EXIT);
SEND_IN_MESSAGE("Voltorb");
} THEN {
EXPECT_EQ(player->species, SPECIES_VOLTORB);
}
}

TO_DO_BATTLE_TEST("Baton Pass doesn't cause Pursuit to increase its power or priority");

0 comments on commit e588268

Please sign in to comment.