mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-17 15:17:48 +01:00
[Bug][Hotfix] Fix Parental bond + Pollen Puff softlock (#5607)
* Fix parental bond softlock * Add test for pollen puff --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
This commit is contained in:
parent
6477be99f5
commit
1229bfe004
@ -912,7 +912,7 @@ export default class Move implements Localizable {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// ...and cannot enhance Pollen Puff when targeting an ally.
|
// ...and cannot enhance Pollen Puff when targeting an ally.
|
||||||
const exceptPollenPuffAlly: boolean = this.id === Moves.POLLEN_PUFF && targets.includes(user.getAlly().getBattlerIndex())
|
const exceptPollenPuffAlly: boolean = this.id === Moves.POLLEN_PUFF && targets.includes(user.getAlly()?.getBattlerIndex())
|
||||||
|
|
||||||
return (!restrictSpread || !isMultiTarget)
|
return (!restrictSpread || !isMultiTarget)
|
||||||
&& !this.isChargingMove()
|
&& !this.isChargingMove()
|
||||||
|
@ -9,7 +9,6 @@ import { StatusEffect } from "#enums/status-effect";
|
|||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import { BattlerIndex } from "#app/battle";
|
|
||||||
|
|
||||||
describe("Abilities - Parental Bond", () => {
|
describe("Abilities - Parental Bond", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
@ -427,21 +426,4 @@ describe("Abilities - Parental Bond", () => {
|
|||||||
// TODO: Update hit count to 1 once Future Sight is fixed to not activate abilities if user is off the field
|
// TODO: Update hit count to 1 once Future Sight is fixed to not activate abilities if user is off the field
|
||||||
expect(enemyPokemon.damageAndUpdate).toHaveBeenCalledTimes(2);
|
expect(enemyPokemon.damageAndUpdate).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not allow Pollen Puff to heal ally more than once", async () => {
|
|
||||||
game.override.battleType("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]);
|
|
||||||
await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]);
|
|
||||||
|
|
||||||
const [, rightPokemon] = game.scene.getPlayerField();
|
|
||||||
|
|
||||||
rightPokemon.damageAndUpdate(rightPokemon.hp - 1);
|
|
||||||
|
|
||||||
game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2);
|
|
||||||
game.move.select(Moves.ENDURE, 1);
|
|
||||||
|
|
||||||
await game.toNextTurn();
|
|
||||||
|
|
||||||
// Pollen Puff heals with a ratio of 0.5, as long as Pollen Puff triggers only once the pokemon will always be <= (0.5 * Max HP) + 1
|
|
||||||
expect(rightPokemon.hp).toBeLessThanOrEqual(0.5 * rightPokemon.getMaxHp() + 1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
64
test/moves/pollen_puff.test.ts
Normal file
64
test/moves/pollen_puff.test.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Moves - Pollen Puff", () => {
|
||||||
|
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.POLLEN_PUFF])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not heal more than once when the user has a source of multi-hit", async () => {
|
||||||
|
game.override.battleType("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]).ability(Abilities.PARENTAL_BOND);
|
||||||
|
await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]);
|
||||||
|
|
||||||
|
const [_, rightPokemon] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
rightPokemon.damageAndUpdate(rightPokemon.hp - 1);
|
||||||
|
|
||||||
|
game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2);
|
||||||
|
game.move.select(Moves.ENDURE, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
// Pollen Puff heals with a ratio of 0.5, as long as Pollen Puff triggers only once the pokemon will always be <= (0.5 * Max HP) + 1
|
||||||
|
expect(rightPokemon.hp).toBeLessThanOrEqual(0.5 * rightPokemon.getMaxHp() + 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should damage an enemy multiple times when the user has a source of multi-hit", async () => {
|
||||||
|
game.override.moveset([Moves.POLLEN_PUFF]).ability(Abilities.PARENTAL_BOND).enemyLevel(100);
|
||||||
|
await game.classicMode.startBattle([Species.MAGIKARP]);
|
||||||
|
|
||||||
|
const target = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.POLLEN_PUFF);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(target.battleData.hitCount).toBe(2);
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user