mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 08:16:04 +00:00
[Hotfix] Fix crash when Mist would block a stat drop (#4746)
* Fix crash when Mist would block a stat drop * Bump version * Bump version (again)
This commit is contained in:
parent
5797f265a4
commit
b4cc9d7892
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@material/material-color-utilities": "^0.2.7",
|
"@material/material-color-utilities": "^0.2.7",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.1.5",
|
"version": "1.1.6",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vite",
|
"start": "vite",
|
||||||
|
@ -126,6 +126,7 @@ export class MistTag extends ArenaTag {
|
|||||||
* Cancels the lowering of stats
|
* Cancels the lowering of stats
|
||||||
* @param arena the {@linkcode Arena} containing this effect
|
* @param arena the {@linkcode Arena} containing this effect
|
||||||
* @param simulated `true` if the effect should be applied quietly
|
* @param simulated `true` if the effect should be applied quietly
|
||||||
|
* @param attacker the {@linkcode Pokemon} using a move into this effect.
|
||||||
* @param cancelled a {@linkcode BooleanHolder} whose value is set to `true`
|
* @param cancelled a {@linkcode BooleanHolder} whose value is set to `true`
|
||||||
* to flag the stat reduction as cancelled
|
* to flag the stat reduction as cancelled
|
||||||
* @returns `true` if a stat reduction was cancelled; `false` otherwise
|
* @returns `true` if a stat reduction was cancelled; `false` otherwise
|
||||||
|
@ -65,7 +65,7 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
|
|
||||||
if (!this.selfTarget && stages.value < 0) {
|
if (!this.selfTarget && stages.value < 0) {
|
||||||
// TODO: add a reference to the source of the stat change to fix Infiltrator interaction
|
// TODO: add a reference to the source of the stat change to fix Infiltrator interaction
|
||||||
this.scene.arena.applyTagsForSide(MistTag, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, false, null, false, cancelled);
|
this.scene.arena.applyTagsForSide(MistTag, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, false, null, cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cancelled.value && !this.selfTarget && stages.value < 0) {
|
if (!cancelled.value && !this.selfTarget && stages.value < 0) {
|
||||||
|
49
src/test/moves/mist.test.ts
Normal file
49
src/test/moves/mist.test.ts
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import { Stat } from "#enums/stat";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Mist", () => {
|
||||||
|
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([ Moves.MIST, Moves.SPLASH ])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.battleType("double")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.GROWL);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should prevent the user's side from having stats lowered", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
const playerPokemon = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
game.move.select(Moves.MIST, 0);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
playerPokemon.forEach(p => expect(p.getStatStage(Stat.ATK)).toBe(0));
|
||||||
|
});
|
||||||
|
|
||||||
|
it.todo("should be ignored by opponents with Infiltrator");
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user