[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:
schmidtc1 2025-03-29 14:25:34 -04:00 committed by GitHub
parent 4f19e4a126
commit 27a1638243
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 66 additions and 2 deletions

View File

@ -905,7 +905,7 @@ export default class Move implements Localizable {
SacrificialAttrOnHit
];
// ...and cannot enhance these specific moves.
// ...and cannot enhance these specific moves
const exceptMoves: Moves[] = [
Moves.FLING,
Moves.UPROAR,
@ -914,10 +914,14 @@ export default class Move implements Localizable {
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)
&& !this.isChargingMove()
&& !exceptAttrs.some(attr => this.hasAttr(attr))
&& !exceptMoves.some(id => this.id === id)
&& !exceptPollenPuffAlly
&& this.category !== MoveCategory.STATUS;
}
}

View File

@ -653,7 +653,7 @@ export class MoveEffectPhase extends PokemonPhase {
this.applyOnHitEffects(user, target, firstHit, lastHit, firstTarget);
this.applyOnGetHitAbEffects(user, target, 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);
}
}

View File

@ -9,6 +9,7 @@ import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { BattlerIndex } from "#app/battle";
describe("Abilities - Parental Bond", () => {
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
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);
});
});

View File

@ -98,6 +98,31 @@ describe("Items - Grip Claw", () => {
expect(enemy1HeldItemCountsAfter).toBe(enemy1HeldItemCount);
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);
});
});
/*

View File

@ -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
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);
});
});