mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
[Bug] Fix interactions for Pollen Puff Parental Bond, Multi-Lens, Grip Claw Ally Healing (#5550)
* Checks for hit result status on Grip Claw application * Adds a boolean check for the Pollen Puff edge case in canBeMultiStrikeEnhanced * Adds parental bond test * Adds grip claw and multi lens tests
This commit is contained in:
parent
4f19e4a126
commit
27a1638243
@ -905,7 +905,7 @@ export default class Move implements Localizable {
|
|||||||
SacrificialAttrOnHit
|
SacrificialAttrOnHit
|
||||||
];
|
];
|
||||||
|
|
||||||
// ...and cannot enhance these specific moves.
|
// ...and cannot enhance these specific moves
|
||||||
const exceptMoves: Moves[] = [
|
const exceptMoves: Moves[] = [
|
||||||
Moves.FLING,
|
Moves.FLING,
|
||||||
Moves.UPROAR,
|
Moves.UPROAR,
|
||||||
@ -914,10 +914,14 @@ export default class Move implements Localizable {
|
|||||||
Moves.ENDEAVOR
|
Moves.ENDEAVOR
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// ...and cannot enhance Pollen Puff when targeting an ally.
|
||||||
|
const exceptPollenPuffAlly: boolean = this.id === Moves.POLLEN_PUFF && targets.includes(user.getAlly().getBattlerIndex())
|
||||||
|
|
||||||
return (!restrictSpread || !isMultiTarget)
|
return (!restrictSpread || !isMultiTarget)
|
||||||
&& !this.isChargingMove()
|
&& !this.isChargingMove()
|
||||||
&& !exceptAttrs.some(attr => this.hasAttr(attr))
|
&& !exceptAttrs.some(attr => this.hasAttr(attr))
|
||||||
&& !exceptMoves.some(id => this.id === id)
|
&& !exceptMoves.some(id => this.id === id)
|
||||||
|
&& !exceptPollenPuffAlly
|
||||||
&& this.category !== MoveCategory.STATUS;
|
&& this.category !== MoveCategory.STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
this.applyOnHitEffects(user, target, firstHit, lastHit, firstTarget);
|
this.applyOnHitEffects(user, target, firstHit, lastHit, firstTarget);
|
||||||
this.applyOnGetHitAbEffects(user, target, hitResult);
|
this.applyOnGetHitAbEffects(user, target, hitResult);
|
||||||
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move.getMove(), hitResult);
|
applyPostAttackAbAttrs(PostAttackAbAttr, user, target, this.move.getMove(), hitResult);
|
||||||
if (this.move.getMove() instanceof AttackMove) {
|
if (this.move.getMove() instanceof AttackMove && hitResult !== HitResult.STATUS) {
|
||||||
globalScene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target);
|
globalScene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ 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;
|
||||||
@ -426,4 +427,21 @@ 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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -98,6 +98,31 @@ describe("Items - Grip Claw", () => {
|
|||||||
expect(enemy1HeldItemCountsAfter).toBe(enemy1HeldItemCount);
|
expect(enemy1HeldItemCountsAfter).toBe(enemy1HeldItemCount);
|
||||||
expect(enemy2HeldItemCountsAfter).toBe(enemy2HeldItemCount);
|
expect(enemy2HeldItemCountsAfter).toBe(enemy2HeldItemCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should not allow Pollen Puff to steal items when healing ally", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("double")
|
||||||
|
.moveset([Moves.POLLEN_PUFF, Moves.ENDURE])
|
||||||
|
.startingHeldItems([
|
||||||
|
{ name: "GRIP_CLAW", count: 1 },
|
||||||
|
{ name: "BERRY", type: BerryType.LUM, count: 1 },
|
||||||
|
]);
|
||||||
|
await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]);
|
||||||
|
|
||||||
|
const [leftPokemon, rightPokemon] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
const gripClaw = leftPokemon.getHeldItems()[0] as ContactHeldItemTransferChanceModifier;
|
||||||
|
vi.spyOn(gripClaw, "chance", "get").mockReturnValue(100);
|
||||||
|
|
||||||
|
const heldItemCountBefore = getHeldItemCount(rightPokemon);
|
||||||
|
|
||||||
|
game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2);
|
||||||
|
game.move.select(Moves.ENDURE, 1);
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(getHeldItemCount(rightPokemon)).toBe(heldItemCountBefore);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -211,4 +211,21 @@ describe("Items - Multi Lens", () => {
|
|||||||
// TODO: Update hit count to 1 once Future Sight is fixed to not activate held items if user is off the field
|
// TODO: Update hit count to 1 once Future Sight is fixed to not activate held items 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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user