pokerogue/test/abilities/shield_dust.test.ts

64 lines
2.2 KiB
TypeScript
Raw Normal View History

import { BattlerIndex } from "#app/battle";
2024-07-25 15:51:05 -07:00
import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { NumberHolder } from "#app/utils";
2024-07-25 15:51:05 -07:00
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
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";
describe("Abilities - Shield Dust", () => {
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 14:57:47 -07:00
game.override.enemySpecies(Species.ONIX);
2024-07-25 15:05:32 -07:00
game.override.enemyAbility(Abilities.SHIELD_DUST);
2024-07-25 15:29:19 -07:00
game.override.startingLevel(100);
game.override.moveset(Moves.AIR_SLASH);
game.override.enemyMoveset(Moves.TACKLE);
});
it("Shield Dust", async () => {
await game.classicMode.startBattle([ Species.PIDGEOT ]);
game.scene.getEnemyPokemon()!.stats[Stat.SPDEF] = 10000;
expect(game.scene.getPlayerPokemon()!.formIndex).toBe(0);
game.move.select(Moves.AIR_SLASH);
2024-10-04 13:08:31 +08:00
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to(MoveEffectPhase, false);
// Shield Dust negates secondary effect
const phase = game.scene.getCurrentPhase() as MoveEffectPhase;
const move = phase.move.getMove();
expect(move.id).toBe(Moves.AIR_SLASH);
const chance = new NumberHolder(move.chance);
2025-02-01 01:29:25 -08:00
await applyAbAttrs(MoveEffectChanceMultiplierAbAttr, phase.getUserPokemon()!, null, false, chance, move, phase.getFirstTarget(), false);
await applyPreDefendAbAttrs(IgnoreMoveEffectsAbAttr, phase.getFirstTarget()!, phase.getUserPokemon()!, null, null, false, chance);
expect(chance.value).toBe(0);
2025-02-01 01:29:25 -08:00
});
//TODO King's Rock Interaction Unit Test
});