2024-08-22 06:49:33 -07:00
|
|
|
import { Species } from "#app/enums/species";
|
|
|
|
import { StatusEffect } from "#app/enums/status-effect";
|
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
|
|
import { toDmgValue } from "#app/utils";
|
2024-08-13 14:00:19 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
2025-02-22 22:52:07 -06:00
|
|
|
import GameManager from "#test/testUtils/gameManager";
|
2024-08-13 14:00:19 -07:00
|
|
|
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
|
|
|
|
.battleType("single")
|
|
|
|
.disableCrits()
|
|
|
|
.enemySpecies(Species.CHARMANDER)
|
|
|
|
.enemyAbility(Abilities.HEATPROOF)
|
2024-09-09 09:55:11 -07:00
|
|
|
.enemyMoveset(Moves.SPLASH)
|
2024-08-13 14:00:19 -07:00
|
|
|
.enemyLevel(100)
|
|
|
|
.starterSpecies(Species.CHANDELURE)
|
|
|
|
.ability(Abilities.BALL_FETCH)
|
2024-10-04 13:08:31 +08:00
|
|
|
.moveset([ Moves.FLAMETHROWER, Moves.SPLASH ])
|
2024-08-13 14:00:19 -07:00
|
|
|
.startingLevel(100);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("reduces Fire type damage by half", async () => {
|
|
|
|
await game.startBattle();
|
|
|
|
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
const initialHP = 1000;
|
|
|
|
enemy.hp = initialHP;
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.FLAMETHROWER);
|
2024-08-13 14:00:19 -07:00
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
const heatproofDamage = initialHP - enemy.hp;
|
|
|
|
|
|
|
|
enemy.hp = initialHP;
|
|
|
|
game.override.enemyAbility(Abilities.BALL_FETCH);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.FLAMETHROWER);
|
2024-08-13 14:00:19 -07:00
|
|
|
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(Species.ABRA);
|
|
|
|
await game.startBattle();
|
|
|
|
|
|
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SPLASH);
|
2024-08-13 14:00:19 -07:00
|
|
|
await game.toNextTurn();
|
|
|
|
|
|
|
|
// Normal burn damage is /16
|
2024-08-22 14:39:11 +09:00
|
|
|
expect(enemy.hp).toBe(enemy.getMaxHp() - toDmgValue(enemy.getMaxHp() / 32));
|
2024-08-13 14:00:19 -07:00
|
|
|
});
|
|
|
|
});
|