mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 17:09:26 +02:00
* Mostly implemented Future Sight/Doom Desire * Fixed a few docs * Fixed com * Update magic_guard.test.ts * Update documentation * Update documentation on arena-tag.ts * Update arena-tag.ts docs * Update arena-tag.ts * Update turn-end-phase.ts * Update move.ts documentation * Fixed tpyo * Update move.ts documentation * Add assorted TODO test cases * Refactored FS to use a positional tag manager * Added strong typing to the manager, finished save load stufff * Fixed locales + tests * Fixed tests and documentation * sh Fixed tests for good * Fixed MEP * Reverted overrides changse * Fixed issues with merging * Fixed locales update & heal block test * Fixed wish tests * Fixed test typo * Fixed wish test flaking out due to speed ties * Fixed tests fr fr * actually fixed tests bc i'm stupid * Fixed tests for real * Remove locales update * Update arena-tag.ts Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com> * Update move.ts Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com> * Update arena-tag.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Applied review suggestions and added a _wee_ bit more docs * fixed wish condition * Applied kev's reviews * Minor nits * Minor formatting change in `heal-block.test.ts` --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
150 lines
4.6 KiB
TypeScript
150 lines
4.6 KiB
TypeScript
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 { PositionalTagType } from "#enums/positional-tag-type";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { WeatherType } from "#enums/weather-type";
|
|
import { GameManager } from "#test/test-utils/game-manager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
// Bulbapedia Reference: https://bulbapedia.bulbagarden.net/wiki/Heal_Block_(move)
|
|
describe("Moves - Heal Block", () => {
|
|
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([MoveId.ABSORB, MoveId.WISH, MoveId.SPLASH, MoveId.AQUA_RING])
|
|
.enemyMoveset(MoveId.HEAL_BLOCK)
|
|
.ability(AbilityId.NO_GUARD)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemySpecies(SpeciesId.BLISSEY)
|
|
.criticalHits(false);
|
|
});
|
|
|
|
it("shouldn't stop damage from HP-drain attacks, just HP restoration", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
player.damageAndUpdate(player.getMaxHp() - 1);
|
|
|
|
game.move.select(MoveId.ABSORB);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.hp).toBe(1);
|
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
|
});
|
|
|
|
it("shouldn't stop Liquid Ooze from dealing damage", async () => {
|
|
game.override.enemyAbility(AbilityId.LIQUID_OOZE);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
game.move.select(MoveId.ABSORB);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.isFullHp()).toBe(false);
|
|
expect(enemy.isFullHp()).toBe(false);
|
|
});
|
|
|
|
it("should prevent Wish from restoring HP", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.field.getPlayerPokemon()!;
|
|
|
|
player.hp = 1;
|
|
|
|
game.move.use(MoveId.WISH);
|
|
await game.toNextTurn();
|
|
|
|
expect(game.scene.arena.positionalTagManager.tags.filter(t => t.tagType === PositionalTagType.WISH)) //
|
|
.toHaveLength(1);
|
|
|
|
game.move.use(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
|
|
// wish triggered, but did NOT heal the player
|
|
expect(game.scene.arena.positionalTagManager.tags.filter(t => t.tagType === PositionalTagType.WISH)) //
|
|
.toHaveLength(0);
|
|
expect(player.hp).toBe(1);
|
|
});
|
|
|
|
it("should prevent Grassy Terrain from restoring HP", async () => {
|
|
game.override.enemyAbility(AbilityId.GRASSY_SURGE);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
|
|
player.damageAndUpdate(player.getMaxHp() - 1);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.hp).toBe(1);
|
|
});
|
|
|
|
it("should prevent healing from heal-over-time moves", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
|
|
player.damageAndUpdate(player.getMaxHp() - 1);
|
|
|
|
game.move.select(MoveId.AQUA_RING);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.getTag(BattlerTagType.AQUA_RING)).toBeDefined();
|
|
expect(player.hp).toBe(1);
|
|
});
|
|
|
|
it("should prevent abilities from restoring HP", async () => {
|
|
game.override.weather(WeatherType.RAIN).ability(AbilityId.RAIN_DISH);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
|
|
player.damageAndUpdate(player.getMaxHp() - 1);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.hp).toBe(1);
|
|
});
|
|
|
|
it("should stop healing from items", async () => {
|
|
game.override.startingHeldItems([{ name: "LEFTOVERS" }]);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
player.damageAndUpdate(player.getMaxHp() - 1);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(player.hp).toBe(1);
|
|
});
|
|
});
|