mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
* [WIP] Refactor ability attribute apply args * [WIP] update ability signatures * Update callsites in pokemon.ts * Update callsites in moves.ts * Update abattr callsites in move-phase * Update abattr callsites in battler-tags Also removed stat drop ability application from cancelling ME stat boost effects * format with biome and remove cancelled from weather lapse * Update abattr callsites in MEP * Update callsites in turn-start-phase * Update abAttr callsites in misc phases * Remove latent test functionality * update ability attribute callsite in shield dust test * update abattr callsite in winstrate challenge encounter * Fix some tests to mock proper methods * Remove improper condition in mimicry's ability application * Fix improper simulated check in moody's apply method * Pass source to postApplyDamage in pokemon.ts * [wip] fix cud chew tests * Make cud chew consumption not subclass postTurnAbAttr * Fix regression in flower veil * Update trySetStatus test in pokemon to respect new return value for undefined * Remove empty, unused file * Fix blockCrit method broken in merge * Fix unnecessary attr type cast in move phase * Address typing issue in safeguard test * Improve documentation and get rid of ts-expect-error directive * Minor comment/TSDoc updates and fixes * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Apply suggestions from code review --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import { BattlerIndex } from "#enums/battler-index";
|
|
import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
|
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
|
import { NumberHolder } from "#app/utils/common";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { MoveId } from "#enums/move-id";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { Stat } from "#enums/stat";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
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);
|
|
game.override
|
|
.battleStyle("single")
|
|
.enemySpecies(SpeciesId.ONIX)
|
|
.enemyAbility(AbilityId.SHIELD_DUST)
|
|
.startingLevel(100)
|
|
.moveset(MoveId.AIR_SLASH)
|
|
.enemyMoveset(MoveId.TACKLE);
|
|
});
|
|
|
|
it("Shield Dust", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.PIDGEOT]);
|
|
|
|
game.scene.getEnemyPokemon()!.stats[Stat.SPDEF] = 10000;
|
|
expect(game.scene.getPlayerPokemon()!.formIndex).toBe(0);
|
|
|
|
game.move.select(MoveId.AIR_SLASH);
|
|
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
|
|
|
// Shield Dust negates secondary effect
|
|
const phase = game.scene.phaseManager.getCurrentPhase() as MoveEffectPhase;
|
|
const move = phase.move;
|
|
expect(move.id).toBe(MoveId.AIR_SLASH);
|
|
|
|
const chance = new NumberHolder(move.chance);
|
|
applyAbAttrs("MoveEffectChanceMultiplierAbAttr", {
|
|
pokemon: phase.getUserPokemon()!,
|
|
chance,
|
|
move,
|
|
});
|
|
applyAbAttrs("IgnoreMoveEffectsAbAttr", {
|
|
pokemon: phase.getFirstTarget()!,
|
|
move,
|
|
chance,
|
|
});
|
|
expect(chance.value).toBe(0);
|
|
});
|
|
|
|
//TODO King's Rock Interaction Unit Test
|
|
});
|