mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-17 15:17:48 +01:00
* Add applyPreLeaveFieldAbAttrs call to AttemptRunPhase * Update tests
This commit is contained in:
parent
40e1e7fd4e
commit
dbc8ac26af
@ -1,4 +1,4 @@
|
||||
import { applyAbAttrs, RunSuccessAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, applyPreLeaveFieldAbAttrs, PreLeaveFieldAbAttr, RunSuccessAbAttr } from "#app/data/ability";
|
||||
import { Stat } from "#app/enums/stat";
|
||||
import { StatusEffect } from "#app/enums/status-effect";
|
||||
import type { PlayerPokemon, EnemyPokemon } from "#app/field/pokemon";
|
||||
@ -29,6 +29,8 @@ export class AttemptRunPhase extends PokemonPhase {
|
||||
applyAbAttrs(RunSuccessAbAttr, playerPokemon, null, false, escapeChance);
|
||||
|
||||
if (playerPokemon.randSeedInt(100) < escapeChance.value && !this.forceFailEscape) {
|
||||
enemyField.forEach(enemyPokemon => applyPreLeaveFieldAbAttrs(PreLeaveFieldAbAttr, enemyPokemon));
|
||||
|
||||
globalScene.playSound("se/flee");
|
||||
globalScene.queueMessage(i18next.t("battle:runAwaySuccess"), null, true, 500);
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { PokeballType } from "#app/enums/pokeball";
|
||||
import { WeatherType } from "#app/enums/weather-type";
|
||||
import type { CommandPhase } from "#app/phases/command-phase";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
@ -131,4 +133,20 @@ describe("Abilities - Desolate Land", () => {
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||
});
|
||||
|
||||
it("should lift after fleeing from a wild pokemon", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.DESOLATE_LAND)
|
||||
.ability(Abilities.BALL_FETCH);
|
||||
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||
|
||||
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);
|
||||
|
||||
const commandPhase = game.scene.getCurrentPhase() as CommandPhase;
|
||||
commandPhase.handleCommand(Command.RUN, 0);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import type { CommandPhase } from "#app/phases/command-phase";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { PostSummonWeatherChangeAbAttr } from "#app/data/ability";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
@ -157,6 +159,22 @@ describe("Abilities - Neutralizing Gas", () => {
|
||||
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should deactivate after fleeing from a wild pokemon", async () => {
|
||||
game.override
|
||||
.enemyAbility(Abilities.NEUTRALIZING_GAS)
|
||||
.ability(Abilities.BALL_FETCH);
|
||||
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined();
|
||||
|
||||
vi.spyOn(game.scene.getPlayerPokemon()!, "randSeedInt").mockReturnValue(0);
|
||||
|
||||
const commandPhase = game.scene.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
|
||||
.battleType("single")
|
||||
|
Loading…
x
Reference in New Issue
Block a user