Compare commits

...

3 Commits

Author SHA1 Message Date
Bertie690
a43ca36d25
Merge 2d6267b668 into 375587213e 2025-08-04 23:25:09 -05:00
Bertie690
2d6267b668 Fixed comment 2025-08-04 17:08:28 -04:00
Bertie690
8b65f9afab Added TODO test case + documentation for failing intim test 2025-08-04 16:27:47 -04:00
2 changed files with 46 additions and 0 deletions

View File

@ -44,6 +44,22 @@ describe("Abilities - Intimidate", () => {
expect(enemy.getStatStage(Stat.ATK)).toBe(-2);
});
// TODO: This fails due to a limitation in our switching logic - the animations and field entry occur concurrently
// inside `SummonPhase`, unshifting 2 `PostSummmonPhase`s and proccing intimidate twice
it.todo("should lower all opponents' ATK by 1 stage on initial switch prompt", async () => {
await game.classicMode.runToSummon([SpeciesId.MIGHTYENA, SpeciesId.POOCHYENA]);
await game.classicMode.startBattleWithSwitch(1);
const [poochyena, mightyena] = game.scene.getPlayerField();
expect(poochyena.species.speciesId).toBe(SpeciesId.POOCHYENA);
const enemy = game.field.getEnemyPokemon();
expect(enemy).toHaveStatStage(Stat.ATK, -1);
expect(poochyena).toHaveAbilityApplied(AbilityId.INTIMIDATE);
expect(mightyena).not.toHaveAbilityApplied(AbilityId.INTIMIDATE);
});
it("should lower ATK of all opponents in a double battle", async () => {
game.override.battleStyle("double");
await game.classicMode.startBattle([SpeciesId.MIGHTYENA]);

View File

@ -1,6 +1,7 @@
import { getGameMode } from "#app/game-mode";
import overrides from "#app/overrides";
import { BattleStyle } from "#enums/battle-style";
import { Button } from "#enums/buttons";
import { GameModes } from "#enums/game-modes";
import { Nature } from "#enums/nature";
import type { SpeciesId } from "#enums/species-id";
@ -100,4 +101,33 @@ export class ClassicModeHelper extends GameManagerHelper {
await this.game.phaseInterceptor.to(CommandPhase);
console.log("==================[New Turn]==================");
}
/**
* Queue inputs to switch at the start of the next battle, and then start it.
* @param pokemonIndex - The 0-indexed position of the party pokemon to switch to.
* Should never be called with 0 as that will select the currently active pokemon and freeze
* @returns A Promise that resolves once the battle has been started and the switch prompt resolved
* @todo Make this work for double battles
* @example
* ```ts
* await game.classicMode.runToSummon([SpeciesId.MIGHTYENA, SpeciesId.POOCHYENA])
* await game.startBattleWithSwitch(1);
* ```
*/
public async startBattleWithSwitch(pokemonIndex: number): Promise<void> {
this.game.scene.battleStyle = BattleStyle.SWITCH;
this.game.onNextPrompt(
"CheckSwitchPhase",
UiMode.CONFIRM,
() => {
this.game.scene.ui.getHandler().setCursor(0);
this.game.scene.ui.getHandler().processInput(Button.ACTION);
},
() => this.game.isCurrentPhase("CommandPhase") || this.game.isCurrentPhase("TurnInitPhase"),
);
this.game.doSelectPartyPokemon(pokemonIndex);
await this.game.phaseInterceptor.to("CommandPhase");
console.log("==================[New Battle (Initial Switch)]==================");
}
}