2024-08-22 06:49:33 -07:00
|
|
|
import { allMoves } from "#app/data/move";
|
2024-09-09 12:59:58 -04:00
|
|
|
import { StatusEffect } from "#app/enums/status-effect";
|
2024-08-22 06:49:33 -07:00
|
|
|
import { TurnStartPhase } from "#app/phases/turn-start-phase";
|
2024-07-05 14:59:53 -04:00
|
|
|
import { Abilities } from "#enums/abilities";
|
2024-07-25 15:51:05 -07:00
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-07-25 15:51:05 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
2024-07-05 14:59:53 -04:00
|
|
|
|
|
|
|
describe("Weather - Strong Winds", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("single");
|
2024-07-25 15:29:19 -07:00
|
|
|
game.override.startingLevel(10);
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.TAILLOW);
|
2024-07-25 15:05:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.DELTA_STREAM);
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE ]);
|
2024-07-05 14:59:53 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("electric type move is not very effective on Rayquaza", async () => {
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.RAYQUAZA);
|
2024-07-05 14:59:53 -04:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.PIKACHU ]);
|
2024-08-07 09:23:12 -07:00
|
|
|
const pikachu = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
2024-07-05 14:59:53 -04:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.THUNDERBOLT);
|
2024-07-05 14:59:53 -04:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnStartPhase);
|
|
|
|
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(0.5);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("electric type move is neutral for flying type pokemon", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.PIKACHU ]);
|
2024-08-07 09:23:12 -07:00
|
|
|
const pikachu = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
2024-07-05 14:59:53 -04:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.THUNDERBOLT);
|
2024-07-05 14:59:53 -04:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnStartPhase);
|
|
|
|
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.THUNDERBOLT].type, pikachu)).toBe(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("ice type move is neutral for flying type pokemon", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.PIKACHU ]);
|
2024-08-07 09:23:12 -07:00
|
|
|
const pikachu = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
2024-07-05 14:59:53 -04:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.ICE_BEAM);
|
2024-07-05 14:59:53 -04:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnStartPhase);
|
|
|
|
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ICE_BEAM].type, pikachu)).toBe(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("rock type move is neutral for flying type pokemon", async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.PIKACHU ]);
|
2024-08-07 09:23:12 -07:00
|
|
|
const pikachu = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
2024-07-05 14:59:53 -04:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.ROCK_SLIDE);
|
2024-07-05 14:59:53 -04:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to(TurnStartPhase);
|
|
|
|
expect(enemy.getAttackTypeEffectiveness(allMoves[Moves.ROCK_SLIDE].type, pikachu)).toBe(1);
|
|
|
|
});
|
2024-09-09 12:59:58 -04:00
|
|
|
|
|
|
|
it("weather goes away when last trainer pokemon dies to indirect damage", async () => {
|
|
|
|
game.override.enemyStatusEffect(StatusEffect.POISON);
|
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-09-09 12:59:58 -04:00
|
|
|
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
enemy.hp = 1;
|
|
|
|
|
|
|
|
game.move.select(Moves.SPLASH);
|
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
|
|
|
|
expect(game.scene.arena.weather?.weatherType).toBeUndefined();
|
|
|
|
});
|
2024-07-05 14:59:53 -04:00
|
|
|
});
|