Added roost tests

This commit is contained in:
Bertie690 2025-07-26 17:39:05 -04:00
parent 3a255e59b5
commit 6d7d2a5c6a

View File

@ -1,4 +1,5 @@
import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MoveId } from "#enums/move-id";
import { PokemonType } from "#enums/pokemon-type";
@ -67,6 +68,21 @@ describe("Moves - Roost", () => {
expect(mew.isGrounded()).toBe(true);
});
it("should not override the user's Tera Type", async () => {
await game.classicMode.startBattle([SpeciesId.PIDGEOT]);
const pidgeot = game.field.getPlayerPokemon();
pidgeot.hp = 1;
pidgeot.teraType = PokemonType.FIGHTING;
game.move.use(MoveId.ROOST, BattlerIndex.PLAYER, undefined, true);
await game.toEndOfTurn(false);
// Should remain flying type
expect(pidgeot.getTypes(true)).toEqual([PokemonType.FLYING]);
expect(pidgeot.isGrounded()).toBe(true);
});
it("should convert pure Flying types into normal types", async () => {
await game.classicMode.startBattle([SpeciesId.TORNADUS]);
@ -87,7 +103,7 @@ describe("Moves - Roost", () => {
])("should render user typeless when roosting after using $name", async ({ move, species }) => {
await game.classicMode.startBattle([species]);
const player = game.field.getPlayerPokemon()!;
const player = game.field.getPlayerPokemon();
player.hp = 1;
game.move.use(move);
@ -97,7 +113,7 @@ describe("Moves - Roost", () => {
expect(player.getTypes()).toEqual([PokemonType.FLYING]);
expect(player.isGrounded()).toBe(false);
game.move.use(move);
game.move.use(MoveId.ROOST);
await game.phaseInterceptor.to("MoveEffectPhase");
// Should be typeless
@ -112,6 +128,53 @@ describe("Moves - Roost", () => {
expect(player.isGrounded()).toBe(false);
});
it("should consider the user's current types when transforming", async () => {
game.override.ability(AbilityId.IMPOSTER).enemySpecies(SpeciesId.CORVIKNIGHT);
await game.classicMode.startBattle([SpeciesId.DITTO]);
const ditto = game.field.getPlayerPokemon();
ditto.hp = 1;
expect(ditto.summonData.speciesForm).toBe(SpeciesId.CORVIKNIGHT);
expect(ditto.getTypes()).toEqual([PokemonType.STEEL, PokemonType.FLYING]);
game.move.use(MoveId.ROOST);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("MoveEffectPhase"); // Roost
expect(ditto.getTypes()).toEqual([PokemonType.STEEL]);
await game.toEndOfTurn();
expect(ditto.getTypes()).toEqual([PokemonType.STEEL, PokemonType.FLYING, PokemonType.GHOST]);
});
it("should not change normally-Flying type Pokemon with 3 types into Normal-types", async () => {
game.override.ability(AbilityId.IMPOSTER).enemySpecies(SpeciesId.CORVIKNIGHT);
await game.classicMode.startBattle([SpeciesId.TORNADUS]);
const tornadus = game.field.getPlayerPokemon();
tornadus.hp = 1;
expect(tornadus.summonData.speciesForm).toBe(SpeciesId.CORVIKNIGHT);
expect(tornadus.getTypes()).toEqual([PokemonType.STEEL, PokemonType.FLYING]);
game.move.use(MoveId.ROOST);
await game.move.forceEnemyMove(MoveId.TRICK_OR_TREAT);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("MoveEffectPhase"); // Trick or treat
expect(tornadus.getTypes()).toEqual([PokemonType.STEEL, PokemonType.FLYING, PokemonType.GHOST]);
await game.phaseInterceptor.to("MoveEffectPhase"); // Roost
expect(tornadus.getTypes()).toEqual([PokemonType.STEEL, PokemonType.GHOST]);
await game.toEndOfTurn();
expect(tornadus.getTypes()).toEqual([PokemonType.STEEL, PokemonType.FLYING, PokemonType.GHOST]);
});
it("should revert to 3 types when affected by Forest's Curse or Trick-or-Treat", async () => {
await game.classicMode.startBattle([SpeciesId.MOLTRES]);
@ -125,7 +188,7 @@ describe("Moves - Roost", () => {
expect(moltres.getTypes()).toEqual([PokemonType.FIRE, PokemonType.GHOST]);
expect(moltres.isGrounded()).toBe(true);
await game.toEndOfTurn();
await game.toNextTurn();
expect(moltres.getTypes()).toEqual([PokemonType.FIRE, PokemonType.FLYING, PokemonType.GHOST]);
expect(moltres.isGrounded()).toBe(false);