diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 2f935b7cc16..aeab8a6490b 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -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; } } diff --git a/src/phases/move-effect-phase.ts b/src/phases/move-effect-phase.ts index 4152fc243f0..995684f8c03 100644 --- a/src/phases/move-effect-phase.ts +++ b/src/phases/move-effect-phase.ts @@ -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); } } diff --git a/test/abilities/parental_bond.test.ts b/test/abilities/parental_bond.test.ts index 2aa24e78d6e..d4bf544e8c7 100644 --- a/test/abilities/parental_bond.test.ts +++ b/test/abilities/parental_bond.test.ts @@ -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); + }); }); diff --git a/test/items/grip_claw.test.ts b/test/items/grip_claw.test.ts index 1d169006116..aa7c23ca43d 100644 --- a/test/items/grip_claw.test.ts +++ b/test/items/grip_claw.test.ts @@ -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); + }); }); /* diff --git a/test/items/multi_lens.test.ts b/test/items/multi_lens.test.ts index 90e73ae88ea..176e8213f55 100644 --- a/test/items/multi_lens.test.ts +++ b/test/items/multi_lens.test.ts @@ -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); + }); });