mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-11 02:43:49 +01:00
* Add isPartner method to trainer class * Ensure force switches cannot pull pokemon from the wrong trainer * Add override for battle type * Fixup tests and broken assumptions * Make move fail override semi-invuln check Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail * Restore overrides * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Fix illusion test battle type invocation * Update struggle and healer tests to use battleStyle --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { BattlerIndex } from "#app/battle";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
describe("Moves - Pollen Puff", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override
|
|
.moveset([Moves.POLLEN_PUFF])
|
|
.ability(Abilities.BALL_FETCH)
|
|
.battleStyle("single")
|
|
.disableCrits()
|
|
.enemySpecies(Species.MAGIKARP)
|
|
.enemyAbility(Abilities.BALL_FETCH)
|
|
.enemyMoveset(Moves.SPLASH);
|
|
});
|
|
|
|
it("should not heal more than once when the user has a source of multi-hit", async () => {
|
|
game.override.battleStyle("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]).ability(Abilities.PARENTAL_BOND);
|
|
await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]);
|
|
|
|
const [_, rightPokemon] = game.scene.getPlayerField();
|
|
|
|
rightPokemon.damageAndUpdate(rightPokemon.hp - 1);
|
|
|
|
game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2);
|
|
game.move.select(Moves.ENDURE, 1);
|
|
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
// Pollen Puff heals with a ratio of 0.5, as long as Pollen Puff triggers only once the pokemon will always be <= (0.5 * Max HP) + 1
|
|
expect(rightPokemon.hp).toBeLessThanOrEqual(0.5 * rightPokemon.getMaxHp() + 1);
|
|
});
|
|
|
|
it("should damage an enemy multiple times when the user has a source of multi-hit", async () => {
|
|
game.override.moveset([Moves.POLLEN_PUFF]).ability(Abilities.PARENTAL_BOND).enemyLevel(100);
|
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
|
|
|
const target = game.scene.getEnemyPokemon()!;
|
|
|
|
game.move.select(Moves.POLLEN_PUFF);
|
|
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(target.battleData.hitCount).toBe(2);
|
|
});
|
|
});
|