mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
[P1 Bug] Fix multi lens granting infinite Future Sight hits
This commit is contained in:
parent
e930536efe
commit
aaef47bc7d
@ -56,7 +56,7 @@ import {
|
|||||||
PokemonMultiHitModifier,
|
PokemonMultiHitModifier,
|
||||||
} from "#app/modifier/modifier";
|
} from "#app/modifier/modifier";
|
||||||
import { PokemonPhase } from "#app/phases/pokemon-phase";
|
import { PokemonPhase } from "#app/phases/pokemon-phase";
|
||||||
import { BooleanHolder, executeIf, NumberHolder } from "#app/utils";
|
import { BooleanHolder, executeIf, isNullOrUndefined, NumberHolder } from "#app/utils";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -106,7 +106,9 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
*/
|
*/
|
||||||
return super.end();
|
return super.end();
|
||||||
}
|
}
|
||||||
user.resetTurnData();
|
if (isNullOrUndefined(user.turnData)) {
|
||||||
|
user.resetTurnData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Type } from "#enums/type";
|
import { Type } from "#enums/type";
|
||||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { toDmgValue } from "#app/utils";
|
import { toDmgValue } from "#app/utils";
|
||||||
import { Abilities } from "#enums/abilities";
|
import { Abilities } from "#enums/abilities";
|
||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
@ -8,7 +8,7 @@ import { Stat } from "#enums/stat";
|
|||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import GameManager from "#test/utils/gameManager";
|
import GameManager from "#test/utils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
|
||||||
describe("Abilities - Parental Bond", () => {
|
describe("Abilities - Parental Bond", () => {
|
||||||
@ -470,4 +470,24 @@ describe("Abilities - Parental Bond", () => {
|
|||||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(1);
|
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(1);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it("should cause Future Sight to hit exactly twice if the user switches out", async () => {
|
||||||
|
game.override.enemyLevel(1000)
|
||||||
|
.moveset(Moves.FUTURE_SIGHT);
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
vi.spyOn(enemyPokemon, "damageAndUpdate");
|
||||||
|
|
||||||
|
game.move.select(Moves.FUTURE_SIGHT);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.doSwitchPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.doSwitchPokemon(2);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemyPokemon.damageAndUpdate).toHaveBeenCalledTimes(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -24,7 +24,7 @@ describe("Items - Multi Lens", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.moveset([ Moves.TACKLE, Moves.TRAILBLAZE, Moves.TACHYON_CUTTER ])
|
.moveset([ Moves.TACKLE, Moves.TRAILBLAZE, Moves.TACHYON_CUTTER, Moves.FUTURE_SIGHT ])
|
||||||
.ability(Abilities.BALL_FETCH)
|
.ability(Abilities.BALL_FETCH)
|
||||||
.startingHeldItems([{ name: "MULTI_LENS" }])
|
.startingHeldItems([{ name: "MULTI_LENS" }])
|
||||||
.battleType("single")
|
.battleType("single")
|
||||||
@ -170,6 +170,7 @@ describe("Items - Multi Lens", () => {
|
|||||||
await game.phaseInterceptor.to("MoveEndPhase");
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.5, 5);
|
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.5, 5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should result in correct damage for hp% attacks with 2 lenses + Parental Bond", async () => {
|
it("should result in correct damage for hp% attacks with 2 lenses + Parental Bond", async () => {
|
||||||
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }])
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 2 }])
|
||||||
.moveset(Moves.SUPER_FANG)
|
.moveset(Moves.SUPER_FANG)
|
||||||
@ -188,4 +189,23 @@ describe("Items - Multi Lens", () => {
|
|||||||
await game.phaseInterceptor.to("MoveEndPhase");
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.25, 5);
|
expect(enemyPokemon.getHpRatio()).toBeCloseTo(0.25, 5);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should cause Future Sight to hit exactly twice if the user switches out", async () => {
|
||||||
|
game.override.enemyLevel(1000);
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||||
|
vi.spyOn(enemyPokemon, "damageAndUpdate");
|
||||||
|
|
||||||
|
game.move.select(Moves.FUTURE_SIGHT);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.doSwitchPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.doSwitchPokemon(2);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemyPokemon.damageAndUpdate).toHaveBeenCalledTimes(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user