mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
* Add new priority queues * Add dynamic queue manager * Add timing modifier and fix post speed ordering * Make `phaseQueue` private * Fix `gameManager.setTurnOrder` * Update `findPhase` to also check dynamic queues * Modify existing phase manager methods to check dynamic queues * Fix move order persisting through tests * Fix magic coat/bounce * Use append for magic coat/bounce * Remove `getSpeedOrder` from `TurnStartPhase`, fix references to `getCommandOrder` in tests * Fix round queuing last instead of next * Add quick draw application * Add quick claw activation * Fix turn order tracking * Add move header queue to fix ordering * Fix abilities activating immediately on summon * Fix `postsummonphases` being shuffled (need to handle speed ties differently here) * Update speed order function * Add `StaticSwitchSummonPhase` * Fix magic coat/bounce error from conflict resolution * Remove conditional queue * Fix dancer and baton pass tests * Automatically queue consecutive Pokémon phases as dynamic * Move turn end phases queuing back to `TurnStartPhase` * Fix `LearnMovePhase` * Remove `PrependSplice` * Move DQM to phase manager * Fix various phases being pushed instead of unshifted * Remove `StaticSwitchSummonPhase` * Ensure the top queue is always at length - 1 * Fix encounter `PostSummonPhase`s and Revival Blessing * Fix move headers * Remove implicit ordering from DQM * Fix `PostSummonPhase`s in encounters running too early * Fix `tryRemovePhase` usages * Add `MovePhase` after `MoveEndPhase` automatically * Implement an `inSpeedOrder` function * Merge fixes * Fix encounter rewards * Defer `FaintPhase`s where splice was used previously * Separate speed order utils to avoid circular imports * Temporarily disable lunar dance test * Simplify deferral * Remove move priority modifier * Fix TS errors in code files * Fix ts errors in tests * Fix more test files * Fix postsummon + checkswitch ability activations * Fix `removeAll` * Reposition `positionalTagPhase` * Re-add `startCurrentPhase` * Avoid overwriting `currentPhase` after `turnStart` * Delete `switchSummonPhasePriorityQueue` * Update `phase-manager.ts` * Remove uses of `isNullOrUndefined` * Rename deferral methods * Update docs and use `getPlayerField(true)` in turn start phase * Use `.getEnemyField(true)` * Update docs for post summon phase priority queue (psppq) * Update speed order utils * Remove null from `nextPhase` * Update move phase timing modifier docs * Remove mention of phases from base priority queue class * Remove and replace `applyInSpeedOrder` * Don't sort weather effect phases * Order priority queues before removing - Add some `readonly` and `public` modifiers - Remove unused `queuedPhases` field from `MoveEffectPhase` * Fix linting in `phase-manager.ts` * Remove unnecessary turn order modification in Rage Fist test --------- Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
195 lines
7.9 KiB
TypeScript
195 lines
7.9 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { ArenaTagType } from "#enums/arena-tag-type";
|
|
import { BattlerIndex } from "#enums/battler-index";
|
|
import { Command } from "#enums/command";
|
|
import { MoveId } from "#enums/move-id";
|
|
import { PokeballType } from "#enums/pokeball";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { Stat } from "#enums/stat";
|
|
import type { CommandPhase } from "#phases/command-phase";
|
|
import { GameManager } from "#test/test-utils/game-manager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
describe("Abilities - Neutralizing Gas", () => {
|
|
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
|
|
.moveset([MoveId.SPLASH])
|
|
.ability(AbilityId.NEUTRALIZING_GAS)
|
|
.battleStyle("single")
|
|
.criticalHits(false)
|
|
.enemySpecies(SpeciesId.MAGIKARP)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemyMoveset(MoveId.SPLASH);
|
|
});
|
|
|
|
it("should prevent other abilities from activating", async () => {
|
|
game.override.enemyAbility(AbilityId.INTIMIDATE);
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
// Intimidate is suppressed, so the attack stat should not be lowered
|
|
expect(game.field.getPlayerPokemon().getStatStage(Stat.ATK)).toBe(0);
|
|
});
|
|
|
|
it("should allow the user's passive to activate", async () => {
|
|
game.override.passiveAbility(AbilityId.INTREPID_SWORD);
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(game.field.getPlayerPokemon().getStatStage(Stat.ATK)).toBe(1);
|
|
});
|
|
|
|
it("should activate before other abilities", async () => {
|
|
game.override.enemySpecies(SpeciesId.ACCELGOR).enemyLevel(100).enemyAbility(AbilityId.INTIMIDATE);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
// Intimidate is suppressed even when the user's speed is lower
|
|
expect(game.field.getPlayerPokemon().getStatStage(Stat.ATK)).toBe(0);
|
|
});
|
|
|
|
it("should activate other abilities when removed", async () => {
|
|
game.override
|
|
.enemyAbility(AbilityId.INTREPID_SWORD)
|
|
.enemyPassiveAbility(AbilityId.DAUNTLESS_SHIELD)
|
|
.enemyMoveset(MoveId.ENTRAINMENT);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
const enemyPokemon = game.field.getEnemyPokemon();
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
|
|
expect(enemyPokemon.getStatStage(Stat.DEF)).toBe(0);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
// Enemy removes user's ability, so both abilities are activated
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
|
expect(enemyPokemon.getStatStage(Stat.DEF)).toBe(1);
|
|
});
|
|
|
|
it("should not activate the user's other ability when removed", async () => {
|
|
game.override.passiveAbility(AbilityId.INTIMIDATE).enemyMoveset(MoveId.ENTRAINMENT);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
// Neutralising gas user's passive is still active
|
|
const enemyPokemon = game.field.getEnemyPokemon();
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
// Intimidate did not reactivate after neutralizing gas was removed
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1);
|
|
});
|
|
|
|
it("should only deactivate when all setters are off the field", async () => {
|
|
game.override.enemyMoveset([MoveId.ENTRAINMENT, MoveId.SPLASH]).battleStyle("double");
|
|
|
|
await game.classicMode.startBattle([SpeciesId.ACCELGOR, SpeciesId.ACCELGOR]);
|
|
game.move.select(MoveId.SPLASH, 0);
|
|
game.move.select(MoveId.SPLASH, 1);
|
|
await game.move.selectEnemyMove(MoveId.ENTRAINMENT, BattlerIndex.PLAYER);
|
|
await game.move.selectEnemyMove(MoveId.SPLASH);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined(); // Now one neut gas user is left
|
|
|
|
game.move.select(MoveId.SPLASH, 0);
|
|
game.move.select(MoveId.SPLASH, 1);
|
|
await game.move.selectEnemyMove(MoveId.ENTRAINMENT, BattlerIndex.PLAYER_2);
|
|
await game.move.selectEnemyMove(MoveId.SPLASH);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined(); // No neut gas users are left
|
|
});
|
|
|
|
it("should deactivate when suppressed by gastro acid", async () => {
|
|
game.override.enemyMoveset(MoveId.GASTRO_ACID);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
|
});
|
|
|
|
it("should deactivate when the pokemon faints", async () => {
|
|
game.override.ability(AbilityId.BALL_FETCH).enemyAbility(AbilityId.NEUTRALIZING_GAS);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
game.move.select(MoveId.SPLASH);
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
|
await game.doKillOpponents();
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
|
});
|
|
|
|
it("should deactivate upon catching a wild pokemon", async () => {
|
|
game.override.battleStyle("single").enemyAbility(AbilityId.NEUTRALIZING_GAS).ability(AbilityId.BALL_FETCH);
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
|
|
|
game.scene.pokeballCounts[PokeballType.MASTER_BALL] = 1;
|
|
game.doThrowPokeball(PokeballType.MASTER_BALL);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
|
});
|
|
|
|
it("should deactivate after fleeing from a wild pokemon", async () => {
|
|
game.override.enemyAbility(AbilityId.NEUTRALIZING_GAS).ability(AbilityId.BALL_FETCH);
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
|
|
|
vi.spyOn(game.field.getPlayerPokemon(), "randBattleSeedInt").mockReturnValue(0);
|
|
vi.spyOn(globalScene, "randBattleSeedInt").mockReturnValue(0);
|
|
|
|
const commandPhase = game.scene.phaseManager.getCurrentPhase() as CommandPhase;
|
|
commandPhase.handleCommand(Command.RUN, 0);
|
|
await game.phaseInterceptor.to("BerryPhase");
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
|
});
|
|
|
|
it("should not activate abilities of pokemon no longer on the field", async () => {
|
|
game.override.battleStyle("single").ability(AbilityId.NEUTRALIZING_GAS).enemyAbility(AbilityId.DELTA_STREAM);
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
|
|
|
const enemy = game.field.getEnemyPokemon();
|
|
const weatherChangeAttr = enemy.getAbilityAttrs("PostSummonWeatherChangeAbAttr", false)[0];
|
|
const weatherChangeSpy = vi.spyOn(weatherChangeAttr, "apply");
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
|
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.killPokemon(enemy);
|
|
await game.killPokemon(game.field.getPlayerPokemon());
|
|
|
|
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
|
expect(weatherChangeSpy).not.toHaveBeenCalled();
|
|
});
|
|
});
|