pokerogue/test/abilities/heatproof.test.ts
NightKev 9dcb904649
[Misc] Improve enum naming (#5933)
* Rename `Abilities` to `AbilityId`

* Rename `abilities.ts` to `ability-id.ts`

* Rename `Moves` to `MoveId`

* Rename `moves.ts` to `move-id.ts`

* Rename `Species` to `SpeciesId`

* Rename `species.ts` to `species-id.ts`

* Rename `Biome` to `BiomeId`

* Rename `biome.ts` to `biome-id.ts`

* Replace `Abilities` with `AbilityId` in comments

* Replace `Biome` with `BiomeId` in comments

* Replace `Moves` with `MoveId` in comments

* Replace `Species` with `SpeciesId` in comments
2025-06-04 14:54:27 -07:00

75 lines
2.3 KiB
TypeScript

import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#app/enums/status-effect";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { toDmgValue } from "#app/utils/common";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Heatproof", () => {
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
.battleStyle("single")
.disableCrits()
.enemySpecies(SpeciesId.CHARMANDER)
.enemyAbility(AbilityId.HEATPROOF)
.enemyMoveset(MoveId.SPLASH)
.enemyLevel(100)
.starterSpecies(SpeciesId.CHANDELURE)
.ability(AbilityId.BALL_FETCH)
.moveset([MoveId.FLAMETHROWER, MoveId.SPLASH])
.startingLevel(100);
});
it("reduces Fire type damage by half", async () => {
await game.classicMode.startBattle();
const enemy = game.scene.getEnemyPokemon()!;
const initialHP = 1000;
enemy.hp = initialHP;
game.move.select(MoveId.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const heatproofDamage = initialHP - enemy.hp;
enemy.hp = initialHP;
game.override.enemyAbility(AbilityId.BALL_FETCH);
game.move.select(MoveId.FLAMETHROWER);
await game.phaseInterceptor.to(TurnEndPhase);
const regularDamage = initialHP - enemy.hp;
expect(heatproofDamage).toBeLessThanOrEqual(regularDamage / 2 + 1);
expect(heatproofDamage).toBeGreaterThanOrEqual(regularDamage / 2 - 1);
});
it("reduces Burn damage by half", async () => {
game.override.enemyStatusEffect(StatusEffect.BURN).enemySpecies(SpeciesId.ABRA);
await game.classicMode.startBattle();
const enemy = game.scene.getEnemyPokemon()!;
game.move.select(MoveId.SPLASH);
await game.toNextTurn();
// Normal burn damage is /16
expect(enemy.hp).toBe(enemy.getMaxHp() - toDmgValue(enemy.getMaxHp() / 32));
});
});