fix more test bugs

This commit is contained in:
snoozbuster 2024-08-13 21:10:14 -07:00
parent 88dcaa3d20
commit f9ea476ef3
3 changed files with 6 additions and 2 deletions

View File

@ -603,14 +603,13 @@ describe("Moves - Pursuit", () => {
expectPursuitSucceeded(game.scene.getPlayerField()[1]); expectPursuitSucceeded(game.scene.getPlayerField()[1]);
}); });
// fails: mysterious crash
it("should not hit a switching ally for double damage (hard-switch, player field)", async () => { it("should not hit a switching ally for double damage (hard-switch, player field)", async () => {
// arrange // arrange
await startBattle(); await startBattle();
forceMovesLast(game.scene.getPlayerField()); forceMovesLast(game.scene.getPlayerField());
// act // act
playerSwitches(0); playerSwitches(2);
playerUsesPursuit(1, BattlerIndex.PLAYER); playerUsesPursuit(1, BattlerIndex.PLAYER);
enemyUses(Moves.SPLASH); enemyUses(Moves.SPLASH);
await runCombatTurn(); await runCombatTurn();

View File

@ -365,6 +365,10 @@ export default class GameManager {
*/ */
doSelectPartyPokemon(slot: number, inPhase = "SwitchPhase") { doSelectPartyPokemon(slot: number, inPhase = "SwitchPhase") {
this.onNextPrompt(inPhase, Mode.PARTY, () => { this.onNextPrompt(inPhase, Mode.PARTY, () => {
if (this.scene.getParty()[slot].isActive(true)) {
throw new Error("Attempting to switch in a party member that is already active");
}
const partyHandler = this.scene.ui.getHandler() as PartyUiHandler; const partyHandler = this.scene.ui.getHandler() as PartyUiHandler;
partyHandler.setCursor(slot); partyHandler.setCursor(slot);

View File

@ -343,6 +343,7 @@ export default class PhaseInterceptor {
lastTime = currentTime; lastTime = currentTime;
if (timeSpentInPrompt > PROMPT_TIMEOUT && !warned) { if (timeSpentInPrompt > PROMPT_TIMEOUT && !warned) {
warned = true;
console.error("Prompt handling stalled waiting for prompt:", actionForNextPrompt); console.error("Prompt handling stalled waiting for prompt:", actionForNextPrompt);
expect.fail("Prompt timeout"); expect.fail("Prompt timeout");
} }