2024-08-22 06:49:33 -07:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
2024-07-25 15:51:05 -07:00
|
|
|
import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
|
2024-08-22 06:49:33 -07:00
|
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
2024-11-03 18:53:52 -08:00
|
|
|
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";
|
2024-11-03 18:53:52 -08:00
|
|
|
import { Stat } from "#enums/stat";
|
2025-02-22 22:52:07 -06:00
|
|
|
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";
|
2024-06-17 18:30:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
2024-11-03 18:53:52 -08:00
|
|
|
game.override.moveset(Moves.AIR_SLASH);
|
|
|
|
game.override.enemyMoveset(Moves.TACKLE);
|
2024-06-17 18:30:42 -06:00
|
|
|
});
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
it("Shield Dust", async () => {
|
2024-11-03 18:53:52 -08:00
|
|
|
await game.classicMode.startBattle([ Species.PIDGEOT ]);
|
2024-06-17 18:30:42 -06:00
|
|
|
|
|
|
|
|
2024-11-03 18:53:52 -08:00
|
|
|
game.scene.getEnemyPokemon()!.stats[Stat.SPDEF] = 10000;
|
|
|
|
expect(game.scene.getPlayerPokemon()!.formIndex).toBe(0);
|
2024-06-17 18:30:42 -06:00
|
|
|
|
2024-11-03 18:53:52 -08:00
|
|
|
game.move.select(Moves.AIR_SLASH);
|
2024-06-17 18:30:42 -06:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
2024-06-17 18:30:42 -06:00
|
|
|
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);
|
|
|
|
|
2024-11-03 18:53:52 -08:00
|
|
|
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);
|
2024-06-17 18:30:42 -06:00
|
|
|
expect(chance.value).toBe(0);
|
|
|
|
|
2025-02-01 01:29:25 -08:00
|
|
|
});
|
2024-06-17 18:30:42 -06:00
|
|
|
|
|
|
|
//TODO King's Rock Interaction Unit Test
|
|
|
|
});
|