[Test] Refactor/consolidate Forecast tests (#3754)
This commit is contained in:
parent
4ac726f79e
commit
4162762a0e
|
@ -1,19 +1,18 @@
|
||||||
import { Abilities } from "#app/enums/abilities.js";
|
|
||||||
import GameManager from "#test/utils/gameManager";
|
|
||||||
import { Moves } from "#enums/moves";
|
|
||||||
import { Species } from "#enums/species";
|
|
||||||
import Phaser from "phaser";
|
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
||||||
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
|
||||||
import { WeatherType } from "#app/enums/weather-type";
|
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
import { allAbilities } from "#app/data/ability";
|
||||||
|
import { Abilities } from "#app/enums/abilities";
|
||||||
|
import { WeatherType } from "#app/enums/weather-type";
|
||||||
import { DamagePhase } from "#app/phases/damage-phase";
|
import { DamagePhase } from "#app/phases/damage-phase";
|
||||||
import { MovePhase } from "#app/phases/move-phase";
|
import { MovePhase } from "#app/phases/move-phase";
|
||||||
import { PostSummonPhase } from "#app/phases/post-summon-phase";
|
import { PostSummonPhase } from "#app/phases/post-summon-phase";
|
||||||
|
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
|
||||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
||||||
import { VictoryPhase } from "#app/phases/victory-phase";
|
import { Moves } from "#enums/moves";
|
||||||
import { allAbilities } from "#app/data/ability";
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
describe("Abilities - Forecast", () => {
|
describe("Abilities - Forecast", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
|
@ -31,7 +30,7 @@ describe("Abilities - Forecast", () => {
|
||||||
* @param initialForm The initial form pre form change
|
* @param initialForm The initial form pre form change
|
||||||
*/
|
*/
|
||||||
const testWeatherFormChange = async (game: GameManager, weather: WeatherType, form: number, initialForm?: number) => {
|
const testWeatherFormChange = async (game: GameManager, weather: WeatherType, form: number, initialForm?: number) => {
|
||||||
game.override.weather(weather).starterForms({[Species.CASTFORM]: initialForm});
|
game.override.weather(weather).starterForms({ [Species.CASTFORM]: initialForm });
|
||||||
await game.startBattle([Species.CASTFORM]);
|
await game.startBattle([Species.CASTFORM]);
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
|
@ -53,54 +52,6 @@ describe("Abilities - Forecast", () => {
|
||||||
expect(game.scene.getPlayerPokemon()?.formIndex).toBe(NORMAL_FORM);
|
expect(game.scene.getPlayerPokemon()?.formIndex).toBe(NORMAL_FORM);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests transforming back to match the weather when Cloud Nine/Air Lock user is fainted
|
|
||||||
* @param {GameManager} game The game manager instance
|
|
||||||
* @param {Abilities} ability The ability that will go out of battle (faint)
|
|
||||||
*/
|
|
||||||
const testTransformAfterAbilityFaint = async (game: GameManager, ability: Abilities) => {
|
|
||||||
game.override.enemyAbility(ability).weather(WeatherType.SNOW).enemySpecies(Species.SHUCKLE);
|
|
||||||
await game.startBattle([Species.CASTFORM]);
|
|
||||||
const castform = game.scene.getPlayerPokemon();
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
|
|
||||||
game.move.select(Moves.TACKLE);
|
|
||||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
|
||||||
await game.phaseInterceptor.to(DamagePhase);
|
|
||||||
|
|
||||||
await game.doKillOpponents();
|
|
||||||
await game.phaseInterceptor.to(VictoryPhase);
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(SNOWY_FORM);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests transforming back to match the weather when Cloud Nine/Air Lock user is switched out
|
|
||||||
* @param {GameManager} game The game manager instance
|
|
||||||
* @param {Abilities} ability The ability that will go out of battle (switched out)
|
|
||||||
*/
|
|
||||||
const testTransformAfterAbilitySwitchOut = async (game: GameManager, ability: Abilities) => {
|
|
||||||
game.override
|
|
||||||
.weather(WeatherType.SNOW)
|
|
||||||
.enemySpecies(Species.CASTFORM)
|
|
||||||
.enemyAbility(Abilities.FORECAST)
|
|
||||||
.ability(ability);
|
|
||||||
await game.startBattle([Species.PICHU, Species.PIKACHU]);
|
|
||||||
|
|
||||||
const castform = game.scene.getEnemyPokemon();
|
|
||||||
|
|
||||||
// We mock the return value of the second Pokemon to be other than Air Lock/Cloud Nine
|
|
||||||
vi.spyOn(game.scene.getParty()[1]!, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
|
|
||||||
expect(game.scene.getParty()[1]?.hasAbility(Abilities.BALL_FETCH));
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
|
|
||||||
game.doSwitchPokemon(1);
|
|
||||||
await game.phaseInterceptor.to(MovePhase);
|
|
||||||
expect(castform?.formIndex).toBe(SNOWY_FORM);
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
type: Phaser.HEADLESS,
|
type: Phaser.HEADLESS,
|
||||||
|
@ -113,55 +64,127 @@ describe("Abilities - Forecast", () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override.moveset([ Moves.SPLASH, Moves.RAIN_DANCE, Moves.SUNNY_DAY, Moves.TACKLE ])
|
game.override
|
||||||
|
.moveset([Moves.SPLASH, Moves.RAIN_DANCE, Moves.SUNNY_DAY, Moves.TACKLE])
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
.enemyMoveset(SPLASH_ONLY)
|
.enemyMoveset(SPLASH_ONLY)
|
||||||
.enemyAbility(Abilities.BALL_FETCH);
|
.enemyAbility(Abilities.BALL_FETCH);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("changes to Sunny Form during Harsh Sunlight", async () => {
|
it("changes form based on weather", async () => {
|
||||||
await testWeatherFormChange(game, WeatherType.SUNNY, SUNNY_FORM);
|
game.override
|
||||||
});
|
.moveset([Moves.RAIN_DANCE, Moves.SUNNY_DAY, Moves.SNOWSCAPE, Moves.SPLASH])
|
||||||
|
.battleType("double")
|
||||||
|
.starterForms({
|
||||||
|
[Species.KYOGRE]: 1,
|
||||||
|
[Species.GROUDON]: 1,
|
||||||
|
[Species.RAYQUAZA]: 1
|
||||||
|
});
|
||||||
|
await game.startBattle([Species.CASTFORM, Species.FEEBAS, Species.KYOGRE, Species.GROUDON, Species.RAYQUAZA, Species.ALTARIA]);
|
||||||
|
|
||||||
it("changes to Sunny Form during Extreme Harsh Sunlight", async () => {
|
vi.spyOn(game.scene.getParty()[5], "getAbility").mockReturnValue(allAbilities[Abilities.CLOUD_NINE]);
|
||||||
await testWeatherFormChange(game, WeatherType.HARSH_SUN, SUNNY_FORM);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("changes to Rainy Form during Rain", async () => {
|
const castform = game.scene.getPlayerField()[0];
|
||||||
await testWeatherFormChange(game, WeatherType.RAIN, RAINY_FORM);
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
});
|
|
||||||
|
|
||||||
it("changes to Rainy Form during Heavy Rain", async () => {
|
game.move.select(Moves.RAIN_DANCE);
|
||||||
await testWeatherFormChange(game, WeatherType.HEAVY_RAIN, RAINY_FORM);
|
game.move.select(Moves.SPLASH, 1);
|
||||||
});
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("changes to Snowy Form during Hail", async () => {
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
await testWeatherFormChange(game, WeatherType.HAIL, SNOWY_FORM);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("changes to Snowy Form during Snow", async () => {
|
game.move.select(Moves.SUNNY_DAY);
|
||||||
await testWeatherFormChange(game, WeatherType.SNOW, SNOWY_FORM);
|
game.move.select(Moves.SPLASH, 1);
|
||||||
});
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("reverts to Normal Form during Sandstorm", async () => {
|
expect(castform.formIndex).toBe(SUNNY_FORM);
|
||||||
await testWeatherFormChange(game, WeatherType.SANDSTORM, NORMAL_FORM, SUNNY_FORM);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("reverts to Normal Form during Fog", async () => {
|
game.move.select(Moves.SNOWSCAPE);
|
||||||
await testWeatherFormChange(game, WeatherType.FOG, NORMAL_FORM, SUNNY_FORM);
|
game.move.select(Moves.SPLASH, 1);
|
||||||
});
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
it("reverts to Normal Form during Strong Winds", async () => {
|
expect(castform.formIndex).toBe(SNOWY_FORM);
|
||||||
await testWeatherFormChange(game, WeatherType.STRONG_WINDS, NORMAL_FORM, SUNNY_FORM);
|
|
||||||
});
|
game.override.moveset([Moves.HAIL, Moves.SANDSTORM, Moves.SNOWSCAPE, Moves.SPLASH]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SANDSTORM);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.HAIL);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(SNOWY_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(2); // Feebas now 2, Kyogre 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(3); // Kyogre now 3, Groudon 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(SUNNY_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(4); // Groudon now 4, Rayquaza 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(2); // Rayquaza now 2, Feebas 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SNOWSCAPE);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(SNOWY_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(5); // Feebas now 5, Altaria 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.doSwitchPokemon(5); // Altaria now 5, Feebas 1
|
||||||
|
await game.phaseInterceptor.to("MovePhase");
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(SNOWY_FORM);
|
||||||
|
|
||||||
|
game.scene.arena.trySetWeather(WeatherType.FOG, false);
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("TurnStartPhase");
|
||||||
|
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
}, 30 * 1000);
|
||||||
|
|
||||||
it("reverts to Normal Form during Clear weather", async () => {
|
it("reverts to Normal Form during Clear weather", async () => {
|
||||||
await testWeatherFormChange(game, WeatherType.NONE, NORMAL_FORM, SUNNY_FORM);
|
await testWeatherFormChange(game, WeatherType.NONE, NORMAL_FORM, SUNNY_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reverts to Normal Form if a Pokémon on the field has Cloud Nine", async () => {
|
|
||||||
await testRevertFormAgainstAbility(game, Abilities.CLOUD_NINE);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("reverts to Normal Form if a Pokémon on the field has Air Lock", async () => {
|
it("reverts to Normal Form if a Pokémon on the field has Air Lock", async () => {
|
||||||
await testRevertFormAgainstAbility(game, Abilities.AIR_LOCK);
|
await testRevertFormAgainstAbility(game, Abilities.AIR_LOCK);
|
||||||
});
|
});
|
||||||
|
@ -177,93 +200,50 @@ describe("Abilities - Forecast", () => {
|
||||||
expect(game.scene.getEnemyPokemon()?.formIndex).not.toBe(RAINY_FORM);
|
expect(game.scene.getEnemyPokemon()?.formIndex).not.toBe(RAINY_FORM);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("cannot be copied", async () => {
|
it("reverts to Normal Form when Castform loses Forecast, changes form to match the weather when it regains it", async () => {
|
||||||
game.override.enemyAbility(Abilities.TRACE);
|
game.override.moveset([Moves.SKILL_SWAP, Moves.WORRY_SEED, Moves.SPLASH]).weather(WeatherType.RAIN).battleType("double");
|
||||||
await game.startBattle([Species.CASTFORM]);
|
await game.startBattle([Species.CASTFORM, Species.FEEBAS]);
|
||||||
|
|
||||||
game.move.select(Moves.SPLASH);
|
const castform = game.scene.getPlayerField()[0];
|
||||||
|
|
||||||
expect(game.scene.getEnemyPokemon()?.hasAbility(Abilities.FORECAST)).toBe(false);
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
});
|
|
||||||
|
|
||||||
it("(Skill Swap) reverts to Normal Form when Castform loses Forecast, changes form to match the weather when it regains it", async () => {
|
game.move.select(Moves.SKILL_SWAP, 0, BattlerIndex.PLAYER_2);
|
||||||
game.override.moveset([Moves.SKILL_SWAP]).weather(WeatherType.RAIN);
|
game.move.select(Moves.SKILL_SWAP, 1, BattlerIndex.PLAYER);
|
||||||
await game.startBattle([Species.CASTFORM]);
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
|
||||||
const castform = game.scene.getPlayerPokemon();
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
// First turn - loses Forecast
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
game.move.select(Moves.SKILL_SWAP);
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
|
|
||||||
// Second turn - regains Forecast
|
|
||||||
game.move.select(Moves.SKILL_SWAP);
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("(Worry Seed) reverts to Normal Form when Castform loses Forecast, changes form to match the weather when it regains it", async () => {
|
|
||||||
game.override.enemyMoveset(Array(4).fill(Moves.WORRY_SEED)).weather(WeatherType.RAIN);
|
|
||||||
await game.startBattle([Species.CASTFORM, Species.PIKACHU]);
|
|
||||||
const castform = game.scene.getPlayerPokemon();
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
|
||||||
|
|
||||||
// First turn - loses Forecast
|
|
||||||
game.move.select(Moves.SPLASH);
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
|
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
// Second turn - switch out Castform, regains Forecast
|
game.move.select(Moves.SPLASH);
|
||||||
game.doSwitchPokemon(1);
|
game.move.select(Moves.WORRY_SEED, 1, BattlerIndex.PLAYER);
|
||||||
await game.toNextTurn();
|
await game.setTurnOrder([BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
// Third turn - switch in Castform
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
game.doSwitchPokemon(1);
|
|
||||||
await game.phaseInterceptor.to(MovePhase);
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("reverts to Normal Form when active weather ends", async () => {
|
|
||||||
await game.startBattle([Species.CASTFORM]);
|
|
||||||
const castform = game.scene.getPlayerPokemon();
|
|
||||||
|
|
||||||
game.move.select(Moves.SUNNY_DAY);
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
|
||||||
|
|
||||||
while (game.scene.arena.weather && game.scene.arena.weather.turnsLeft > 0) {
|
|
||||||
game.move.select(Moves.SPLASH);
|
|
||||||
expect(castform?.formIndex).toBe(SUNNY_FORM);
|
|
||||||
await game.toNextTurn();
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("reverts to Normal Form when Forecast is suppressed, changes form to match the weather when it regains it", async () => {
|
it("reverts to Normal Form when Forecast is suppressed, changes form to match the weather when it regains it", async () => {
|
||||||
game.override.enemyMoveset(Array(4).fill(Moves.GASTRO_ACID)).weather(WeatherType.RAIN);
|
game.override.enemyMoveset(Array(4).fill(Moves.GASTRO_ACID)).weather(WeatherType.RAIN);
|
||||||
await game.startBattle([Species.CASTFORM, Species.PIKACHU]);
|
await game.startBattle([Species.CASTFORM, Species.PIKACHU]);
|
||||||
const castform = game.scene.getPlayerPokemon();
|
const castform = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
|
|
||||||
// First turn - Forecast is suppressed
|
// First turn - Forecast is suppressed
|
||||||
game.move.select(Moves.SPLASH);
|
game.move.select(Moves.SPLASH);
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||||
await game.move.forceHit();
|
await game.move.forceHit();
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
await game.phaseInterceptor.to(TurnEndPhase);
|
||||||
|
|
||||||
expect(castform?.summonData.abilitySuppressed).toBe(true);
|
expect(castform.summonData.abilitySuppressed).toBe(true);
|
||||||
expect(castform?.formIndex).toBe(NORMAL_FORM);
|
expect(castform.formIndex).toBe(NORMAL_FORM);
|
||||||
|
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
@ -275,21 +255,8 @@ describe("Abilities - Forecast", () => {
|
||||||
game.doSwitchPokemon(1);
|
game.doSwitchPokemon(1);
|
||||||
await game.phaseInterceptor.to(MovePhase);
|
await game.phaseInterceptor.to(MovePhase);
|
||||||
|
|
||||||
expect(castform?.summonData.abilitySuppressed).toBe(false);
|
expect(castform.summonData.abilitySuppressed).toBe(false);
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
});
|
|
||||||
|
|
||||||
it("if a Pokémon transforms into Castform, the Pokémon will remain in the same form as the target Castform, regardless of the weather", async () => {
|
|
||||||
game.override.enemyMoveset(Array(4).fill(Moves.TRANSFORM));
|
|
||||||
await game.startBattle([Species.CASTFORM]);
|
|
||||||
|
|
||||||
game.move.select(Moves.SUNNY_DAY);
|
|
||||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
|
||||||
|
|
||||||
await game.phaseInterceptor.to(TurnEndPhase);
|
|
||||||
|
|
||||||
expect(game.scene.getPlayerPokemon()?.formIndex).toBe(SUNNY_FORM);
|
|
||||||
expect(game.scene.getEnemyPokemon()?.formIndex).toBe(NORMAL_FORM);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not change Castform's form until after Stealth Rock deals damage", async () => {
|
it("does not change Castform's form until after Stealth Rock deals damage", async () => {
|
||||||
|
@ -304,31 +271,15 @@ describe("Abilities - Forecast", () => {
|
||||||
game.doSwitchPokemon(1);
|
game.doSwitchPokemon(1);
|
||||||
await game.phaseInterceptor.to(PostSummonPhase);
|
await game.phaseInterceptor.to(PostSummonPhase);
|
||||||
|
|
||||||
const castform = game.scene.getPlayerPokemon();
|
const castform = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
// Damage phase should come first
|
// Damage phase should come first
|
||||||
await game.phaseInterceptor.to(DamagePhase);
|
await game.phaseInterceptor.to(DamagePhase);
|
||||||
expect(castform?.hp).toBeLessThan(castform?.getMaxHp() ?? 0);
|
expect(castform.hp).toBeLessThan(castform.getMaxHp());
|
||||||
|
|
||||||
// Then change form
|
// Then change form
|
||||||
await game.phaseInterceptor.to(QuietFormChangePhase);
|
await game.phaseInterceptor.to(QuietFormChangePhase);
|
||||||
expect(castform?.formIndex).toBe(RAINY_FORM);
|
expect(castform.formIndex).toBe(RAINY_FORM);
|
||||||
});
|
|
||||||
|
|
||||||
it("transforms to weather-based form when Pokemon with Air Lock is fainted", async () => {
|
|
||||||
await testTransformAfterAbilityFaint(game, Abilities.AIR_LOCK);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("transforms to weather-based form when Pokemon with Cloud Nine is fainted", async () => {
|
|
||||||
await testTransformAfterAbilityFaint(game, Abilities.CLOUD_NINE);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("transforms to weather-based form when Pokemon with Air Lock is switched out", async () => {
|
|
||||||
await testTransformAfterAbilitySwitchOut(game, Abilities.AIR_LOCK);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("transforms to weather-based form when Pokemon with Cloud Nine is switched out", async () => {
|
|
||||||
await testTransformAfterAbilitySwitchOut(game, Abilities.CLOUD_NINE);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be in Normal Form after the user is switched out", async () => {
|
it("should be in Normal Form after the user is switched out", async () => {
|
||||||
|
|
Loading…
Reference in New Issue